started JiffyDOS byte reception, fixes for turbo dispatcher

This commit is contained in:
FeralChild64 committed 2019-11-19 22:33:38 +01:00
1 parent d0fd34e79f
commit 98f3e87105
6 files changed
+70 -26

No files matched your search

+6 -4
View File
@@ -304,18 +304,20 @@
.var features_str = ""
#if CONFIG_TAPE_NORMAL
.eval features_str = ADD_FEATURE(features_str, "TAPE NORMAL")
.eval features_str = ADD_FEATURE(features_str, "TAPE LOAD NORMAL")
#elif CONFIG_TAPE_TURBO
.eval features_str = ADD_FEATURE(features_str, "TAPE TURBO")
.eval features_str = ADD_FEATURE(features_str, "TAPE LOAD TURBO")
#elif CONFIG_TAPE_NORMAL && CONFIG_TAPE_TURBO
.eval features_str = ADD_FEATURE(features_str, "TAPE NORMAL+TURBO")
.eval features_str = ADD_FEATURE(features_str, "TAPE LOAD NORMAL+TURBO")
#endif
.eval feature_new_line = true
#if CONFIG_IEC
#if !CONFIG_IEC_JIFFYDOS
.eval features_str = ADD_FEATURE(features_str, "IEC")
#else
.eval features_str = ADD_FEATURE(features_str, "IEC+JD")
.eval features_str = ADD_FEATURE(features_str, "IEC+JIFFY DEF")
#endif
#endif
+59 -8
View File
@@ -17,7 +17,17 @@
iec_tx_byte_jiffydos:
// We need to preserve 3 lowest bits of CIA2_PRA - as they encode
// Timing is critical, do not allow interrupts
sei
// Preserve .X (.Y is not used by the routine)
phx_trash_a
// If EOI requested (carryy flag set), mark this in IECPROTO as 0
bcc !+
dec IECPROTO // turns 1 into 0
!:
// We need to preserve 3 lowest bits of CIA2_PRA, they contain important (but unrelated) data
// Use C3PO for this, as afterwards we have to set there 0 nevertheless
lda CIA2_PRA
and #%00000111
@@ -68,21 +78,40 @@ __jd_check1:
and #%00110000 // clear everything but CLK/DATA
sta CIA2_PRA
// Signal EOI if needed XXX calculate cycles for quicklyy pulling CLK
lda C3PO
ldx IECPROTO
beq iec_tx_byte_jiffydos_wait_eoi
// FALLTROUGH
// XXX EOI signalled by early CLK (20us delay for non-CLK?)
iec_tx_byte_jiffydos_finalize:
ora #BIT_CIA2_PRA_CLK_OUT // pull CLK
sta CIA2_PRA
// Re-enable sprites
pla
lda VIC_SPENA
sta VIC_SPENA
// Mark TX buffer as empty
lda #$00
sta C3PO
// Mark TX buffer as empty, restore proper IECPROTO value
ldx #$00
stx C3PO
inx
sta IECPROTO
// Restore .X, interrupts, return
plx_trash_a
cli
rts
iec_tx_byte_jiffydos_wait_eoi:
jsr iec_wait20us // XXX is it enough?
lda C3PO
jmp iec_tx_byte_jiffydos_finalize
iec_rx_byte_jiffydos:
@@ -105,13 +134,35 @@ iec_rx_byte_jiffydos:
pla
sta CIA2_PRA
// Retrieve byte XXX count cycles, synchronize
lda CIA2_PRA // bits 0 and 1
and #%11000000
pha
// XXX retrieve byte
lda CIA2_PRA // bits 2 and 3
and #%11000000
pha
lda CIA2_PRA // bits 4 and 5
and #%11000000
pha
lda CIA2_PRA // bits 6 and 7
and #%11000000
pha
// XXX check for EOI here
// XXX decode byte instead of this - can we do it in real time?
pla // bits 6 and 7
pla // bits 4 and 5
pla // bits 2 and 3
pla // bits 0 and 1
// Re-enable sprites
pla
lda VIC_SPENA
sta VIC_SPENA
rts
+2 -1
View File
@@ -1,7 +1,8 @@
//
// Helper table for encoding lower nibble for JiffyyDOS,
// values found by observing the actual transfer
// values found by observing the actual transfer using
// original ROMs
//
#if CONFIG_IEC_JIFFYDOS
+2 -12
View File
@@ -10,23 +10,13 @@
iec_rx_dispatch:
lda IECPROTO
#if CONFIG_IEC_JIFFYDOS
cmp #$01
beq iec_rx_dispatch_jiffydos
beq_far iec_rx_byte_jiffydos
#endif // CONFIG_IEC_JIFFYDOS
// FALLTROUGH
iec_rx_dispatch_normal:
plp
jmp iec_rx_byte
#if CONFIG_IEC_JIFFYDOS
iec_rx_dispatch_jiffydos:
plp
jmp iec_rx_byte_jiffydos
#endif // CONFIG_IEC_JIFFYDOS
#endif // any turbo supported
-1
View File
@@ -81,7 +81,6 @@ iec_jiffydos_detect_loop:
skip_2_bytes_trash_nvz
iec_jiffydos_detected:
lda #$01 // JiffyDOS protocol
iec_jiffydos_store_proto:
+1
View File
@@ -11,6 +11,7 @@ iec_tx_dispatch:
php // preserve C flag for EOI indication
lda IECPROTO
#if CONFIG_IEC_JIFFYDOS
cmp #$01
beq iec_tx_dispatch_jiffydos