From 18b3f0e895d027f84679f40de53b47dd456cb71e Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Fri, 27 Dec 2019 18:40:08 +0100 Subject: [PATCH] initial DophinDOS byte TX, does not work yet --- c64/kernal/iec/iec_cmd_open.s | 13 +++++++++++++ c64/kernal/iec/iec_tx_byte.s | 27 +++++++++++++++++++++++++++ c64/kernal/iec/save_iec.s | 12 ++++++------ 3 files changed, 46 insertions(+), 6 deletions(-) diff --git a/c64/kernal/iec/iec_cmd_open.s b/c64/kernal/iec/iec_cmd_open.s index 48fceb28..209702ca 100644 --- a/c64/kernal/iec/iec_cmd_open.s +++ b/c64/kernal/iec/iec_cmd_open.s @@ -17,8 +17,21 @@ iec_cmd_open: // similar to TKSA, but without turnaround !: ora #$F0 +#if CONFIG_IEC_DOLPHINDOS +/* XXX does not work yet + sta TBTCNT + jsr iec_tx_command + bcs !+ // branch if error + + jsr dolphindos_detect + jmp iec_tx_command_finalize +*/ +#else + // FALLTROUGH +#endif + common_open_close_unlsn_second: // common part of several commands sta TBTCNT diff --git a/c64/kernal/iec/iec_tx_byte.s b/c64/kernal/iec/iec_tx_byte.s index 9b4cf8db..40b0c49a 100644 --- a/c64/kernal/iec/iec_tx_byte.s +++ b/c64/kernal/iec/iec_tx_byte.s @@ -70,6 +70,29 @@ iec_tx_common: jsr iec_pull_clk_release_data_oneshot jsr iec_wait60us +#if CONFIG_IEC_DOLPHINDOS + + // Check if DolphinDOS was detected + lda IECPROTO + cmp #$02 + bne iec_tx_no_dolphindos + + // For DolphinDOS just push the byte to parallel port (set it to output first) + lda #$FF + sta CIA2_DDRB + lda TBTCNT + sta CIA2_PRB + + // Release CLK to indicate data is now valid (we should not hold DATA nevertheless) + jsr iec_release_clk_data + + // Finish the flow + jmp iec_tx_common_finalize + +iec_tx_no_dolphindos: + +#endif // CONFIG_IEC_DOLPHINDOS + // Now, we can start transmission of 8 bits of data ldx #7 @@ -115,6 +138,10 @@ iec_tx_common_bit_is_sent: dex bpl iec_tx_common_sendbit + // FALLTROUGH + +iec_tx_common_finalize: + cli // Give devices time to tell if they are busy by pulling DATA diff --git a/c64/kernal/iec/save_iec.s b/c64/kernal/iec/save_iec.s index 71d7f02d..98b5e7d7 100644 --- a/c64/kernal/iec/save_iec.s +++ b/c64/kernal/iec/save_iec.s @@ -48,18 +48,18 @@ save_iec: lda STAL+0 sta TBTCNT clc -#if CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS +#if CONFIG_IEC_JIFFYDOS jsr iec_tx_dispatch -#else // no turbo supported +#else jsr iec_tx_byte #endif lda STAL+1 sta TBTCNT clc -#if CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS +#if CONFIG_IEC_JIFFYDOS jsr iec_tx_dispatch -#else // no turbo supported +#else jsr iec_tx_byte #endif @@ -78,9 +78,9 @@ iec_save_loop: // Send the byte sta TBTCNT clc -#if CONFIG_IEC_JIFFYDOS || CONFIG_IEC_DOLPHINDOS +#if CONFIG_IEC_JIFFYDOS jsr iec_tx_dispatch -#else // no turbo supported +#else jsr iec_tx_byte #endif