From 2e9a0b16107a0164ea1ddc6f409edc0b5dbd84a3 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Thu, 7 Nov 2019 17:23:27 +0100 Subject: [PATCH] SECOND/TKSA compatibility fix --- c64/kernal/iec/chkin_iec.s | 1 + c64/kernal/iec/ckout_iec.s | 1 + c64/kernal/iec/save_iec.s | 2 +- c64/kernal/iec/second.s | 13 ++++++------- c64/kernal/iec/tksa.s | 13 ++++++------- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/c64/kernal/iec/chkin_iec.s b/c64/kernal/iec/chkin_iec.s index 584e40f6..b86dee9c 100644 --- a/c64/kernal/iec/chkin_iec.s +++ b/c64/kernal/iec/chkin_iec.s @@ -22,6 +22,7 @@ chkin_iec: bcs_far chkinout_device_not_present lda LAT, Y + ora #$60 jsr TKSA bcs_far chkinout_device_not_present diff --git a/c64/kernal/iec/ckout_iec.s b/c64/kernal/iec/ckout_iec.s index 4a504f9c..662f4840 100644 --- a/c64/kernal/iec/ckout_iec.s +++ b/c64/kernal/iec/ckout_iec.s @@ -21,6 +21,7 @@ ckout_iec: bcs_far chkinout_device_not_present lda LAT, Y + ora #$60 jsr SECOND bcs_far chkinout_device_not_present diff --git a/c64/kernal/iec/save_iec.s b/c64/kernal/iec/save_iec.s index e580a167..5c1d3e81 100644 --- a/c64/kernal/iec/save_iec.s +++ b/c64/kernal/iec/save_iec.s @@ -47,7 +47,7 @@ save_iec: jsr LISTEN bcs save_iec_dev_not_found - lda #$60 // open channel / data (p3) , required according to p13 + lda #$61 // open channel / data (p3) , required according to p13 sta TBTCNT jsr iec_tx_command bcs save_iec_error diff --git a/c64/kernal/iec/second.s b/c64/kernal/iec/second.s index 12d49f44..d1931234 100644 --- a/c64/kernal/iec/second.s +++ b/c64/kernal/iec/second.s @@ -14,13 +14,12 @@ SECOND: #if CONFIG_IEC - // Due to OPEN/CLOSE/TKSA/SECOND command encoding (see https://www.pagetable.com/?p=1031), - // allowed channels are 0-15; report error if out of range - cmp #$10 - bcc !+ - jmp kernalerror_DEVICE_NOT_FOUND // XXX find a better error message for wrong channel (create new one?) -!: - ora #$60 + // Due to OPEN/CLOSE/TKSA/SECOND command encoding, allowed channels are 0-15; it is the caller + // responsibility, hovewer, to provide value ORed with $60 + // - https://www.lemon64.com/forum/viewtopic.php?t=57694&sid=531ba3592bcffadef2ac8b9162f2e529 + // - https://www.pagetable.com/?p=1031 (Kernal API description) + + // XXX consider checking whether value is in range (contrary to original ROM implementation) jmp common_open_close_unlsn_second diff --git a/c64/kernal/iec/tksa.s b/c64/kernal/iec/tksa.s index 63215256..9794a7b9 100644 --- a/c64/kernal/iec/tksa.s +++ b/c64/kernal/iec/tksa.s @@ -14,13 +14,12 @@ TKSA: #if CONFIG_IEC - // Due to OPEN/CLOSE/TKSA/SECOND command encoding (see https://www.pagetable.com/?p=1031), - // allowed channels are 0-15; report error if out of range - cmp #$10 - bcc !+ - jmp kernalerror_DEVICE_NOT_FOUND // XXX find a better error message for wrong channel (create new one?) -!: - ora #$F0 + // Due to OPEN/CLOSE/TKSA/SECOND command encoding, allowed channels are 0-15; it is the caller + // responsibility, hovewer, to provide value ORed with $60 + // - https://www.lemon64.com/forum/viewtopic.php?t=57694&sid=531ba3592bcffadef2ac8b9162f2e529 + // - https://www.pagetable.com/?p=1031 (Kernal API description) + + ora #$90 jmp common_untlk_tksa