;---------------------------------------------------
; auxmsg
;
; A first program to test the communications setup.
;---------------------------------------------------

	.z80
auxout	equ	4		; BDOS function
conout	equ	2		; /

bdos	equ	5		; BDOS entry

	aseg

	org	100h

	ld	hl,msg		; Point at message
	push	hl		; Precondition stack
emit:
	pop	hl		; Fetch message pointer
	ld	a,(hl)		; Load character
	inc	hl		; Increment pointer
	push	hl		; Save it for next time
	or	a		; Check for terminator
	jr	nz,putc		; Continue if more to go
	rst	0
putc:
	push	af		; Save output character
	ld	e,a		; Send it to the auxiliary
	ld	c,auxout	;  output device
	call	bdos
	pop	af		; Retrieve output character
	ld	e,a		; Send a copy to the console
	ld	c,conout
	call	bdos
	jr	emit		; Loop through message
msg:
	defb	'Hello from the auxiliary output device',13,10,0
	end

