diff --git a/c64/kernal/iec/iec_tx_byte.s b/c64/kernal/iec/iec_tx_byte.s index 4cff6ad9..5dcca324 100644 --- a/c64/kernal/iec/iec_tx_byte.s +++ b/c64/kernal/iec/iec_tx_byte.s @@ -59,7 +59,10 @@ iec_tx_common_sendbit: bne !+ // branch if not sending the last bit lda IECPROTO - bpl !+ // branch if protocol is known + beq !+ // branch if standard protocol + + // JiffyDOS ROM performs detection loop on every command; it seems we have to + // replicate this behaviour for compatibility with at least 1541 JiffyDOS ROM jsr jiffydos_detect !: diff --git a/c64/kernal/iec/unlsn.s b/c64/kernal/iec/unlsn.s index b5dc8990..4681c089 100644 --- a/c64/kernal/iec/unlsn.s +++ b/c64/kernal/iec/unlsn.s @@ -20,7 +20,7 @@ UNLSN: #if CONFIG_IEC_JIFFYDOS - lda #$00 // switch back to standard protocol + lda #$FF // XXX sta IECPROTO #endif diff --git a/c64/kernal/iec/untlk.s b/c64/kernal/iec/untlk.s index 3dfceb2b..d8db0fb1 100644 --- a/c64/kernal/iec/untlk.s +++ b/c64/kernal/iec/untlk.s @@ -20,7 +20,7 @@ UNTLK: #if CONFIG_IEC_JIFFYDOS - lda #$00 // switch back to standard protocol + lda #$FF // XXX sta IECPROTO #endif diff --git a/c64/kernal/iec_fast/jiffydos_detect.s b/c64/kernal/iec_fast/jiffydos_detect.s index 40f19523..49ada03c 100644 --- a/c64/kernal/iec_fast/jiffydos_detect.s +++ b/c64/kernal/iec_fast/jiffydos_detect.s @@ -8,6 +8,9 @@ // - https://github.com/rkrajnc/sd2iec/blob/master/src/iec.c // The 'iec.s' suggests, that the drive should respond by pulling data +// The original JiffyyDOS ROM seems to perform detection with every command +// (even though for many of them it always fails) and we have to replicate +// this behaviour for compatibility with at least 1541 JiffyDOS ROM #if CONFIG_IEC_JIFFYDOS @@ -24,6 +27,9 @@ jiffydos_detect_loop: dey // 2 cycles bne jiffydos_detect_loop // 3 cycles if branch + lda IECPROTO + bpl jiffydos_detect_end // no detection requested, preserve existing protocol + lda #$00 // normal protocol beq jiffydos_store_proto // branch always @@ -36,6 +42,9 @@ jiffydos_detected: jiffydos_store_proto: sta IECPROTO + // FALLTROUGH + +jiffydos_detect_end: rts