fix(serial): now returning read status codes from polled char input
This commit is contained in:
11
src/serial.s
11
src/serial.s
@@ -85,14 +85,15 @@ END@
|
||||
|
||||
; Reads a char in polled mode non-FIFO mode (INITUART state).
|
||||
; A: Filled with char from RX buffer or NUL ($00) if no char is ready
|
||||
; B: Filled with LSR status codes masked with $9F
|
||||
PINCHAR
|
||||
lda UART_LSR ; See if a char is ready
|
||||
ldb UART_LSR ; See if a char is ready
|
||||
; Mask of possible UART error codes | data ready flag ($9F)
|
||||
anda #(UARTF_LSR_DR|UARTF_LSR_OE|UARTF_LSR_PE|UARTF_LSR_FE|UARTF_LSR_BI|UARTF_LSR_FIFO)
|
||||
bita #UARTF_LSR_DR
|
||||
andb #(UARTF_LSR_DR|UARTF_LSR_OE|UARTF_LSR_PE|UARTF_LSR_FE|UARTF_LSR_BI|UARTF_LSR_FIFO)
|
||||
bitb #UARTF_LSR_DR ; Check for char
|
||||
beq NOCHAR@
|
||||
lda UART_RBR ; Pull char from RX buffer
|
||||
lda UART_RBR ; Pull char from RX buffer
|
||||
rts
|
||||
NOCHAR@
|
||||
clra ; Fill A with '\0'.
|
||||
clra ; Fill A with '\0'.
|
||||
rts
|
||||
|
Reference in New Issue
Block a user