From 8de99f2b14a86dff95de7dd266d2d73afde03b01 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 9 Sep 2019 17:00:42 +0200 Subject: [PATCH] one more cleanup in aliases --- c64/aliases/,aliases_ram_lowmem.s | 26 +++++++++++++------------- c64/basic/,aliases.s | 2 -- c64/basic/basic_cold_start.s | 2 +- c64/kernal/,aliases.s | 2 -- c64/kernal/cint_real.s | 2 +- c64/kernal/close_load.s | 2 +- c64/kernal/f291.close.s | 2 +- c64/kernal/f4a5.load.s | 5 ++--- c64/kernal/fd15.vector.s | 2 +- c64/kernal/iec/iec_cmd_open.s | 2 +- c64/kernal/iec/iec_rx_byte.s | 4 ++-- c64/kernal/iec/iec_tx_byte.s | 6 +++--- c64/kernal/iec/iec_tx_command.s | 2 +- c64/kernal/lvs_helpers.s | 6 +++--- c64/kernal/memtop.s | 8 ++++---- c64/kernal/ramtas.s | 8 ++++---- c64/kernal/talk.s | 2 +- c64/kernal/untlk.s | 2 +- 18 files changed, 40 insertions(+), 45 deletions(-) diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index 8b116ec7..f7dd4ea0 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -39,7 +39,7 @@ .label STREND = $31 // $31-$32 -- NOT IMPLEMENTED -- .label FRETOP = $33 // $33-$34 -- NOT IMPLEMENTED -- .label FRESPC = $35 // $35-$36 [!] our implementation might be different XXX give more details - // .label MEMSIZ = $37 // $37-$38 -- NOT IMPLEMENTED -- highest address of BASIC memory XXX remove name conflict + .label MEMSIZ = $37 // $37-$38 -- NOT IMPLEMENTED -- highest address of BASIC memory .label CURLIN = $39 // $39-$3A current BASIC line number .label OLDLIN = $3B // $3B-$3C previous BASIC line number .label OLDTXT = $3D // $3D-$3E current BASIC line pointer @@ -75,7 +75,7 @@ .label IOSTATUS = $90 .label STKEY = $91 // Keys down clears bits. STOP - bit 7, C= - bit 6, SPACE - bit 4, CTRL - bit 2 .label SVXT = $92 // -- NOT IMPLEMENTED -- - .label VERCK = $93 // 0 = LOAD, 1 = VERIFY XXX rename to VERCKK + .label VERCKK = $93 // 0 = LOAD, 1 = VERIFY .label C3PO = $94 // flag - is BSOUR content valid .label BSOUR = $95 // serial bus buffered output byte .label SYNO = $96 // -- NOT IMPLEMENTED -- @@ -88,9 +88,9 @@ .label MSGFLG = $9D // bit 6 = error messages, bit 7 = control message .label PTR1 = $9E // -- NOT IMPLEMENTED -- .label PTR2 = $9F // -- NOT IMPLEMENTED -- - .label TIME = $A0 // $A0-$A2, jiffy clock - .label IEC_TMP1 = $A3 // temporary variable for tape and IEC, [!] our usage probably differs in details XXX rename to TSFCNT - .label IEC_TMP2 = $A4 // temporary variable for tape and IEC, [!] our usage probably differs in details XXX rename to TBTCNT + .label TIME = $A0 // $A0-$A2 jiffy clock + .label TSFCNT = $A3 // temporary variable for tape and IEC, [!] our usage probably differs in details + .label TBTCNT = $A4 // temporary variable for tape and IEC, [!] our usage probably differs in details .label CNTDN = $A5 // -- NOT IMPLEMENTED -- .label BUFPNT = $A6 // -- NOT IMPLEMENTED -- .label INBIT = $A7 // -- NOT IMPLEMENTED -- @@ -100,7 +100,7 @@ .label RIPRTY = $AB // -- NOT IMPLEMENTED -- .label SAL = $AC // $AC-$AD -- NOT IMPLEMENTED -- (implemented screen part) .label EAL = $AE // $AE-$AF -- NOT IMPLEMENTED -- [!] used also byy screen editor - .label CMP0 = $B0 // $B0-$B1, temporary tape storage, [!] here used for BRK instruction address + .label CMP0 = $B0 // $B0-$B1 temporary tape storage, [!] here used for BRK instruction address .label TAPE1 = $B2 // $B2-$B3 tape buffer pointer .label BITTS = $B4 // -- NOT IMPLEMENTED -- .label NXTBIT = $B5 // -- NOT IMPLEMENTED -- @@ -109,13 +109,13 @@ .label LA = $B8 // current logical_file number .label SA = $B9 // current secondary address .label FA = $BA // current device number - .label FNADDR = $BB // $BB-$BC, current file name pointer + .label FNADDR = $BB // $BB-$BC current file name pointer .label ROPRTY = $BD // -- NOT IMPLEMENTED -- .label FSBLK = $BE // -- NOT IMPLEMENTED -- .label MYCH = $BF // -- NOT IMPLEMENTED -- .label CAS1 = $C0 // -- NOT IMPLEMENTED -- - .label STAL = $C1 // $C1-$C2, LOAD/SAVE start address - .label MEMUS = $C3 // $C3-$C4, temporary address for tape LOAD/SAVE XXX rename to MEMUSS + .label STAL = $C1 // $C1-$C2 LOAD/SAVE start address + .label MEMUSS = $C3 // $C3-$C4 temporary address for tape LOAD/SAVE .label LSTX = $C5 // last keyy matrix position [!] our usage probably differs in details .label NDX = $C6 // number of chars in keyboard buffer .label RVS = $C7 // flag, whether to print reversed characters @@ -157,9 +157,9 @@ .label LAT = $259 // $259-$262, logical file numbers (table, 10 bytes) .label FAT = $263 // $263-$26C, device numbers (table, 10 bytes) .label SAT = $26D // $26D-$276, secondary addresses (table, 10 bytes) - .label KEYD = $277 // $277-$280 keyboard buffer - .label MEMSTR = $281 // $281-$282 XXX rename to LORAM - .label MEMSIZ = $283 // $283-$284, NOTE: Mapping the 64 erroneously has the hex as $282, while the DEC is correct XXX rename to HIRAM + .label KEYD = $277 // $277-$280, keyboard buffer + .label MEMSTR = $281 // $281-$282, start of BASIC memory + .label MEMEND = $283 // $283-$284, NOTE: Mapping the 64 erroneously has the hex as $282 (DEC is correct), name seems to be mistaken too .label TIMOUT = $285 // IEEE-488 timeout .label COLOR = $286 // current text foreground color .label GDCOL = $287 // color of character under cursor @@ -189,7 +189,7 @@ .label TRDTMP = $2A3 // -- NOT IMPLEMENTED -- .label TD1IRQ = $2A4 // -- NOT IMPLEMENTED -- .label TLNIDX = $2A5 // -- NOT IMPLEMENTED -- - .label PALNTSC = $2A6 // 0 = NTSC, 1 = PAL XXX rename to TVSFLG + .label TVSFLG = $2A6 // 0 = NTSC, 1 = PAL // [!] XXX document $2A7-$2FF usage // BASIC vectors diff --git a/c64/basic/,aliases.s b/c64/basic/,aliases.s index a626522d..2cd8b229 100644 --- a/c64/basic/,aliases.s +++ b/c64/basic/,aliases.s @@ -90,8 +90,6 @@ .label screen_line_link_table = $D9 .label current_screen_line_colour_ptr = $F3 .label keyboard_decoding_table_ptr = $F5 - .label rs232_rx_buffer_ptr = $F7 - .label rs232_tx_buffer_ptr = $F9 .label basic_input_buffer = BUF diff --git a/c64/basic/basic_cold_start.s b/c64/basic/basic_cold_start.s index ac1f507c..d3aab8fd 100644 --- a/c64/basic/basic_cold_start.s +++ b/c64/basic/basic_cold_start.s @@ -19,7 +19,7 @@ startup_banner: // Print PAL/NTSC ldx #30 // NTSC - lda PALNTSC + lda TVSFLG beq !+ ldx #31 // PAL !: diff --git a/c64/kernal/,aliases.s b/c64/kernal/,aliases.s index e2a275b5..0d133ed5 100644 --- a/c64/kernal/,aliases.s +++ b/c64/kernal/,aliases.s @@ -41,8 +41,6 @@ .label screen_line_link_table = $D9 .label current_screen_line_colour_ptr = $F3 .label keyboard_decoding_table_ptr = $F5 - .label rs232_rx_buffer_ptr = $F7 - .label rs232_tx_buffer_ptr = $F9 // "Compute's Mapping the 64" book .label keyboard_buffer = $0277 diff --git a/c64/kernal/cint_real.s b/c64/kernal/cint_real.s index 401db85c..97a4d701 100644 --- a/c64/kernal/cint_real.s +++ b/c64/kernal/cint_real.s @@ -54,7 +54,7 @@ cint_pal: lda #$01 !: - sta PALNTSC + sta TVSFLG cint_brk: // entry for BRK and STOP+RESTORE - XXX, where should it start? diff --git a/c64/kernal/close_load.s b/c64/kernal/close_load.s index b899cf21..efb0b013 100644 --- a/c64/kernal/close_load.s +++ b/c64/kernal/close_load.s @@ -13,7 +13,7 @@ close_load: jsr LISTEN lda #$E0 // CLOSE command - sta IEC_TMP2 + sta TBTCNT jsr iec_tx_command jsr iec_tx_command_finalize diff --git a/c64/kernal/f291.close.s b/c64/kernal/f291.close.s index 5b45bf47..ca60794b 100644 --- a/c64/kernal/f291.close.s +++ b/c64/kernal/f291.close.s @@ -34,7 +34,7 @@ CLOSE: jmp close_remove_from_table !: ora $E0 // CLOSE command - sta IEC_TMP2 + sta TBTCNT jsr iec_tx_command bcs close_remove_from_table jsr iec_tx_command_finalize diff --git a/c64/kernal/f4a5.load.s b/c64/kernal/f4a5.load.s index cbf0b1d7..bb43f88f 100644 --- a/c64/kernal/f4a5.load.s +++ b/c64/kernal/f4a5.load.s @@ -1,4 +1,3 @@ - // // Official Kernal routine, described in: // @@ -23,7 +22,7 @@ LOAD: // Are we loading or verifying? - sta VERCK + sta VERCKK // Store start address of LOAD stx STAL+0 @@ -82,7 +81,7 @@ LOAD: jmp lvs_load_verify_error // XXX deduplicate with other jumps in this routine !: lda #$60 // open channel / data (p3) , required according to p13 - sta IEC_TMP2 + sta TBTCNT jsr iec_tx_command bcc !+ jmp lvs_load_verify_error // XXX deduplicate with other jumps in this routine diff --git a/c64/kernal/fd15.vector.s b/c64/kernal/fd15.vector.s index eaad0ece..7b7fd00d 100644 --- a/c64/kernal/fd15.vector.s +++ b/c64/kernal/fd15.vector.s @@ -21,7 +21,7 @@ VECTOR: // Temporary storage location - checked on real C64 that this is the // address originally used; after calling VECTOR and checking zero page // area afterwards, the address could be found there - .label _caller_arr_ptr = MEMUS + .label _caller_arr_ptr = MEMUSS // According to 'Compute's Mapping the Commodore 64' page 237, // the CBM implementation does not disable IRQs - yet, the diff --git a/c64/kernal/iec/iec_cmd_open.s b/c64/kernal/iec/iec_cmd_open.s index 1d6389ab..5cc86ccb 100644 --- a/c64/kernal/iec/iec_cmd_open.s +++ b/c64/kernal/iec/iec_cmd_open.s @@ -18,7 +18,7 @@ iec_cmd_open: // similar to TKSA, but without turnaround common_open_close_unlsn_second: // common part of several commands - sta IEC_TMP2 + sta TBTCNT jsr iec_tx_command bcs !+ // branch if error jmp iec_tx_command_finalize diff --git a/c64/kernal/iec/iec_rx_byte.s b/c64/kernal/iec/iec_rx_byte.s index f0f17915..bb9328ef 100644 --- a/c64/kernal/iec/iec_rx_byte.s +++ b/c64/kernal/iec/iec_rx_byte.s @@ -135,12 +135,12 @@ iec_rx_clk_wait2: plp // Restore registers - sta IEC_TMP2 // $A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html + sta TBTCNT // $A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html pla tay pla tax - lda IEC_TMP2 + lda TBTCNT clc rts diff --git a/c64/kernal/iec/iec_tx_byte.s b/c64/kernal/iec/iec_tx_byte.s index bd561fb9..69e71f52 100644 --- a/c64/kernal/iec/iec_tx_byte.s +++ b/c64/kernal/iec/iec_tx_byte.s @@ -1,7 +1,7 @@ // Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc -// Expects byte to send in IEC_TMP2 ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html) +// Expects byte to send in TBTCNT ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html) // Carry flag set = signal EOI // // Preserves .X and .Y registers @@ -53,9 +53,9 @@ iec_tx_common: iec_tx_common_sendbit: // Is next bit 0 or 1? - lda IEC_TMP2 + lda TBTCNT lsr - sta IEC_TMP2 + sta TBTCNT bcs !+ // Bit is 0 diff --git a/c64/kernal/iec/iec_tx_command.s b/c64/kernal/iec/iec_tx_command.s index 6965d1d0..42c98960 100644 --- a/c64/kernal/iec/iec_tx_command.s +++ b/c64/kernal/iec/iec_tx_command.s @@ -1,7 +1,7 @@ // Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc -// Expects byte to send in IEC_TMP2 ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html) +// Expects byte to send in TBTCNT ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html) // Carry flag set = signal EOI // // Preserves .X and .Y registers diff --git a/c64/kernal/lvs_helpers.s b/c64/kernal/lvs_helpers.s index 2998b7e1..b4e20e98 100644 --- a/c64/kernal/lvs_helpers.s +++ b/c64/kernal/lvs_helpers.s @@ -18,7 +18,7 @@ lvs_send_file_name_loop: sec !: // Transmit one character - sta IEC_TMP2 + sta TBTCNT jsr iec_tx_byte jmp lvs_send_file_name_loop lvs_send_file_name_done: @@ -86,7 +86,7 @@ lvs_display_loading_verifying: // Display LOADING / VERIFYING and start address lda MSGFLG bpl lvs_display_end - lda VERCK + lda VERCKK beq !+ jsr printf // XXX don't use printf, use packed message .byte $0D @@ -156,7 +156,7 @@ lvs_illegal_device_number: lvs_load_verify_error: // XXX should we really return BASIC error code here? - lda VERCK + lda VERCKK bne lvs_verify_error lda #B_ERR_LOAD bne lvs_error_end diff --git a/c64/kernal/memtop.s b/c64/kernal/memtop.s index 1e244453..06995cf8 100644 --- a/c64/kernal/memtop.s +++ b/c64/kernal/memtop.s @@ -12,13 +12,13 @@ MEMTOP: bcc memtop_set - ldy MEMSIZ+1 - ldx MEMSIZ+0 + ldy MEMEND+1 + ldx MEMEND+0 rts memtop_set: - sty MEMSIZ+1 - stx MEMSIZ+0 + sty MEMEND+1 + stx MEMEND+0 rts diff --git a/c64/kernal/ramtas.s b/c64/kernal/ramtas.s index 4dddce03..d7481427 100644 --- a/c64/kernal/ramtas.s +++ b/c64/kernal/ramtas.s @@ -61,14 +61,14 @@ ramtas_l2: ldx #>$0400 stx HIBASE - // Work out RAM size and put in MEMSTR and MEMSIZ + // Work out RAM size and put in MEMSTR and MEMEND // "Compute's Mapping the 64", p54 // http://unusedino.de/ec64/technical/project64/mapping_c64.html ldx #>$0800 stx MEMSTR+1 ldx #$00 stx MEMSTR+0 - stx MEMSIZ+0 + stx MEMEND+0 // Try to modify $8000, if it fails then RAM ends at $7FFF, else $9FFF lda $8000 eor #$FF @@ -79,12 +79,12 @@ ramtas_l2: beq ramtas_32K_RAM sta $8000 ldx #$A0 - stx MEMSIZ+1 + stx MEMEND+1 jmp ramtas_RAM_sized ramtas_32K_RAM: sta $8000 // in case RAM is hiding beneath a ROM ldx #$80 - stx MEMSIZ+1 + stx MEMEND+1 // Fall through ramtas_RAM_sized: diff --git a/c64/kernal/talk.s b/c64/kernal/talk.s index 556de7d9..f895e4fb 100644 --- a/c64/kernal/talk.s +++ b/c64/kernal/talk.s @@ -26,7 +26,7 @@ TALK: common_talk_listen: // common part of TALK and LISTEN - sta IEC_TMP2 + sta TBTCNT jmp iec_tx_command diff --git a/c64/kernal/untlk.s b/c64/kernal/untlk.s index e1d5ba59..758d36ef 100644 --- a/c64/kernal/untlk.s +++ b/c64/kernal/untlk.s @@ -21,7 +21,7 @@ UNTLK: common_untlk_tksa: // common part of UNTLK and TKSA - sta IEC_TMP2 + sta TBTCNT jsr iec_tx_command bcs !+ // branch if error // XXX - for TKSA, is it really the right place to do a turnaround? I've got some doubts