From 8eb435d2b22e39c719a9c7272c5a2a356ba64842 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sun, 25 Aug 2019 13:25:03 +0200 Subject: [PATCH] fix potential IEC data transfer problem --- c64/kernal/iec/iec_pull_clk_release_data_oneshot.s | 8 ++++++++ c64/kernal/iec/iec_tx_common.s | 10 +++++----- 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 c64/kernal/iec/iec_pull_clk_release_data_oneshot.s diff --git a/c64/kernal/iec/iec_pull_clk_release_data_oneshot.s b/c64/kernal/iec/iec_pull_clk_release_data_oneshot.s new file mode 100644 index 00000000..78d40472 --- /dev/null +++ b/c64/kernal/iec/iec_pull_clk_release_data_oneshot.s @@ -0,0 +1,8 @@ + +iec_pull_clk_release_data_oneshot: + + lda CIA2_PRA + ora #BIT_CIA2_PRA_CLK_OUT ; pull + and #$FF - BIT_CIA2_PRA_DAT_OUT ; release + sta CIA2_PRA + rts diff --git a/c64/kernal/iec/iec_tx_common.s b/c64/kernal/iec/iec_tx_common.s index 8cc63e0f..d2cddf82 100644 --- a/c64/kernal/iec/iec_tx_common.s +++ b/c64/kernal/iec/iec_tx_common.s @@ -33,9 +33,9 @@ iec_tx_common: ;; Pull CLK back to indicate that DATA is not valid, keep it for 60us ;; We can use this routine as we don't hold DATA anyway (and its state doesn't even matter) - jsr iec_pull_clk_release_data + jsr iec_pull_clk_release_data_oneshot jsr iec_wait60us - + ;; Now, we can start transmission of 8 bits of data ldx #7 @@ -57,11 +57,11 @@ iec_tx_common_bit_is_sent: ;; Wait 20us, so that device(s) can pick DATA jsr iec_wait20us - + ;; Pull CLK for 20us again, before sending the next bit ;; or performing any other action - jsr iec_pull_clk_release_data - jsr iec_wait20us ; XXX this might be an overkill, there is a lot of code besides this wait here - few NOPs might be enough + jsr iec_pull_clk_release_data_oneshot + jsr iec_wait20us ;; More bits to send? dex