From 44db729d5cbf7578cb0d2d7bdc7d4651886d9f13 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Tue, 23 Jul 2019 20:56:28 +0200 Subject: [PATCH] fixed incorrect byte comparing --- c64/basic/select_device.s | 11 +++++++---- c64/kernal/iec/iec_devnum_check.s | 12 +++++------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/c64/basic/select_device.s b/c64/basic/select_device.s index 48061f8a..f5939033 100644 --- a/c64/basic/select_device.s +++ b/c64/basic/select_device.s @@ -1,15 +1,18 @@ select_device: - ;; Take last device number, make sure it's a drive - ;; If not, set to 8 (first drive number) + ;; Take last device number, make sure it's a drive - 8 or above. Above 30, + ;; although illegal for IEC we also consider a drive, as they exists + ;; drivers assigning these numbers to CBM-DOS capable devices - like some + ;; IEEE-488 carts. + ;; + ;; If current device is not a drive, set device to 8 (first drive number) ;; Device number is left in X, for SETFLS Kernal routine ;; Note: if tape support is introduced here, make sure DOS wedge won't get broken ldx current_device_number - cpx #$07 - bpl + + cpx #$08 bcs + ldx #$08 * diff --git a/c64/kernal/iec/iec_devnum_check.s b/c64/kernal/iec/iec_devnum_check.s index 8fffb64e..84cd506b 100644 --- a/c64/kernal/iec/iec_devnum_check.s +++ b/c64/kernal/iec/iec_devnum_check.s @@ -7,18 +7,16 @@ iec_devnum_check: ;; 0, 1, 2, or 3 are illegal - reserved for non-IEC devices on Commodore - cmp #$03 - bpl + + cmp #$04 bcs + ;; FALLTROUGH iec_devnum_check_failed: - sec + sec ; indicate non-IEC device rts * - ;; 30 and above are illegal too, due to IEC command encoding scheme, + ;; 31 and above are illegal too, due to IEC command encoding scheme, ;; see https://www.pagetable.com/?p=1031 - cmp #$1E - bpl iec_devnum_check_failed + cmp #$1F bcs iec_devnum_check_failed - clc + ;; Carry is clear here - indicates IEC device rts