
 lib environment
 lib acia
 data
 sttl System console Code - ACIA
 pag
 name sys_acia
 global systpc,sysrtt,sysbrg,sys_acia,sysgetc

sys_acia equ $0001
*
* These are non-interrupt output routines for the system
* console.
*

*
* systpc
*
* Output the character in A.  X points to the port.  All
* registers should be preserved.
*

systpc pshs a save a reg
2 lda 0,x get acia status
 bita #ACTBSY xmit busY?
 beq 2b
 puls a get character
 sta 1,x output char
 rts return

*
* sysgetc
*
* Read a character (& echo) into the A register
*
sysgetc pshs x save register
 ldx scon get system console address
00 lda 0,x get status
 bita #ACRBSY character present?
 beq 00b
 lda 1,x read character
 anda #$7F strip parity
 puls x,pc return


*
* sysrtt
*
* Reset the console port.  X points to port.  Preserve all but A reg.
*

sysrtt lda #$03 reset code
 sta 0,x
 lda #$15 config byte
 sta 0,x
 rts return


*
* sysbrg
*
* Setup baud rates.  Y points to receive baud rate, U points to xmit.
* A has configuration byte.  Preserve all regs but A.
*

sysbrg sta 0,y
 sta 0,u
 rts return
