; Epson FX-80 Printer Setup Program ; A Peace Product ; Copyright 1983 by George F Peace ; VERSION EQU 1$2 ; ;revision history: (lifo) ; ; 3/25/83 1.2 Corrected signon message to say FX instead of MX ; Add RIGHT0 command ; Expand the 12lpi command to my liking (subscript, ; 132lpp,137col,right0,condensed,skip6) ; ; 3/23/83 1.1 Add CELITE NOSKIP RIGHT8 SUB SUPER ; 64COL 80COL 96COL 132COL 137COL ; 12LPI SKIP3 SKIP6 ; Change help operation to display a configurable ; number of commands on each line. ; ; 3/12/83 1.0 Upgrade of the MXPRNT program version 2.0 to ; add FX-80 specific comand sequences. ; ;-------------------- CONFIGURATION -------------------- ; FALSE EQU 0 TRUE EQU NOT FALSE ; ;The value HELPCHR should be set to the single character ;prompt for HELP output. ; HELPCHR EQU '?' ;use question mark ; ;Set CMDHLP true if an invalid command entry is to cause ;display of the full help text. Set it false to limit ;help to explicit requests. ; CMDHLP EQU FALSE ;full help needed ; ;The HELPLIN parameter determines the number of commands that will ;be displayed on each help output line. The value can be any positive ;integer (0...). ; HELPLIN EQU 5 ;number of commands listed per line ; ;CASEUP controls conversion of console input to upper case. ;Set true to convert all lower case characters to upper case. ;A false value will leave all input as it was received. ; CASEUP EQU TRUE ;convert to upper case ; ;-------------------- CP/M DEFINITION -------------------- ; BDOS EQU 05H ;BDOS entry CONOUT EQU 02H ;console output byte LIST EQU 05H ;list output byte PSTRING EQU 09H ;console output string CINPUT EQU 0AH ;console input line CR EQU 0DH ;carriage return LF EQU 0AH ;line feed VT EQU 0BH ;vertical tab ESC EQU 1BH ;escape ; ;-------------------- MAIN PROGRAM -------------------- ; START ORG 100H JMP FXPRNT ;jump around signon message ; ; Following is the triple-purpose buffer ; ; 1. TYPEable text when in COMmand file format ; 2. The SIGNON message displayed on the console ; each time the program is run ; 3. After signon, the first 128 bytes are used ; for the console command input buffer ; SIGNON: DB CR DB LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF DB LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF,LF DB VT,VT,VT,VT,VT,VT,VT,VT,VT,VT,VT,VT DB VT,VT,VT,VT,VT,VT,VT,VT,VT,VT,VT ; DB 'Epson FX Printer Setup (level ' DB (VERSION/10)+'0','.',(VERSION MOD 10)+'0',')' DB CR,LF,'Copyright 1983 by George F Peace' DB CR,LF,CR,LF,'Enter commands one per line as required.' DB CR,LF DB CR,LF,'Enter ',HELPCHR,' for help.' DB CR,LF,'$',CR,' ','Z'-40H IF NOT ($-SIGNON) / 128 DS 128-($-SIGNON) ;complete the command buffer ENDIF ; ;-------------------- MAIN PROGRAM -------------------- ; FXPRNT: LXI H,NOTHOME ;get nobody-home exit address SHLD START+1 ;so we won't allow restart in memory LXI D,SIGNON ;load signon message address CALL PRINT ;display it on the console MVI A,128-1 ;get maximum input character count STA SIGNON ;put it in the input buffer CMDGET: XRA A ;get a zero value STA COMMAND ;obliterate last command LXI D,INPUTM ;get input prompt CALL PRINT ;display it on the console LXI D,CMDBUF ;command input buffer MVI C,CINPUT ;set to get input line CALL BDOS ;now get the input line LDA COMMAND ;get first character of command CPI HELPCHR ;request for help? JZ HELP ;yes - go provide some help LXI D,CHRCNT ;get address of char count byte LDAX D ;load number of characters CPI 0 ;was character count zero? JZ DONE ;yes, assume we are all done DECODE: LXI H,CMDTAB ;list of commands/actions AGAIN: XRA A ;zero the accumulator CMP M ;compare to memory JZ CMDERR ;no match found MOV C,M ;load the character count INX H ;increment to first letter LXI D,COMMAND ;point to command input buffer LDA CHRCNT ;load input character count MOV B,A ;now move it to B NXTCHR: LDAX D ;get command character IF CASEUP CPI 'A'+20H ;is character less than 'a'? JC UPPER ;yes - no conversion needed CPI 'Z'+20H ;is character greater than 'z'? JNC UPPER ;yes - no conversion needed SUI 20H ;convert lower case to upper UPPER: ENDIF CMP M ;compare with input character JNZ NXTCMD ;no match, try next command INX H ;match, increment command table address INX D ; and input buffer address DCR C ;decrement command table character count JZ NOMORE ;all done if no more characters DCR B ;decrement input character count JNZ NXTCHR ;go process more if nonzero count NOLOOP: INX H ;increment command table pointer DCR C ;decrement character count JNZ NOLOOP ;keep going until past command NOMORE: MOV E,M ;get low string address into E INX H ;bump command table pointer MOV D,M ;get high string address into D XCHG ;put address into HL CALL PROUT ;call list output routine JMP CMDGET ;get next command NXTCMD: INR C ;increment char count past address INR C ;second byte NOTYET: INX H ;increment list address DCR C ;decrement command character count JNZ NOTYET ;keep going until past the command JMP AGAIN ;at next command, process it ; NOTHOME: LXI D,GETOUT ;get the no trespassing message CALL PRINT ;and display it before exiting ; DONE: LXI D,CRLF ;finish up with a CR/LF CALL PRINT ;print it on the console RET ;and return to CP/M ; ;-------------------- SUBROUTINES -------------------- ; CMDERR: LXI D,ERRMSG ;load error message address CALL PRINT ;print error message on console IF NOT CMDHLP LXI D,HELPM0 ;get help reminder CALL PRINT ;and display it on the console JMP CMDGET ;now go get next command line ENDIF HELP: LXI D,HELPM1 ;load up help message address CALL PRINT ;print it on the console XRA A ;zero the accumulator STA HELCNT ;and zero the help command tally LXI H,CMDTAB ;get command table address HELCMD: XRA A ;zero the accumulator CMP M ;end of table? JZ HELEND ;yes - so get out MOV C,M ;get command length INX H ;increment to first byte of command HELOOP: MOV E,M ;load next character of command PUSH B ;save character count PUSH H ;save command table pointer MVI C,CONOUT ;set console output CALL BDOS ;and output byte to console POP H ;restore command table pointer POP B ;restore character count INX H ;increment to next byte DCR C ;decrement character count JNZ HELOOP ;go back if more characters INX H ;increment past INX H ; string address LDA HELCNT ;get count of commands displayed INR A ;increment to show latest entry STA HELCNT ;replace help count CPI HELPLIN ;have configured number yet? JZ HELOOP2 ;finish off the line with a CR/LF LXI D,COMMA ;get comma definition address PUSH B ;save character count PUSH H ;save command table pointer CALL PRINT ;display the string on the console POP H ;restore command table pointer POP B ;restore character count JMP HELCMD ;go get next command HELOOP2: LXI D,CRLF ;load CR/LF address PUSH B ;save character count PUSH H ;save command table pointer CALL PRINT ;send CR/LF to console POP H ;restore command table pointer POP B ;restore character count XRA A ;clear accumulator to zeros STA HELCNT ;zero help count for next line JMP HELCMD ;go process next command HELEND: LXI D,HELPM2 ;get help message address CALL PRINT ;display on console JMP CMDGET ;go get the next command line ; HELCNT DB 0 ;local storage for print count ; PROUT: MOV E,M ;byte to E for list output MOV A,M ;and to A for test MVI C,LIST ;get list output code CPI '$' ;is this the string terminator? RZ ;yes - so return to caller PUSH H ;save string pointer CALL BDOS ;now fire off the request POP H ;restore string pointer INX H ;increment to next string byte JMP PROUT ;and go back for more PRINT: MVI C,PSTRING ;print string function CALL BDOS ;send the string to the console RET ;return to caller ; ;-------------------- COMMAND INPUT BUFFER -------------------- ; CMDBUF EQU SIGNON ;command buffer CHRCNT EQU CMDBUF+1 ;input character count COMMAND EQU CMDBUF+2 ;actual command address ; ;-------------------- COMMAND LOOKUP TABLE -------------------- ; CMDTAB: DB 6,'CELITE' ;centered elite mode DW CELITE DB 9,'CONDENSED' ;condensed print mode DW COND DB 6,'DOUBLE' ;double srike mode DW DOUBLE DB 5,'ELITE' ;ELITE print mode DW ELITE DB 10,'EMPHASIZED' ;emphasized print mode DW EMPHA DB 7,'ITALICS' ;italics character set DW ITALIC DB 6,'NORMAL' ;turn off funny modes DW NORMAL DB 6,'NOSKIP' ;cancel perforation skip DW NOSKIP DB 4,'PICA' ;PICA print mode DW NORMAL DB 12,'PROPORTIONAL' ;set/clear proportional spacing DW PROPOR DB 5,'QUIET' ;set/clear half speed mode DW QUIET DB 5,'RESET' ;Reset printer DW RESET DB 6,'RIGHT0' ;reset left margin to 0 columns DW RIGHT0 DB 6,'RIGHT8' ;move page right 8 characters DW RIGHT8 DB 5,'SKIP3' ;set to skip 3 lines at perf DW SKIP3 DB 5,'SKIP6' ;set to skip 6 lines at perf DW SKIP6 DB 8,'STANDARD' ;standard character set DW NORMAL DB 3,'SUB' ;set subscript mode DW SUBS DB 5,'SUPER' ;set superscript mode DW SUPERS DB 4,'TAB8' ;set horizontal tabs DW TAB8 DB 8,'VIEWMODE' ;sets incremental or view mode DW VIEW DB 4,'6LPI' ;six lines per inch DW LPI6 DB 4,'8LPI' ;eight lines per inch DW LPI8 DB 4,'9LPI' ;nine lines per inch DW LPI9 DB 5,'12LPI' ;special 12lpi condensed print DW LPI12 DB 5,'64COL' ;64 characters per line DW COL64 DB 5,'80COL' ;80 characters per line DW COL80 DB 5,'96COL' ;96 characters per line DW COL96 DB 6,'132COL' ;132 characters per line DW COL132 DB 6,'137COL' ;137 characters per line DW COL137 DB 0 ;command table terminator ; ;-------------------- PRINTER OUTPUT STRINGS -------------------- ; CELITE DB ESC,'!',1,ESC,'l',8,'$' COL64 DB ESC,'Q',64,'$' COL80 DB ESC,'Q',80,'$' COL96 DB ESC,'Q',96,'$' COL132 DB ESC,'Q',132,'$' COL137 DB ESC,'Q',137,'$' COND DB ESC,'!',4,'$' DOUBLE DB ESC,'!',16,'$' ELITE DB ESC,'!',1,'$' EMPHA DB ESC,'!',8,'$' ITALIC DB ESC,'4',ESC,'$' LPI6 DB ESC,'2',ESC,'C',66,'$' LPI8 DB ESC,'0',ESC,'C',88,'$' LPI9 DB ESC,'3',24,ESC,'C',99,'$' LPI12 DB ESC,'3',18,ESC,'C',0,11,ESC,'S',1,ESC,'!',4 DB ESC,'Q',137,ESC,'l',0,ESC,'N',6,'$' NORMAL DB ESC,'!',0,'$' NOSKIP DB ESC,'O','$' PROPOR DB ESC,'p',1,'$' QUIET DB ESC,'s',1,'$' RESET DB ESC,'@','$' RIGHT0 DB ESC,'l',0,'$' RIGHT8 DB ESC,'l',8,'$' SKIP3 DB ESC,'N',3,'$' SKIP6 DB ESC,'N',6,'$' SUBS DB ESC,'S',1,'$' SUPERS DB ESC,'S',0,'$' TAB8 DB ESC,'D',9,17,25,33,41,49,57,65,73,81,89,97,115,123,131,0,'$' VIEW DB ESC,'i','$' ; ;-------------------- CONSOLE OUTPUT STRINGS -------------------- ; INPUTM DB CR,LF,'Enter command (or CR): ','$' ERRMSG DB CR,LF,'Unrecognized command','$' HELPM0 DB CR,LF,'Enter ',HELPCHR,' for help.' DB CR,LF,'$' HELPM1 DB CR,LF DB CR,LF,'The following commands are recognized:' DB CR,LF,CR,LF,'$' HELPM2 DB CR,LF DB CR,LF,'Control-C (^C) or carriage return will terminate' DB CR,LF,'the program.' DB CR,LF DB CR,LF,'Each command entered may be abbreviated to the' DB CR,LF,'minimum number of characters needed to uniquely' DB CR,LF,'identify it.' DB CR,LF,'$' GETOUT DB CR,LF,CR,LF,'No program in memory.',CR,LF,'$' CRLF DB CR,LF,'$' COMMA DB ', ','$' END START