Skip to content

Commit

Permalink
Prevent hang probing for The Cricket! in MAME on IIc/IIc+
Browse files Browse the repository at this point in the history
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 a2stuff/a2d@14e72b7
  • Loading branch information
inexorabletash committed Oct 22, 2023
1 parent 18a7300 commit 01175cf
Showing 1 changed file with 24 additions and 2 deletions.
26 changes: 24 additions & 2 deletions clocks/cricket/cricket.system.s
Original file line number Diff line number Diff line change
Expand Up @@ -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)."
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit 01175cf

Please sign in to comment.