fix(iec): disable IRQs before releasing CLK to send a byte
iec_tx_byte and iec_tx_command released CLK and only then disabled IRQs. An IRQ in between took about 500 cycles, longer than a listener's EOI wait and acknowledgement, so the talker waited for an acknowledgement that had come and gone, and a LOAD over the bus hung after its file name. Which byte an IRQ hit depended on where the build placed the code.
This commit is contained in:
1 parent
93c4932309
commit
b4f334bbbf
2 files changed
+12
-5
No files matched your search
@@ -62,6 +62,14 @@ iec_tx_byte:
|
||||
jsr kernalstatus_DEVICE_NOT_FOUND
|
||||
jmp iec_return_DEVICE_NOT_FOUND
|
||||
@1:
|
||||
; Timing is critical from here on - execute on disabled IRQs, from before
|
||||
; CLK is released: an IRQ between the release and the EOI wait would hide
|
||||
; the listener's EOI acknowledgement, and the transfer would hang
|
||||
; The best practice would be to do PHP first, but it seems this is not
|
||||
; what the original ROM does; furthermore, pushing additional bytes to
|
||||
; stack can wreck autostart software loading at $0100
|
||||
sei
|
||||
|
||||
; Notify all devices that we are going to send a byte
|
||||
; and it is going to be a data byte (released ATN)
|
||||
jsr iec_release_atn_clk_data
|
||||
@@ -72,11 +80,7 @@ iec_tx_byte:
|
||||
|
||||
iec_tx_common:
|
||||
|
||||
; Timing is critical here - execute on disabled IRQs
|
||||
; The best practice would be to do PHP first, but it seems this is not
|
||||
; what the original ROM does; furthermore, pushing additional bytes to
|
||||
; stack can wreck autostart software loading at $0100
|
||||
sei
|
||||
; Entered with IRQs disabled, by iec_tx_byte and iec_tx_command
|
||||
|
||||
; Wait till all receivers are ready, they should all release DATA
|
||||
jsr iec_wait_for_data_release
|
||||
|
||||
@@ -32,7 +32,10 @@ iec_tx_command:
|
||||
; (can be busy processing something), we have to wait till they are all
|
||||
; ready (or bored with DOS attack...)
|
||||
; Release back CLK, keep DATA released - to ask devices for status.
|
||||
; From here on IRQs are disabled, as in iec_tx_byte: a listener takes a
|
||||
; talker that waits too long after the release for EOI
|
||||
|
||||
sei
|
||||
jsr iec_release_clk_data
|
||||
|
||||
; Common part of iec_txbyte and iec_tx_common - waits for devices
|
||||
|
||||
Reference in new issue
Block a user