; ******* System Options - SINGER *********
base	equ	1c00h
suspend equ	0109h	; Block task voluntarily
vdu	equ	010fh	; A -> Screen
testm	equ	0112h	; Z: Mainframe -> A
put	equ	0115h	; A -> Mainframe
putt	equ	011bh	; A -> Telecomms
listen	equ	0127h	; Z = Mainframe -> A
user	equ	0154h	; KYBD User Exit Routine
trace	equ	017eh	; A -> screen if [SF1] lit
;
djnz	equ	00010h
ldir	equ	0b0edh
;
nul	equ	00h
stx	equ	02h
etx	equ	03h
enq	equ	05h
bel	equ	07h
bs	equ	08h
lf	equ	0ah
ff	equ	0ch
cr	equ	0dh
so	equ	0eh
si	equ	0fh
can	equ	18h
esc	equ	1bh
rs	equ	1eh
;
ctl	equ	01d0h	; System Control Block
flags	equ	ctl+18	; B0: LOGON busy
;
	org	base
	lxi	h,screen  !shld 014fh
	lxi	h,input   !shld 016dh
	lxi	h,echo	  !shld 0173h
	ret
;
; A -> Singer--
echo	push	psw !cpi ' ' !jnc ec0 !cpi esc !jc ec1
	adi	'0'-esc !call putr !mvi a,rs
ec0	call	putr !pop psw !ret
ec1	cpi	etx !jnz $+5 !mvi a,enq !cpi stx !cnz putr !pop psw !ret
putr	call	put !ori 80h !jmp trace
;
; Variable length field from Mainframe -> (HL)--
input	shld	savehl !call term
in1	mvi	a,cr !call trace !mvi a,lf !call trace !mvi a,'[' !call trace
	lhld	savehl !lxi b,0
in2	call	get !cpi stx !jz in1	; restart
	cpi	cr !jz in3 !mov m,a !inx h !inx b !call trace !jmp in2
in3	mvi	a,']' !call trace !mov a,b !ora c !ret
;
tm1	ora	a !jpe $+5 !ori 80h !call putt !ani 7fh ; send even parity
tm0	call	screen !dcr b !cz suspend !jnz term+2
term	mvi	b,8 !call get !lxi h,flags !dw 046cbh ; BIT 0,(HL) ; LOGON?
	jnz	tm1 !cpi stx !rz !jmp tm0	; wait for STX
;
get	call	testm !rz !call suspend !jmp get
;
screen	cpi	' ' !jnc vdu
	cpi	cr !jz sc1 !cpi lf !jz vdu
	cpi	bs !jz vdu !cpi bel !jz vdu
	cpi	so !jz sc2 !cpi si !jz sc3
	cpi	can !rnz		; ignore other codes
	push	psw !mvi a,ff !call vdu !mvi e,'=' !call esce ; Clear Screen
	mvi	a,33 !call vdu !mvi a,32 !call vdu !pop psw !ret
sc1	push	psw !mvi a,lf !call vdu !pop psw !jmp vdu
sc2	mvi	e,'0' !jmp esce 	; start Highlight
sc3	mvi	e,'1'			; end Highlight
esce	push	psw !mvi a,esc !push d !call vdu !pop d !jmp $+4
vdue	push	psw !mov a,e !call vdu !pop psw !ret
;
savehl	ds	2
	end	base

The QX10 Archive