.progid test,0,0
.ident test
statport=	0b8h
rda	=	1	;0 == true,
tbe	=	2	;0 == true,
inport	=	0b9h
outport	=	0b9h
;
;Invoke the tests in the 8086.
;
test:	call	reset		;reset it,
	call	inp		;get $boot,
	mvi	a,0f8h		;test command,
	call	outp
t1:	call	inp		;just echo bytes,
	cpi	0
	jz	0
	call	conout
	jmp	t1
;
;Get a byte from the 8086.
;
inp:	in	statport
	ani	rda
	jnz	inp
	in	inport
	ret
;
;Send a byte to the 8086.
;
outp:	push	psw
op1:	in	statport
	ani	tbe
	jnz	op1
	pop	psw
	out	outport
	ret
;
;Reset the 8086.
;
reset:	mvi	a,1		;stop/reset,
	out	statport
	xthl			;short delay,
	xthl			;slow instruction.
	mvi	a,0
	out	statport	;run,
	in	inport		;flush garbage,
	ret
;
;Send a byte to CP/M.
;
conout:	mov	e,a
	mvi	c,2
	call	5
	ret


	.end	test
                                                                                           
