Prevent hang probing for The Cricket! in MAME on IIc/IIc+

In MAME, for the SSC in Slot 2, the STATUS flag never comes back with
ready-to-send, so the probe would hang. Introduce a timer, same as on
the receiving side, and timeout instead of hanging.

Similar to 14e72b7384
This commit is contained in:
Joshua Bell 2023-10-22 17:08:34 -04:00
parent 18a73004c4
commit 01175cf573
1 changed files with 24 additions and 2 deletions

View File

@ -89,6 +89,7 @@ init_ssc:
;; Read Cricket ID code: 00 ($00)
lda #0
jsr sendbyte
bcs cricket_not_found ; timeout
;; "The Cricket will return a "C" (195, $C3) followed by a
;; version number (in ASCII) and a carriage return (141, $8D)."
@ -168,12 +169,33 @@ saved_control: .byte 0
;; Write byte in A
.proc sendbyte
tries := $100 * read_delay_hi
counter := $A5
pha
: lda STATUS
lda #<tries
sta counter
lda #>tries
sta counter+1
check: lda STATUS
and #(1 << 4) ; transmit register empty? (bit 4)
beq :- ; nope, keep waiting
bne ready ; yes, ready to write
dec counter
bne check
dec counter+1
bne check
pla
sec ; failed
rts
ready:
pla
sta TDREG
clc
rts
.endproc