;	NECSET.ASM
;       		by david arkush, 11/84
;
;	PROGRAM TO SET A NEC-8023 OR C.ITOH
;	PROWRITER PRINTER VIA KEYBOARD INPUT.
;
;	INPUT IS TERMINATED BY A CARRIAGE RETURN.
;
	ORG	100H
BDOS	EQU	0005H
CR	EQU	000DH	;CARRIAGE RETURN
LF	EQU	000AH	;LINE FEED
TAB	EQU	0009H	;TAB CHARACTER
CLRSCR	EQU	001AH	;CLEAR SCREEN - CTRL Z 
;
	LXI	SP,STACK	;SET UP STACK
	LXI	D,MESSAGE	;POINT TO MESSAGE
	MVI	C,9		;PRINT STRING FUNCTION
	CALL	BDOS
;
LOOP	MVI	C,1		;CONSOLE INPUT FUNCTION
	CALL	BDOS		;GET CHARACTER
	CPI	3		;TEST FOR ^C
	JZ	0		;IF YES, QUIT
	MOV	E,A		;ELSE MOVE IT TO E
	PUSH	D		;SAVE IT
	MVI	C,5 		;SEND TO PRINTER
	CALL 	BDOS		;
	POP	D		;GET IT BACK
	MOV	A,E 
	CPI	01BH		;TEST FOR ESC.
	JNZ	LOOP		;IF NOT, GET ANOTHER CHAR.
;
	LXI	D,ESCMSG	;IF YES, ECHO ESCMSG TO SCREEN
	MVI	C,9		;PRINT STRING FUNCTION
	CALL	BDOS
	JMP 	LOOP
ESCMSG	DB	'<esc>$'
;
MESSAGE	DB	CLRSCR,TAB,'NEC-8023 PRINTER FUNCTIONS',TAB,TAB,'[r.d.arkush, 11/84]',CR,LF,LF
	DB	'<esc>N  	= Pica (10 characters per inch)',CR,LF
	DB	'<esc>E  	= Elite (12 characters per inch)',CR,LF
	DB	'<esc>P  	= Proportional type'	,CR,LF
	DB	'<esc>Q  	= Condensed (17 characters per inch)',CR,LF,LF
	DB	'<esc>!  	= Enhanced print'	,CR,LF
	DB	'<esc>"  	= Non-enhanced'		,CR,LF
	DB	'  ^N    	= Double width characters',CR,LF
	DB	'  ^O    	= Normal   "        "'	,CR,LF,LF
	DB	'<esc>Lnnn	= Left margin at nnn (e.g., <esc>L008 for 8 spaces in)',CR,LF
	DB	'<esc>A  	= 6 Lines per inch (normal) line spacing',CR,LF
	DB	'<esc>B   	= 8 Lines per inch line spacing',CR,LF
	DB	'<esc>Tnn 	= Line height of nn/144s of an inch',CR,LF,LF
	DB	TAB,'Be sure to use capitals where indicated.',CR,LF
	DB	TAB,'Turn on printer.',CR,LF
	DB	TAB,'Press ^C to quit.',CR,LF,LF
	DB	'==> $'
;
;	STACK AREA	
;
	DS	10H
STACK
;
	END
TAB,'Turn on printer.',CR,LF
	DB	TAB,'Press ^C to quit.',CR,LF,LF
	DB	'==> $'
;
;	STACK AREA	
;
	DS	