From dcebe17e5148ae14abf986af3c5ec6a0f6735527 Mon Sep 17 00:00:00 2001 From: Paul Gardner-Stephen Date: Wed, 1 May 2019 23:02:29 +0930 Subject: [PATCH] fix inverted sense of DATA line when writing bytes. We can now get a device to respond to an ATN byte. --- c64/kernal/iec_tx_byte.s | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/c64/kernal/iec_tx_byte.s b/c64/kernal/iec_tx_byte.s index 6be100d4..3b1d1c87 100644 --- a/c64/kernal/iec_tx_byte.s +++ b/c64/kernal/iec_tx_byte.s @@ -33,7 +33,7 @@ iec_tx_byte: jsr iec_wait60us ;; Do the actual transmission of 8 bits of data - ldx #8 + ldx #7 pla @@ -44,11 +44,11 @@ iec_tx_byte_nextbit: bcs + ;; Setup 0 - jsr iec_assert_clk_release_data + jsr iec_assert_clk_and_data jmp iec_tx_byte_l1 * ;; Setup 1 - jsr iec_assert_clk_and_data + jsr iec_assert_clk_release_data iec_tx_byte_l1: ;; Clock bit out jsr iec_wait20us @@ -60,13 +60,15 @@ iec_tx_byte_l1: ;; More bits to send? pla dex - bne iec_tx_byte_nextbit + bpl iec_tx_byte_nextbit ;; Done sending bits. Assert CLK and wait for acknowledgement jsr iec_assert_clk_release_data ;; Acknowledgement must happen within 1ms, else it ;; is DEVICE NOT PRESENT + ;; Acknowledgement consists of the DATA line being pulled + ;; by the listener. ;; We can't easily count rasters here, so we just ;; try a set number of times ldx #$ff