	TITLE	'ERGO ergo printer mode pgm'
;
; The ergo hush 80 printer program this
; program sets the hush 80 print modes
; it is not for sale but can be shared 
; as long as a profit is not made on it
;
; copyright 1985  Troy Soult
;		  P.O. Box 620340
;		  Woodside,Ca.
;			94062
;
; the equate table
bdos	equ	05h
boot	equ	00h
prnt	equ	05h
scrn	equ	09h	
cr	equ	0DH
lf	equ	0ah
reset	equ	'@'
esc	equ	1bh
;
; the start of the program
	org	0100h		; The begining of TPA
	lxi	d,menu		; location of the menu
	call    print		; Print it to screen
input:  mvi	c,06h		; the direct I/O call
	mvi	e,0ffh		; to get char's from
	call	bdos		; the keyboard.
	cpi	03		; compare for ^c
	jz	quit		; if got exit the pgm
	cpi	31h		; is it a "1" then
	jz	conon		; set printer for condensed
	cpi	34h		; is it a "4" then 
	jz	conoff		; turn off condensed
	cpi	32h		; is it a "2" then
	jz	expon		; turn expanded print
	cpi	35h		; is it a "5" then
	jz	expoff		; turn off expanded
	cpi	33h		; is it a "3" then
	jz	invon		; turn on inversed
	cpi	36h		; is it a "6" then
	jz	invoff		; turn off inversed
	cpi	30h		; is it a "0" then
	jz	resetp		; reset the printer
	jmp	input		; nothing try again
;
menu:	db 	1ah,lf,lf,cr		; the main menu
	db	'   HUSH 80 printer pgm'; that is displayed
	db	lf,cr,'       Version 1.0'
	db	lf,lf,lf,cr		; at the signon
	db	'1 for Condensed'
	db	cr,lf
	db	'2 for Expanded'
	db	cr,lf	
	db	'3 for Inverse'
	db	cr,lf
	db	'4 for Condensed off'
	db	cr,lf	
	db	'5 for Expanded off'
	db	cr,lf	
	db	'6 for Inverse off'
	db	cr,lf
	db	'0 to Reset to defaults'
	db	cr,lf,lf
	db	' ^C to Exit'
	db	cr,lf
	db	cr,lf,lf 
	db	lf,' Make Selection    :'
	db	'$'
quit:	call	clrscrn		; the exit routine
	jmp	0000h

;
conon:	mvi	e,0fh	; the condensed mode
	call    print	; selection routine
        lxi	d,conmsg
	call    shwmsg
;
conoff:	mvi	e,12h	;the routine to turn
	call    print	;to turn it off (condensed) 
	lxi	d,coffmsg
	call    shwmsg
;
expon:	call    escape		; escape routine
	mvi	e,57h		; load a "w" to printer
	call    print		; print it
	mvi	e,31h		; now a "1" 
	call    print		; print it too
	lxi	d,eonmsg	; now load msg
	call    shwmsg		; print it
;
expoff:	call    escape
	mvi	e,57h
	call	print
	mvi	e,30h
	call	print
	lxi	d,eoffmsg
	call    shwmsg
invon:	call	escape
	mvi	e,'I'
	call	print
	mvi	e,31h
	call	print
	lxi	d,ionmsg
	call	shwmsg
invoff: call	escape
	mvi	e,'I'
	call	print
	mvi	e,30h
	call	print
	lxi	d,ioffmsg
	call	shwmsg
resetp: call	escape
	mvi	e,'@'
	call	print
	lxi	d,rstmsg
	call	shwmsg
shwmsg: mvi	c,scrn		; the rountine to show 
	call	bdos		; messages to the screen
	call	clrscrn
	jmp	boot
escape:	mvi	e,esc		; send a escape to the printer
	mvi	c,prnt
	call	bdos
	ret
print:	mvi	c,prnt		; sends the char in "e"
	call	bdos		; to the printer
	ret
clrscrn:lxi	d,clear		; this clears the screen 
	mvi	c,9		; and exits 
	call	bdos
	ret
clear:	db	1ah,'$'
;
conmsg: db	lf,cr,'condensed print selected','$' ;the following are 
;
coffmsg:db	lf,cr,'condensed print deselected','$' ; the messages used for 
;
eonmsg:	db	lf,cr,'expanded print selected','$'  ; identifing the selection
;
eoffmsg:db	lf,cr,'expanded print selected','$'
;
ionmsg:	db	lf,cr,'inverse print selected','$'
;
ioffmsg:db	lf,cr,'inverse print delselected','$'
;
rstmsg:	db	lf,cr,'printer default reset','$'
;
	end



