program PSETUP;
{ This program is intended to send setup code sequences to
  a Panasonic KX-P1092 printer.

  Written by Kent Walker, September, 1985, using Turbo Pascal v2.0
  }

var
  A:     char;
  N:     integer;

const
        { Printer Codes }
  PrinterCode: array[0..14] of string[6] =
               (
                 #$0F ,
                 #$12 ,
                 #$1B'2',
                 #$1B'M',
                 #$1B'Wn',
                 #$1B'Wm',
                 #$1B'7',
                 #$1B'6',
                 #$1B'E',
                 #$1B'F',
                 #$1B'G',
                 #$1B'H',
                 #$1B'A12'#$1B'2',
                 #$1B'0',
                 #$0C#$1B'@'
               );

        { Messages matching above Printer Codes }
  Message: array[0..14] of string[25] =
               (
                 'Compressed Print',
                 'Non-Compressed Print',
                 'Pica - 10 cpi',
                 'Elite - 12 cpi',
                 'Double Width Print Set',
                 'Double Width Print Reset',
                 'IBM-PC Graphics Mode 1',
                 'IBM-PC Graphics Mode 2',
                 'Emphasized Print Set',
                 'Emphasized Print Reset',
                 'Double Strike Print Set',
                 'Double Strike Print Reset',
                 '6 Lines Per Inch',
                 '8 Lines Per Inch',
                 'Reset Printer'
               );

begin


         { Display the menu }
  ClrScr;
  Writeln( '           Panasonic Printer Setup Program ');
  Writeln( ' ' );

  for N := 0 to 14 do
    begin
    A :=  chr( N + ord( 'A' ) ) ;
    Writeln( A:15, '   ', Message[N] );
    end;
    GotoXY(15,23);
    Write('Press RETURN to terminate');


         { Request input until a RETURN is entered}
  repeat
    GotoXY(15,22);
    Write( 'Please enter your selection(s) ' );
    read( KBD, A );

         {  Convert the letter to upper case & a number starting
             with A = 0  }
    N := ord( UpCase( A ) ) - ord( 'A' );

         { If number is in range }
    if ( N >= 0 ) and ( N <= 14 ) then
      begin
         { send the code to the printer }
      write( LST, PrinterCode[N] );
         { Point on the screen to the selection made }
      GotoXY( 10, N+3 );
      write( '>>>'#$07 );
      Delay(1000);
      GotoXY( 10, N+3 );
      write( '   ' );

      end

  until A = #$0D ;

         { Write out a final message }
  ClrScr;
  write( '        Printer is Configured' );

end.
