diff --git a/src/kernal/iec/iec_tx_byte.s b/src/kernal/iec/iec_tx_byte.s index 014dca9e..ef0efffd 100644 --- a/src/kernal/iec/iec_tx_byte.s +++ b/src/kernal/iec/iec_tx_byte.s @@ -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 diff --git a/src/kernal/iec/iec_tx_command.s b/src/kernal/iec/iec_tx_command.s index 3e4a223d..c8b19295 100644 --- a/src/kernal/iec/iec_tx_command.s +++ b/src/kernal/iec/iec_tx_command.s @@ -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