home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / PASCAL / OKI390.ZIP / OKI2.PAS next >
Encoding:
Pascal/Delphi Source File  |  1988-09-15  |  34.7 KB  |  848 lines

  1. {
  2.  
  3. PRINTER SETUP FOR THE IBM CONFIGURED OKIDATA 192 - 193
  4. Modified for Okidata 390 - 391 Epson & IBM Proporinter Mode 9\88
  5.  
  6. Select fonts, print quality, line spacing, form length, margins, alternate
  7. character sets, special functions, default setup, printer test
  8. by Norman Newbury, January 1987            ***  FOR PUBLIC DOMAIN USE  ***
  9.  
  10.  
  11. }
  12.  
  13. program okiprint;
  14.  
  15. uses
  16.   Crt, Printer, Oki390;
  17.  
  18.   type
  19.      AnyString   = String[80];          { type for Center procedure          }
  20.   const
  21.      Beep        : Char    = ^G;        { beep the console on error          }
  22.      Working     : Boolean = true;      { loop control for main program      }
  23.      Done        : Boolean = false;     { loop control for procedures        }
  24.      IBM2        : Boolean = false;     { flag for IBM character set 2       }
  25.      IOerr       : Boolean = false;     { for I/O error handling             }
  26.      SetStr      : String[20] = 'ASCII unslashed 0';    { character set name }
  27.  
  28.      Text        : Integer = 11;        { Screen colors can be changed here  }
  29.      Back        : Integer = 0;         { by changing integer values.        }
  30.      Border      : Integer = 14;        { 0 to 15 for regular non─blinking   }
  31.      Bold        : Integer = 15;        {                                    }
  32.   var
  33.      I           : Integer;             { loop counter                       }
  34.      Ch          : Char;                { characters read from keyboard      }
  35.      OrigMode    : Word;
  36.  
  37.  
  38. {****************************************************************************}
  39. {*                                                                          *}
  40. {*                                  SCREENS                                 *}
  41. {*                                                                          *}
  42. {****************************************************************************}
  43.  
  44.  
  45. Procedure ClearBox(X1,Y1,X2,Y2 : Integer);
  46.    begin
  47.       Window(X1,Y1,X2,Y2);
  48.       ClrScr;
  49.       Window(1,1,80,25);
  50.    end; { of procedure ClearBox }
  51.  
  52. procedure Center(x,y : Integer; Text : AnyString); { Centers any string on   }
  53.    begin                                           { the screen              }
  54.       if y < 0 then y := 12;
  55.       if x < 0 then x := (80-Length(Text)) Div 2;  { negative num for x or y }
  56.       GotoXY(x,y);Write(Text);                     { centers side to side or }
  57.    end; { of procedure Center }                    { top to bottom or both   }
  58.  
  59.  
  60. procedure FirstScreen;
  61.    begin
  62.       TextColor(Border); TextBackground(Back);
  63.       ClearBox(1,1,80,40);
  64.       GotoXY(1,1);Write(Chr(201));                      { upper left corner  }
  65.       GotoXY(80,1);Write(Chr(187));                     { upper right corner }
  66.       for I := 2 to 23 do begin
  67.          GotoXY(1,I);Write(Chr(186));                   { vertical borders   }
  68.          GotoXY(80,I);Write(Chr(186));
  69.       end;
  70.       GotoXY(1,24);Write(Chr(200));                     { lower left corner  }
  71.       GotoXY(80,24);Write(Chr(188));                    { lower right croner }
  72.       GotoXY(1,4);Write(Chr(204));                      { left intersection  }
  73.       GotoXY(1,21);Write(Chr(204));                     { left intersection  }
  74.       GotoXY(80,4);Write(Chr(185));                     { right intersection }
  75.       GotoXY(80,21);Write(Chr(185));                    { right intersection }
  76.       for I := 2 to 79 do begin
  77.          GotoXY(I,1);Write(Chr(205));                   { horizontal borders }
  78.          GotoXY(I,4);Write(Chr(205));
  79.          GotoXY(I,21);Write(Chr(205));
  80.          GotoXY(I,24);Write(Chr(205));
  81.       end;
  82.       Textcolor(Text);
  83.       Center(-1,2,
  84.       'PRINTER SETUP FOR THE EPSON OR IBM CONFIGURED OKIDATA MICROLINE 390 OR 391');
  85.       GotoXY(25,7);Write('Written 1/87 by Norman Newbury');
  86.       GotoXY(25,8);Write('  Modified  9/88 by S. Kline');
  87.       GotoXY(12,11);
  88.       Write('This Program is free to any one who wants it so long as');
  89.       GotoXY(12,12);
  90.       Write('it is not sold.  I encourage you to copy and pass it on.');
  91.       Center(-1,16,'Printer must be ready or program will not run');
  92.       TextColor(Bold);
  93.       Center(-1,22,'PREPARE PRINTER FOR OPERATION');
  94.       Center(-1,23,'PRESS ANY KEY TO CONTINUE');
  95.       GotoXY(12,16);TextColor(Border + Blink);Write('==>');
  96.       CH:=Readkey;
  97.    end;{ of procedure FirstScreen }
  98.  
  99.  
  100. procedure DoneScreen;
  101. begin
  102.     ClearBox(2,5,78,20);
  103.     TextColor(Text);
  104.     Center(-1,-1,'PRINTER HAS YOUR SELECTION ');
  105.     delay(1000);
  106. end; { DoneScreen }
  107.  
  108.  
  109. procedure MainMenu;
  110.    begin
  111.       TextColor(Text);TextBackground(Back);
  112.       ClearBox(2,5,78,20);
  113.       GotoXY(27,6); Write('1 - PRINT SIZE AND QUALITY');
  114.       GotoXY(27,8); Write('2 - SET LINE SPACING');
  115.       GotoXY(27,10);Write('3 - SET MARGINS');
  116.       GotoXY(27,12);Write('4 - SELECT FANCY SETS');
  117.       GotoXY(27,14);Write('5 - SELECT LANGUAGE SET');
  118.       GotoXY(27,16);Write('6 - SPECIAL FUNCTIONS');
  119.       GotoXY(27,18);Write('7 - ENGAGE DEFAULT SETTINGS');
  120.       GotoXY(27,20);Write('8 - PRINT TEST');
  121.       ClearBox(2,2,78,3);ClearBox(2,22,78,23);
  122.       Center(-1,2,'MAIN MENU');
  123.       Center(-1,23,'Press 1 - 8 To Select a Task');
  124.       TextColor(Bold);
  125.       Center(-1,22,'Esc TO EXIT PROGRAM');
  126.    end; { of procedure MainMenu }
  127.  
  128.  
  129. procedure FontMenu;
  130.    begin
  131.       TextColor(Text); TextBackground(Back);
  132.       ClearBox(2,5,78,20);
  133.       GotoXY(23,6); Write('1 - PICA.................. 10 CPI');
  134.       GotoXY(23,8); Write('2 - ELITE................. 12 CPI');
  135.       GotoXY(23,10);Write('3 - CONDENSED............. 15 CPI');
  136.       GotoXY(23,12);Write('4 - PICA COMPRESSED....... 17 CPI');
  137.       GotoXY(23,14);Write('5 - ELITE COMPRESSED...... 20 CPI');
  138.       GotoXY(23,16);Write('6 - DOUBLE WIDE PICA......  5 CPI');
  139.       GotoXY(23,18);Write('7 - DOUBLE WIDE ELITE.....  6 CPI');
  140.       GotoXY(23,20);Write('8 - DOUBLE WIDE CONDENSED 8.5 CPI');
  141.       ClearBox(2,2,78,3);ClearBox(2,22,78,23);
  142.       Center(-1,2,'FONT SELECTION');
  143.       Center(-1,23,'Press 1 - 8 To Select a Font');
  144.    end; { Font Menu  }
  145.  
  146.  
  147. procedure QualityMenu;
  148.    begin
  149.       ClearBox(2,5,78,20);
  150.       GotoXY(27,8); Write('1 - NORMAL DATA PROCESSING');
  151.       GotoXY(27,10);Write('2 - LETTER QUALITY');
  152.       GotoXY(27,12);Write('3 - ENHANCED');
  153.       GotoXY(27,14);Write('4 - EMPHASIZED');
  154.       GotoXY(27,16);Write('5 - ENHANCED AND EMPHASIZED');
  155.       ClearBox(2,2,78,3);ClearBox(2,22,78,23);
  156.       Center(-1,2,'PRINT QUALITY MENU');
  157.       Center(-1,23,'Press 1 - 5 To Select Impact Quality');
  158.    end; { QualityMenu }
  159.  
  160.  
  161. procedure LineSpaceMenu;
  162.    begin
  163.       TextColor(Text);TextBackground(Back);
  164.       ClearBox(2,5,78,20);
  165.       GotoXY(25,8); Write('1 - 6 LINES PER INCH');
  166.       GotoXY(25,10);Write('2 - 8 LINES PER INCH');
  167.       GotoXY(25,12);Write('3 - VARIABLE LINE SPACING (max N is 127)');
  168.       GotoXY(25,14);Write('4 - N/180 FINE LINE SPACING (max N is 255)');
  169.       GotoXY(25,16);Write('5 - N/360 (max N is 255)');
  170.       ClearBox(2,2,78,3);ClearBox(2,22,78,23);
  171.       Center(-1,2,'LINE SPACING MENU');
  172.       Center(-1,23,'Press 1 - 5 To Set Line Spacing ');
  173.       TextColor(Bold);
  174.       Center(-1,22,'Esc TO RETURN TO MAIN MENU');
  175.    end; { of LineSpaceMenu }
  176.  
  177.  
  178. procedure MarginsMenu;
  179.    begin
  180.       TextColor(Text);TextBackground(Back);
  181.       ClearBox(2,5,78,20);
  182.       GotoXY(22,9) ;Write('1 - SET LEFT MARGIN');
  183.       GotoXY(22,11);Write('2 - SET RIGHT MARGIN');
  184.       GotoXY(22,13);Write('3 - RESET MARGINS TO COLUMNS 1 - 80 ');
  185.       ClearBox(2,2,78,3);ClearBox(2,22,78,23);
  186.       Center(-1,2,'MARGINS MENU');
  187.       Center(-1,23,'Press 1 - 3 To Set Margins');
  188.       TextColor(Bold);
  189.       Center(-1,22,'Esc TO RETURN TO PREVIOUS MENU');
  190.    end; { of Margins Menu }
  191.  
  192.  
  193. procedure LanguageSetMenu;
  194.    begin
  195.       TextColor(Text);TextBackground(Back);
  196.       ClearBox(2,5,78,20);
  197.       GotoXy(28,7); Write('1 - ASCII (slashed 0)');
  198.       GotoXy(28,8); Write('2 - LATIN AMERICAN   (IBM - ASCII unslashed 0)');
  199.       GotoXy(28,9); Write('3 - BRITISH');
  200.       GotoXy(28,10);Write('4 - GERMAN');
  201.       GotoXy(28,11);Write('5 - FRENCH');
  202.       GotoXy(28,12);Write('6 - SWEDISH');
  203.       GotoXy(28,13);Write('7 - DANISH I');
  204.       GotoXy(28,14);Write('8 - NORWEGIAN');
  205.       GotoXy(28,15);Write('9 - DANISH II       (IBM - DUTCH)');
  206.       GotoXy(28,16);Write('I - ITALIAN');
  207.       GotoXy(28,17);Write('F - FRENCH CANADIAN');
  208.       GotoXy(28,18);Write('S - SPANISH');
  209.       ClearBox(2,2,78,3);ClearBox(2,22,78,23);
  210.       Center(-1,2,'LANGUAGE SET MENU');
  211.       Center(-1,23,'Press 1 - S To Select a Language Set');
  212.       TextColor(Bold);
  213.       Center(-1,22,'Esc TO RETURN TO MAIN MENU');
  214.    end; { of language set menu }
  215.  
  216.  
  217. procedure CharacterSetMenu;
  218.    begin
  219.       TextColor(Text); TextBackground(Back);
  220.       ClearBox(2,5,78,20);
  221.       GotoXY(23,6); Write('1 - PROPORTIONAL.......... 10 CPI');
  222.       GotoXY(23,8); Write('2 - PROPORTIONAL DOUBLE...  5 CPI');
  223.       GotoXY(23,10);Write('3 - PROPORTIONAL CONDENSED 17 CPI');
  224.       GotoXY(23,12);Write('4 - DOUBLE HEIGHT................');
  225.       GotoXY(23,14);Write('5 - ITALICS ON...................');
  226.       GotoXY(23,16);Write('6 - IBM SET 1....................');
  227.       GotoXY(23,18);Write('7 - IBM SET 2....................');
  228.       ClearBox(2,2,78,3);ClearBox(2,22,78,23);
  229.       Center(-1,2,'FONT SELECTION');
  230.       Center(-1,23,'Press 1 - 7 To Select a Font');
  231.    end; { Font Menu  }
  232.  
  233.  
  234.  
  235. procedure SpecialFunctionMenu;
  236.    begin
  237.       TextColor(Text);TextBackground(Back);
  238.       ClearBox(2,5,78,20);
  239.       GotoXY(24,9); Write('1 - SKIP OVER PERFORATION');
  240.       GotoXY(24,11); Write('2 - SET FORM LENGTH');
  241.       GotoXY(24,13);Write('3 - PRINTHEAD LEFT TO RIGHT ONLY');
  242.       GotoXY(24,15);Write('4 - PRINTHEAD BIDIRECTIONAL');
  243.       ClearBox(2,2,78,3);ClearBox(2,22,78,23);
  244.       Center(-1,2,'SPECIAL FUNCTIONS MENU');
  245.       Center(-1,23,'Press 1 - 4 To Set a Special Function');
  246.       TextColor(Bold);
  247.       Center(-1,22,'Esc TO RETURN TO MAIN MENU');
  248.    end; { of SpecialFunctionMenu }
  249.  
  250.  
  251. procedure PrintTestMenu;
  252.    begin
  253.       TextColor(Text);TextBackground(Back);
  254.       ClearBox(2,5,78,20);
  255.       GotoXY(15,7);
  256.       Write('If you are using paper less than the full carriage');
  257.       GotoXY(15,8);
  258.       Write('width you could print off the form with this test.');
  259.       Center(-1,10,'Set your right margin if necessary.');
  260.       GotoXY(23,15);Write('1 - DO THE PRINT TEST');
  261.       GotoXY(23,17);Write('2 - SET MARGINS BEFORE PRINT TEST');
  262.       ClearBox(2,2,78,3);ClearBox(2,22,78,23);
  263.       Center(-1,2,'PRINT TEST MENU');
  264.       Center(-1,23,'Press 1 - 2 To Set Up The Print Test');
  265.       TextColor(Bold);
  266.       Center(-1,22,'Esc EXIT TO MAIN MENU (no test)');
  267.    end; { of procedure PrintTestMenu }
  268.  
  269.  
  270. Procedure DefaultScreen;
  271.    begin
  272.       TextColor(Text);TextBackground(Back);
  273.       ClearBox(2,5,78,20);
  274.       GotoXY(27,8); Write('PICA FONT DATA PROCESSING MODE');
  275.       GotoXY(27,9); Write('6 LINES PER INCH');
  276.       GotoXY(27,10);Write('66 LINES PER PAGE');
  277.       GotoXY(27,11);Write('11 INCH PAGE LINGTH');
  278.       GotoXY(27,12);Write('RESET MARGINS TO COLUMN 1 - 80 ');
  279.       GotoXY(27,13);Write('PERFORATION SKIP to DEFAULT');
  280.       GotoXY(27,14);Write('BIDIRECTIONAL PRINTING');
  281.       ClearBox(2,2,78,3);ClearBox(2,22,78,23);
  282.       Center(-1,2,'DEFAULTS SELECTED');
  283.       TextColor(Bold);
  284.       Center(-1,23,'PRESS ANY KEY TO CONTINUE');
  285.    end; { of defaultScreen }
  286.  
  287.  
  288. {****************************************************************************}
  289. {*                                                                          *}
  290. {*                           UTILITY PROCEDURES                             *}
  291. {*                                                                          *}
  292. {****************************************************************************}
  293.  
  294.  
  295. procedure ResetPrintMode;            { clears special print & returns DP mode}
  296.    begin
  297. {      Write(Lst,Rset);}                              { Reset to default }
  298.       Write(Lst,Enhanced_Off);                      { enhanced off }
  299.       Write(Lst,Emphasized_Off);                    { emphasized off       }
  300.       Write(Lst,Utility);                           { data processing mode }
  301.       Write(Lst,Pica);                              { pica - 10 cpi        }
  302.    end; { of ResetPrintMode}
  303.  
  304.  
  305. procedure SkipPerf;                  { sets printer to skip over perforation }
  306.    var Lines : Integer;
  307.    begin
  308.       ClearBox(2,22,78,23);TextColor(Text);
  309.       Center(-1,23,'Range is 0 - 127 lines');
  310.       {$I-}                                             { compiler directive }
  311.       repeat
  312.          ClearBox(2,5,78,20);
  313.          Center(-1,5,'A Value of 0 resets it to the default.');
  314.          Center(-1,-1,'ENTER NUMBER OF LINES TO SKIP AT PERFORATION  ');
  315.          Read(Lines); IOerr := (IOresult<>0);
  316.          if IOerr or (Lines < 0) or (Lines > 127) then begin
  317.             Center(-1,14,'Error, try again'+ Beep);
  318.          end; { of if error }
  319.       until (Lines >= 0) and (Lines <128) and not IOerr;
  320.       {$I+}                                             { compiler directive }
  321.       if Lines = 0 then Write(Lst,Default_Perf)
  322.       else Write(Lst,Set_Perf_Skip,Chr(Lines));       { set perf skip      }
  323.    end; { of procedure SkipPerf }
  324.  
  325.  
  326.  
  327. procedure FormLength;                { sets form length 1 to 22 inches       }
  328.    var Inches : Integer;
  329.    begin
  330.       ClearBox(2,22,78,23);TextColor(text);
  331.       Center(-1,23,'Range is 1 - 22 inches');
  332.       {$I-}                                             { compiler directive }
  333.       repeat
  334.          ClearBox(2,5,78,20);
  335.          Center(-1,-1,'ENTER FORM LENGTH IN INCHES ');
  336.          Read(Inches); IOerr := (IOresult<>0);
  337.          if IOerr or (Inches < 1) or (Inches > 22) then begin
  338.             Center(-1,14,'Error, try again' + Beep);
  339.          end; { of if error }
  340.       until (Inches > 0) and (Inches < 23) and not IOerr;
  341.       {$I+}                                             { compiler directive }
  342.       Write(Lst,Set_Form_Length,Chr(Inches));    { set form length    }
  343.       DoneScreen;
  344.    end; { of procedure FormLength }
  345.  
  346.  
  347. {****************************************************************************}
  348. {*                                                                          *}
  349. {*                             FONT SELECTION                               *}
  350. {*                                                                          *}
  351. {****************************************************************************}
  352.  
  353.  
  354. {function Correct_Mode(var LQ : string; tipe :string): string;
  355.  
  356. var
  357.   LQ1,S : string;
  358.   T : byte;
  359.   Code : integer;
  360.  
  361. begin
  362.  
  363.   LQ1:=LQ;LQ:='';
  364.   GoToXY(20,LastRow);Write(LQ1);
  365.   S:=Copy(Tipe,19,2);
  366.   Val(S,T,Code);
  367.   T:=ABS(T)+Abs(2);
  368.   Str(T,S);
  369.   Insert(S,LQ1,19);
  370.   Delete(LQ1,21,1);
  371.   LQ:=LQ1;
  372. end;}
  373.  
  374. procedure SelectFont(IBM_Mode : boolean);
  375.   const Condensed : Boolean = false;
  376.   var
  377.     Pic,El,Con : Boolean;
  378.  
  379.   begin
  380.      Pic:=False;El:=False;Con:=False;
  381.      FontMenu; ResetPrintMode; Condensed := false;
  382.      repeat
  383.         Ch:=Readkey;
  384.      until (Ch IN ['1','2','3','4','5','6','7','8']);
  385.      case Ch of
  386.         '1' : Begin
  387.                 Write(Lst,Pica);                       { pica  - 10 char/inch }
  388.                 Pic:=True;
  389.               end;
  390.         '2' : Begin
  391.                 Write(Lst,Elite);                      { elite - 12 char/inch }
  392.                 El:=True;
  393.               end;
  394.         '3' : Begin
  395.                 Write(Lst,Condense);                  { condensed - 15 char  }
  396.                 Con:=True;
  397.               end;
  398.         '4' : Begin
  399.                 Write(Lst,Compress,Pica );           { pica  compressed}
  400.                 Pic:=True;
  401. {                Condense := True;}
  402.              end;
  403.         '5' : Begin
  404.                 Write(Lst,Compress,Elite);           { elite compressed}
  405.                 El:=True;
  406. {                Condensed := True;  }
  407.               end;
  408.         '6' : Begin
  409.                 Write(Lst,Pica,                        { pica }
  410.                       Double_Wide);                    { double wide on       }
  411.                 Pic:=True;
  412.               end;
  413.         '7' : Begin
  414.                 Write(Lst,Elite,                       { elite }
  415.                       Double_Wide);                    { double wide on }
  416.                 El:=True;
  417.               end;
  418.         '8' : Begin
  419.                 Write(Lst,Compress,Pica,
  420.                       Double_Wide);
  421.                 Pic:=True;
  422.               end;
  423.      end; { of case }
  424.      If not Condensed then begin                      { data processing only }
  425.         QualityMenu;                                  { with condensed font  }
  426.         repeat
  427.            CH:=ReadKey;
  428.         until (Ch IN ['1','2','3','4','5']);
  429.         write(mode);
  430.         case Ch of
  431.            '1' : write(Lst,Utility);                  { data processing      }
  432.            '2' : Begin
  433.                    if NOT IBM_Mode then
  434.                       Write(Lst,LQ);
  435.                    if IBM_Mode then
  436.                       begin
  437.                         if Pic then
  438.                            Write(Lst,LQ,CHR(2));
  439.                         if El then
  440.                            Write(Lst,LQ,CHR(10));
  441.                         if Con then
  442.                            Write(Lst,LQ,Chr(26));
  443.                       end;
  444.                     end;
  445.            '3' : Write(Lst,Enhanced_On);              { enhanced             }
  446.            '4' : Write(Lst,Emphasis_On);              { emphasized           }
  447.            '5' : Write(Lst,Enhanced_Emphasis_On);     { both emphasized and  }
  448.                                                       { enhanced printing    }
  449.         end; { of case }
  450.      end; { of if not condensed }
  451.      DoneScreen;
  452.   end; { of SelectFont }
  453.  
  454. {****************************************************************************}
  455. {*                                                                          *}
  456. {*                               LINE SPACING                               *}
  457. {*                                                                          *}
  458. {****************************************************************************}
  459.  
  460.  
  461. procedure SetLineSpacing;
  462.    var N : Integer;
  463.    begin
  464.       LineSpaceMenu;TextColor(Text); Done := false;
  465.       repeat
  466.          CH:=ReadKey;
  467.       until (Ch IN ['1','2','3','4','5','6',#27]);
  468.       case Ch of
  469.          '1' : Write(Lst,Six_Lines);                 { 1/6 spacing (12/72)   }
  470.          '2' : Write(Lst,Eight_Lines);               { 1/8 spacing           }
  471.          '3' : begin
  472.                   ClearBox(2,22,78,23);
  473.                   Center(-1,23,'Range is 1 - 255');
  474.                   {$I-}                              { compiler directive    }
  475.                   repeat
  476.                      ClearBox(2,5,78,20);
  477.                      Center(-1,-1,'ENTER Variable Line Space VALUE  ');
  478.                      Read(N); IOerr := (IOresult<>0);
  479.                      if IOerr or (N < 1) or (N > 255) then begin
  480.                         Center(-1,14,'Error, try again'+ Beep);
  481.                      end; { of if error }
  482.                  until (N > 0) and (N < 256) and not IOerr;
  483.                  {$I+}                               { compiler directive    }
  484.                  Write(Lst,Var_Line,Chr(N));   { set spacing to N/72   }
  485.                end;
  486.          '4' : begin
  487.                   ClearBox(2,22,78,23);
  488.                   Center(-1,23,'Range is 1 - 255');
  489.                   {$I-}                              { compiler directive    }
  490.                   repeat
  491.                      ClearBox(2,5,78,20);
  492.                      Center(-1,-1,'ENTER (N/216) VALUE  ');
  493.                      Read(N);IOerr := (IOresult<>0);
  494.                      if IOerr or (N < 1) or (N > 255) then begin
  495.                         Center(-1,14,'Error, try again'+ Beep);
  496.                      end; { of if error }
  497.                   until (N > 0) and (N < 256) and not IOerr;
  498.                   {$I+}                              { compiler directive    }
  499.                   Write(Lst,Fine_Line,Chr(N)); { set spacing to N/216  }
  500.                end;
  501.          '5' : begin
  502.                   ClearBox(2,22,78,23);
  503.                   Center(-1,23,'Range is 1 - 255');
  504.                   {$I-}                              { compiler directive    }
  505.                   repeat
  506.                      ClearBox(2,5,78,20);
  507.                      Center(-1,-1,'ENTER (N/360) VALUE  ');
  508.                      Read(N);IOerr := (IOresult<>0);
  509.                      if IOerr or (N < 1) or (N > 255) then begin
  510.                         Center(-1,14,'Error, try again'+ Beep);
  511.                      end; { of if error }
  512.                   until (N > 0) and (N < 256) and not IOerr;
  513.                   {$I+}                              { compiler directive    }
  514.                   Write(Lst,N360,Chr(N)); { set spacing to N/360  }
  515.                end;
  516.          #27 : Done := true;
  517.       end; { of case }
  518.       if not Done then begin SkipPerf; DoneScreen; end;
  519.    end; { of SetLineSpacing }
  520.  
  521.  
  522. {****************************************************************************}
  523. {*                                                                          *}
  524. {*                               SET MARGINS                                *}
  525. {*                                                                          *}
  526. {****************************************************************************}
  527.  
  528.  
  529. procedure SetMargins;
  530.    var
  531.       Left,Right : Integer;
  532.    begin
  533.       MarginsMenu;Done := false;
  534.       repeat
  535.          CH:=ReadKey;
  536.       until (Ch IN ['1','2','3',#27]);
  537.       case Ch of
  538.          '1' : begin
  539.                   ClearBox(2,22,78,23);
  540.                   Center(-1,23,'Minimum between left and right is 10');
  541.                   {$I-}                                 { compiler directive }
  542.                   repeat
  543.                      ClearBox(2,5,78,20);TextColor(Text);
  544.                      Center(-1,-1,'ENTER LEFT COLUMN NUMBER   ');
  545.                      Read(Left); IOerr := (IOresult<>0);
  546.                      if IOerr or (Left < 1) or (Left > 255) then begin
  547.                         Center(-1,15,'Error try again'+ Beep);
  548.                      end; { of if error }
  549.                   until not IOerr and ((Left >= 1) and (Left <= 255));
  550.                   {$I+}                                  { compiler directive}
  551.                   Write(Lst,Left_Margin,Chr(Left));                { set left margin       }
  552.                end; { of case '1' }
  553.          '2' : begin
  554.                   ClearBox(2,22,78,23);
  555.                   Center(-1,23,'Minimum between left and right is 10');
  556.                   {$I-}                                 { compiler directive }
  557.                   repeat
  558.                      ClearBox(2,5,78,20);TextColor(Text);
  559.                      Center(-1,10,'Left margin set at column ');
  560.                      Write(Left);
  561.                      Center(-1,14,' ENTER RIGHT COLUMN NUMBER ');
  562.                      Read(Right);IOerr := (IOresult<>0);
  563.                      if IOerr or (Right-Left < 10) or (Right > 255) then begin
  564.                         Center(-1,16,'Error, try again'+ Beep);
  565.                      end; { of if error }
  566.                  until not IOerr and (((Right-Left) >= 10) and (Right <= 255));
  567.                  {$I+}
  568.                  Write(Lst,Right_Margin,Chr(Right));
  569.                end { of case '2'};
  570.          '3' : write(Lst,Set_Both_Margins);                { reset to 1 - 80   }
  571.          #27 : Done := true;
  572.       end; { of case }
  573.       if not Done then DoneScreen;
  574.    end; { Set Margins }
  575.  
  576.  
  577. {****************************************************************************}
  578. {*                                                                          *}
  579. {*                              CHARACTER SETS                              *}
  580. {*                                                                          *}
  581. {****************************************************************************}
  582.  
  583.  
  584. procedure SelectCharacterSet;
  585.   const Condensed : Boolean = false;
  586.   begin
  587.      CharacterSetMenu; ResetPrintMode; Condensed := false;
  588.      repeat
  589.         Ch:=Readkey;
  590.      until (Ch IN ['1','2','3','4','5','6','7']);
  591.      case Ch of
  592.         '1' : Write(Lst,Proportional);                  { proportional}
  593.         '2' : Write(Lst,Proportional_Double);           { proportional double}
  594.         '3' : Write(Lst,Proportional_Double_Condense);  { proportional double condensed}
  595.         '4' : Write(Lst,Double_Height);                 { double height}
  596.         '5' : Write(Lst,Italics);                       { Italics On}
  597.         '6' : Write(Lst,IBM1);                          { IBM 1}
  598.         '7' : Write(Lst,IBM2A);                         { IBM 2}
  599.       end; { of case }
  600.        if not Done then DoneScreen;
  601.    end; { SelectCharacterSet }
  602.  
  603.  
  604.  
  605.  
  606. {****************************************************************************}
  607. {*                                                                          *}
  608. {*                              LANGUAGE SETS                               *}
  609. {*                                                                          *}
  610. {****************************************************************************}
  611.  
  612.  
  613. procedure SelectLanguageSet;
  614.    begin
  615.        LanguageSetMenu;Done := false;
  616.        repeat
  617.           CH:=ReadKey;
  618.           Ch := UpCase(Ch);
  619.        until (Ch IN ['1','2','3','4','5','6','7','8','9','I','F','S',#27]);
  620.        case Ch of
  621.           '1' : begin
  622.                    Write(Lst,USA);
  623.                    SetStr := 'ASCII slashed 0';
  624.                 end;
  625.           '2' : begin
  626.                    Write(Lst,LATIN_AMERICAN);
  627.                    SetStr := 'Latin American';
  628.                 end;
  629.           '3' : begin
  630.                    Write(Lst,BRITISH);SetStr := 'British';
  631.                 end;
  632.           '4' : begin
  633.                    Write(Lst,GERMAN);SetStr := 'German';
  634.                 end;
  635.           '5' : begin
  636.                    Write(Lst,FRENCH);SetStr := 'French';
  637.                 end;
  638.           '6' : begin
  639.                    Write(Lst,SWEDISH);SetStr := 'Swedish';
  640.                 end;
  641.           '7' : begin
  642.                    Write(Lst,DANISH_I);SetStr := 'Danish I';
  643.                 end;
  644.           '8' : begin
  645.                    Write(Lst,NORWEGIAN);SetStr := 'Norwegian';
  646.                 end;
  647.           '9' : begin
  648.                    Write(Lst,DANISH_II);SetStr := 'Danish II';
  649.                 end;
  650.           'I' : begin
  651.                    Write(Lst,ITALIAN);SetStr := 'Italian';
  652.                 end;
  653.           'F' : begin
  654.                    Write(Lst,FRENCH_CANADIAN);
  655.                    SetStr := 'French Canadian';
  656.                 end;
  657.           'S' : begin
  658.                    Write(Lst,SPANISH);SetStr := 'Spanish';
  659.                 end;
  660.           #27 : Done := true;
  661.        end; { of case }
  662.        if not Done then DoneScreen;
  663.    end; { SelectLanguageSet }
  664.  
  665.  
  666.  
  667. {****************************************************************************}
  668. {*                                                                          *}
  669. {*                            SPECIAL FUNCTIONS                             *}
  670. {*                                                                          *}
  671. {****************************************************************************}
  672.  
  673.  
  674. procedure SelectSpecialFunction;
  675.    begin
  676.       Done := false;
  677.       While not Done do begin
  678.          SpecialFunctionMenu;
  679.          repeat
  680.             CH:=ReadKey;
  681.          until (Ch IN ['1','2','3','4',#27]);
  682.          case Ch of
  683.            '1' : begin SkipPerf; DoneScreen; end;
  684.            '2' : begin FormLength; SkipPerf; DoneScreen; end;
  685.            '3' : begin
  686.                     Write(Lst,UNIDIRECTIONAL);  { printhead l to r   }
  687.                     DoneScreen;
  688.                  end;
  689.            '4' : begin
  690.                     Write(Lst,BIDIRECTIONAL);  { printhead l and r  }
  691.                     DoneScreen;
  692.                  end;
  693.            #27 : Done := true;
  694.          end; { of case }
  695.       end; { of while not done }
  696.    end; { SelectSpecialFunction }
  697.  
  698.  
  699. {****************************************************************************}
  700. {*                                                                          *}
  701. {*                             ENGAGE DEFAULTS                              *}
  702. {*                                                                          *}
  703. {****************************************************************************}
  704.  
  705.  
  706. procedure EngageDefaults;   { Epson mode - back to system startup }
  707.    begin
  708.       DefaultScreen;
  709.       ResetPrintMode;
  710.       Write(Lst,PICA);                     { PICA }
  711.       Write(Lst,SIX_LINES);                { 6 Lines per Inch }
  712.       Write(Lst,FORM_LENGTH_11);           { Form Length 11 inches }
  713.       Write(Lst,Default_Perf);             { skip over perforation }
  714.       Write(Lst,LEFT_MARGIN_1,             { Left Margin 1 }
  715.                 RIGHT_MARGIN_80);          { Right Margin 80 }
  716.       Write(Lst,BIDIRECTIONAL);            { Bidirectional Printing }
  717.       CH:=ReadKey;
  718.   end; { EngageDefaults }
  719.  
  720.  
  721. {****************************************************************************}
  722. {*                                                                          *}
  723. {*                                PRINT TEST                                *}
  724. {*                                                                          *}
  725. {****************************************************************************}
  726.  
  727.  
  728. procedure DoPrintTest;
  729.    var
  730.       Index     : Integer;                               { array index       }
  731.       Counter   : Integer;                               { character counter }
  732.       Code      : String[3];                             { holds ASCII code  }
  733.       PrintStr  : Array[1..255] of String [6];           { array of print str}
  734.    begin
  735.       Done := false;
  736.       while not Done do begin
  737.          PrintTestMenu;
  738.          repeat
  739.             CH:=ReadKey;
  740.          until (Ch IN ['1','2',#27]);
  741.          case Ch of
  742.             '1' : begin
  743.                      Index := 0;Counter := 0;
  744.                      for I := 1 to 6 do WriteLn(Lst);
  745.                      if IBM2
  746.                         then Write(Lst,'IBM set 2, ')
  747.                         else Write(Lst,'IBM set 1, ');
  748.                      WriteLn(Lst,'Language set: ',SetStr);
  749.                      WriteLn(Lst,'┌─────────────────────────────┐');
  750.                      WriteLn(Lst,'│Special for this language set│');
  751.                      WriteLn(Lst,'├─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┬─┤');
  752.                      WriteLn(Lst,'│#│&│0│@│O│[│\│]│^│_│`│{│|│}│~│');
  753.                      WriteLn(Lst,'└─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┴─┘');
  754.                      WriteLn(Lst);
  755.                      WriteLn(Lst,'TEST LINE TEST LINE;test line test line');
  756.                      WriteLn(Lst,'TEST LINE TEST LINE;test line test line');
  757.                      WriteLn(Lst,'233 columns, (the maximum possible)');
  758.                      Write(Lst,'L--------10--------20--------30--------4');
  759.                      Write(Lst,'0--------50--------60--------70--------8');
  760.                      Write(Lst,'0--------90--------100-------110-------1');
  761.                      Write(Lst,'20-------130-------140-------150-------1');
  762.                      Write(Lst,'60-------170-------180-------190-------2');
  763.                      Write(Lst,'00-------210-------220-------230R');
  764.                      WriteLn(Lst);WriteLn(Lst);
  765.                      WriteLn(Lst,'Printable characters for ',SetStr);
  766.                      WriteLn(Lst,'─────────────────────────────────────────');
  767.                      if IBM2 then begin               { start building array }
  768.                         for I := 3 to 6 do begin
  769.                            Index := Index +1;Str(I,Code);
  770.                            PrintStr[Index] := Code+'   '+Chr(I)+'│';
  771.                            Write(Lst,Chr(I));
  772.                         end;
  773.                         Index := Index +1;
  774.                         PrintStr[Index] := '21'+'  '+Chr(21)+'│';
  775.                         Write(Lst,Chr(21));
  776.                      end;
  777.                      for I := 33 to 99 do begin
  778.                         Index := Index +1;Str(I,Code);
  779.                         PrintStr[Index] := Code+'  '+Chr(I)+'│';
  780.                         Write(Lst,Chr(I));
  781.                      end;
  782.                      for I := 100 to 126 do begin
  783.                         Index := Index +1;Str(I,Code);
  784.                         PrintStr[Index] := Code+' '+Chr(I)+'│';
  785.                         Write(Lst,Chr(I));
  786.                      end;
  787.                      if IBM2 then I := 128 else I := 160;
  788.                      for I := I to 254 do begin
  789.                         Index := Index +1;Str(I,Code);
  790.                         PrintStr[Index] := Code+' '+Chr(I)+'│';
  791.                         Write(Lst,Chr(I));
  792.                      end;
  793.                      WriteLn(Lst);WriteLn(Lst);WriteLn(Lst);
  794.                      for I := 1 to Index do begin      { print out the array }
  795.                         Write(Lst,PrintStr[I]);
  796.                         Counter := Counter +1;
  797.                         if Counter >= 8 then begin
  798.                            Write(Lst,Chr(10),Chr(13));
  799.                            Counter := 0;
  800.                         end;
  801.                      end;
  802.                      Done := true;
  803.                      Write(Lst,Chr(27),Chr(60),Chr(12));
  804.                   end; { of case 1 }
  805.             '2' : begin SetMargins;Done := false; end;
  806.             #27 : Done := true;
  807.          end; { of case '1' }
  808.       end; { of while }
  809.    end; { DoPrintTestn }
  810.  
  811.  
  812. {****************************************************************************}
  813. {*                                                                          *}
  814. {*                              BEGIN PROGRAM                               *}
  815. {*                                                                          *}
  816. {****************************************************************************}
  817.  
  818.  
  819. begin
  820.    CheckBreak:=False;
  821.    OrigMode:=LastMode;
  822.    TextMode(Lo(LastMode)+Font8x8);
  823.    FirstScreen;
  824.    Clearbox(2,5,78,20);
  825.    Print_Select;
  826.    while working do begin
  827.       MainMenu;
  828.       repeat
  829.          CH:=ReadKey;
  830.       until (Ch IN ['1','2','3','4','5','6','7','8',#27]);
  831.       case Ch of
  832.          '1' : SelectFont(IBM_Mode);
  833.          '2' : SetLineSpacing;
  834.          '3' : SetMargins;
  835.          '4' : SelectCharacterSet;
  836.          '5' : SelectLanguageSet;
  837.          '6' : SelectSpecialFunction;
  838.          '7' : EngageDefaults;
  839.          '8' : DoPrintTest;
  840.          #27 : working := false;
  841.       end; { of case }
  842.    end; { of while working }
  843.    ClearBox(2,5,78,20);TextColor(Border + Blink);           { end of program }
  844.    Center(-1,-1,'BYE');delay(2000);                         { routine here   }
  845.    TextColor(7);TextBackground(0);ClrScr;
  846.    TextMode(OrigMode);
  847. end. { of program Printer }
  848.