IEC turnaround move to proper (I hope...) places

This commit is contained in:
FeralChild64 committed 2019-07-24 18:02:38 +02:00
1 parent c909f323ce
commit 5b70404563
11 files changed
+77 -38

No files matched your search

+10 -5
View File
@@ -4,6 +4,12 @@
iec_turnaround_to_listen:
;; Store .X and .Y on the stack - preserve them
txa
pha
tya
pha
;; Timing is critical here - execute on disabled IRQs
php
sei
@@ -20,14 +26,13 @@ iec_turnaround_to_listen:
dex
bne -
;; Timeout
;; Timeout - XXX what errors do original Kernal report?
plp
sec
rts
jmp iec_return_DEVICE_NOT_FOUND
;; CLK is pulled by the device, OK
*
plp
clc
rts
jmp iec_return_success
+8 -2
View File
@@ -4,6 +4,12 @@
iec_turnaround_to_talk:
;; Store .X and .Y on the stack - preserve them
txa
pha
tya
pha
;; Timing is critical here - execute on disabled IRQs
php
sei
@@ -19,5 +25,5 @@ iec_turnaround_to_talk:
jsr iec_pull_clk_release_data
plp
clc
rts
jmp iec_return_success
+1 -7
View File
@@ -55,12 +55,6 @@ iec_tx_command:
jmp iec_return_DEVICE_NOT_FOUND
*
;; 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
;; Done
jmp iec_return_success
+20
View File
@@ -0,0 +1,20 @@
;; Routine to finalize these IEC commands which do not end in turnaround
;; Implemented based on https://www.pagetable.com/?p=1135, https://github.com/mist64/cbmbus_doc
iec_tx_command_finalize:
;; Store .X and .Y on the stack - preserve them
txa
pha
tya
pha
;; Give device some time to complete command reception, release ATN,
;; give it some time again before (possible) next command
jsr iec_wait20us
jsr iec_set_idle
jsr iec_wait20us
jmp iec_return_success