Moved tools

This commit is contained in:
2022-09-07 13:11:36 +02:00
parent d3beeb0538
commit ddabf14706
24 changed files with 0 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
; -------------------------------------------------
; uart.inc.jsm
; -------------------------------------------------
; needs xmem-address definition for
; - uart_status (Status register)
; - uart_data (Data register)
UART_TX_EMPTY: equ 0x01
UART_TX_FULL: equ 0x02
UART_TX_CMPL: equ 0x04
UART_RX_PRESENT: equ 0x10
; -------------------------------------------------
; uart_puts
; -------------------------------------------------
; R1 : ptr to string
uart_puts: push R0
u_p_lp: movx R0, (R1)
inc R1
tst R0
jz ex_ugp
call uart_putchar
jmp u_p_lp
ex_ugp: pop R0
ret
; -------------------------------------------------
; uart_putchar
; -------------------------------------------------
; R0 = input
uart_putchar: jmp sout
; -------------------------------------------------
; sout
; -------------------------------------------------
; R0 = input
sout: push R1
sout1: xin R1, (uart_status)
and R1, UART_TX_FULL
jnz sout1
xout (uart_data), R0
pop R1
ret
; -------------------------------------------------
; sin
; -------------------------------------------------
; R0 = output
sin: push R1
sin1: xin R1, (uart_status)
and R1, UART_RX_PRESENT
jnz sin1
xin R0, (uart_data)
pop R1
ret
; -------------------------------------------------