Move devices into devices folder

This commit is contained in:
Byron Lathi
2022-04-16 21:47:54 -05:00
parent c5f1b64cba
commit 238a4b6f98
17 changed files with 10 additions and 9 deletions

36
sw/devices/uart.s Normal file
View File

@@ -0,0 +1,36 @@
.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