; Port Direction Function
;hex dez
;-------------------------------------------------------------------------
-;00 0 in - Con status.
+;00 0 in - Con status. (deprecated)
; Returns 0xFF if the UART has a byte, 0 otherwise.
;01 1 in/out - Console input, aka UDR. / Console Output
;02 2 out - Console Output (deprecated)
-;03 3 in - "UART" status: bit 0 = rx, bit 1 = tx
-;04 4 in - "UART" data register, no wait
+;03 3 in - "UART" status: bit 0 = rx (UARTRXRDY)
+; bit 1 = tx (UARTTXRDY)
+;03 3 out - "UART" control (tbd)
+;04 4 in/out - "UART" data register, no wait
;
;------------------------ Virtual I2C interface --------------------------
;05 5 out - Control Port: 1 = Start read operation
.cseg
vport_tbl:
- .db 00,1 ;Port 0, length 1
+ .db 00,1 ;Port 0, length, 1 deprecated
.dw conStatus ; in
.dw dbgOut ; out
- .db 01,1
- .dw uartgetc
- .dw uartputc
- .db 02,1 ;Port 2 (old console output)
- .dw uartgetc ; filler
- .dw uartputc ; deprecated
- .db 03,1
+
+ .db UARTDR,1 ;Port UARTDR, length 1
+ .dw uartgetc ; in
+ .dw uartputc ; out
+
+; .db 02,1 ;Port 2 (old console output)
+; .dw uartgetc ; filler
+; .dw uartputc ; deprecated
+
+ .db UARTCSR,1
.dw uartstat
.dw vport_out_dummy
+
.db 04,1
.dw uartin
.dw uartout
vport_out_dummy:
ret
+;---------------------------------------------------------------------
+
uartstat:
clr temp
lds temp2,rxcount
cpse temp2,_0
- sbr temp,0x01
+ sbr temp,UARTRXRDY
lds temp2,txcount
cpi temp2,TXBUFSIZE
breq uartst_1
- sbr temp,0x02
+ sbr temp,UARTTXRDY
uartst_1:
ret