Apple2 SSC: Implement no flow control

This commit is contained in:
Colin Leroy-Mira
2023-10-27 07:07:38 +02:00
committed by Oliver Schmidt
parent 5b47def166
commit 94239525ca

View File

@@ -87,6 +87,7 @@ SendFreeCnt: .res 1 ; Number of free bytes in send buffer
Stopped: .res 1 ; Flow-stopped flag Stopped: .res 1 ; Flow-stopped flag
RtsOff: .res 1 ; Cached value of command register with RtsOff: .res 1 ; Cached value of command register with
; flow stopped ; flow stopped
HSType: .res 1 ; Flow-control type
RecvBuf: .res 256 ; Receive buffer: 256 bytes RecvBuf: .res 256 ; Receive buffer: 256 bytes
SendBuf: .res 256 ; Send buffer: 256 bytes SendBuf: .res 256 ; Send buffer: 256 bytes
@@ -276,13 +277,15 @@ NoDev: lda #SER_ERR_NO_DEVICE
; Check if the handshake setting is valid ; Check if the handshake setting is valid
AciaOK: ldy #SER_PARAMS::HANDSHAKE AciaOK: ldy #SER_PARAMS::HANDSHAKE
lda (ptr1),y lda (ptr1),y
cmp #SER_HS_HW ; This is all we support cmp #SER_HS_SW ; Not supported
beq HandshakeOK bne HandshakeOK
lda #SER_ERR_INIT_FAILED lda #SER_ERR_INIT_FAILED
bne Out bne Out
HandshakeOK: HandshakeOK:
sta HSType ; Store flow control type
ldy #$00 ; Initialize buffers ldy #$00 ; Initialize buffers
sty Stopped sty Stopped
sty RecvHead sty RecvHead
@@ -473,11 +476,14 @@ SER_IRQ:
bcc Flow ; Assert flow control if buffer space low bcc Flow ; Assert flow control if buffer space low
rts ; Interrupt handled (carry already set) rts ; Interrupt handled (carry already set)
Flow: ldx Index ; Assert flow control if buffer space too low Flow: lda HSType ; Don't touch if no flow control
beq IRQDone
ldx Index ; Assert flow control if buffer space too low
lda RtsOff lda RtsOff
sta ACIA_CMD,x sta ACIA_CMD,x
sta Stopped sta Stopped
sec ; Interrupt handled IRQDone:sec ; Interrupt handled
Done: rts Done: rts
;---------------------------------------------------------------------------- ;----------------------------------------------------------------------------