Add basic UART driver

This didn't have a chance to get tested so I hope it works.

There is not fancy stuff here, just write to the register and wait till
it is done.
This commit is contained in:
Byron Lathi
2022-03-14 00:24:08 -05:00
parent b48438f6b2
commit 0b5ccf48b8
3 changed files with 46 additions and 1 deletions

29
sw/uart.s Normal file
View File

@@ -0,0 +1,29 @@
.include "io.inc65"
.importzp sp, sreg
.export _uart_txb
.export _uart_txb_block
.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:
sta UART_TXB ; Write value
@1: lda UART_STATUS ; Wait for status[0] to be 0
bit #$01
bne @1
rts
_uart_status:
lda UART_STATUS
ldx #$00
rts