From 676db127c3d2689fcce5d617338dedc871bed7a4 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 10 Aug 2019 16:06:32 +0200 Subject: [PATCH 01/16] implemented UDTIM routine --- STATUS.md | 2 +- c64/kernal/scnkey.s | 10 ---------- c64/kernal/udtim.s | 42 ++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 43 insertions(+), 11 deletions(-) diff --git a/STATUS.md b/STATUS.md index 83831a1f..e29d912c 100644 --- a/STATUS.md +++ b/STATUS.md @@ -106,7 +106,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FFE1` | `STOP` | DONE | | | `$FFE4` | `GETIN` | PARTIAL | only some devices supported | | `$FFE7` | `CLALL` | DONE | | -| `$FFEA` | `UDTIM` | NOT DONE | checking for STOP key present in SCNKEY instead | +| `$FFEA` | `UDTIM` | DONE | | | `$FFED` | `SCREEN` | DONE | | | `$FFF0` | `PLOT` | NOT DONE | | | `$FFF3` | `IOBASE` | DONE | | diff --git a/c64/kernal/scnkey.s b/c64/kernal/scnkey.s index d5a6bb1b..c1a8a28a 100644 --- a/c64/kernal/scnkey.s +++ b/c64/kernal/scnkey.s @@ -204,10 +204,6 @@ ReturnNoKeys: NoActivityDetected: - ;; Cancel STKEY status - lda #$FF - sta STKEY ; XXX this variable should be set by UDTIM - ;; So cancel all bucky keys lda key_bucky_state sta key_last_bucky_state @@ -334,12 +330,6 @@ next_row: ;; //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ;; // Check and flag Non Alphanumeric Keys - ;; Store last row of keyboard scan result, - ;; so that RUN/STOP etc can be checked easily - ;; (Compute's Mapping the 64, p27) - lda ScanResult+0 - sta STKEY ; XXX this variable should be set by UDTIM - ;; Store de-bounce data for bucky keys ;; (Compute's Mapping the 64, p58-59) lda key_bucky_state diff --git a/c64/kernal/udtim.s b/c64/kernal/udtim.s index b502112f..28af8cc4 100644 --- a/c64/kernal/udtim.s +++ b/c64/kernal/udtim.s @@ -9,4 +9,46 @@ ;; udtim: + + ;; Update jiffy clock. The whole day is $4F1A00 jiffies (24 hours * 60 minutes * 60 seconds * 60 jiffies), + ;; after this time we have to reset the clock. + + inc TIME+0 + bne udtim_clock_done + inc TIME+1 + bne udtim_clock_rollover + inc TIME+2 + + ;; FALLTROUGH + +udtim_clock_done: +udtim_update_stkey: ; entry to be used when interrupts are disabled + + ;; Another action we have to perform is to copy the last row of keyboard to RAM, + ;; so that various routines can detect the STOP key press + ;; XXX scnkey contains similar sequence - deduplicate this! + lda #$FF + sta CIA1_DDRA ; output + lda #$00 + sta CIA1_DDRB ; input + + lda #$7F + sta CIA1_PRA ; select the last row (bit to 0) + + lda CIA1_PRB ; read the row + sta STKEY rts + +udtim_clock_rollover: + + ;; At this point TIME+0 has to contain 0, + lda TIME+1 + cmp #$1A + bne udtim_clock_done + lda TIME+2 + cmp #$4F + bne udtim_clock_done + lda #$00 + sta TIME+2 + sta TIME+1 + beq udtim_clock_done ; will always jump From 403be441dc86b2683709539353ef7b3ba753a6da Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 10 Aug 2019 16:56:03 +0200 Subject: [PATCH 02/16] implemented PLOT routine --- STATUS.md | 2 +- c64/kernal/plot.s | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/STATUS.md b/STATUS.md index e29d912c..7a71fed7 100644 --- a/STATUS.md +++ b/STATUS.md @@ -108,7 +108,7 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FFE7` | `CLALL` | DONE | | | `$FFEA` | `UDTIM` | DONE | | | `$FFED` | `SCREEN` | DONE | | -| `$FFF0` | `PLOT` | NOT DONE | | +| `$FFF0` | `PLOT` | DONE | | | `$FFF3` | `IOBASE` | DONE | |
diff --git a/c64/kernal/plot.s b/c64/kernal/plot.s index 439b1828..3739b362 100644 --- a/c64/kernal/plot.s +++ b/c64/kernal/plot.s @@ -9,4 +9,19 @@ ;; plot: + bcs plot_get + +plot_set: + sty current_screen_y + stx current_screen_x + + ;; Our implementation has different screen editor, updating any + ;; other variables (see [CM64]) seems to be unnecessary + + ;; FALLTROUGH to save one byte on RTS + +plot_get: + ldy current_screen_y + ldx current_screen_x rts + From 4f77af52a475eb0e4f3182b710851309ef83e17e Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 10 Aug 2019 18:09:37 +0200 Subject: [PATCH 03/16] adjuster startup once again - not the most effective way, but should be more compatible with cartridges --- c64/kernal/cint.s | 49 ++++++++++++++++++++++++++++++++++++---- c64/kernal/fda3.ioinit.s | 36 ----------------------------- c64/kernal/reset_entry.s | 16 +++++-------- 3 files changed, 51 insertions(+), 50 deletions(-) diff --git a/c64/kernal/cint.s b/c64/kernal/cint.s index 1fa22258..a99aa08d 100644 --- a/c64/kernal/cint.s +++ b/c64/kernal/cint.s @@ -11,14 +11,55 @@ cint: + ;; According to [CM64], this routine checks for PAL/NTSC. It's definitely not done + ;; within the 'BRK' part, this can be easily checked - POKE something + ;; to address 678 on a real C64, press STOP+RESTORE, the value won't change + + ;; Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable + ;; see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc + + lda #$C8 ; preparation, as the VIC might be uninitialized + sta VIC_SCROLX + +cint_w0: + lda VIC_RASTER +cint_w1: + cmp VIC_RASTER + beq cint_w1 + bmi cint_w0 + + ;; Result in A, if no interrupt happened during the test: + ;; #$37 -> 312 rasterlines, PAL, VIC 6569 + ;; #$06 -> 263 rasterlines, NTSC, VIC 6567R8 + ;; #$05 -> 262 rasterlines, NTSC, VIC 6567R56A + + cmp #$07 + bcs cint_pal + +cint_ntsc: + + ;; NTSC C64 (https://codebase64.org/doku.php?id=base:cpu_clocking), + ;; is clocked at 1.022727 MHz, so that 1/60s is 17045 CPU cycles + + ldy #<17045 + ldx #>17045 + + sty CIA1_TIMALO + stx CIA1_TIMAHI + + lda #$00 + beq + + +cint_pal: + + lda #$01 +* + sta PALNTSC + cint_brk: ; entry for BRK and STOP+RESTORE - XXX, where should it start? jsr setup_vicii - ;; According to [CM64], this routine also checks for PAL/NTSC - this must be a mistake, - ;; it's too late (IOINIT already needs this information), besides - POKE something - ;; to address 678 on a real C64, press STOP+RESTORE - the value won't change - ;; Initialise cursor blink flags (Compute's Mapping the 64 p215) lda #$00 sta cursor_blink_disable diff --git a/c64/kernal/fda3.ioinit.s b/c64/kernal/fda3.ioinit.s index 3f1a3ba9..7572e3cf 100644 --- a/c64/kernal/fda3.ioinit.s +++ b/c64/kernal/fda3.ioinit.s @@ -34,32 +34,7 @@ ioinit: cpy #$80 ; $20 * amount of chips to silence, $80 to silence 4 chips bne - - ;; Detect video system (PAL/NTSC), use Graham's method, as it's short and reliable - ;; see here: https://codebase64.org/doku.php?id=base:detect_pal_ntsc -ioinit_w0: - lda VIC_RASTER -ioinit_w1: - cmp VIC_RASTER - beq ioinit_w1 - bmi ioinit_w0 - - ;; Result in A, if no interrupt happened during the test: - ;; #$37 -> 312 rasterlines, PAL, VIC 6569 - ;; #$06 -> 263 rasterlines, NTSC, VIC 6567R8 - ;; #$05 -> 262 rasterlines, NTSC, VIC 6567R56A - - cmp #$07 - bcs ioinit_pal - -ioinit_ntsc: - lda #$00 - beq + - -ioinit_pal: - lda #$01 -* - sta PALNTSC ;; XXX: calibrate TOD for both CIA's, see here: https://codebase64.org/doku.php?id=base:efficient_tod_initialisation @@ -81,17 +56,6 @@ ioinit_pal: ldy #<16421 ldx #>16421 - lda PALNTSC - bne + - - ;; NTSC C64 (https://codebase64.org/doku.php?id=base:cpu_clocking), - ;; is clocked at 1.022727 MHz, so that 1/60s is 17045 CPU cycles - - ldy #<17045 - ldx #>17045 - - ;; Store the IRQ timing constant to CIA chip -* sty CIA1_TIMALO stx CIA1_TIMAHI diff --git a/c64/kernal/reset_entry.s b/c64/kernal/reset_entry.s index 8a6ccabc..e41cd7f3 100644 --- a/c64/kernal/reset_entry.s +++ b/c64/kernal/reset_entry.s @@ -13,14 +13,8 @@ reset_entry: ; The following routine is based on reading the public KERNAL jumptable routine ; list, and making unimaginative assumptions about what should be done on reset. - - ; According to example here: https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image - ; the cartridge does not call RAMTAS - despite it's obviously required. So, call RAMTAS - ; before the cartridge check/takeover - - ; Setting up the screen and testing ram is obviously required - ; also affirmed by p269 of c64 prg - jsr RAMTAS + ; Also, https://codebase64.org/doku.php?id=base:assembling_your_own_cart_rom_image was used + ; as it shows example startup sequence, to be followe by cartridge creators ; C64 PRG p269 jsr cartridge_check @@ -28,10 +22,12 @@ reset_entry: jmp (ICART_COLD_START) * ; Initialising IO is obviously required. Also indicated by c64 prg p269. - ; Has to be after ther RAMTAS, as it clears memory, including the PAL/NTSC flag, - ; which is set by IOINIT jsr IOINIT + ; Setting up the screen and testing ram is obviously required + ; also affirmed by p269 of c64 prg + jsr RAMTAS ; called RANTAM on Codebase64 wiki + ; Resetting IO vectors is obviously required, if we want interrupts to run ; also affirmed by c64 prg p269 jsr RESTOR From b954d23a6b4f87593978bb1a314539046e171798 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 11 Aug 2019 10:22:14 +0200 Subject: [PATCH 04/16] multiple SID silencing improvement --- STATUS.md | 2 +- c64/kernal/fda3.ioinit.s | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/STATUS.md b/STATUS.md index 7a71fed7..211c014d 100644 --- a/STATUS.md +++ b/STATUS.md @@ -6,7 +6,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8 * improved keyboard scanning, supports multi-key roll-over and rejection of spurious joystick input * joystick (port 1) can be used to move text cursor * uses RAM under ROM and I/O: 61436 bytes free -* cold/warm start silences 4 SID chips - assumes addresses $D400, $D420, $D440, $D460 +* cold/warm start silences SID chips - $D400, $D420, ..., $D4E0, $D500 * extended `LOAD` command * start/end addresses are displayed, in the Final cartridge style * command with just the file name tries to use the last device if it's number seems sane; otherwise uses 8 diff --git a/c64/kernal/fda3.ioinit.s b/c64/kernal/fda3.ioinit.s index 7572e3cf..92cd3b7c 100644 --- a/c64/kernal/fda3.ioinit.s +++ b/c64/kernal/fda3.ioinit.s @@ -20,7 +20,7 @@ ioinit: sta CPU_R6510 stx CPU_D6510 - ;; Silence the SID chips + ;; Silence the SID chips in the $D4xx range ldy #$00 * @@ -31,10 +31,13 @@ ioinit: clc adc #$20 tay - cpy #$80 ; $20 * amount of chips to silence, $80 to silence 4 chips bne - + ;; Silence the SID chip on $D500 + lda SID_SIGVOL+$100 + and #$F0 + sta SID_SIGVOL+$100 ;; XXX: calibrate TOD for both CIA's, see here: https://codebase64.org/doku.php?id=base:efficient_tod_initialisation From 8eb435d2b22e39c719a9c7272c5a2a356ba64842 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 25 Aug 2019 13:25:03 +0200 Subject: [PATCH 05/16] fix potential IEC data transfer problem --- c64/kernal/iec/iec_pull_clk_release_data_oneshot.s | 8 ++++++++ c64/kernal/iec/iec_tx_common.s | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 c64/kernal/iec/iec_pull_clk_release_data_oneshot.s diff --git a/c64/kernal/iec/iec_pull_clk_release_data_oneshot.s b/c64/kernal/iec/iec_pull_clk_release_data_oneshot.s new file mode 100644 index 00000000..78d40472 --- /dev/null +++ b/c64/kernal/iec/iec_pull_clk_release_data_oneshot.s @@ -0,0 +1,8 @@ + +iec_pull_clk_release_data_oneshot: + + lda CIA2_PRA + ora #BIT_CIA2_PRA_CLK_OUT ; pull + and #$FF - BIT_CIA2_PRA_DAT_OUT ; release + sta CIA2_PRA + rts diff --git a/c64/kernal/iec/iec_tx_common.s b/c64/kernal/iec/iec_tx_common.s index 8cc63e0f..d2cddf82 100644 --- a/c64/kernal/iec/iec_tx_common.s +++ b/c64/kernal/iec/iec_tx_common.s @@ -33,9 +33,9 @@ iec_tx_common: ;; Pull CLK back to indicate that DATA is not valid, keep it for 60us ;; We can use this routine as we don't hold DATA anyway (and its state doesn't even matter) - jsr iec_pull_clk_release_data + jsr iec_pull_clk_release_data_oneshot jsr iec_wait60us - + ;; Now, we can start transmission of 8 bits of data ldx #7 @@ -57,11 +57,11 @@ iec_tx_common_bit_is_sent: ;; Wait 20us, so that device(s) can pick DATA jsr iec_wait20us - + ;; Pull CLK for 20us again, before sending the next bit ;; or performing any other action - jsr iec_pull_clk_release_data - jsr iec_wait20us ; XXX this might be an overkill, there is a lot of code besides this wait here - few NOPs might be enough + jsr iec_pull_clk_release_data_oneshot + jsr iec_wait20us ;; More bits to send? dex From cfb50cda46444b243c74744500819a42de8e2dc3 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 25 Aug 2019 13:31:28 +0200 Subject: [PATCH 06/16] adapted SID initialization for these insane 8 SID configurations --- STATUS.md | 2 +- c64/kernal/fda3.ioinit.s | 13 ++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/STATUS.md b/STATUS.md index 211c014d..8bcd4a96 100644 --- a/STATUS.md +++ b/STATUS.md @@ -6,7 +6,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8 * improved keyboard scanning, supports multi-key roll-over and rejection of spurious joystick input * joystick (port 1) can be used to move text cursor * uses RAM under ROM and I/O: 61436 bytes free -* cold/warm start silences SID chips - $D400, $D420, ..., $D4E0, $D500 +* cold/warm start silences multiple SID chips - all $D4xx and $D5xx addresses * extended `LOAD` command * start/end addresses are displayed, in the Final cartridge style * command with just the file name tries to use the last device if it's number seems sane; otherwise uses 8 diff --git a/c64/kernal/fda3.ioinit.s b/c64/kernal/fda3.ioinit.s index 92cd3b7c..961ffdae 100644 --- a/c64/kernal/fda3.ioinit.s +++ b/c64/kernal/fda3.ioinit.s @@ -20,25 +20,24 @@ ioinit: sta CPU_R6510 stx CPU_D6510 - ;; Silence the SID chips in the $D4xx range + ;; Silence the SID chips under common addresses ldy #$00 * + ;; SIDs under $D4xx lda SID_SIGVOL, Y and #$F0 sta SID_SIGVOL, Y + ;; SIDs under $D5xx + lda SID_SIGVOL + $100, Y + and #$F0 + sta SID_SIGVOL + $100, Y tya clc adc #$20 tay bne - - ;; Silence the SID chip on $D500 - - lda SID_SIGVOL+$100 - and #$F0 - sta SID_SIGVOL+$100 - ;; XXX: calibrate TOD for both CIA's, see here: https://codebase64.org/doku.php?id=base:efficient_tod_initialisation ;; Enable CIA1 IRQ and ~50Hz timer (https://csdb.dk/forums/?roomid=11&topicid=69037) From ef183a6cb1bb29d6ff2b4504f4885dd94b6d33bf Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 28 Aug 2019 17:45:40 +0200 Subject: [PATCH 07/16] implemented SETTIM and RDTIM routines --- STATUS.md | 4 ++-- c64/kernal/rdtim.s | 14 ++++++++++++++ c64/kernal/settim.s | 14 ++++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/STATUS.md b/STATUS.md index 8bcd4a96..fc091654 100644 --- a/STATUS.md +++ b/STATUS.md @@ -101,8 +101,8 @@ NOTE: Even the 'DONE' routines won't support features described as missing in on | `$FFD2` | `CHROUT` | PARTIAL | | | `$FFD5` | `LOAD` | PARTIAL | no VERIFY support yet, no STOP key support | | `$FFD8` | `SAVE` | NOT DONE | | -| `$FFDB` | `SETTIM` | NOT DONE | | -| `$FFDE` | `RDTIM` | NOT DONE | | +| `$FFDB` | `SETTIM` | DONE | | +| `$FFDE` | `RDTIM` | DONE | | | `$FFE1` | `STOP` | DONE | | | `$FFE4` | `GETIN` | PARTIAL | only some devices supported | | `$FFE7` | `CLALL` | DONE | | diff --git a/c64/kernal/rdtim.s b/c64/kernal/rdtim.s index a9e40a16..41a32290 100644 --- a/c64/kernal/rdtim.s +++ b/c64/kernal/rdtim.s @@ -9,4 +9,18 @@ ;; rdtim: + + ;; Disable interrupts for the duration of the routine, to prevent + ;; jiffy clock update while reeading it's values + php + sei + + ;; Store the jiffy clock state + ldy TIME + 0 + ldx TIME + 1 + lda TIME + 2 + + ;; Restore processor state and return + plp rts + diff --git a/c64/kernal/settim.s b/c64/kernal/settim.s index 804538c1..2a995427 100644 --- a/c64/kernal/settim.s +++ b/c64/kernal/settim.s @@ -9,4 +9,18 @@ ;; settim: + + ;; Disable interrupts for the duration of the routine, to prevent + ;; jiffy clock update while changing it's values + php + sei + + ;; Store the jiffy clock state + sty TIME + 0 + stx TIME + 1 + sta TIME + 2 + + ;; Restore processor state and return + plp rts + From ee499b6b21230f22c743eb3a7443496acdf8a9d1 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Wed, 28 Aug 2019 21:45:53 +0200 Subject: [PATCH 08/16] size optimization of the IEC support --- c64/kernal/iec/iec_tx_command.s | 28 ++++++------------- .../{iec_wait1ms.s => iec_wait1ms_for_data.s} | 6 ++-- 2 files changed, 13 insertions(+), 21 deletions(-) rename c64/kernal/iec/{iec_wait1ms.s => iec_wait1ms_for_data.s} (74%) diff --git a/c64/kernal/iec/iec_tx_command.s b/c64/kernal/iec/iec_tx_command.s index e2da97f2..0fcfaebd 100644 --- a/c64/kernal/iec/iec_tx_command.s +++ b/c64/kernal/iec/iec_tx_command.s @@ -19,17 +19,10 @@ iec_tx_command: ;; and it is going to be a command (pulled ATN) jsr iec_pull_atn_clk_release_data - ;; Give devices time to respond (response is mandatory!) - jsr iec_wait1ms + ;; Give devices time to respond (response is mandatory!) by pulling DATA + jsr iec_wait1ms_for_data + bmi iec_tx_command_dev_not_found - ;; Did at least one device respond by pulling DATA? - lda CIA2_PRA - and #BIT_CIA2_PRA_DAT_IN ; XXX try to optimize this, move to separate routine - beq + - - ;; No devices present on the bus, so we can immediately return with device not found - jmp iec_return_DEVICE_NOT_FOUND -* ;; At least one device responded, but they are still allowed to stall ;; (can be busy processing something), we have to wait till they are all ;; ready (or bored with DOS attack...) @@ -46,17 +39,14 @@ iec_tx_command: ;; According to https://www.pagetable.com/?p=1135 there is some complicated and dangerous ;; flow here, but http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf (page 6) ;; advices to just wait 1ms and check the DATA status - jsr iec_wait1ms - lda CIA2_PRA - and #BIT_CIA2_PRA_DAT_IN ; XXX try to optimize this, move to separate routine - beq + - ;; XXX possible optimization of the flow above: for many commands it is enough - ;; to wait for the DATA being pulled, as confirmation is expected from - ;; a single device only - but not sure if it's worth the trouble + jsr iec_wait1ms_for_data + bmi iec_tx_command_dev_not_found - jmp iec_return_DEVICE_NOT_FOUND -* ;; Done jmp iec_return_success + +iec_tx_command_dev_not_found: + + jmp iec_return_DEVICE_NOT_FOUND diff --git a/c64/kernal/iec/iec_wait1ms.s b/c64/kernal/iec/iec_wait1ms_for_data.s similarity index 74% rename from c64/kernal/iec/iec_wait1ms.s rename to c64/kernal/iec/iec_wait1ms_for_data.s index a492df7f..f12d89b2 100644 --- a/c64/kernal/iec/iec_wait1ms.s +++ b/c64/kernal/iec/iec_wait1ms_for_data.s @@ -1,6 +1,6 @@ ;; -;; Wait 1 ms (1000 usec) +;; Wait 1 ms (1000 usec) - afterwards can use 'bpl' to check that DATA is pulled ;; ;; On NTSC this means 1023 cycles (slightly less on PAL, but we have to be sure). ;; We can't count on badlines, as the screen might be disabled. @@ -8,7 +8,7 @@ ;; 63 cycles, we need at least 17 full rasters to be 100% sure we wait enough -iec_wait1ms: +iec_wait1ms_for_data: ldx #18 ; we probably won't start with the beginning of raster lda VIC_RASTER * @@ -17,4 +17,6 @@ iec_wait1ms: lda VIC_RASTER dex bne - + + lda CIA2_PRA ; pulled DATA = highest bit 0 = 'plus' rts From e3314f8b8f5676ce53d1dd12cc84b712139e1ce0 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 30 Aug 2019 19:12:56 +0200 Subject: [PATCH 09/16] IEC cleanups and size optimization --- c64/kernal/f34a.open.s | 2 +- c64/kernal/f4a5.load.s | 2 +- c64/kernal/iec/iec_tx_byte.s | 72 +++++++++++++++++-- c64/kernal/iec/iec_tx_command.s | 21 ++---- c64/kernal/iec/iec_tx_common.s | 72 ------------------- .../{iec_wait1ms_for_data.s => iec_wait1ms.s} | 5 +- 6 files changed, 74 insertions(+), 100 deletions(-) delete mode 100644 c64/kernal/iec/iec_tx_common.s rename c64/kernal/iec/{iec_wait1ms_for_data.s => iec_wait1ms.s} (74%) diff --git a/c64/kernal/f34a.open.s b/c64/kernal/f34a.open.s index 8d494dfe..c1bbb282 100644 --- a/c64/kernal/f34a.open.s +++ b/c64/kernal/f34a.open.s @@ -76,7 +76,7 @@ open_iec: lda current_secondary_address jsr iec_cmd_open bcc + - jmp kernalerror_DEVICE_NOT_FOUND ; XXX find a better error message for wrong channel (create new one?) + jmp kernalerror_DEVICE_NOT_FOUND * ;; We need our helpers to get to filenames under ROMs or IO area diff --git a/c64/kernal/f4a5.load.s b/c64/kernal/f4a5.load.s index ece03816..b5290e55 100644 --- a/c64/kernal/f4a5.load.s +++ b/c64/kernal/f4a5.load.s @@ -65,7 +65,7 @@ load: ;; Open channel 0 (reserved for file reading) lda #$00 jsr iec_cmd_open - bcs lvs_load_verify_error + bcs lvs_device_not_found_error ;; Send file name jsr lvs_send_file_name diff --git a/c64/kernal/iec/iec_tx_byte.s b/c64/kernal/iec/iec_tx_byte.s index 767dce76..82cf41c0 100644 --- a/c64/kernal/iec/iec_tx_byte.s +++ b/c64/kernal/iec/iec_tx_byte.s @@ -19,11 +19,73 @@ iec_tx_byte: ;; and it is going to be a data byte (released ATN) jsr iec_release_atn_clk_data - ;; Common part of iec_txbyte and iec_tx_common - waits for devices - ;; and transmits a byte + ;; Common part of iec_tx_byte and iec_tx_command + ;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc + ;; and http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf + +iec_tx_common: + + ;; Timing is critical here - execute on disabled IRQs + php + sei + + ;; Wait till all receivers are ready, they should all release DATA + jsr iec_wait_for_data_release + + ;; At this point a delay 256 usec or more is considered EOI - add waits if necessary + bcc + + jsr iec_wait100us + jsr iec_wait100us + jsr iec_wait60us + + ;; XXX waits above should be enough - why do we need more waits??? + jsr iec_wait100us + jsr iec_wait100us + jsr iec_wait100us + + ;; Receiver should now acknowledge EOI by pulling data for at least 60 usec + jsr iec_wait60us + jsr iec_wait_for_data_release +* + ;; Pull CLK back to indicate that DATA is not valid, keep it for 60us + ;; We can use this routine as we don't hold DATA anyway (and its state doesn't even matter) + + jsr iec_pull_clk_release_data_oneshot + jsr iec_wait60us + + ;; Now, we can start transmission of 8 bits of data + ldx #7 + +iec_tx_common_sendbit: + ;; Is next bit 0 or 1? + lda IEC_TMP2 + lsr + sta IEC_TMP2 + bcs + + + ;; Bit is 0 + jsr iec_release_clk_pull_data + jmp iec_tx_common_bit_is_sent +* + ;; Bit is 1 + jsr iec_release_clk_data + +iec_tx_common_bit_is_sent: + + ;; Wait 20us, so that device(s) can pick DATA + jsr iec_wait20us + + ;; Pull CLK for 20us again, before sending the next bit + ;; or performing any other action + jsr iec_pull_clk_release_data_oneshot + jsr iec_wait20us + + ;; More bits to send? + dex + bpl iec_tx_common_sendbit + + plp - jsr iec_tx_common - ;; Give device time to tell if they are busy by pulling DATA ;; They should do it within 1ms ldx #$FF @@ -36,5 +98,3 @@ iec_tx_byte: bpl iec_return_DEVICE_NOT_FOUND * jmp iec_return_success - - diff --git a/c64/kernal/iec/iec_tx_command.s b/c64/kernal/iec/iec_tx_command.s index 0fcfaebd..98aeb585 100644 --- a/c64/kernal/iec/iec_tx_command.s +++ b/c64/kernal/iec/iec_tx_command.s @@ -20,8 +20,9 @@ iec_tx_command: jsr iec_pull_atn_clk_release_data ;; Give devices time to respond (response is mandatory!) by pulling DATA - jsr iec_wait1ms_for_data - bmi iec_tx_command_dev_not_found + jsr iec_wait1ms + lda CIA2_PRA ; pulled DATA = highest bit 0 = 'plus' + bmi iec_return_DEVICE_NOT_FOUND ;; At least one device responded, but they are still allowed to stall ;; (can be busy processing something), we have to wait till they are all @@ -34,19 +35,5 @@ iec_tx_command: ;; and transmits a byte clc ; Carry flag set is used for EOI mark - jsr iec_tx_common + jmp iec_tx_common - ;; According to https://www.pagetable.com/?p=1135 there is some complicated and dangerous - ;; flow here, but http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf (page 6) - ;; advices to just wait 1ms and check the DATA status - - jsr iec_wait1ms_for_data - bmi iec_tx_command_dev_not_found - - ;; Done - - jmp iec_return_success - -iec_tx_command_dev_not_found: - - jmp iec_return_DEVICE_NOT_FOUND diff --git a/c64/kernal/iec/iec_tx_common.s b/c64/kernal/iec/iec_tx_common.s deleted file mode 100644 index d2cddf82..00000000 --- a/c64/kernal/iec/iec_tx_common.s +++ /dev/null @@ -1,72 +0,0 @@ - -;; This is a common part of iec_tx_byte and iec_tx_command -;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc -;; and http://www.zimmers.net/anonftp/pub/cbm/programming/serial-bus.pdf - -;; Expects byte to send in IEC_TMP2 ($A4 is a byte buffer according to http://sta.c64.org/cbm64mem.html) -;; Carry flag set = signal EOI - -iec_tx_common: - - ;; Timing is critical here - execute on disabled IRQs - php - sei - - ;; Wait till all receivers are ready, they should all release DATA - jsr iec_wait_for_data_release - - ;; At this point a delay 256 usec or more is considered EOI - add waits if necessary - bcc + - jsr iec_wait100us - jsr iec_wait100us - jsr iec_wait60us - - ;; XXX waits above should be enough - why do we need more waits??? - jsr iec_wait100us - jsr iec_wait100us - jsr iec_wait100us - - ;; Receiver should now acknowledge EOI by pulling data for at least 60 usec - jsr iec_wait60us - jsr iec_wait_for_data_release -* - ;; Pull CLK back to indicate that DATA is not valid, keep it for 60us - ;; We can use this routine as we don't hold DATA anyway (and its state doesn't even matter) - - jsr iec_pull_clk_release_data_oneshot - jsr iec_wait60us - - ;; Now, we can start transmission of 8 bits of data - ldx #7 - -iec_tx_common_sendbit: - ;; Is next bit 0 or 1? - lda IEC_TMP2 - lsr - sta IEC_TMP2 - bcs + - - ;; Bit is 0 - jsr iec_release_clk_pull_data - jmp iec_tx_common_bit_is_sent -* - ;; Bit is 1 - jsr iec_release_clk_data - -iec_tx_common_bit_is_sent: - - ;; Wait 20us, so that device(s) can pick DATA - jsr iec_wait20us - - ;; Pull CLK for 20us again, before sending the next bit - ;; or performing any other action - jsr iec_pull_clk_release_data_oneshot - jsr iec_wait20us - - ;; More bits to send? - dex - bpl iec_tx_common_sendbit - - plp - rts ; Flow continues differently for data/command - diff --git a/c64/kernal/iec/iec_wait1ms_for_data.s b/c64/kernal/iec/iec_wait1ms.s similarity index 74% rename from c64/kernal/iec/iec_wait1ms_for_data.s rename to c64/kernal/iec/iec_wait1ms.s index f12d89b2..3da125d8 100644 --- a/c64/kernal/iec/iec_wait1ms_for_data.s +++ b/c64/kernal/iec/iec_wait1ms.s @@ -1,6 +1,6 @@ ;; -;; Wait 1 ms (1000 usec) - afterwards can use 'bpl' to check that DATA is pulled +;; Wait 1 ms (1000 usec) ;; ;; On NTSC this means 1023 cycles (slightly less on PAL, but we have to be sure). ;; We can't count on badlines, as the screen might be disabled. @@ -8,7 +8,7 @@ ;; 63 cycles, we need at least 17 full rasters to be 100% sure we wait enough -iec_wait1ms_for_data: +iec_wait1ms: ldx #18 ; we probably won't start with the beginning of raster lda VIC_RASTER * @@ -18,5 +18,4 @@ iec_wait1ms_for_data: dex bne - - lda CIA2_PRA ; pulled DATA = highest bit 0 = 'plus' rts From 27161f2371f6169e54df2a4e54062973977c99da Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 30 Aug 2019 20:49:35 +0200 Subject: [PATCH 10/16] improved compatibility with non-CBM IEC implementations --- c64/kernal/iec/iec_tx_byte.s | 19 ++++++------------- c64/kernal/iec/iec_wait100us.s | 22 ---------------------- 2 files changed, 6 insertions(+), 35 deletions(-) delete mode 100644 c64/kernal/iec/iec_wait100us.s diff --git a/c64/kernal/iec/iec_tx_byte.s b/c64/kernal/iec/iec_tx_byte.s index 82cf41c0..6a978848 100644 --- a/c64/kernal/iec/iec_tx_byte.s +++ b/c64/kernal/iec/iec_tx_byte.s @@ -32,19 +32,12 @@ iec_tx_common: ;; Wait till all receivers are ready, they should all release DATA jsr iec_wait_for_data_release - ;; At this point a delay 256 usec or more is considered EOI - add waits if necessary - bcc + - jsr iec_wait100us - jsr iec_wait100us - jsr iec_wait60us - - ;; XXX waits above should be enough - why do we need more waits??? - jsr iec_wait100us - jsr iec_wait100us - jsr iec_wait100us - - ;; Receiver should now acknowledge EOI by pulling data for at least 60 usec - jsr iec_wait60us + ;; At this point a delay 256 usec or more is considered EOI, + ;; receiver should now acknowledge it by pulling data for at least 60 usec + ;; Keep the implementation as simple as possible: data should be released now + ;; so wait until it's pushed and released again + + jsr iec_wait_for_data_pull jsr iec_wait_for_data_release * ;; Pull CLK back to indicate that DATA is not valid, keep it for 60us diff --git a/c64/kernal/iec/iec_wait100us.s b/c64/kernal/iec/iec_wait100us.s deleted file mode 100644 index b3101685..00000000 --- a/c64/kernal/iec/iec_wait100us.s +++ /dev/null @@ -1,22 +0,0 @@ - -iec_wait100us: - - ;; Wait 100usec - - ;; PAL: - ;; - CPU frequency 0.985248 MHz, we need to waste at least 99 cycles - ;; NTSC: - ;; - CPU frequency 1.022727 MHZ, we need to waste at least 103 cycles - - ;; Waste cycles in a loop - - ldy #$12 ; 2 cycles -* dey ; 2 cycles * 18 - bpl - ; 3 cycles * 17 + 2 cycles - rts ; 6 cycles - - ;; 6 cycles JSR to routine, - ;; 97 cycles routine with RTS - ;; 1 cycle to fetch next instruction - ;; --- - ;; 104 cycles From 2d590f95c52cceef3d91681adc09edc3ca55db51 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 30 Aug 2019 21:22:35 +0200 Subject: [PATCH 11/16] fixed LOAD/VERIFY wrongly swapped in error messages --- STATUS.md | 4 +--- bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/kernal/lvs_helpers.s | 2 +- 5 files changed, 2 insertions(+), 4 deletions(-) diff --git a/STATUS.md b/STATUS.md index fc091654..4e9cf6bd 100644 --- a/STATUS.md +++ b/STATUS.md @@ -15,6 +15,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8 NOTE: extra features and their syntax can change in the future! + # Features missing @@ -29,9 +30,6 @@ The following ROM features are currently missing: * breaking Kernal routines with RUN/STOP key * BRK handling; NMI/IRQ handling is incomplete -Features currently being worked on: - -* IEC support needs more work; alternative drive ROMs (JiffyDOS, DolphinDOS, etc) usually don't work with current implementation, SAVE / VERIFY are not implemented, etc. # API status diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index 140ad0231fada4d96304d5c3a6f1804c23649b15..2cbd041ab981769474a95b89573ecb70f914f001 100644 GIT binary patch delta 2128 zcmY*a4Qw3672eyuAOCRn+Qi8^3HHz?;fzw`x+%D{QA`@bK?fYdZz3V4pok^9w5X~S zqe`(;Zm+J%nM*gJww1`|ctBI-=%-?5xTJxmmS6$jruVv(j;*45Zd;^GYPu zs(qm{QbZasu0SxQe2}@;@C6J+K2o;U#>*$me&iTi9J(+jzhAanc9uVGdqRG;ybi|0 z<@XE^l{;<1t6zEJud|J;R_;~p!Pi+)#0S3;@vFm=x7FEP(Hx#yME&xjdtFtxo}SP+ z+^GvhIn8fIF}bGV&h~npYBv?xs6sK_{q%!-AKtz1;m00g@KZWnz^xDLqAJK}_uke= z(I!TjK+oM!#xV@1`EhD^vh{zJs|RiVaq%*$8cDsEifO((=lD>)qwzX*83k z`=;ebDt9=s72kNU2LxSoi zU_w(FWHa#JNOKh$rss_&1g)q#@6IMD*gmk5KzU94wwl6)=-O;;9*hf z6^6uE7ZGDPofTun)IrIDf~_o2ujo_mDM^OaND*Qhp!ZnMyP7FZ%KmGQ!+g7G`?pf_Aw5Gy(h`@|LYPVt|^5z!+> zDVvq3Kzh8<9;58(PI~W$dAub9k^U@)ojHb4KGN*XDnp_00uZ7=+<6W@g8y_woeZwk z;?>%8wPxIGv{J4_MfhZ7=P~88?Gl=>~; zd#}n#eS~4~xp^Vd6kd|gRMoZrGm`IXLx;@}=VLn1TgzzVI-1U){h4QdOqj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ClEehM%-^6V=o@0+4^-YH7LtuI)hduW(a7be0fh5}rC|@>P~75dws_|4qQTs_S^n zOgmFB1nHL4x6;9e^*?GYiZrPI8%iCjbn5>h$S?i1q5daf1AnN;Ylrw{68BIE{tkBv(oOAQ)P5kbqrr%)q!E} z^?0k?nY;kG#!t%+N^=_<*=8&1=&H158U{}4Zf;>avg6M+*E%{nviSTme(MH)!@!pe zoHg;1iQN{KO#GsWU&`VaE&POqdyDwIiMuQuG;xoKb0*$n;r-IPEgLtT%iz~D{XVXL c3)jDu!`*p&)WQ#C;@4${Fw73~h5T*ff1;?WApigX diff --git a/bin/kernal_mega65.rom b/bin/kernal_mega65.rom index 140ad0231fada4d96304d5c3a6f1804c23649b15..2cbd041ab981769474a95b89573ecb70f914f001 100644 GIT binary patch delta 2128 zcmY*a4Qw3672eyuAOCRn+Qi8^3HHz?;fzw`x+%D{QA`@bK?fYdZz3V4pok^9w5X~S zqe`(;Zm+J%nM*gJww1`|ctBI-=%-?5xTJxmmS6$jruVv(j;*45Zd;^GYPu zs(qm{QbZasu0SxQe2}@;@C6J+K2o;U#>*$me&iTi9J(+jzhAanc9uVGdqRG;ybi|0 z<@XE^l{;<1t6zEJud|J;R_;~p!Pi+)#0S3;@vFm=x7FEP(Hx#yME&xjdtFtxo}SP+ z+^GvhIn8fIF}bGV&h~npYBv?xs6sK_{q%!-AKtz1;m00g@KZWnz^xDLqAJK}_uke= z(I!TjK+oM!#xV@1`EhD^vh{zJs|RiVaq%*$8cDsEifO((=lD>)qwzX*83k z`=;ebDt9=s72kNU2LxSoi zU_w(FWHa#JNOKh$rss_&1g)q#@6IMD*gmk5KzU94wwl6)=-O;;9*hf z6^6uE7ZGDPofTun)IrIDf~_o2ujo_mDM^OaND*Qhp!ZnMyP7FZ%KmGQ!+g7G`?pf_Aw5Gy(h`@|LYPVt|^5z!+> zDVvq3Kzh8<9;58(PI~W$dAub9k^U@)ojHb4KGN*XDnp_00uZ7=+<6W@g8y_woeZwk z;?>%8wPxI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xOVF_*bjx<~ zu37Ci&x3C@*p2&(*IwL!{>6SItQ8CDaUduQ%+gQLB5c>LVZ2793`g`n-8{* zs*2_HLmk#3NClEehM%-^6V=o@0+4^-YH7LtuI)hduW(a7be0fh5}rC|@>P~75dws_|4qQTs_S^n zOgmFB1nHL4x6;9e^*?GYiZrPI8%iCjbn5>h$S?i1q5daf1AnN;Ylrw{68BIE{tkBv(oOAQ)P5kbqrr%)q!E} z^?0k?nY;kG#!t%+N^=_<*=8&1=&H158U{}4Zf;>avg6M+*E%{nviSTme(MH)!@!pe zoHg;1iQN{KO#GsWU&`VaE&POqdyDwIiMuQuG;xoKb0*$n;r-IPEgLtT%iz~D{XVXL c3)jDu!`*p&)WQ#C;@4${Fw73~h5T*ff1;?WApigX diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom index 140ad0231fada4d96304d5c3a6f1804c23649b15..2cbd041ab981769474a95b89573ecb70f914f001 100644 GIT binary patch delta 2128 zcmY*a4Qw3672eyuAOCRn+Qi8^3HHz?;fzw`x+%D{QA`@bK?fYdZz3V4pok^9w5X~S zqe`(;Zm+J%nM*gJww1`|ctBI-=%-?5xTJxmmS6$jruVv(j;*45Zd;^GYPu zs(qm{QbZasu0SxQe2}@;@C6J+K2o;U#>*$me&iTi9J(+jzhAanc9uVGdqRG;ybi|0 z<@XE^l{;<1t6zEJud|J;R_;~p!Pi+)#0S3;@vFm=x7FEP(Hx#yME&xjdtFtxo}SP+ z+^GvhIn8fIF}bGV&h~npYBv?xs6sK_{q%!-AKtz1;m00g@KZWnz^xDLqAJK}_uke= z(I!TjK+oM!#xV@1`EhD^vh{zJs|RiVaq%*$8cDsEifO((=lD>)qwzX*83k z`=;ebDt9=s72kNU2LxSoi zU_w(FWHa#JNOKh$rss_&1g)q#@6IMD*gmk5KzU94wwl6)=-O;;9*hf z6^6uE7ZGDPofTun)IrIDf~_o2ujo_mDM^OaND*Qhp!ZnMyP7FZ%KmGQ!+g7G`?pf_Aw5Gy(h`@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8S7(}iP*F32Pa0Aw{^EN3Drbc;B?T0 zV}}i80@Y9`Va^f-^v_%PrGk9VmC1sXU;p%h!$r9SKi|T;fmA+d6MdIxOVF_*bjx<~ zu37Ci&x3C@*p2&(*IwL!{>6SItQ8CDaUduQ%+gQLB5c>LVZ2793`g`n-8{* zs*2_HLmk#3NClEehM%-^6V=o@0+4^-YH7LtuI)hduW(a7be0fh5}rC|@>P~75dws_|4qQTs_S^n zOgmFB1nHL4x6;9e^*?GYiZrPI8%iCjbn5>h$S?i1q5daf1AnN;Ylrw{68BIE{tkBv(oOAQ)P5kbqrr%)q!E} z^?0k?nY;kG#!t%+N^=_<*=8&1=&H158U{}4Zf;>avg6M+*E%{nviSTme(MH)!@!pe zoHg;1iQN{KO#GsWU&`VaE&POqdyDwIiMuQuG;xoKb0*$n;r-IPEgLtT%iz~D{XVXL c3)jDu!`*p&)WQ#C;@4${Fw73~h5T*ff1;?WApigX diff --git a/c64/kernal/lvs_helpers.s b/c64/kernal/lvs_helpers.s index 646a9bbd..7bcbf4e9 100644 --- a/c64/kernal/lvs_helpers.s +++ b/c64/kernal/lvs_helpers.s @@ -146,7 +146,7 @@ lvs_illegal_device_number: lvs_load_verify_error: ;; XXX should we really return BASIC error code here? lda VERCK - beq lvs_verify_error + bne lvs_verify_error lda #B_ERR_LOAD bne lvs_error_end ;; FALLTHROUGH From 180c88ef42646b8a60d39c1a15beb407abdd1777 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 1 Sep 2019 16:20:36 +0200 Subject: [PATCH 12/16] reenabled BRK handler, now prints BRK address --- STATUS.md | 3 ++- c64/aliases/,aliases_ram_lowmem.s | 6 +----- c64/basic/basic_warm_start.s | 20 +++++++++++++++++-- .../interrupts/fe47.default_nmi_handler.s | 6 +++++- c64/kernal/interrupts/irq_handler.s | 19 ++++++++++++------ src/compress_text.c | 2 +- 6 files changed, 40 insertions(+), 16 deletions(-) diff --git a/STATUS.md b/STATUS.md index 4e9cf6bd..65bf9f8f 100644 --- a/STATUS.md +++ b/STATUS.md @@ -7,6 +7,7 @@ Here are the features of the Open ROMs not found in the original ROMs from the 8 * joystick (port 1) can be used to move text cursor * uses RAM under ROM and I/O: 61436 bytes free * cold/warm start silences multiple SID chips - all $D4xx and $D5xx addresses +* wark start due to BRK prints out the instruction address * extended `LOAD` command * start/end addresses are displayed, in the Final cartridge style * command with just the file name tries to use the last device if it's number seems sane; otherwise uses 8 @@ -28,7 +29,7 @@ The following ROM features are currently missing: * tape support * RS-232 support * breaking Kernal routines with RUN/STOP key -* BRK handling; NMI/IRQ handling is incomplete +* NMI andling is incomplete # API status diff --git a/c64/aliases/,aliases_ram_lowmem.s b/c64/aliases/,aliases_ram_lowmem.s index 6108e28e..d72deec7 100644 --- a/c64/aliases/,aliases_ram_lowmem.s +++ b/c64/aliases/,aliases_ram_lowmem.s @@ -34,11 +34,7 @@ .alias IEC_TMP1 $A3 ; temporary variable for tape and IEC .alias IEC_TMP2 $A4 ; temporary variable for tape and IEC - ;; 2-byte location below seems to be a good place for temporary storage, - ;; it seems used for timing during tape reads only - see: - ;; - 'C64 Programmer's Reference Guide', page 314 - ;; - 'Compute's Mapping the Commodore 64', page 32 - .alias CMP0 $B0 ; $B0-$B1 + .alias CMP0 $B0 ; $B0-$B1, temporary tape storage, we use it too for BRK instruction address .alias FNLEN $B7 ; current file name length diff --git a/c64/basic/basic_warm_start.s b/c64/basic/basic_warm_start.s index e8e51b31..adeb329e 100644 --- a/c64/basic/basic_warm_start.s +++ b/c64/basic/basic_warm_start.s @@ -2,6 +2,22 @@ basic_warm_start: jsr install_ram_routines - + + ;; If warm start caused by BRK, print it address + lda CMP0 + ora CMP0+1 + beq + + + ldx #32 + jsr print_packed_message + + lda CMP0+1 + jsr printf_printhexbyte + lda CMP0+0 + jsr printf_printhexbyte + lda #$0D + jsr JCHROUT + +* jmp basic_main_loop - + diff --git a/c64/kernal/interrupts/fe47.default_nmi_handler.s b/c64/kernal/interrupts/fe47.default_nmi_handler.s index 8814ac2c..1a1c915f 100644 --- a/c64/kernal/interrupts/fe47.default_nmi_handler.s +++ b/c64/kernal/interrupts/fe47.default_nmi_handler.s @@ -26,5 +26,9 @@ default_nmi_handler: bcs + jmp return_from_interrupt ; no STOP pressed * - jmp (CBINV) ; STOP + RESTORE + ;; STOP + RESTORE - clean the address of the BRK instruction (it's not BRK) first + lda #$00 + sta CMP0+0 + sta CMP0+1 + jmp (CBINV) diff --git a/c64/kernal/interrupts/irq_handler.s b/c64/kernal/interrupts/irq_handler.s index 99733333..292f88e0 100644 --- a/c64/kernal/interrupts/irq_handler.s +++ b/c64/kernal/interrupts/irq_handler.s @@ -16,12 +16,10 @@ irq_handler: pha ;; Check if caused by BRK - - ;; XXX disabled for now - resets Duotris game, unknown why - ; tsx - ; lda $0104, x ; get the pre-interrupt processor state - ; and #$10 - ; bne irq_handler_brk + tsx + lda $0104, x ; get the pre-interrupt processor state + and #$10 + bne irq_handler_brk ;; Not caused by BRK - call interrupt routine (only if initialised) lda CINV @@ -34,6 +32,15 @@ irq_handler: irq_handler_brk: + ;; Store BRK adddress, to be displayed + sec + lda $0105, x + sbc #$02 + sta CMP0+0 + lda $0106, x + sbc #$00 + sta CMP0+1 + ;; Interrupt caused by BRK jmp (CBINV) diff --git a/src/compress_text.c b/src/compress_text.c index 57c02f19..576d4d09 100644 --- a/src/compress_text.c +++ b/src/compress_text.c @@ -161,7 +161,7 @@ char *error_list[]={ "READY.\r", // #29 // https://www.ibm.com/support/knowledgecenter/zosbasics/com.ibm.zos.zconcepts/zconc_whatistsonative.htm https://github.com/stefanhaustein/expressionparser "NTSC, ", // #30 "PAL, ", // #31 - "", // unused for now + "BRK AT $", // #32 "ERROR", // #33 // Simply the word error that is attached to the other parts of messages https://fjkraan.home.xs4all.nl/comp/apple2faq/app2asoftfaq.html "BYTES FREE\r\r", // #34 // https://github.com/stefanhaustein/expressionparser "MEMORY CORRUPT", // #35 From 1c2b498e153344d87af8066075c062c35b95ff5a Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 1 Sep 2019 16:34:38 +0200 Subject: [PATCH 13/16] moved two Kernal routines into original location to fix 'Duotris' game startup --- bin/basic_generic.rom | Bin 8192 -> 8192 bytes bin/basic_mega65.rom | Bin 8192 -> 8192 bytes bin/basic_ultimate64.rom | Bin 8192 -> 8192 bytes bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/kernal/{cint.s => cint_real.s} | 2 +- c64/kernal/fd15.interop | 4 ++++ c64/kernal/{vector.s => fd15.vector.s} | 0 c64/kernal/ff5b.cint.jmp.s | 6 ++++++ c64/kernal/ff5b.interop | 4 ++++ 11 files changed, 15 insertions(+), 1 deletion(-) rename c64/kernal/{cint.s => cint_real.s} (99%) create mode 100644 c64/kernal/fd15.interop rename c64/kernal/{vector.s => fd15.vector.s} (100%) create mode 100644 c64/kernal/ff5b.cint.jmp.s create mode 100644 c64/kernal/ff5b.interop diff --git a/bin/basic_generic.rom b/bin/basic_generic.rom index 82c768bfabff2a51bd13ec0e3b045336360ec807..51ee29800f73cba8b8b48bbf0f181fade29bb85b 100644 GIT binary patch delta 2343 zcmcIle^8V68Gn)(5(to&5jvC>z6ukuK_Y_+C>la7c)kh|im*D#I^5B->pV|(HoaQ_ z8;|QBZRFjpb+hvFk~hg4Aq$Ltn+d-1j;Xs(IOIpNIQKyAw;*nM{j*{=Pw;G2K$ zr`EYyi2o?d;fi+aMh`}g#I}E)*9x&?Uz1qbdYby6p>};4 z%x4{*g%eJ&J7?pY7Qr@9yJUtxzh;KH_T6w4zJjc##<|(Go_8}A7hMo5KQIX|e4cAs z%bM8HMhpbq?YLf&j|cHh*`3fsW=bswtcStgUrsFtr9@|+>aT_}xcf_jre2??maPtk zuYN;a>pS?#Lq5C%Oon>3s~ncLFI6vX z8>q8(5SPs(HNHz-^$ge>o7odHkk=~5D&aTQLhDiMr+K@f$J*as0Q1M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+}%wgvPIcm?c*>P`0E(Y%{ zdt!YcjNzH64Q{?OE=}Ej`cmA{0l`YtvDb?JnRD2BWr+j^|g4xaP zO-!SnV_!+!!zO4R&D<6YU@4YH%?SM(P$8UFj`C5U9A(TueB49KVKE@M0CL3_kP%COJ)=yg zj7>j0o(l)rY8U?B1j&aAlKnsVMtF(v!H#Rn6q^@)PFP;f^mAVqrBY z_L8S}5a3JQ8!=#q>P87_h^2Px4pL{?UT+}4rH#7jFwLc-6G;j1#U<10eSFDuE=lw) zbp)4z7Um>-QvC}h0+2SI6Q}pHnoaEWL{sAO6UUjZV*522HOINb)!rn$GVd0tM|}6O zS~f^lZt-_gq++kRZfivi68vAfKGvYke$X8FrgqYwiV~kc*4Qay41OkyJ)qt62zHhs poPaZM9{Z@onrd~APbmU4r?8SEe$2th2bom=*d=YAik;GC{|CMv>kR+^ diff --git a/bin/basic_mega65.rom b/bin/basic_mega65.rom index 911bacab8c131069e70af5472545df8c2ab3311e..84c5459392b97956c0e361a839808e34093eedb6 100644 GIT binary patch delta 2038 zcmb_ceNYr-7=LyzyyH%|1@H2s#23U)^1#c$009qBp>a)44Y|hRDkkW=9BcG!<^)=& zbgGkWD*L))xxHgg@jfWcOUh}=SpKLLbF#@la8hKP#_kTVh+=#9sHXmHnw@>0XP&R$ z^SsaVKKrcutObYosmP}Fb=5W1TUV{$w)vhdcURL}*KN4BVN-3Ly{54~ziGQEW24Qy z^iaVrS8>T|`7XJ%OkPwjr>&8fTCQ%k!|`_a@ph;*KrQP3+}l0*bS-s$p#imAL=}af z!RX!1_={SOR2lc>6|qzMwcenpAm+i2?4=GxneVbb{cICMI} z<{X!crlH1DJ7b1#Uo*o*^G4VSKZ9{=!^C*5`@^j1X%{3)b_~N)7jg`_UW2#40T+VP zZMnE|DL#;Y#O8!{lw4)mVSOBIT_seiD5W~vNLM8k!_@N#L%lgkrBJ)W=YFHkw_xY< zEjT5#zY7u!B(8zS?#9=d=sX0;Y^a_B)5Og3rSJi;S>(dz5}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UjS zG(SW=cv8uLQi6+7Qk*`UvMw?|9`z&~3Q63}?hTMGiHvIGL(OMk_enbZgTN5bic@tD zQTno#-7S&1kPw}>a2wMv!!N8wE4i4#`QgLXgq@t#R4e%`qdEn2oV^m@(4Pn|JF`cD zCga)-bsGK2FfiihkRj<33XKm_%tNHX_O31NxpFW#4e9C<0oJ{^poY>rl@ zO}S`gxpnd5xuKKI?5-fGh{}fs)=g*$8qd?GA>Xrj88DSUgvqy}vJ6SA3`-vVed&4r zd`6@5$Rf8z_TRzlXW4iVt9*2Xw8kR2SR82~B36VYJ3k^r4S!D8+tYfLLFGAifjnRj zEL7)-l;4CQJ+jXj8e=zyk5(L6Nh)P&1z#&U_&U5uwb>iJwenu4L1I+8nnP+P-lErT zLkJmckt}NA4T({xghAFE^4u7?D(kyfWwtaFFr5P`+jlh^i!wp5wAn*iBLt_~J zs>}sUXca$V;uKq?Bw$f3W_;30)zo8NuuPEymW1_}4%zdv9tE9UWH8%Tgi7p2H>>xXhz>x(b9f=US& zayR1NV0F)rW_m&_CecCRTHYNDW;w309mB6!H&Z&`ij6QGAuK#jG|l#cIbCfWamb9% zD|Va^k2T9V2$47F{Srbq=_X4%%xvhp;@lfpqVc@a%CxVa%BBxe3%Vj_BG^NBhuM<; z%n%0E9M^|2sOj-5Y|k%Uf&Jx3WaI6h!EUPN7IOn56Q&3)nmBSSj8j#-i^Utr^t1Nx Na9{qe93hfl`U91AdO-jH diff --git a/bin/basic_ultimate64.rom b/bin/basic_ultimate64.rom index e54c732fd549876fb69f7924ad5c195d4a9248ee..5df8a636c8d9549076016907158baec46a0c5a90 100644 GIT binary patch delta 2323 zcmcIleNYo;8ho#&9oItCB3wO5TXg8y_HG=xvFXeO zuyL6F(MERWT0L8qC7Wa;q}ij@la@K#>DVkYH*T@^dObUb(~&yP&6x1jvs7}=5_Ia_ zKmF&D$@}g;pTFlb-PUev5%peyv~ycSZC&l|vTb{sp4#OG0FjIA@4mOib z;46eXpVd7#3tL+<{=9WBT>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F7t@ovBz=s-xE^8@L|Iu*kjw0oR0?g@QAv Date: Mon, 2 Sep 2019 17:07:55 +0200 Subject: [PATCH 14/16] more compatible SETTIM and RDTIM routines --- c64/kernal/rdtim.s | 7 ++++--- c64/kernal/settim.s | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/c64/kernal/rdtim.s b/c64/kernal/rdtim.s index 41a32290..41ad0b94 100644 --- a/c64/kernal/rdtim.s +++ b/c64/kernal/rdtim.s @@ -12,7 +12,6 @@ rdtim: ;; Disable interrupts for the duration of the routine, to prevent ;; jiffy clock update while reeading it's values - php sei ;; Store the jiffy clock state @@ -20,7 +19,9 @@ rdtim: ldx TIME + 1 lda TIME + 2 - ;; Restore processor state and return - plp + ;; Enable interrupts. More elegant solution would be pha + sei + ... + pla, + ;; but (checked by running a test program) original ROM routine always + ;; leaves IRQs enabled. + cli rts diff --git a/c64/kernal/settim.s b/c64/kernal/settim.s index 2a995427..7cfb3f11 100644 --- a/c64/kernal/settim.s +++ b/c64/kernal/settim.s @@ -12,7 +12,6 @@ settim: ;; Disable interrupts for the duration of the routine, to prevent ;; jiffy clock update while changing it's values - php sei ;; Store the jiffy clock state @@ -20,7 +19,9 @@ settim: stx TIME + 1 sta TIME + 2 - ;; Restore processor state and return - plp + ;; Enable interrupts. More elegant solution would be pha + sei + ... + pla, + ;; but (checked by running a test program) original ROM routine always + ;; leaves IRQs enabled. + cli rts From a4114dd0d19457886cd0f61b5273e930b047b9f9 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 2 Sep 2019 19:19:01 +0200 Subject: [PATCH 15/16] updated pre-built binaries,. explained similarities --- bin/kernal_generic.rom | Bin 8192 -> 8192 bytes bin/kernal_mega65.rom | Bin 8192 -> 8192 bytes bin/kernal_ultimate64.rom | Bin 8192 -> 8192 bytes c64/kernal/reset_entry.s | 8 ++++---- strings/00DD29DF | 3 +++ strings/00DD29DF8D00DD60 | 5 +++++ strings/2006EEA5 | 3 +++ strings/4C15FD4C1AFD4C | 1 + strings/4C5BFF4CA3FD4C | 1 + ...233F357F1CAF1EDF63EF12FF366FEA5F4EDF5A900} | 2 +- strings/6C28036C2A036C2C034C | 2 +- strings/7F8D0DDC | 3 +++ strings/9848BABD04012910 | 3 +++ strings/A59D10FB | 3 +++ strings/A97F8D00DCAD01DC | 3 +++ strings/D006E6A1D0 | 3 +++ strings/DD09088D00DD | 5 +++++ strings/DD60AD00DD0910 | 5 +++++ strings/DF8D00DD60AD00DD09 | 5 +++++ strings/EEAD00DD | 3 +++ strings/F66C28036C2A036C2C034C | 1 + strings/FF586C00A0 | 3 +++ 22 files changed, 56 insertions(+), 6 deletions(-) create mode 100644 strings/00DD29DF create mode 100644 strings/00DD29DF8D00DD60 create mode 100644 strings/2006EEA5 create mode 100644 strings/4C15FD4C1AFD4C create mode 100644 strings/4C5BFF4CA3FD4C rename strings/{6031EA66FE47FE4AF391F20EF250F233F357F1CAF1EDF63EF12FF366FEA5F4EDF5 => 6031EA66FE47FE4AF391F20EF250F233F357F1CAF1EDF63EF12FF366FEA5F4EDF5A900} (93%) create mode 100644 strings/7F8D0DDC create mode 100644 strings/9848BABD04012910 create mode 100644 strings/A59D10FB create mode 100644 strings/A97F8D00DCAD01DC create mode 100644 strings/D006E6A1D0 create mode 100644 strings/DD09088D00DD create mode 100644 strings/DD60AD00DD0910 create mode 100644 strings/DF8D00DD60AD00DD09 create mode 100644 strings/EEAD00DD create mode 100644 strings/F66C28036C2A036C2C034C create mode 100644 strings/FF586C00A0 diff --git a/bin/kernal_generic.rom b/bin/kernal_generic.rom index 3d37f90600b798068d361d448ea57bc0a8ffaefc..67a92cbceaaebd3eb53764694f4e9c9ec8652b8a 100644 GIT binary patch delta 241 zcmVBfs*}4DwgGdqaufjq8m$1`Dff*4-C%g6pr)avqF7*fgrJ6@g`!xKjuv0D z>=va6F2(jtB=$@&_Dsn2Ot|$-hw4nh_DrPqOn~%E*!4_~_DrbtOl0*;7xqk+_Dr3V rzaJeWh4xH*_G~BvY$^k6ECWnE>P)=$OlbC?+@b(r002_;GV;yw(Q9(M delta 242 zcmVBftCPDEwgHB-aufjq8whxWpoXD^q9|ag0EN?q)=X3KtpMFA_l*GElZ_T% zv+Wk72rkCNc^-N^-Oc(Y{m-bAa slfNGwBy;vmI^}FA18gb-Y%BvzJ?c!o_DpE@pxmMWU;qG8^)m9!@#IKy6#xJL diff --git a/bin/kernal_mega65.rom b/bin/kernal_mega65.rom index 3d37f90600b798068d361d448ea57bc0a8ffaefc..67a92cbceaaebd3eb53764694f4e9c9ec8652b8a 100644 GIT binary patch delta 241 zcmVBfs*}4DwgGdqaufjq8m$1`Dff*4-C%g6pr)avqF7*fgrJ6@g`!xKjuv0D z>=va6F2(jtB=$@&_Dsn2Ot|$-hw4nh_DrPqOn~%E*!4_~_DrbtOl0*;7xqk+_Dr3V rzaJeWh4xH*_G~BvY$^k6ECWnE>P)=$OlbC?+@b(r002_;GV;yw(Q9(M delta 242 zcmVBftCPDEwgHB-aufjq8whxWpoXD^q9|ag0EN?q)=X3KtpMFA_l*GElZ_T% zv+Wk72rkCNc^-N^-Oc(Y{m-bAa slfNGwBy;vmI^}FA18gb-Y%BvzJ?c!o_DpE@pxmMWU;qG8^)m9!@#IKy6#xJL diff --git a/bin/kernal_ultimate64.rom b/bin/kernal_ultimate64.rom index 3d37f90600b798068d361d448ea57bc0a8ffaefc..67a92cbceaaebd3eb53764694f4e9c9ec8652b8a 100644 GIT binary patch delta 241 zcmVBfs*}4DwgGdqaufjq8m$1`Dff*4-C%g6pr)avqF7*fgrJ6@g`!xKjuv0D z>=va6F2(jtB=$@&_Dsn2Ot|$-hw4nh_DrPqOn~%E*!4_~_DrbtOl0*;7xqk+_Dr3V rzaJeWh4xH*_G~BvY$^k6ECWnE>P)=$OlbC?+@b(r002_;GV;yw(Q9(M delta 242 zcmVBftCPDEwgHB-aufjq8whxWpoXD^q9|ag0EN?q)=X3KtpMFA_l*GElZ_T% zv+Wk72rkCNc^-N^-Oc(Y{m-bAa slfNGwBy;vmI^}FA18gb-Y%BvzJ?c!o_DpE@pxmMWU;qG8^)m9!@#IKy6#xJL diff --git a/c64/kernal/reset_entry.s b/c64/kernal/reset_entry.s index e41cd7f3..7fb0b6a7 100644 --- a/c64/kernal/reset_entry.s +++ b/c64/kernal/reset_entry.s @@ -22,18 +22,18 @@ reset_entry: jmp (ICART_COLD_START) * ; Initialising IO is obviously required. Also indicated by c64 prg p269. - jsr IOINIT + jsr JIOINIT ; Setting up the screen and testing ram is obviously required ; also affirmed by p269 of c64 prg - jsr RAMTAS ; called RANTAM on Codebase64 wiki + jsr JRAMTAS ; called RANTAM on Codebase64 wiki ; Resetting IO vectors is obviously required, if we want interrupts to run ; also affirmed by c64 prg p269 - jsr RESTOR + jsr JRESTOR ;; "Compute's Mapping the 64" p236 - jsr CINT + jsr JCINT ; What do we do when finished? A C64 jumps into the BASIC ROM cli ; Allow interrupts to happen diff --git a/strings/00DD29DF b/strings/00DD29DF new file mode 100644 index 00000000..fd7ade84 --- /dev/null +++ b/strings/00DD29DF @@ -0,0 +1,3 @@ +$DD00 + AND #$DF + +Instruction and a half (well known hardware register address) - not copyrightable. diff --git a/strings/00DD29DF8D00DD60 b/strings/00DD29DF8D00DD60 new file mode 100644 index 00000000..e8fcd0b0 --- /dev/null +++ b/strings/00DD29DF8D00DD60 @@ -0,0 +1,5 @@ +$DD00 + AND #$DF + STA $DD00 + RTS + +$DD00 is a hardware register, where one typically set/unset/read individual bits. +Having a set of trivial helper subroutines to set/clear individual bits (or groups of bits) is an obvious solution (thus not copyrightable), some similarities are unevitable. +Besides, in this case (since the similarity does not even cover a single subroutine from start to end) it is clear that the similar code actually performs slightly different actions. diff --git a/strings/2006EEA5 b/strings/2006EEA5 new file mode 100644 index 00000000..4b53a2e3 --- /dev/null +++ b/strings/2006EEA5 @@ -0,0 +1,3 @@ +JSR $EE06 + LDA (argument does not match) + +Instruction and a half - not copyrightable. diff --git a/strings/4C15FD4C1AFD4C b/strings/4C15FD4C1AFD4C new file mode 100644 index 00000000..93764d3f --- /dev/null +++ b/strings/4C15FD4C1AFD4C @@ -0,0 +1 @@ +This is a part of Kernal jumptable - series of jumps, sometimes to the well known addreses (or through documented vectors). No business logic, part of the Kernal API itself (has to be as it is to maintain compatibility) - not copyrightable. diff --git a/strings/4C5BFF4CA3FD4C b/strings/4C5BFF4CA3FD4C new file mode 100644 index 00000000..93764d3f --- /dev/null +++ b/strings/4C5BFF4CA3FD4C @@ -0,0 +1 @@ +This is a part of Kernal jumptable - series of jumps, sometimes to the well known addreses (or through documented vectors). No business logic, part of the Kernal API itself (has to be as it is to maintain compatibility) - not copyrightable. diff --git a/strings/6031EA66FE47FE4AF391F20EF250F233F357F1CAF1EDF63EF12FF366FEA5F4EDF5 b/strings/6031EA66FE47FE4AF391F20EF250F233F357F1CAF1EDF63EF12FF366FEA5F4EDF5A900 similarity index 93% rename from strings/6031EA66FE47FE4AF391F20EF250F233F357F1CAF1EDF63EF12FF366FEA5F4EDF5 rename to strings/6031EA66FE47FE4AF391F20EF250F233F357F1CAF1EDF63EF12FF366FEA5F4EDF5A900 index b12c656e..8cd90eb1 100644 --- a/strings/6031EA66FE47FE4AF391F20EF250F233F357F1CAF1EDF63EF12FF366FEA5F4EDF5 +++ b/strings/6031EA66FE47FE4AF391F20EF250F233F357F1CAF1EDF63EF12FF366FEA5F4EDF5A900 @@ -1,4 +1,4 @@ -RTS (from previous routine) + a list of vectors to be copied starting from $0314 +RTS (from previous routine) + a list of vectors to be copied starting from $0314 + LDA #$00 Values of the vectors are already present in many autostart software - as it often overrides them, sometimes changing one to trigger autostart (one of the possible techniques). We have to use the same diff --git a/strings/6C28036C2A036C2C034C b/strings/6C28036C2A036C2C034C index fcfe7208..93764d3f 100644 --- a/strings/6C28036C2A036C2C034C +++ b/strings/6C28036C2A036C2C034C @@ -1 +1 @@ -This is a part of Kernal jumptable - series of jumps, sometimes to the well known addreses (or through documented vectors). No business logic, part of the Kernal API itself - not copyrightable. +This is a part of Kernal jumptable - series of jumps, sometimes to the well known addreses (or through documented vectors). No business logic, part of the Kernal API itself (has to be as it is to maintain compatibility) - not copyrightable. diff --git a/strings/7F8D0DDC b/strings/7F8D0DDC new file mode 100644 index 00000000..d0c43352 --- /dev/null +++ b/strings/7F8D0DDC @@ -0,0 +1,3 @@ +$7F + STA $DC0D + +Instruction (access to a docummented hardware register) and some part - not copyrightable. diff --git a/strings/9848BABD04012910 b/strings/9848BABD04012910 new file mode 100644 index 00000000..d0775e65 --- /dev/null +++ b/strings/9848BABD04012910 @@ -0,0 +1,3 @@ +TYA + PHA + TSX + LDA $0104,X + AND #$10 + +Beginning of IRQ handler - checks whether it is caused by BRK instruction or some other reason. Since IRQ handling for BRK/non-BRK caused interrupts are totally different, there is no other way but to start with such a check. Not creative - not copyrightable. diff --git a/strings/A59D10FB b/strings/A59D10FB new file mode 100644 index 00000000..90699c4e --- /dev/null +++ b/strings/A59D10FB @@ -0,0 +1,3 @@ +LDA $9D + BPL (address match) + +Checking a well-known zeropage flag - not creative, not copyrightable. diff --git a/strings/A97F8D00DCAD01DC b/strings/A97F8D00DCAD01DC new file mode 100644 index 00000000..9a2265bf --- /dev/null +++ b/strings/A97F8D00DCAD01DC @@ -0,0 +1,3 @@ +LDA #$7F + STA $DC00 + LDA $DC01 + +Part of keyboard scanning code in UDTIM routine - to get the last row (not even complete code, as there is also some code to set the port directions). This is probably the only sane way to read the rom. Not creative - not copyrightable. diff --git a/strings/D006E6A1D0 b/strings/D006E6A1D0 new file mode 100644 index 00000000..9856932f --- /dev/null +++ b/strings/D006E6A1D0 @@ -0,0 +1,3 @@ +BNE (offset match) + INC $A1 + BNE (offset does not match) + +Part of the routine to increment a well-known 24-bit counter. There are not many ways to do this in a sane way, some similarity is unavoidable, 2 instructions and a half is not much in this case. Not copyrightable. diff --git a/strings/DD09088D00DD b/strings/DD09088D00DD new file mode 100644 index 00000000..33ed075b --- /dev/null +++ b/strings/DD09088D00DD @@ -0,0 +1,5 @@ +$DD + ORA #$08 + STA $DD00 + +$DD00 is a hardware register, where one typically set/unset/read individual bits. +Having a set of trivial helper subroutines to set/clear individual bits (or groups of bits) is an obvious solution (thus not copyrightable), some similarities are unevitable. +Besides, in this case (since the similarity does not even cover a single subroutine from start to end) it is clear that the similar code actually performs slightly different actions. diff --git a/strings/DD60AD00DD0910 b/strings/DD60AD00DD0910 new file mode 100644 index 00000000..5167b1a0 --- /dev/null +++ b/strings/DD60AD00DD0910 @@ -0,0 +1,5 @@ +$DD + RTS + LDA $DD00 + ORA #$10 + +$DD00 is a hardware register, where one typically set/unset/read individual bits. +Having a set of trivial helper subroutines to set/clear individual bits (or groups of bits) is an obvious solution (thus not copyrightable), some similarities are unevitable. +Besides, in this case (since the similarity does not even cover a single subroutine from start to end) it is clear that the similar code actually performs slightly different actions. diff --git a/strings/DF8D00DD60AD00DD09 b/strings/DF8D00DD60AD00DD09 new file mode 100644 index 00000000..077c308b --- /dev/null +++ b/strings/DF8D00DD60AD00DD09 @@ -0,0 +1,5 @@ +$DF + STA $DD00 + RTS + LDA $DD00 + ORA (argument does not match) + +$DD00 is a hardware register, where one typically set/unset/read individual bits. +Having a set of trivial helper subroutines to set/clear individual bits (or groups of bits) is an obvious solution (thus not copyrightable), some similarities are unevitable. +Besides, in this case (since the similarity does not even cover a single subroutine from start to end) it is clear that the similar code actually performs slightly different actions. diff --git a/strings/EEAD00DD b/strings/EEAD00DD new file mode 100644 index 00000000..14560bce --- /dev/null +++ b/strings/EEAD00DD @@ -0,0 +1,3 @@ +$EE + LDA $DD00 + +Instruction (access to a well known hardware register address) and a half - not copyrightable. diff --git a/strings/F66C28036C2A036C2C034C b/strings/F66C28036C2A036C2C034C new file mode 100644 index 00000000..93764d3f --- /dev/null +++ b/strings/F66C28036C2A036C2C034C @@ -0,0 +1 @@ +This is a part of Kernal jumptable - series of jumps, sometimes to the well known addreses (or through documented vectors). No business logic, part of the Kernal API itself (has to be as it is to maintain compatibility) - not copyrightable. diff --git a/strings/FF586C00A0 b/strings/FF586C00A0 new file mode 100644 index 00000000..e69471c4 --- /dev/null +++ b/strings/FF586C00A0 @@ -0,0 +1,3 @@ +$FF + CLI + JMP ($A000) + +Part of the address, reenabling interrupts, jump through a documented vector - part of the initialization/reset sequence. Not creative - not copyrightable. From e0bbee443b514bc8d236a40707db649d3a06b0c4 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Mon, 2 Sep 2019 20:56:37 +0200 Subject: [PATCH 16/16] removed 'branch out of range' warnings --- c64/basic/basic_execute_line.s | 5 +-- c64/basic/cmd_load.s | 4 ++- c64/basic/wedge_dos.s | 26 ++++++++++----- c64/kernal/chrout_real.s | 5 +-- c64/kernal/f4a5.load.s | 58 ++++++++++++++++++++------------- c64/kernal/iec/iec_tx_command.s | 5 +-- c64/kernal/lvs_helpers.s | 7 ++-- c64/kernal/scnkey.s | 9 +++-- 8 files changed, 76 insertions(+), 43 deletions(-) diff --git a/c64/basic/basic_execute_line.s b/c64/basic/basic_execute_line.s index 5ea0aafb..1ddd7b43 100644 --- a/c64/basic/basic_execute_line.s +++ b/c64/basic/basic_execute_line.s @@ -30,8 +30,9 @@ basic_execute_statement: ;; Check for RUN/STOP lda STKEY - bpl basic_do_break - + bmi + + jmp basic_do_break +* ;; Skip over any white space and : ldy #0 ldx #