Routines for the SCI of the 68HC11 (in assembler)

The receive and transmit routines intentionally do NOT use indexed addressing with IX, since in my application it is occupied.
If the index register IX in your code already is set to the I/O base address however, you could save a few bytes by using indexed addressing.
sci.s

	include "hc11regs.i"

; ---------------------------------------------------------------------------
; Function	sci_init
; Description	
; Last update	
; Code size	
; ---------------------------------------------------------------------------

sci_init:


; ---------------------------------------------------------------------------
; Function	sci_rxd
; Description	Receive 1 byte (returned in accu A)
; Last update	2005-10-16
; Code size	11 bytes (15 bytes with error handling)
; ---------------------------------------------------------------------------

sci_rxd:
	ldaa	REGBASE+SCSR
;	bita	#%00001010		; OV or FE bits set ?
;	bne	error_handler
	anda	#%00100000		; RDRF bit set ?
	beq	sci_rxd
	ldaa	REGBASE+SCDR
	rts

; ---------------------------------------------------------------------------
; Function	sci_txd
; Description	Transmit 1 byte (in accu A) as soon as transmitter is ready
; Last update	2005-10-16
; Code size	9 bytes
; ---------------------------------------------------------------------------

sci_txd:
	tst	REGBASE+SCSR
	bpl	sci_txd			; wait until TDRE bit set
	staa	REGBASE+SCDR
	rts