From 53add429a95daa3a7026d535b793f33a584a9376 Mon Sep 17 00:00:00 2001 From: Gale Faraday Date: Fri, 26 Sep 2025 13:52:31 -0500 Subject: [PATCH] fix(serial): now returning read status codes from polled char input --- src/serial.s | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/serial.s b/src/serial.s index 6c35585..5da47c9 100644 --- a/src/serial.s +++ b/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