home *** CD-ROM | disk | FTP | other *** search
- ;
- ; PSET16.ASM - 7 July 1986
- ;
- ; Version 1.6a - 17 Jul 86 - I found a bug in the code that could
- ; have caused a problem on exit of the program. This revision
- ; fixes that bug. Also fixed minor bug in form length setting
- ; code. - Barron McIntire
- ;
- ; Version 1.6 - 7 Jul 86 - I have added an equate for the Citizen
- ; MSP-20. I have also changed the menu to display
- ; only when the program is first called up. A '?' option has
- ; been added to re-display the menu. Also added a command line
- ; parsing routine. This allows you to skip the interactive mode
- ; completely. Thus, entering PSET (assuming that you have renamed
- ; this to PSET.COM) will enter interactive mode, but entering
- ; PSET A V 32 B will initialize the printer, set the left margin at
- ; column 32, set elite mode on, and then return to DOS. Spaces
- ; may be inserted for readability, but are not necessary between
- ; commands, as the program ignores them. Spaces ARE required,
- ; however, to end decimal numbers. Thus, PSET V32 B is valid,
- ; but PSET V32B is not. PSET V 3 2 B will set the left margin at
- ; column 3, set proportional printing off (for MSP-20), and then
- ; set elite mode on. The point is, be careful of spaces following
- ; numbers. An erroneous character in the command line will cause
- ; PSET to generate an error message and stop processing at the point
- ; where it found the error. All previous commands will be
- ; acted upon. - Barron McIntire
- ;
- ; Version 1.5 - 25 Aug 85 - I finally received the complete user
- ; guide for my citizen printer and found that it had a 160 column
- ; compressed elite mode. This version adds this under the citizen
- ; equate. - Barron McIntire
- ;
- ; Version 1.4 - 28 Jul 85 - I have added an equate for the Gemini
- ; printers, as it appears that they are not totally Epson compatible.
- ; insure that both Citizen and Gemini equates are not both set at
- ; the same time. - Barron McIntire
- ;
- ; Version 1.3 - 1 Mar 85 - I traded my Epson RX-80 in on a Citizen
- ; MSP-10, and found that it did not release the last line when the
- ; off-line switch was pressed. I have therefore added an option to
- ; generate a cr,lf. this replaces the one-line enlarged mode which
- ; didn't work anyway. I have also added an equate for the Citizen
- ; printer which will add the correspondence quality mode. Setting
- ; this to false will keep the Epson compatibility. - Barron McIntire
- ;
- ; Version 1.2 - 6 Jan 85 - I have added the superscript and subscript
- ; modes, as they can create some very fine printing when permanently
- ; set, if somewhat slow. (Try condensed mode, superscript mode, and
- ; 5/72 inch line spacing.) - Barron McIntire
- ;
- ; Version 1.1 - 12/9/84 - This is one of the nicest and most generic
- ; epson menus. My only contribution was to add the appropriate mask
- ; byte wherever required to allow selection via lower case as well
- ; upper case letters. It seems to run fine on a kaypro 4-84 under
- ; ZCPR3 with a Mannesmann-Talley Spirit 80 printer. - Bruce Morgen
- ;
- ;---------------------------------------------------------------------------
- ;
- ; Version 1.0 - 5 November 1983
- ;
- ; This program will allow the operator to pre-set certain printer
- ; states. The printer will remain in these states until the printer
- ; power is recycled, or the printer is directed into another state
- ; by program control.
- ;
- ; This program was originally written in Mbasic, and translated into
- ; asm code for speed and ease of use.
- ;
- ; This program was written for the Epson RX-80 and Heath CP/M 2.2.03.
- ; It has since been found to work with Heath CP/M 2.2.04 and Kaypro
- ; CP/M 2.2xx, and should work with any Epson compatible printer.
- ;
- ; Written by: Barron F. McIntire III
- ; 3400 S. Greeley Hwy #8
- ; Cheyenne, Wyoming 82007
- ; R.A.S. Phone 307-635-8366, 300/1200 baud, 24 hours
- ; Compuserve ID 74155,441
- ;
- ; define cp/m routines
- ;
- boot equ 0 ;bottom of memory
- bdos equ boot+5 ;jump to cp/m bdos
- tpa equ boot+100h ;transient program area
- conin equ 1 ;console input function
- conout equ 2 ;console output function
- lstout equ 5 ;printer output function
- linout equ 9 ;text output function
- ;
- ; misc equates
- ;
- no equ 0 ;for conditional assembly
- yes equ not no ;(=0ffffh usually, not 0ffh)
- ver equ '1'
- modlev equ '6'
- cr equ 13
- lf equ 10
- bel equ 7
- esc equ 27
- clptr equ 81h ;pointer to current command line position
- clscr equ yes ;yes if you wish screen clear at start
- ;patch your clear screen data at clr below
- ;
- ; +++++ IMPORTANT NOTE +++++
- ;
- ; printer equates - insure that no more than one of these equates
- ; is true, as unpredictable results may occur
- ;
- epson equ no ;yes for Epson printers
- gemini equ no ;yes for Gemini printers
- msp10 equ no ;yes for Citizen MSP-10 printers
- msp20 equ yes ;yes for Citizen MSP-20 printers
- ;
- org tpa
- ;
- ; set up stack
- ;
- start
- lxi h,0 ;zero hl reg
- dad sp ;set hl to stack pointer
- lxi sp,stack ;set our stack pointer
- push h ;save cp/m's stack pointer on ours
- ;
- ; parse command line
- ;
- lxi h,80h ;set hl to cpm command line buffer
- mov a,m ;get char count in a reg
- cpi 0 ;is char count 0?
- jz openms ;no command line - go run pset with menu
- inr a ;add one to a (parse starts by sub one)
- sta ccount ;save character count +1
- shld cladr ;save hl register
- mvi a,1
- sta clflg ;store 1 in command line flag
- call clprs ;go parse command line
- jmp cpopt ;skip option input, we already have it
- ;
- openms
- mvi a,0
- sta clflg ;store 0 in command line flag
- ;
- ; display opening message
- ;
- if clscr ;clear screen
- lxi d,clr ;point to clear screen data
- mvi c,linout ;get linout function
- call bdos ;clear the screen
- endif
- ;
- lxi d,messg ;point to opening message
- mvi c,linout ;get linout function
- call bdos ;print the message
- ;
- ; display menu
- ;
- mnudis
- lxi d,mnumes ;point to menu message
- mvi c,linout ;get linout function
- call bdos ;print the message
- ;
- ; ask for option
- ;
- optdis
- lxi d,optmes ;point to options message
- mvi c,linout ;get linout function
- call bdos ;print the message
- ;
- ; input option
- ;
- optin
- mvi c,conin ;get menu option
- call bdos ;get character
- cpi 'a' ;less than 'a'?
- jc cont2 ;don't mask if not lower case
- cpi 'z' ;greater then 'z'?
- jnc cont2 ;skip mask
- ani 5fh ;mask to upper case (b.m. - 12/84)
- cont2
- push psw ;save a reg
- mvi c,conout ;get conout function
- mvi e,cr ;get cr char
- call bdos ;send it
- mvi c,conout ;get conout function
- mvi e,lf ;get lf char
- call bdos ;send it
- pop psw ;get a reg back
- ;
- ; compare option
- ;
- cpopt
- push psw ;save input
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz cpopt1 ;press on if so
- pop psw ;get original character back
- cpi 20h ;space?
- jnz cpopt2 ;no, go process it
- call clprs ;else, get another character
- jmp cpopt ;go again
- cpopt1
- pop psw ;get original character back
- cpopt2
- cpi '?'
- jz mnudis
- cpi '#'
- jz exit
- cpi 'A'
- jz opt1
- cpi 'B'
- jz opt2
- cpi 'C'
- jz opt3
- cpi 'D'
- jz opt4
- cpi 'E'
- jz opt5
- cpi 'F'
- jz opt6
- cpi 'G'
- jz opt7
- cpi 'H'
- jz opt8
- cpi 'I'
- jz opt9
- cpi 'J'
- jz opt10
- cpi 'K'
- jz opt11
- cpi 'L'
- jz opt12
- cpi 'M'
- jz opt13
- cpi 'N'
- jz opt14
- cpi 'O'
- jz opt15
- cpi 'P'
- jz opt16
- cpi 'Q'
- jz opt17
- cpi 'R'
- jz opt18
- cpi 'S'
- jz opt19
- cpi 'T'
- jz opt20
- cpi 'U'
- jz opt21
- cpi 'V'
- jz opt22
- cpi 'W'
- jz opt23
- cpi 'X'
- jz opt24
- ;
- if msp10 or msp20
- cpi 'Y'
- jz opt25
- cpi 'Z'
- jz opt26
- endif
- if msp20
- cpi '0'
- jz opt27
- cpi '1'
- jz opt28
- cpi '2'
- jz opt29
- cpi '3'
- jz opt30
- endif
- ;
- ; error if no compare
- ;
- erdis
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz erdis2 ;then run normal error message
- lxi d,emessx ;else get command line error message
- mvi c,linout ;get linout function
- call bdos ;send to user
- jmp exit ;exit to DOS
- erdis2
- lxi d,emess ;point to error message
- mvi c,linout ;get linout function
- call bdos ;ask if exit is desired
- mvi c,conin ;get conin function
- call bdos ;get the character
- ani 5fh ;mask to upper case (b.m. - 12/84)
- push psw ;save a reg
- mvi c,conout ;get conout function
- mvi e,cr ;get carriage return char
- call bdos ;output to crt
- mvi c,conout ;get conout function
- mvi e,lf ;get line feed
- call bdos ;output to crt
- pop psw ;get a reg
- cpi 'Y' ;is it yes?
- jz exit ;then exit to cp/m
- jmp optdis ;otherwise re-display options
- ;
- ; printer initialization
- ;
- opt1
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'@' ;get printer reset char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; elite-sized character setting
- ;
- opt2
- call escap ;send escape character to printer
- if gemini
- mvi c,lstout ;get lstout function
- mvi e,'B' ;get elite first char
- call bdos ;send to printer
- mvi c,lstout ;get lstout char
- mvi e,2 ;get lstout second char
- call bdos ;send to printer
- endif
- if not gemini
- mvi c,lstout ;get lstout function
- mvi e,'M' ;get elite char
- call bdos ;send to printer
- endif
- jmp more ;another option?
- ;
- ; pica-sized character setting
- ;
- opt3
- call escap ;send escape character to printer
- if gemini
- mvi c,lstout ;get lstout function
- mvi e,'B' ;get pica first char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- mvi e,1 ;get pica second char
- call bdos ;send to printer
- endif
- if not gemini
- mvi c,lstout ;get lstout function
- mvi e,'P' ;get pica char
- call bdos ;send to printer
- endif
- jmp more ;another option?
- ;
- ; enlarged mode
- ;
- opt4
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'W' ;get enlarged mode first char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- mvi e,1 ;get enlarged mode second char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; send cr,lf to printer
- ;
- opt5
- mvi c,lstout ;get lstout function
- mvi e,cr ;get carriage return char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- mvi e,lf ;get line feed char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; condensed mode
- ;
- opt6
- mvi c,lstout ;get lstout function
- mvi e,15 ;get condensed mode char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; emphasized and enlarged mode
- ;
- opt7
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'E' ;get emphasized mode char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- mvi e,esc ;get escape character
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- mvi e,'W' ;get enlarged mode first char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- mvi e,1 ;get enlarged mode second char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; emphasized mode
- ;
- opt8
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'E' ;get emphasized mode char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; double-strike mode
- ;
- opt9
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'G' ;get double-strike mode char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; alternate character set (italics)
- ;
- opt10
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'4' ;get alernate char set char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; underline mode
- ;
- opt11
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'-' ;get underline mode first char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- mvi e,1 ;get underline mode second char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; ignore paper end detector
- ;
- opt12
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'8' ;get ignore paper end mode char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; unidirectional printing
- ;
- opt13
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'U' ;get unidirectional printing first char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- mvi e,1 ;get unidirectional printing second char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; 7/72 inch line spacing
- ;
- opt14
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'1' ;get 7/72 inch line spacing mode char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; 1/16 inch line spacing
- ;
- opt15
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'2' ;get 1/16 inch line spacing mode char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; 1/8 inch line spacing
- ;
- opt16
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'0' ;get 1/8 inch line spacing mode char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; n/72 inch line spacing
- ;
- opt17
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz o17a ;press on if so
- jmp o17b ;else skip asking for data
- o17a
- lxi d,mes17 ;point to message
- mvi c,linout ;get linout function
- call bdos ;print the message
- o17b
- call decin ;decimal input routine
- mov a,e ;save low byte in accumulator
- cpi 00h ;check for error
- jnz o17c ;press on if not
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz opt17 ;let user re-input
- jmp erdis ;else display error message and exit
- o17c
- push psw ;save a reg
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'A' ;get n/72 inch line spacing char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- pop psw ;get a reg
- mov e,a ;get n
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; n/216 inch line spacing (n/144 for gemini)
- ;
- opt18
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz o18a ;press on if so
- jmp o18b ;else skip asking for data
- o18a
- lxi d,mes18 ;point to message
- mvi c,linout ;get linout function
- call bdos ;print the message
- o18b
- call decin ;decimal input routine
- mov a,e ;save low byte in accumulator
- cpi 00h ;check for error
- jnz o18c ;press on if not
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz opt18 ;let user re-input
- jmp erdis ;else display error message and exit
- o18c
- push psw ;save a reg
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'3' ;get n/216 inch line spacing char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- pop psw ;get a reg
- mov e,a ;get n
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; form length setting
- ;
- opt19
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz o19a ;press on if so
- call clprs ;get input from command line
- cpi 20h ;valid character?
- jz opt19 ;then get another
- jmp o19b ;skip asking for data
- o19a
- lxi d,mes19 ;point to message
- mvi c,linout ;get linout function
- call bdos ;print the message
- mvi c,conin ;get conin function
- call bdos ;get the character
- push psw ;save a reg
- mvi c,conout ;get conout function
- mvi e,cr ;get carriage return
- call bdos ;output to crt
- mvi c,conout ;get conout function
- mvi e,lf ;get line feed
- call bdos ;output to crt
- pop psw ;get a reg
- o19b
- cpi 'I' ;is it inches?
- jnz lines ;go to lines routine if not
- inchs
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz o19c ;press on if so
- jmp o19d ;skip asking for data
- o19c
- lxi d,minch ;point to inches message
- mvi c,linout ;get linout function
- call bdos ;print the message
- o19d
- call decin ;get number of inches
- mov a,e ;save low byte in accumulator
- cpi 00h ;check for error
- jnz o19e ;press on if not
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz inchs ;let user re-input
- jmp erdis ;else display error message and exit
- o19e
- push psw ;save a reg
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'C' ;get form length char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- mvi e,0 ;get inches designator
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- pop psw ;get a reg
- mov e,a ;get number of inches
- call bdos ;send to printer
- jmp more ;another option?
- lines
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz o19f ;press on if so
- jmp o19g ;skip asking for data
- o19f
- lxi d,mlin ;point to lines message
- mvi c,linout ;get linout function
- call bdos ;print the message
- o19g
- call decin ;get number of lines
- mov a,e ;save low byte in accumulator
- cpi 00h ;check for error
- jnz o18h ;press on if not
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz lines ;let user re-input
- jmp erdis ;else display error message and exit
- o18h
- push psw ;save a reg
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'C' ;get form length char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- pop psw ;get a reg
- mov e,a ;get number of lines
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; skip over perforation
- ;
- opt20
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz o20a ;press on if so
- jmp o20b ;skip asking for data
- o20a
- lxi d,mes20 ;point to message
- mvi c,linout ;get linout function
- call bdos ;print the message
- o20b
- call decin ;get number of lines to be skipped
- mov a,e ;save low byte in accumulator
- cpi 00h ;check for error
- jnc o20c ;press on if not
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz opt20 ;let user re-input
- jmp erdis ;else display error message and exit
- o20c
- cpi 127 ;greater than 127?
- jc o20d ;press on if not
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz opt20 ;let user re-input
- jmp erdis ;else display error message and exit
- o20d
- push psw ;save a reg
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'N' ;get skip perf char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- pop psw ;get a reg
- mov e,a ;get number of lines to skip
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; right margin setting
- ;
- opt21
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz o21a ;press on if so
- jmp o21b ;skip asking for data
- o21a
- lxi d,mes21 ;point to message
- mvi c,linout ;get linout function
- call bdos ;print the message
- o21b
- call decin ;get number of char in line
- mov a,e ;save low byte in accumulator
- cpi 00h ;check for error
- jnz o21c ;press on if not
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz opt21 ;let user re-input
- jmp erdis ;else display error message and exit
- o21c
- push psw ;save a reg
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'Q' ;get right margin char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- pop psw ;get a reg
- mov e,a ;get number of char in line
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; left margin setting
- ;
- opt22
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz o22a ;press on if so
- jmp o22b ;skip asking for data
- o22a
- lxi d,mes22 ;point to message
- mvi c,linout ;get linout function
- call bdos ;print message
- o22b
- call decin ;get left margin column number
- mov a,e ;save low byte in accumulator
- cpi 00h ;check for error
- jnz o22c ;press on if not
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz opt22 ;let user re-input
- jmp erdis ;else display error message and exit
- o22c
- push psw ;save a reg
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- if gemini
- mvi e,'M' ;get left margin character
- endif
- if not gemini
- mvi e,'l' ;get left margin character
- endif
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- pop psw ;get a reg
- mov e,a ;get left margin column number
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; superscript mode
- ;
- opt23
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'S' ;get superscript first character
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- mvi e,0 ;get superscript second character
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; subscript mode
- ;
- opt24
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'S' ;get subscript first character
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- mvi e,1 ;get subscript second character
- call bdos ;send to printer
- jmp more ;another option?
- ;
- if msp10 or msp20
- ;
- ; correspondence quality mode
- ;
- opt25
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'x' ;get cq first char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- mvi e,1 ;get cq second char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- ; condensed elite mode
- ;
- opt26
- call escap ;send escape character to printer
- mvi c,lstout ;get lstout function
- mvi e,'M' ;get ce first char
- call bdos ;send to printer
- mvi c,lstout ;get lstout function
- mvi e,15 ;get ce second char
- call bdos ;send to printer
- jmp more ;another option?
- ;
- endif
- ;
- if msp20
- ;
- ; select proportional spacing
- ;
- opt27
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz o27a ;press on if so
- jmp o27b ;skip asking for data
- o27a
- lxi d,mes27 ;point to message
- mvi c,linout ;get linout function
- call bdos ;print message
- o27b
- call decin ;get number
- mov a,e ;put number in a reg
- cpi 00h ;less than 0?
- jnc o27c ;press on if not
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz opt27 ;let user re-input
- jmp erdis ;else display error message and exit
- o27c
- cpi 80h ;greater than 127?
- jc o18d ;press on if not
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz opt27 ;let user re-input
- jmp erdis ;else display error message and exit
- o18d
- push psw ;save
- call escap ;send esc to ptr
- mvi c,lstout
- mvi e,' ' ;get space char
- call bdos ;send it
- pop psw ;get a reg back
- mvi c,lstout
- mov e,a ;put in e reg
- call bdos ;send it
- jmp more ;another option?
- ;
- ; Set Proportional printing on
- ;
- opt28
- call escap
- mvi c,lstout
- mvi e,'p'
- call bdos
- mvi c,lstout
- mvi e,1
- call bdos
- jmp more
- ;
- ; Set proportional printing off
- ;
- opt29
- call escap
- mvi c,lstout
- mvi e,'p'
- call bdos
- mvi c,lstout
- mvi e,0
- call bdos
- jmp more
- ;
- ; Clear print buffer
- ;
- opt30
- mvi c,lstout
- mvi e,24
- call bdos
- jmp more
- ;
- endif
- ;
- ; decimal input subroutine (returns with number in de register)
- ;
- decin
- lxi d,0000h ;clear d-e reg
- next
- push d ;save d-e reg
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz next1 ;get input if so
- mvi a,1
- sta decflg ;set decimal input flag
- call clprs ;else get next char from command line
- jmp next2 ;skip user input
- next1
- mvi c,conin ;get conin function
- call bdos ;get the character
- next2
- pop d ;get d-e reg
- cpi cr ;are we done with interactive input?
- jz next3 ;return if so
- cpi 20h ;are we done with command line imput?
- jz next3 ;return if so
- sui 0030h ;convert ascii to decimal
- jc error ;no good if carry (less than 0)
- cpi 000ah ;higher than 9?
- jnc error ;no good if so
- lxi h,0000h ;clear h-l reg for multiplication
- dad d ;multiply previous data by ten
- dad h
- dad h
- dad d
- dad h
- mov e,a ;new entry to e
- mvi d,00h ;clear d reg
- dad d ;add units value to d-e reg
- xchg ;new total to d-e reg
- jmp next ;loop for next char
- next3
- mvi a,0
- sta decflg ;reset decimal input flag
- ret ;return
- error
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jnz erdis ;go to command line error routine if not
- lxi d,ermes ;else point to error message
- mvi c,linout ;get linout function
- call bdos ;print message
- lxi d,0000h ;clear d-e reg
- ret
- ;
- ; misc subroutines
- ;
- ; Send ESCape character to printer
- ;
- escap
- mvi c,lstout ;get lstout function
- mvi e,esc ;get escape character
- call bdos ;send to printer
- ret
- ;
- ; Command line parse routine - returns with char in A register
- ;
- clprs
- lhld cladr ;get address of last command line character
- lda ccount ;get character count
- dcr a ;decriment character count
- sta ccount ;put character count back in buffer
- cpi 0 ;any more characters?
- jnz clprs1 ;yes, press on
- lda decflg ;else, get decimal input flag
- cpi 0 ;zero unless called from decimal input
- jz exit ;if not, then exit to DOS
- mvi a,1 ;put 1 back in character count
- sta ccount ;so will decriment to 0 on next run through
- mvi a,20h ;put space in a register
- ret ;return to decimal input routine
- clprs1
- inx h ;get next character
- mov a,m ;get character
- cpi 'a' ;less then a?
- jc clprs2 ;skip upper case mask
- cpi 'z' ;greater then z?
- jnc clprs2 ;skip upper case mask
- ani 5fh ;otherwise mask to upper case
- clprs2
- shld cladr ;save character address in buffer
- ret
- ;
- ; If command line, get next character
- ; if not, ask user if done
- ;
- more
- lda clflg ;get command line flag
- cpi 0 ;is it zero?
- jz more2 ;display message if not
- call clprs ;go to command line parse routine if so
- jmp cpopt ;go do another one if clprs didn't exit
- more2
- lxi d,msend ;point to message
- mvi c,linout ;get linout function
- call bdos ;print the message
- mvi c,conin ;get conin function
- call bdos ;input character
- ani 5fh ;mask to upper case (b.m. -12/84)
- push psw ;save a reg
- mvi c,conout ;get conout function
- mvi e,cr ;get carriage return
- call bdos ;output to crt
- mvi c,conout ;get conout function
- mvi e,lf ;get line feed
- call bdos ;output to crt
- pop psw ;get a reg
- cpi 'Y' ;is it yes?
- jz optdis ;display options if so
- ;
- exit
- pop h ;get cp/m's stack
- sphl ;set it
- jmp boot ;return to cp/m
- ;
- ; messages
- ;
- if clscr ;clear screen
- clr db 26,'$' ;put your clear screen data here *********
- endif ;i.e...heath=esc,'e'
- ;
- messg db ' ***** '
- if epson
- db 'EPSON'
- endif
- if gemini
- db 'GEMINI'
- endif
- if msp10
- db 'CITIZEN MSP-10'
- endif
- if msp20
- db 'CITIZEN MSP-20'
- endif
- db ' PRINTER PRE-SET '
- db 'PROGRAM v',ver,'.',modlev,' *****',cr,lf,lf
- db 'This program will allow the operator to pre-set certain '
- db 'printer states.',cr,lf
- db 'The printer will remain in these states until the printer '
- db 'power is',cr,lf
- db 'recycled, or the printer is directed into another state '
- db 'by program control.',cr,lf,'$'
- mnumes db lf,'The following options are available:',cr,lf,lf
- db ' ?. Display this list '
- db ' O. 1/16 inch line spacing',cr,lf
- db ' #. Exit to DOS '
- db ' P. 1/8 inch line spacing',cr,lf
- db ' A. Printer initialization '
- db ' Q. n/72 inch line spacing',cr,lf
- db ' B. Elite-sized character setting '
- if gemini
- db ' R. n/144 inch line spacing',cr,lf
- endif
- if not gemini
- db ' R. n/216 inch line spacing',cr,lf
- endif
- db ' C. Pica-sized character setting '
- db ' S. Form length setting',cr,lf
- db ' D. Enlarged mode '
- db ' T. Skip over perforation',cr,lf
- db ' E. Send cr,lf to printer '
- db ' U. Right margin setting',cr,lf
- db ' F. Condensed mode '
- db ' V. Left margin setting',cr,lf
- db ' G. Emphasized/enlarged mode '
- db ' W. Superscript mode',cr,lf
- db ' H. Emphasized mode '
- db ' X. Subscript mode',cr,lf
- db ' I. Double strike mode '
- if msp10 or msp20
- db ' Y. Correspondence quality mode',cr,lf
- endif
- if not (msp10 or msp20)
- db ' ',cr,lf
- endif
- db ' J. Alternate character set (italics) '
- if msp10 or msp20
- db ' Z. Condensed elite mode (160 col)',cr,lf
- endif
- if not (msp10 or msp20)
- db ' ',cr,lf
- endif
- db ' K. Underline mode '
- if msp20
- db ' 0. Select proportional spacing',cr,lf
- endif
- if not msp20
- db ' ',cr,lf
- endif
- db ' L. Ignore paper end detector '
- if msp20
- db ' 1. Set proportional printing on',cr,lf
- endif
- if not msp20
- db ' ',cr,lf
- endif
- db ' M. Unidirectional printing '
- if msp20
- db ' 2. Set proportional printing off',cr,lf
- endif
- if not msp20
- db ' ',cr,lf
- endif
- db ' N. 7/72 inch line spacing '
- if msp20
- db ' 3. Clear print buffer',cr,lf
- endif
- if not msp20
- db ' ',cr,lf
- endif
- db cr,lf,'$'
- optmes db 'Enter desired option:','$'
- emess db bel,lf,'++ Unknown entry! - exit to CP/M (Y/N)?','$'
- emessx db bel,cr,lf,'++ Unknown character selected in ++',cr,lf
- db '++ command line - exiting to DOS ++',cr,lf,'$'
- mes17 db 'Enter n/72 line spacing required: ','$'
- mes18 db 'Enter n/216 line spacing required: ','$'
- mes19 db 'Specify setting by lines (l) or inches (i) ?','$'
- minch db 'Enter number of inches?','$'
- mlin db 'Enter number of lines?','$'
- mes20 db 'Enter number of lines to be skipped?','$'
- mes21 db 'Enter number of characters required in line '
- db '(P=80, E=96, C=137)?','$'
- mes22 db 'Enter column in which to start left margin?','$'
- mes27 db 'Enter spacing between characters in half-dot'
- db ' increments (0 to 127): ','$'
- ermes db bel,cr,lf,'Non-numeric character entered! Try again!',cr,lf,'$'
- msend db cr,lf,'Another option (Y/N) ?','$'
- ;
- ; define space
- ;
- ccount ds 1 ;number of characters remaining in command line
- ;
- cladr dw 0080h ;address of current command line character
- ;
- clflg ds 1 ;command line flag (0 of none / 1 if some)
- ;
- decflg ds 1 ;decimal input flag
- ;
- ds 16
- stack equ $
- ;
- end start