diff --git a/c64/kernal/iec/iec_rx_byte.s b/c64/kernal/iec/iec_rx_byte.s index 4ae314bc..c186f33c 100644 --- a/c64/kernal/iec/iec_rx_byte.s +++ b/c64/kernal/iec/iec_rx_byte.s @@ -30,30 +30,8 @@ iec_rx_byte: // Wait till data line is released (someone else might be holding it) jsr iec_wait_for_data_release - // Wait for talker to pull CLK. - // If over 200 usec (205 cycles on NTSC machine) , then it is EOI. - // Loop iteraction takes 13 cycles, 17 full iterations are enough - - ldx #$11 // 2 cycles -iec_rx_clk_wait1: - lda CIA2_PRA // 4 cycles - rol // 2 cycles, to put CLK in as the last bit - bpl iec_rx_not_eoi // 2 cycles if not jumped - dex // 2 cycles - bne iec_rx_clk_wait1 // 3 cycles if jumped - - // Timeout - either this is the last byte of stream, or the stream is empty at all. - // Mark end of stream in IOSTATUS - jsr kernalstatus_EOI - -iec_rx_not_empty: - - // Pull data for 60 usec to confirm it - jsr iec_release_clk_pull_data - jsr iec_wait60us - jsr iec_release_clk_data - -iec_rx_not_eoi: + // Check if EOI + jsr iec_rx_check_eoi #if CONFIG_IEC_DOLPHINDOS diff --git a/c64/kernal/iec/iec_rx_check_eoi.s b/c64/kernal/iec/iec_rx_check_eoi.s new file mode 100644 index 00000000..5c95c71d --- /dev/null +++ b/c64/kernal/iec/iec_rx_check_eoi.s @@ -0,0 +1,32 @@ + +// +// Helper routine to check for EOI while receiving byte from IEC +// + +iec_rx_check_eoi: + + // Wait for talker to pull CLK. + // If over 200 usec (205 cycles on NTSC machine) , then it is EOI. + // Loop iteraction takes 13 cycles, 17 full iterations are enough + + ldx #$11 // 2 cycles + +!: + lda CIA2_PRA // 4 cycles + rol // 2 cycles, to put CLK in as the last bit + bpl iec_rx_check_eoi_done // 2 cycles if not jumped + dex // 2 cycles + bne !- // 3 cycles if jumped + + // Timeout - either this is the last byte of stream, or the stream is empty at all. + // Mark end of stream in IOSTATUS + jsr kernalstatus_EOI + + // Pull data for 60 usec to confirm it + jsr iec_release_clk_pull_data + jsr iec_wait60us + jsr iec_release_clk_data + +iec_rx_check_eoi_done: + + rts diff --git a/c64/kernal/iec/load_iec.s b/c64/kernal/iec/load_iec.s index c0d564aa..92c983a1 100644 --- a/c64/kernal/iec/load_iec.s +++ b/c64/kernal/iec/load_iec.s @@ -99,12 +99,18 @@ load_iec: lda VERCKK bne load_iec_loop // branch if VERIFY - lda IECPROTO - cmp #$01 - bne load_iec_loop // branch if not JiffyDOS - jmp load_jiffydos +#if CONFIG_IEC_JIFFYDOS + cmp #$01 + beq_far load_jiffydos // branch if JiffyDOS +#endif + +#if CONFIG_IEC_DOLPHINDOS + // XXX enable when finished + // cmp #$02 + // beq_far load_dolphindos // branch if JiffyDOS +#endif #endif diff --git a/c64/kernal/iec_fast/dolphindos_detect.s b/c64/kernal/iec_fast/dolphindos_detect.s index dbdafab7..b8cb278d 100644 --- a/c64/kernal/iec_fast/dolphindos_detect.s +++ b/c64/kernal/iec_fast/dolphindos_detect.s @@ -54,6 +54,8 @@ dolphindos_detect_loop: dolphindos_detect_fail: + panic #$00 + rts dolphindos_detect_success: diff --git a/c64/kernal/iec_fast/load_dolphindos.s b/c64/kernal/iec_fast/load_dolphindos.s new file mode 100644 index 00000000..a80eba8e --- /dev/null +++ b/c64/kernal/iec_fast/load_dolphindos.s @@ -0,0 +1,27 @@ + +// +// DolphinDOS protocol support for IEC - optimized load loop +// + + +#if CONFIG_IEC_DOLPHINDOS && !CONFIG_MEMORY_MODEL_60K + + +load_dolphindos: + + // Timing is critical for some parts, do not allow interrupts + sei + + // A trick to shorten EAL update time + ldy #$FF + + // FALLTROUGH + +load_dolphindos_loop: + + + + panic #$00 // XXX this routine is not finished yet + + +#endif // CONFIG_IEC_DOLPHINDOS and not CONFIG_MEMORY_MODEL_60K