Files
super6502/sw/uart.s
Byron Lathi 340f43103a Fix bug where A was overwritten in _uart_txb_block
If you wanted to transmit a value and then check what it was, you can do
that now.
2022-03-14 22:19:19 -05:00

37 lines
615 B
ArmAsm

.include "io.inc65"
.importzp sp, sreg
.export _uart_txb, _uart_txb_block
.export _uart_rxb
.export _uart_status
.autoimport on
.code
; @in A: byte to transmit
; Transmits a byte over the UART
_uart_txb:
sta UART_TXB ; Just write value, don't wait
rts
_uart_txb_block:
pha
sta UART_TXB ; Write value
@1: lda UART_STATUS ; Wait for status[0] to be 0
bit #$01
bne @1
pla
rts
_uart_rxb:
lda UART_RXB ; Read value
ldx #$00
rts
_uart_status:
lda UART_STATUS
ldx #$00
rts