From a1d3c74a0d1f201db005f8164f39deaf05a6be08 Mon Sep 17 00:00:00 2001 From: FeralChild64 Date: Sat, 22 Jun 2019 15:52:09 +0200 Subject: [PATCH] more IEC work - the turnaround seems to work now --- ...lease_atn_clock.s => iec_pull_data_release_atn_clk.s} | 0 c64/kernal/iec_release_atn.s | 8 ++++++++ c64/kernal/iec_tx_command.s | 9 ++++++--- c64/kernal/iec_tx_common.s | 2 +- c64/kernal/iec_tx_eoi.s | 3 +++ 5 files changed, 18 insertions(+), 4 deletions(-) rename c64/kernal/{iec_pull_data_release_atn_clock.s => iec_pull_data_release_atn_clk.s} (100%) create mode 100644 c64/kernal/iec_release_atn.s diff --git a/c64/kernal/iec_pull_data_release_atn_clock.s b/c64/kernal/iec_pull_data_release_atn_clk.s similarity index 100% rename from c64/kernal/iec_pull_data_release_atn_clock.s rename to c64/kernal/iec_pull_data_release_atn_clk.s diff --git a/c64/kernal/iec_release_atn.s b/c64/kernal/iec_release_atn.s new file mode 100644 index 00000000..194f3856 --- /dev/null +++ b/c64/kernal/iec_release_atn.s @@ -0,0 +1,8 @@ + +iec_release_atn: + + lda CI2PRA + and #$FF - BIT_CI2PRA_ATN_OUT ; release + sta CI2PRA + rts + diff --git a/c64/kernal/iec_tx_command.s b/c64/kernal/iec_tx_command.s index ca50f4a2..526ae80a 100644 --- a/c64/kernal/iec_tx_command.s +++ b/c64/kernal/iec_tx_command.s @@ -57,9 +57,12 @@ iec_tx_command: jsr iec_set_idle jmp kernalerror_DEVICE_NOT_FOUND * - ;; All done - before exiting wait a moment and restore bus to idle state - jsr iec_wait20us - jsr iec_set_idle + ;; All done + + ;; XXX All the documentation says we should release ATN at this point, but when I do so + ;; the turnaround mechanism does not work. Why??? + ;; jsr iec_wait20us + ;; jsr iec_set_idle clc rts diff --git a/c64/kernal/iec_tx_common.s b/c64/kernal/iec_tx_common.s index 73753f72..a9652d6b 100644 --- a/c64/kernal/iec_tx_common.s +++ b/c64/kernal/iec_tx_common.s @@ -43,7 +43,7 @@ iec_tx_common_bit_is_sent: ;; Pull CLK for 20us again, before sending the next bit ;; or performing any other action jsr iec_pull_clk_release_data - jsr iec_wait20us + jsr iec_wait20us ; XXX this might be an overkill, there is a lot of code besides this wait here - few NOPs might be enough ;; More bits to send? dex diff --git a/c64/kernal/iec_tx_eoi.s b/c64/kernal/iec_tx_eoi.s index 76169af3..5cae87f2 100644 --- a/c64/kernal/iec_tx_eoi.s +++ b/c64/kernal/iec_tx_eoi.s @@ -1,6 +1,9 @@ iec_tx_eoi: + ;; Releasing ATN needed due to current iec_tx_command implementation + jsr iec_release_atn + ;; Wait at least 256 usec jsr iec_wait100us jsr iec_wait100us