Changed sta (ptr1,x) to sta (ptr1)

Reset serial status on ser_close
Fixed error for saving serial state
This commit is contained in:
Alex Thissen 2024-02-11 23:12:27 +00:00
parent 8b172e05bc
commit 7d6f3d24d4
1 changed files with 5 additions and 4 deletions

View File

@ -76,7 +76,8 @@ SER_CLOSE:
; Disable interrupts and stop timer 4 (serial) ; Disable interrupts and stop timer 4 (serial)
lda #TXOPEN|RESETERR lda #TXOPEN|RESETERR
sta SERCTL sta SERCTL
stz TIM4CTLA ; Disable count and no reload stz TIM4CTLA ; Disable count and no reload
stz SerialStat ; Reset status
; Done, return an error code ; Done, return an error code
lda #SER_ERR_OK lda #SER_ERR_OK
@ -241,8 +242,8 @@ GetByte:
ldy RxPtrOut ldy RxPtrOut
lda RxBuffer,y lda RxBuffer,y
inc RxPtrOut inc RxPtrOut
sta (ptr1)
ldx #$00 ldx #$00
sta (ptr1,x)
txa ; Return code = 0 txa ; Return code = 0
rts rts
@ -288,8 +289,8 @@ PutByte:
SER_STATUS: SER_STATUS:
lda SerialStat lda SerialStat
sta (ptr1)
ldx #$00 ldx #$00
sta (ptr1,x)
txa ; Return code = 0 txa ; Return code = 0
rts rts
@ -327,7 +328,7 @@ SER_IRQ:
and #PAREN ; Parity enabled implies SER_PAR_EVEN or SER_PAR_ODD and #PAREN ; Parity enabled implies SER_PAR_EVEN or SER_PAR_ODD
tay tay
ora #OVERRUN|FRAMERR|RXBRK ora #OVERRUN|FRAMERR|RXBRK
bit SERCTL ; Check presence of relevant error flags in SERCTL and SERCTL ; Check presence of relevant error flags in SERCTL
beq @rx_irq ; No errors so far beq @rx_irq ; No errors so far