Fix logic error on parameters checks

This commit is contained in:
Colin Leroy-Mira
2023-10-12 08:53:05 +02:00
committed by Oliver Schmidt
parent c7db08b4e3
commit 6e0bbb00ee

View File

@@ -334,14 +334,8 @@ SER_OPEN:
ldy #SER_PARAMS::HANDSHAKE ; Handshake ldy #SER_PARAMS::HANDSHAKE ; Handshake
lda (ptr1),y lda (ptr1),y
cmp #SER_HS_HW ; This is all we support cmp #SER_HS_HW ; This is all we support
beq SetupBufs bne InvParam
InvParam:
lda #SER_ERR_INIT_FAILED
ldy #$00 ; Mark port closed
jmp SetupOut
SetupBufs:
; Initialize buffers ; Initialize buffers
ldy #$00 ldy #$00
sty Stopped sty Stopped
@@ -371,10 +365,9 @@ SetupBufs:
ldy #SER_PARAMS::PARITY ldy #SER_PARAMS::PARITY
lda (ptr1),y ; Parity bits lda (ptr1),y ; Parity bits
tay tay
cmp #$FF
beq InvParam
pla pla
ora ParityTable,y ; Get value ora ParityTable,y ; Get value
bmi InvParam
ora #TX_RX_CLOCK_MUL ora #TX_RX_CLOCK_MUL
@@ -406,10 +399,17 @@ SetBaud:
tay tay
lda BaudTable,y ; Get chip value from Low/High tables lda BaudTable,y ; Get chip value from Low/High tables
bpl BaudOK ; Verify baudrate is supported
InvParam:
lda #SER_ERR_INIT_FAILED
ldy #$00 ; Mark port closed
bra SetupOut
BaudOK:
tay tay
lda BaudLowTable,y ; Get low byte lda BaudLowTable,y ; Get low byte
bmi InvParam ; Branch if rate not supported
phy phy
ldy #WR_BAUDL_CTRL ldy #WR_BAUDL_CTRL