diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index 966d794a..826cc63b 100644 Binary files a/bin/basic_generic.rom and b/bin/basic_generic.rom differ diff --git a/bin/basic_mega65.rom b/bin/basic_mega65.rom index 20dc20c0..071c0b5b 100644 Binary files a/bin/basic_mega65.rom and b/bin/basic_mega65.rom differ diff --git a/bin/basic_ultimate64.rom b/bin/basic_ultimate64.rom index 482ff397..da45a31a 100644 Binary files a/bin/basic_ultimate64.rom and b/bin/basic_ultimate64.rom differ diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index 32bd602e..1765f7d2 100644 Binary files a/bin/kernal_generic.rom and b/bin/kernal_generic.rom differ diff --git a/bin/kernal_mega65.rom b/bin/kernal_mega65.rom index f6b0fd85..5660cad6 100644 Binary files a/bin/kernal_mega65.rom and b/bin/kernal_mega65.rom differ diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom index a52e636e..f853f836 100644 Binary files a/bin/kernal_ultimate64.rom and b/bin/kernal_ultimate64.rom differ diff --git a/c64/aliases/,aliases_hardware.s b/c64/aliases/,aliases_hardware.s index 343fb5db..73abfd8c 100644 --- a/c64/aliases/,aliases_hardware.s +++ b/c64/aliases/,aliases_hardware.s @@ -10,7 +10,7 @@ // VIC-II registers - .label VIC_BASE = $D000 // base address of the chip + .label __VIC_BASE = $D000 // base address of the chip .label VIC_SP0X = $D000 .label VIC_SP0Y = $D001 @@ -64,7 +64,7 @@ // SID registers - .label SID_BASE = $D400 // base address of the chip + .label __SID_BASE = $D400 // base address of the chip .label SID_FRELO1 = $D400 .label SID_FREHI1 = $D401 @@ -101,7 +101,7 @@ // CIA #1 registers - .label CIA1_BASE = $DC00 // base address of the chip + .label __CIA1_BASE = $DC00 // base address of the chip .label CIA1_PRA = $DC00 .label CIA1_PRB = $DC01 @@ -125,7 +125,7 @@ // CIA #2 registers - .label CIA2_BASE = $DD00 // base address of the chip + .label __CIA2_BASE = $DD00 // base address of the chip .label CIA2_PRA = $DD00 // VIC bank switching and IEC port .label CIA2_PRB = $DD01 diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index 8a18c4af..0c63eaa0 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -166,13 +166,13 @@ .label HIBASE = $288 // high byte of start of screen .label XMAX = $289 // max keyboard buffer size .label RPTFLG = $28A // -- NOT IMPLEMENTED -- - .label KOUNT = $28B // -- NOT IMPLEMENTED -- + .label KOUNT = $28B // key repeat counter .label DELAY = $28C // -- NOT IMPLEMENTED -- .label SHFLAG = $28D // bucky keys (SHIFT/CTRL/C=) flags .label LSTSHF = $28E // last bucky key flags - .label KEYLOG = $28F // $28F-$290 -- NOT IMPLEMENTED -- + .label KEYLOG = $28F // $28F-$290 -- NOT IMPLEMENTED -- keyboard decoding pointer .label MODE = $291 // flag, is case switch allowed - .label AUTODN = $292 // -- NOT IMPLEMENTED -- + .label AUTODN = $292 // -- NOT IMPLEMENTED -- screen scroll disable .label M51CRT = $293 // -- NOT IMPLEMENTED -- mock 6551 .label M51CDR = $294 // -- NOT IMPLEMENTED -- mock 6551 .label M51AJB = $295 // $295-$296 -- NOT IMPLEMENTED -- mock 6551 diff --git a/c64/basic/,aliases.s b/c64/basic/,aliases.s index e2a02afb..ef91afa0 100644 --- a/c64/basic/,aliases.s +++ b/c64/basic/,aliases.s @@ -60,7 +60,6 @@ // We also use the following for temp colour pointer when scrolling .label load_save_verify_end_address = $AE - .label cassette_buffer_ptr = $B2 .label current_logical_filenum = $B8 .label current_secondary_address = $B9 .label current_device_number = $BA @@ -80,7 +79,6 @@ .label keyboard_input_ready = $D0 .label current_screen_line_ptr = $D1 .label current_screen_x = $D3 - .label quote_mode_flag = $D4 .label logical_line_length = $D5 .label current_screen_y = $D6 .label last_printed_character_ascii = $D7 @@ -91,28 +89,6 @@ .label current_screen_line_colour_ptr = $F3 .label keyboard_decoding_table_ptr = $F5 - .label basic_input_buffer = BUF - - // "Compute's Mapping the 64" book - .label keyboard_buffer = $0277 - .label text_colour = $0286 // p55 - .label colour_under_cursor = $0287 // p56 - .label key_buffer_size = $0289 // p57 - - // 0 = cursor keys, insert, delete and space repeat, but nothing else - // 128 = all keys repeat - // 64 = no keys repeat - .label key_repeat_flags = $028A // p58 - // https://www.c64-wiki.com/wiki/Page_2 - .label key_repeat_counter = $028B - .label key_first_repeat_delay = $028C - // bit 0 = shift, 1 = Vendor Key, 2 = Control - .label key_bucky_state = $028D - .label key_last_bucky_state = $028E - .label keyboard_decoding_ptr = $028F - .label enable_case_switch = $0291 - .label screen_scroll_disable = $0292 - #if CONFIG_MEMORY_MODEL_60K // BASIC uses some extra bytes for memory access under ROMs located at $2A7 onwards diff --git a/c64/basic/basic_main_loop.s b/c64/basic/basic_main_loop.s index ef5c56dd..bfee34e6 100644 --- a/c64/basic/basic_main_loop.s +++ b/c64/basic/basic_main_loop.s @@ -24,7 +24,7 @@ read_line_loop: ldx #22 jmp basic_do_error !: - sta basic_input_buffer,x + sta BUF,x inx jmp read_line_loop diff --git a/c64/basic/cmd_list.s b/c64/basic/cmd_list.s index 7c56e38e..b2e6e2a6 100644 --- a/c64/basic/cmd_list.s +++ b/c64/basic/cmd_list.s @@ -66,7 +66,7 @@ list_single_line: // entry point needed by DOS wedge // Iterate through printing out the line // contents lda #0 - sta quote_mode_flag + sta QTSW ldy #4 list_print_loop: @@ -82,14 +82,14 @@ list_print_loop: beq list_end_of_line cmp #$22 bne list_not_quote - lda quote_mode_flag + lda QTSW eor #$ff - sta quote_mode_flag + sta QTSW lda #$22 jmp list_is_literal list_not_quote: // Check quote mode, and display as literal if required - ldx quote_mode_flag + ldx QTSW bne list_is_literal cmp #$7f @@ -128,7 +128,7 @@ list_not_quote: // REM command locks quote flag on until the end of the line, allowing // funny characters in REM statements without problem. inc $0427 - sta quote_mode_flag // Any value other than $00 or $FF will lock quote mode on, so the token value of REM is fine here + sta QTSW // Any value other than $00 or $FF will lock quote mode on, so the token value of REM is fine here // FALL THROUGH list_not_rem: diff --git a/c64/basic/tokenise_line.s b/c64/basic/tokenise_line.s index 38e412b0..df2314af 100644 --- a/c64/basic/tokenise_line.s +++ b/c64/basic/tokenise_line.s @@ -17,7 +17,7 @@ tokenise_line: lda #$00 sta $0110 sta $0112 - sta quote_mode_flag + sta QTSW lda tokenise_work1 sta $0113 @@ -40,7 +40,7 @@ tokenise_char: // Clear quote mode flag that is also used by KERNAL for screen display lda #$00 - sta quote_mode_flag + sta QTSW rts !: // More to do @@ -60,9 +60,9 @@ tokenise_char_loop: bne tk_not_quote // Quote - lda quote_mode_flag + lda QTSW eor #$ff - sta quote_mode_flag + sta QTSW jmp tk_literal_char tk_not_quote: @@ -82,7 +82,7 @@ tk_not_quote: tk_might_be_keyword: // Don't tokenise in quote mode - lda quote_mode_flag + lda QTSW bne tk_literal_char // Pack string @@ -137,9 +137,9 @@ found_token_in_line: // If it is REM, then lock us in quote mode to the end of the line cmp #$8f bne not_rem - sta quote_mode_flag -not_rem: - + sta QTSW +not_rem: + // Now skip over the length of the token lda $0110 clc diff --git a/c64/kernal/,aliases.s b/c64/kernal/,aliases.s index da75162a..286d92da 100644 --- a/c64/kernal/,aliases.s +++ b/c64/kernal/,aliases.s @@ -5,7 +5,6 @@ // XXX get rid of this file, use ,aliases_ram_lowmem.s instead - .label kernal_load_or_verify_flag = $93 .label current_file_num = $98 .label input_device_number = DFLTN .label cassette_buffer_bytes_used = $A6 @@ -30,7 +29,6 @@ .label keyboard_input_ready = $D0 .label current_screen_line_ptr = $D1 .label current_screen_x = $D3 - .label quote_mode_flag = $D4 .label logical_line_length = $D5 .label current_screen_y = $D6 .label last_printed_character_ascii = $D7 @@ -40,26 +38,6 @@ .label screen_line_link_table = $D9 .label current_screen_line_colour_ptr = $F3 .label keyboard_decoding_table_ptr = $F5 - - // "Compute's Mapping the 64" book - .label keyboard_buffer = $0277 - .label text_colour = $0286 // p55 - .label colour_under_cursor = $0287 // p56 - .label key_buffer_size = $0289 // p57 - - // 0 = cursor keys, insert, delete and space repeat, but nothing else - // 128 = all keys repeat - // 64 = no keys repeat - .label key_repeat_flags = $028A // p58 - // https://www.c64-wiki.com/wiki/Page_2 - .label key_repeat_counter = $028B - .label key_first_repeat_delay = $028C - // bit 0 = shift, 1 = Vendor Key, 2 = Control - .label key_bucky_state = $028D - .label key_last_bucky_state = $028E - .label keyboard_decoding_ptr = $028F - .label enable_case_switch = $0291 - .label screen_scroll_disable = $0292 #if CONFIG_MEMORY_MODEL_60K diff --git a/c64/kernal/blink_cursor.s b/c64/kernal/blink_cursor.s index 3135b4bd..1f64e898 100644 --- a/c64/kernal/blink_cursor.s +++ b/c64/kernal/blink_cursor.s @@ -3,7 +3,7 @@ // cursor_blink_countdown // cursor_saved_character // cursor_is_visible -// colour_under_cursor +// GDCOL (colour under cursor) show_cursor_if_enabled: lda cursor_blink_disable @@ -48,8 +48,8 @@ draw_cursor: sta (current_screen_line_ptr),y // Also set cursor colour lda (current_screen_line_colour_ptr),y - sta colour_under_cursor - lda text_colour + sta GDCOL + lda COLOR sta (current_screen_line_colour_ptr),y lda #1 @@ -63,7 +63,7 @@ undraw_cursor: lda cursor_saved_character ldy current_screen_x sta (current_screen_line_ptr),y - lda colour_under_cursor + lda GDCOL sta (current_screen_line_colour_ptr),y lda #0 diff --git a/c64/kernal/chrin_real.s b/c64/kernal/chrin_real.s index fed6552d..741534e5 100644 --- a/c64/kernal/chrin_real.s +++ b/c64/kernal/chrin_real.s @@ -90,7 +90,7 @@ read_from_keyboard: lda keys_in_key_buffer beq chrin_repeat - lda keyboard_buffer + lda KEYD cmp #$0d bne not_enter @@ -145,7 +145,7 @@ empty_line: not_enter: // Print character - lda keyboard_buffer + lda KEYD jsr CHROUT jsr pop_keyboard_buffer @@ -160,11 +160,11 @@ pop_keyboard_buffer: sei ldx #$00 ldy #$01 -!: lda keyboard_buffer,y - sta keyboard_buffer,x +!: lda KEYD,y + sta KEYD,x inx iny - cpy key_buffer_size + cpy XMAX bne !- dec keys_in_key_buffer cli diff --git a/c64/kernal/chrout_real.s b/c64/kernal/chrout_real.s index 190a4067..03d2b849 100644 --- a/c64/kernal/chrout_real.s +++ b/c64/kernal/chrout_real.s @@ -110,7 +110,7 @@ not_0a: bne not_0d // RETURN clears quote and insert modes lda #$00 - sta quote_mode_flag + sta QTSW sta insert_mode jmp screen_advance_to_next_line not_0d: @@ -235,7 +235,7 @@ done_delete: not_14: // Check for quote mode - ldx quote_mode_flag + ldx QTSW bne is_quote_mode ldx insert_mode bne is_quote_mode @@ -274,7 +274,7 @@ not_quote_mode: colour_check_loop: cmp colour_codes,x bne !+ - stx text_colour + stx COLOR jmp chrout_done !: dex bpl colour_check_loop @@ -415,14 +415,14 @@ output_literal_char: bne not_quote // Toggle quote flag if required - lda quote_mode_flag + lda QTSW eor #$80 - sta quote_mode_flag + sta QTSW not_quote: // Set colour - lda text_colour + lda COLOR sta (current_screen_line_colour_ptr),y // Advance the column, and scroll screen down if we need @@ -556,7 +556,7 @@ no_copy_down: // Erase newly inserted line ldy #79 !: - lda text_colour + lda COLOR sta (current_screen_line_colour_ptr),y lda #$20 sta (current_screen_line_ptr),y @@ -659,7 +659,7 @@ scroll_copy_loop2: // Fill in scrolled up area ldx load_or_scroll_temp_pointer+0 scroll_copy_loop3: - lda text_colour + lda COLOR sta (current_screen_line_colour_ptr),y lda #$20 sta (current_screen_line_ptr),y diff --git a/c64/kernal/cint_real.s b/c64/kernal/cint_real.s index 97a4d701..23452e08 100644 --- a/c64/kernal/cint_real.s +++ b/c64/kernal/cint_real.s @@ -79,17 +79,17 @@ cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? // But require key to be held for ~1/3sec before // repeating (Compute's Mapping the 64 p58) ldx #22-2 // Fudge factor to match speed - stx key_first_repeat_delay + stx DELAY // Set current colour for text (Compute's Mapping the 64 p215) ldx #$01 // default is light blue ($0E), but we use a different one - stx text_colour + stx COLOR // Set maximum keyboard buffer size (Compute's Mapping the 64 p215) ldx #10 - stx key_buffer_size - // Put non-zero value in enable_case_switch - stx enable_case_switch + stx XMAX + // Put non-zero value in MODE to enable case switch + stx MODE // Set default I/O devices (see SCINIT description at http://sta.c64.org/cbm64krnfunc.html) jsr clrchn_reset diff --git a/c64/kernal/e544.clear_screen.s b/c64/kernal/e544.clear_screen.s index d0e0e639..e699f2ec 100644 --- a/c64/kernal/e544.clear_screen.s +++ b/c64/kernal/e544.clear_screen.s @@ -47,7 +47,7 @@ clearscreen_l2: // Clear colour RAM // (Compute's Mapping the 64 p216) - lda text_colour + lda COLOR clearscreen_l3: sta $d800,y sta $d900,y diff --git a/c64/kernal/f13e.getin.s b/c64/kernal/f13e.getin.s index 485535b0..c5f6b713 100644 --- a/c64/kernal/f13e.getin.s +++ b/c64/kernal/f13e.getin.s @@ -22,7 +22,7 @@ GETIN: rts !: - lda keyboard_buffer + lda KEYD pha jsr pop_keyboard_buffer diff --git a/c64/kernal/fda3.ioinit.s b/c64/kernal/fda3.ioinit.s index bdffec29..00fbf343 100644 --- a/c64/kernal/fda3.ioinit.s +++ b/c64/kernal/fda3.ioinit.s @@ -53,15 +53,15 @@ IOINIT: #endif // CONFIG_SID_D4XX || CONFIG_SID_D5XX #if CONFIG_SID_2ND - lda SID_SIGVOL - SID_BASE + CONFIG_SID_2ND_ADDRESS + lda SID_SIGVOL - __SID_BASE + CONFIG_SID_2ND_ADDRESS and #$F0 - sta SID_SIGVOL - SID_BASE + CONFIG_SID_2ND_ADDRESS + sta SID_SIGVOL - __SID_BASE + CONFIG_SID_2ND_ADDRESS #endif // CONFIG_SID_2ND #if CONFIG_SID_3RD - lda SID_SIGVOL - SID_BASE + CONFIG_SID_3RD_ADDRESS + lda SID_SIGVOL - __SID_BASE + CONFIG_SID_3RD_ADDRESS and #$F0 - sta SID_SIGVOL - SID_BASE + CONFIG_SID_3RD_ADDRESS + sta SID_SIGVOL - __SID_BASE + CONFIG_SID_3RD_ADDRESS #endif // CONFIG_SID_3RD // Initialize CIAs diff --git a/c64/kernal/scnkey.s b/c64/kernal/scnkey.s index 6bf96d90..31a587a4 100644 --- a/c64/kernal/scnkey.s +++ b/c64/kernal/scnkey.s @@ -74,9 +74,9 @@ SCNKEY: sta BufferQuantity // Decrement key repeat timeout if non-zero - ldx key_repeat_counter + ldx KOUNT beq sk_start - dec key_repeat_counter + dec KOUNT sk_start: // Call main keyboard scanning routine @@ -110,7 +110,7 @@ accept_key: // Convert matrix position to key code // XXX - Add offset of $40, $80 or $C0 if shift, CONTROL or C= are held down pha - lda key_bucky_state + lda SHFLAG and #$7 tax pla @@ -123,9 +123,9 @@ accept_key: // Stash key into keyboard buffer ldx keys_in_key_buffer - cpx key_buffer_size + cpx XMAX beq sk_nokey - sta keyboard_buffer,x + sta KEYD,x inc keys_in_key_buffer sk_nokey: @@ -204,10 +204,10 @@ ReturnNoKeys: NoActivityDetected: // So cancel all bucky keys - lda key_bucky_state - sta key_last_bucky_state + lda SHFLAG + sta LSTSHF lda #$00 - sta key_bucky_state + sta SHFLAG jmp ReturnNoKeys @@ -239,7 +239,7 @@ JoystickActivity: // Clear bucky key status lda #$00 - sta key_bucky_state + sta SHFLAG lda $dc01 and #$03 @@ -254,7 +254,7 @@ JoystickActivity: // Up // Mark shift as pressed ldx #$01 - stx key_bucky_state + stx SHFLAG ldx #$07 // UP/DOWN jsr KeyFound !: @@ -278,7 +278,7 @@ JoystickActivity: cmp #$08 bne !+ ldx #$01 - stx key_bucky_state + stx SHFLAG ldx #$02 jsr KeyFound // LEFT/RIGHT !: @@ -332,20 +332,20 @@ next_row: // Store de-bounce data for bucky keys // (Compute's Mapping the 64, p58-59) - lda key_bucky_state - sta key_last_bucky_state + lda SHFLAG + sta LSTSHF // Build bucky state lda #$00 - sta key_bucky_state + sta SHFLAG lda ScanResult+6 eor #%10000000 and #%10000000 // Left shift rol rol and #$01 - ora key_bucky_state - sta key_bucky_state + ora SHFLAG + sta SHFLAG // Right shift lda ScanResult+1 @@ -355,15 +355,15 @@ next_row: lsr lsr and #$01 - ora key_bucky_state - sta key_bucky_state + ora SHFLAG + sta SHFLAG // Control lda ScanResult+0 eor #$04 and #$04 - ora key_bucky_state - sta key_bucky_state + ora SHFLAG + sta SHFLAG // Vendor key lda ScanResult+0 @@ -373,17 +373,17 @@ next_row: lsr lsr and #$02 - ora key_bucky_state - sta key_bucky_state + ora SHFLAG + sta SHFLAG // Chick for shift + Vendor cmp #$03 bne no_case_toggle - lda key_last_bucky_state + lda LSTSHF cmp #$03 beq no_case_toggle - lda enable_case_switch + lda MODE beq no_case_toggle lda $D018 @@ -509,15 +509,15 @@ KeyHeld: // Different key held sta last_key_matrix_position pha - lda key_first_repeat_delay - sta key_repeat_counter + lda DELAY + sta KOUNT pla BuckyHeld: jmp ConsiderNextKey SameKeyHeld: pha - lda key_repeat_counter + lda KOUNT bmi KeyCanRepeat bne KeyRepeatWait // Count down ended, so repeat key now @@ -526,7 +526,7 @@ KeyCanRepeat: // (Compute's Mapping the 64 p58) pha lda #6-2 // Fudge factor to match speed - sta key_repeat_counter + sta KOUNT pla pla