PROGRAM epsetup(lst, input, output); (* setup Epson RX80 printer *) (* By C.B. Falconer. 83/Nov/24. Released to Public Domain. *) (* 1.1 1 Jan 84 - added double strike, elite chars for RX 80 *) (* 1.2 6 Apr 84 - init does not cancel double, tabs kept at 8 units *) (* 1.3 27 Jan 87 - Commands for subscript mode at 13 lpi. *) (*$n-,d- no run-time checks nor line nums. *) CONST header = 'EPSETUP (lst); Ver. 1.3; for MX80/RX80 printers'; rx80 = true; (* false to remove RX80 only commands *) TYPE commands = (init, setform, compress, elite, pica, normal, double, little, halflf, lpi6, lpi7, lpi8, lpi13, onesheet, multisheet, tabs, formout, none); (* declaration order controls execution order and *) (* thus precedence. Last declared takes effect *) VAR command : SET OF commands; oneliner : boolean; cmd, lst : text; (* 1----------------1 *) FUNCTION getcommand(VAR f : text) : boolean; VAR cmd : commands; BEGIN (* getcommand *) IF NOT oneliner THEN BEGIN IF rx80 THEN prompt( 'I)nit S)etform L)ittle C)ompress E)lite P)ica D)ouble N)ormal ?-') ELSE prompt( 'I)nit S)etform C)ompress P)ica D)ouble N)ormal ?-'); IF f^ = '?' THEN BEGIN readln; prompt( 'O)nepage M)ultipg T)abs H)alflf 6)lpi 7)lpi 8)lpi 9)13lpi F)ormout -'); END; END; command := []; WHILE NOT eof(f) AND (f^ <> ' ') DO BEGIN cmd := none; (* also provides for "?" returning here *) IF f^ IN ['a'..'z'] THEN (* upshift *) f^ := chr(ord(f^) - ord('a') + ord('A')); CASE f^ OF 'C': cmd := compress; 'D': cmd := double; 'E': cmd := elite; 'F': cmd := formout; 'H': cmd := halflf; 'I': cmd := init; 'L': cmd := little; 'M': cmd := multisheet; 'N': cmd := normal; 'O': cmd := onesheet; 'P': cmd := pica; 'S': cmd := setform; 'T': cmd := tabs; '9': cmd := lpi13; '6': cmd := lpi6; '7': cmd := lpi7; '8': cmd := lpi8; (*$s- non-standard Pascal *) OTHERWISE (* ignore *); (*$s+*) END; (* case *) command := command + [cmd]; get(f); END; IF NOT eof(f) THEN readln(f); getcommand := command <> []; END; (* getcommand *) (* 1----------------1 *) PROCEDURE setup(verbose : boolean); (* The overprint procedure suppresses a final line-feed, *) (* but flushes buffers with a final carriage return. *) (* Prompt flushes buffers with no cr nor lf. *) CONST (*$s- these character definitions are non-standard Pascal *) si = (:15:); dc1 = (:17:); dc2 = (:18:); dc3 = (:19:); dc4 = (:20:); esc = (:27:); (*$s+*) VAR cmd : commands; BEGIN (* setup *) command := command - [none]; (* ensure empty *) cmd := init; WHILE cmd < none DO BEGIN (* scan in declared order *) IF cmd IN command THEN BEGIN write(lst, dc1 {enable}, dc1 {flush any garbage}); CASE cmd OF init: BEGIN command := command + [setform, multisheet, compress, normal]; IF verbose THEN writeln('Initializing for 11 inch page, 3 line skipover'); overprint(lst, dc2, {cancel condensed chars} dc4, {cancel enlarged chars} esc, '2', {std line spacing via dip switch} esc, 'F', {cancel emphasized printing} esc, 'T' {cancel any subscript mode} ); (* pagesize setting sets top of form *) END; halflf: BEGIN IF verbose THEN writeln('Setting 1/2 line feed @ 6 lpi'); overprint(lst, esc, 'A', chr(6) {72nds inch/line}); END; lpi6: BEGIN IF verbose THEN writeln('Setting 6 lines/in, 63 per page'); overprint(lst, esc, 'A', chr(12) {72nds inch/line}); END; lpi7: BEGIN IF verbose THEN writeln('Setting 7 lines/in, 76 per page'); overprint(lst, esc, 'A', chr(10) {72nds inch/line}); END; lpi8: BEGIN IF verbose THEN writeln('Setting 8 lines/in, 84 per page'); overprint(lst, esc, 'A', chr(9) {72nds inch/line} ); END; lpi13: BEGIN IF verbose THEN writeln('Setting 13 lines/in, 142 per page'); overprint(lst, esc, '3', chr(16) {216ths inch/line} ); END; onesheet: BEGIN IF verbose THEN writeln('No paper-out detection'); overprint(lst, esc, '8'); END; multisheet: BEGIN IF verbose THEN writeln('Paper-out detection'); overprint(lst, esc, '9'); END; setform: BEGIN IF verbose THEN BEGIN prompt('Position paper to top of form, press return'); readln; END; overprint(lst, esc, 'C', chr(0), chr(11) {inch pages} ,esc, 'N', chr(3) {lines skipover} ); (* pagesize setting sets top of form *) END; little: BEGIN IF rx80 THEN BEGIN IF verbose THEN writeln('Setting subscript font'); overprint(lst, esc, 'S', chr(1)); {set subscript} END; END; elite: BEGIN IF rx80 THEN BEGIN IF verbose THEN writeln('Setting 96 char. lines'); overprint(lst, esc ,'M' {set elite chars} , esc ,'T' {cancel any subscript} ); command := command + [tabs]; END; END; compress: BEGIN IF verbose THEN writeln('Setting 132 char. lines'); IF rx80 THEN write(lst ,esc ,'P' {cancel elite chars} ,esc ,'T' {cancel subscript} ); overprint(lst ,si); command := command + [tabs]; END; pica: BEGIN IF verbose THEN writeln('Setting 80 char. lines'); IF rx80 THEN write(lst, esc, 'P' {cancel elite chars} ,esc ,'T' {cancel subscript} ); overprint(lst ,dc2 {cancel condensed chars} ,dc4 {cancel enlarged chars} ,esc ,'F' {cancel emphasised print} ); command := command + [tabs]; END; tabs: BEGIN IF rx80 THEN BEGIN IF verbose THEN writeln('Setting tabs at 8 char interval'); overprint(lst, esc ,'e0', chr(8) {keep tabs aligned}); END; END; double: BEGIN IF verbose THEN writeln('Setting double strike (letter) mode'); overprint(lst, esc, 'G'); END; normal: BEGIN IF verbose THEN writeln('Cancelling double strike (letter) mode'); overprint(lst, esc, 'H'); END; formout: BEGIN IF verbose THEN writeln('Advancing to top of page'); page(lst); END; END; (* case *) END; command := command - [cmd]; cmd := succ(cmd); END; END; (* setup *) (* 1----------------1 *) PROCEDURE checkfor(VAR oneliner : boolean); VAR ch : char; decided : boolean; BEGIN (* checkfor *) decided := false; oneliner := false; WHILE NOT decided DO IF eoln(cmd) THEN decided := true ELSE BEGIN read(cmd, ch); IF ch = '-' THEN BEGIN decided := true; oneliner := true; END; END; END; (* checkfor *) (* 1----------------1 *) BEGIN (* epsetup *) (*$s- The file name is non-standard Pascal. *) reset(cmd, 'CMD '); (* This device file is the command line *) (*$s+*) rewrite(lst); checkfor(oneliner); IF oneliner THEN BEGIN IF getcommand(cmd) THEN setup(false); END ELSE BEGIN writeln(header); writeln('Options may be entered after "-" in command line'); writeln(' Ex: A>runpcd epsetup -ed (for elite double-strike)'); writeln('Multiple letters in one command cause multiple actions'); writeln(' ''?'' shows extended commands'); WHILE getcommand(input) DO WHILE command <> [] DO setup(true); END; END. (* epsetup *)