
program FX80;

{   This program will control most of the frequently used -- and
 also some infrequently used -- configuration parameters for the
 Epson FX80.  The code compiles 'as is' using TURBO Pascal.  Feel
 free to modify it in any way.  A nice project might be a font
 creation routine.  Please get word to me concerning any changes.
 I'd like to see them.  Go to it!

                                  Mark Davis
                                  2315 Mtn Oaks Cir
                                  Birmingham, AL  35226

 }

type
   Command_type = string[3];
   Prompt_type  = string[30];
var
   Input  : integer;
   Exit   : boolean;
   Esc    : char;
   Command: Command_type;

procedure Give_printer(Command: Command_type);

{    Sends a string of up to 3 chars to printer }

          begin
             write(Lst, Esc, Command);
          end;

function Get_parm(Prompt: Prompt_type): integer;

{    Returns an integer taken after prompt
     for keyboard input.
}

var  parm: integer;

         begin
            textcolor(Yellow);
            gotoXY(26,24);
            write(Copy(Prompt,1,Length(Prompt)));
            readln(parm);
            Get_parm := parm;
            gotoXY(26,24);
            ClrEol;
            textcolor(Green);
         end;

procedure Scrn_put(X,Y:integer; text:Prompt_type);

{    Put a menu line on the screen at X,Y     }

         begin
            gotoXY(X,Y);
            writeln(Copy(text,1,Length(text)));
         end;

begin

     Esc := chr(27);
     textcolor(Yellow);
     textbackground(Black);
     Scrn_put(26,2,'EPSON SETUP PROGRAM');
     textcolor(Green);
     Scrn_put(5,4,' 0 - reset');
     Scrn_put(5,5,' 1 - pica');
     Scrn_put(5,6,' 2 - elite');
     Scrn_put(5,7,' 3 - comp.');
     Scrn_put(5,8,' 4 - emph. pica');
     Scrn_put(5,9,' 5 - dbl-str. pica');
     Scrn_put(5,10,' 6 - dbl-str. elite');
     Scrn_put(5,11,' 7 - dbl-str. comp.');
     Scrn_put(5,12,' 8 - dbl-str. emphasised pica');
     Scrn_put(5,13,' 9 - sngl-str. exp. pica');
     Scrn_put(5,14,'10 - sngl-str. exp. elite');
     Scrn_put(5,15,'11 - sngl-str. exp. comp.');
     Scrn_put(5,16,'12 - sngl-str. emph. exp. pica');
     Scrn_put(5,17,'13 - dbl-str. exp. pica');
     Scrn_put(5,18,'14 - dbl-str. exp. elite');
     Scrn_put(5,19,'15 - dbl-str. exp. comp.');
     Scrn_put(5,20,'16 - dbl-str. emph. exp. pica');
     Scrn_put(40,4,'17 - proportional mode ON');
     Scrn_put(40,5,'18 - proportional mode OFF');
     Scrn_put(40,6,'19 - unidirectional mode ON');
     Scrn_put(40,7,'20 - unidirectional mode OFF');
     Scrn_put(40,8,'21 - half-speed mode');
     Scrn_put(40,9,'22 - normal speed');
     Scrn_put(40,10,'23 - set left margin');
     Scrn_put(40,11,'24 - set right margin');
     Scrn_put(40,12,'25 - set form length');
     Scrn_put(40,13,'26 - set skip over perf.');
     Scrn_put(40,14,'27 - skip over perf OFF');
     Scrn_put(40,15,'28 - select character set');
     Scrn_put(40,16,'29 - n/72 line spacing');
     Scrn_put(40,17,'30 - n/216 line spacing');
     Scrn_put(40,18,'31 - 1/8 line spacing');
     Scrn_put(40,19,'32 - 1/6 line spacing (standard)');
     Scrn_put(40,20,'33 - copy ROM to RAM');
     textcolor(Yellow);
     Scrn_put(28,21,'99 - EXIT TO DOS');
     textcolor(Green);
     Exit := false;
     repeat
     begin
          gotoXY(23,23);
          write('Select option by number: ');
          ClrEol;
          read(Input);

          {  parse Input and select output string  }

          case Input of

              0 : Command := '@';
              1 : Command := '!'+chr(0);
              2 : Command := '!'+chr(1);
              3 : Command := '!'+chr(4);
              4 : Command := '!'+chr(8);
              5 : Command := '!'+chr(16);
              6 : Command := '!'+chr(17);
              7 : Command := '!'+chr(20);
              8 : Command := '!'+chr(24);
              9 : Command := '!'+chr(32);
             10 : Command := '!'+chr(33);
             11 : Command := '!'+chr(36);
             12 : Command := '!'+chr(40);
             13 : Command := '!'+chr(48);
             14 : Command := '!'+chr(49);
             15 : Command := '!'+chr(52);
             16 : Command := '!'+chr(56);
             17 : Command := 'p1';
             18 : Command := 'p0';
             19 : Command := 'U1';
             20 : Command := 'U0';
             21 : Command := 's1';
             22 : Command := 's0';
             23 : Command := 'l'+chr(get_parm('left margin at:'));
             24 : Command := 'Q'+chr(get_parm('right margin at:'));
             25 : Command := 'C'+chr(get_parm('form length: '));
             26 : Command := 'N'+chr(get_parm('number of lines:'));
             27 : Command := 'O';
             28 : Command := 'V+chr(0);
             29 : Command := 'A'+chr(get_parm('n/72 spacing, n = '));
             30 : Command := '3'+chr(get_parm('n/216 spacing, n = '));
             31 : Command := '0';
             32 : Command := '2';
             33 : Command := ':'+chr(0)+chr(0)+chr(0);
             99 : Exit := True;

          end; {case}

     if not Exit then Give_printer(Command);

     end; {until}

   until Exit;

end.9 : Exit := True;

          end; {case}

     if not Exit then Give_printer(Command)