diff --git a/c64/aliases/,aliases_config.s b/c64/aliases/,aliases_config.s index 1ea8ba6f..4524efdf 100644 --- a/c64/aliases/,aliases_config.s +++ b/c64/aliases/,aliases_config.s @@ -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 diff --git a/c64/kernal/iec/f000.iec_jiffydos.s b/c64/kernal/iec/f000.iec_jiffydos.s index c7528db4..bc238d4f 100644 --- a/c64/kernal/iec/f000.iec_jiffydos.s +++ b/c64/kernal/iec/f000.iec_jiffydos.s @@ -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 diff --git a/c64/kernal/iec/iec_jiffydos_bittable.s b/c64/kernal/iec/iec_jiffydos_bittable.s index 0cc99ed9..3c4914a2 100644 --- a/c64/kernal/iec/iec_jiffydos_bittable.s +++ b/c64/kernal/iec/iec_jiffydos_bittable.s @@ -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 diff --git a/c64/kernal/iec/iec_rx_dispatch.s b/c64/kernal/iec/iec_rx_dispatch.s index 78a3690a..465ee4b5 100644 --- a/c64/kernal/iec/iec_rx_dispatch.s +++ b/c64/kernal/iec/iec_rx_dispatch.s @@ -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 diff --git a/c64/kernal/iec/iec_tx_byte.s b/c64/kernal/iec/iec_tx_byte.s index bed60be5..15b5d01c 100644 --- a/c64/kernal/iec/iec_tx_byte.s +++ b/c64/kernal/iec/iec_tx_byte.s @@ -81,7 +81,6 @@ iec_jiffydos_detect_loop: skip_2_bytes_trash_nvz iec_jiffydos_detected: - lda #$01 // JiffyDOS protocol iec_jiffydos_store_proto: diff --git a/c64/kernal/iec/iec_tx_dispatch.s b/c64/kernal/iec/iec_tx_dispatch.s index 4222e6a8..88898664 100644 --- a/c64/kernal/iec/iec_tx_dispatch.s +++ b/c64/kernal/iec/iec_tx_dispatch.s @@ -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