moved JiffyDOS detection to a separate routine
This commit is contained in:
1 parent
4596728121
commit
d5077496bf
2 files changed
+44
-27
No files matched your search
@@ -57,36 +57,11 @@ iec_tx_common_sendbit:
|
|||||||
|
|
||||||
#if CONFIG_IEC_JIFFYDOS
|
#if CONFIG_IEC_JIFFYDOS
|
||||||
|
|
||||||
// Here is the place we can detect JiffyDOS protocol, by inserting a long delay
|
bne !+ // branch if not sending the last bit
|
||||||
// (above 400us?) during sending command last bit, see:
|
|
||||||
// - https://sites.google.com/site/h2obsession/CBM/C128/JiffySoft128
|
|
||||||
// - https://github.com/rkrajnc/sd2iec/blob/master/src/iec.c
|
|
||||||
// The 'iec.s' suggests, that the drive should respond by pulling data
|
|
||||||
|
|
||||||
lda IECPROTO
|
lda IECPROTO
|
||||||
bpl !+ // branch if protocol is known
|
bpl !+ // branch if protocol is known
|
||||||
cpx #$00
|
|
||||||
bne !+ // branch if not sending the last bit
|
|
||||||
|
|
||||||
ldy #$25 // 400us is nearly 410 cycles on NTSC
|
|
||||||
// loop iteration below is 11 cycles,
|
|
||||||
// and several cycles were already used
|
|
||||||
iec_jiffydos_detect_loop:
|
|
||||||
lda CIA2_PRA // 4 cycles
|
|
||||||
bpl iec_jiffydos_detected // 2 cycles
|
|
||||||
dey // 2 cycles
|
|
||||||
bne iec_jiffydos_detect_loop // 3 cycles if branch
|
|
||||||
|
|
||||||
lda #$00 // normal protocol
|
|
||||||
beq iec_jiffydos_store_proto // branch always
|
|
||||||
|
|
||||||
iec_jiffydos_detected:
|
|
||||||
jsr iec_wait_for_data_release // guessed from VICE logs
|
|
||||||
lda #$01 // JiffyDOS protocol
|
|
||||||
|
|
||||||
iec_jiffydos_store_proto:
|
|
||||||
sta IECPROTO
|
|
||||||
|
|
||||||
|
jsr jiffydos_detect
|
||||||
!:
|
!:
|
||||||
#endif // CONFIG_IEC_JIFFYDOS
|
#endif // CONFIG_IEC_JIFFYDOS
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
|
||||||
|
//
|
||||||
|
// Helper routine for JiffyDOS detection
|
||||||
|
//
|
||||||
|
|
||||||
|
// Detection is done by inserting a long delay (above 400us?) during sending command last bit, see:
|
||||||
|
// - https://sites.google.com/site/h2obsession/CBM/C128/JiffySoft128
|
||||||
|
// - https://github.com/rkrajnc/sd2iec/blob/master/src/iec.c
|
||||||
|
// The 'iec.s' suggests, that the drive should respond by pulling data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#if CONFIG_IEC_JIFFYDOS
|
||||||
|
|
||||||
|
|
||||||
|
jiffydos_detect:
|
||||||
|
|
||||||
|
ldy #$25 // 400us is nearly 410 cycles on NTSC
|
||||||
|
// loop iteration below is 11 cycles,
|
||||||
|
// and several cycles were already used
|
||||||
|
jiffydos_detect_loop:
|
||||||
|
lda CIA2_PRA // 4 cycles
|
||||||
|
bpl jiffydos_detected // 2 cycles
|
||||||
|
dey // 2 cycles
|
||||||
|
bne jiffydos_detect_loop // 3 cycles if branch
|
||||||
|
|
||||||
|
lda #$00 // normal protocol
|
||||||
|
beq jiffydos_store_proto // branch always
|
||||||
|
|
||||||
|
jiffydos_detected:
|
||||||
|
jsr iec_wait_for_data_release // guessed from VICE logs
|
||||||
|
lda #$01 // JiffyDOS protocol
|
||||||
|
|
||||||
|
// FALLTROUGH
|
||||||
|
|
||||||
|
jiffydos_store_proto:
|
||||||
|
sta IECPROTO
|
||||||
|
|
||||||
|
rts
|
||||||
|
|
||||||
|
|
||||||
|
#endif // CONFIG_IEC_JIFFYDOS
|
||||||
Reference in new issue
Block a user