;written by herbert simplex.
;for the osborne executive.
BDOS	EQU	05H
CR	EQU	0DH	;carriage return
LF	EQU	0AH	;line feed
FCB1	EQU	05DH
FCB2	EQU	05EH
FCB3	EQU	05FH
FCB4	EQU	060H
	EXTRN	HLDCUR,BD006D,SCRN1,BD001,BD002,DECODE,SNDESC
	ORG	100H
;sets up user stack
START:	LXI	H,0	;clear hl
	DAD	SP	;get current stack pointer
	SHLD	OLDSP	;save it
	LXI	SP,STKTOP ;put in new stack pointer
	LDA	FCB1	;put passed character in register a
	CPI	20H	;is it equal to space?
	JZ	MENU	;yes. bring up menu
	CALL	DECODE
	LDA	FCB2
	CPI	20H
	JZ	DONE
	CALL	DECODE
	LDA	FCB3
	CPI	20H
	JZ	DONE
	CALL	DECODE
	LDA	FCB4
	CPI	20H
	JZ	DONE
	CALL	DECODE
	JMP	DONE
MENU:	CALL	SCRN1
GETSEL:	CALL	HLDCUR	;position cursor
	XRA	A	;clear flags and accumulator
	CALL	BD001	;read selection from console.
	CALL	DECODE
	CPI	'Q'	;was quit selected?
	JZ	DONE	;yes, go home.
	CPI	'?'	;error detected?
	JZ	ERRIN
	JMP	GETSEL	;get next character from console
ERRIN:	CALL	HLDCUR
	MVI	E,'?'	;indicate error
	CALL	BD002
	JMP	GETSEL	;back to selection
DONE:	LHLD	OLDSP	;restore old stack pointer
	SPHL
	JMP	0000H
OLDSP	DS	2	;old stack pointer
	DS	48	;new stack
STKTOP:			;new stack starts here
	END
