more work towards IEC bus. Also don't corrupt $DD00 VIC-II bank bits in the process.

This commit is contained in:
Paul Gardner-Stephen committed 2019-05-01 21:47:00 +09:30
1 parent 16dcfbe22b
commit 687ed9c56a
7 files changed
+54 -36

No files matched your search

+36 -1
View File
@@ -1,8 +1,44 @@
iec_tx_byte:
pha
jsr iec_assert_clk_release_data
;; Give devices time to respond
jsr wait1ms
;; Did a device respond? (DATA will be pulled if so)
lda $DD00
bmi +
;; No devices present, so we can immediately return with device not found
pla
jmp kernalerror_DEVICE_NOT_FOUND
*
;; Release CLK and wait for DATA to release.
jsr iec_release_clk_and_data
;; Wait for DATA to be released
;; Listener is allowed to hold DATA for as long as they want.
;; i.e., this is the part of the protocol where the listener indicates
;; that they are busy doing something, like processing the previous
;; character.
jsr iec_wait_for_data_release
;; We then wait for 60 usec (less than 200usec so we don't
;; signal EOI), before asserting CLK again.
jsr iec_wait60us
;; Re-assert CLK line
jsr iec_assert_clk_release_data
;; Do the actual transmission of 8 bits of data
ldx #8
pla
iec_tx_byte_nextbit:
;; Is next bit 0 or 1?
lsr
@@ -40,7 +76,6 @@ iec_tx_byte_l1:
bne -
;; Timeout - DEVICE NOT PRESENT
cli
jmp kernalerror_DEVICE_NOT_FOUND
*
;; All done.