fix for infinite loop in iec_rx_byte on empty stream

This commit is contained in:
FeralChild64 committed 2019-07-07 19:01:35 +02:00
1 parent ac1fb40eb6
commit 49d452d07d
2 files changed
+15 -6

No files matched your search

+15 -3
View File
@@ -11,6 +11,9 @@ iec_rx_byte:
;; We can use this routine, since we weren't pulling CLK anyway
jsr iec_release_clk_data
;; Wait till data line is released (someone else might be holding it)
jsr iec_wait_for_data_release
;; Wait for talker to pull CLK.
;; If over 200 usec (205 cycles on NTSC machine) , then it is EOI.
;; Loop iteraction takes 13 cycles, 17 full iterations are enough
@@ -21,14 +24,23 @@ iec_rx_clk_wait:
rol ; 2 cycles, to put BIT_CI2PRA_CLK_IN as the last bit
bpl iec_rx_not_eoi ; 2 cycles if not jumped
dex ; 2 cycles
bne iec_rx_clk_wait ; 3 cycles if jumped
bne iec_rx_clk_wait ; 3 cycles if jumped
;; Timeout - wait for pulled CLK and pull data for 60 usec to confirm
jsr iec_wait_for_clk_pull
;; Timeout - wait a little bit more to see if EOI confirmation is needed
;; (if CLK not pulled within 256 usec - it's not needed, see
;; https://www.pagetable.com/?p=1135, chapters End of Stream and Empty Stream)
jsr iec_wait60us
lda CI2PRA
rol
bmi iec_rx_no_eoi_confirmation
;; Pull data for 60 usec to confirm
jsr iec_release_clk_pull_data
jsr iec_wait60us
jsr iec_release_clk_data
iec_rx_no_eoi_confirmation:
;; Store EOI information in IOSTATUS - XXX this should be done by the caller!
lda IOSTATUS
ora #$40
-3
View File
@@ -111,9 +111,6 @@ sent_filename:
jsr iec_turnaround_to_listen
bcs load_error
jsr printf
.byte "DBG: LOAD 1", $0D, 0
;; Get load address and store it if secondary address is zero
jsr iec_rx_byte
bcs file_not_found_error