home *** CD-ROM | disk | FTP | other *** search
- Unit PRT;
- { PRT.pas - Useful procs for IBM ProPrinter II XL24 & X24 }
- { The following unit contains many useful printer routines }
- { for the IBM ProPrinter XL24. I have tested all procs and }
- { they seem to work great for me. Careful with some of them }
- { though, some routines seem to have funny effects depending }
- { on the order in which they are used. Keep an eye on any of }
- { the routines that vary line spacing, ( i.e. DHDW, LineNorm }
- { and LineSpace). In using these I have found it necessary }
- { thoroughly test and even make minor alterations in some }
- { cases for the unit to perform as planned. }
- { This was written and checked w/ TurboPascal 5.5 }
- { If YOU find any major flaws in this unit, please contact me }
- { to let me know. Thanx!!! }
- { Rick Camp }
- { Compuserve ID# 72361,2755 }
-
- INTERFACE
- uses Printer;
-
- { Used in Double High, Double Wide Procedure }
-
- const { This group contains valid values for "a" }
- LUCU = 0; { no changes in either line feeds or char Ht.}
- LUSH = 1; { Linefeeds unchanged, single high character }
- LUDH = 2; { linefeeds unchanged, double high character }
- SLCU = 16; { single linefeeds, unchanged char. height }
- SLSH = 17; { single linefeeds, single high character }
- SLDH = 18; { single linefeeds, double high character }
- DLCU = 32; { double linefeeds, unchanged char. height }
- DLSH = 33; { double linefeeds, single high character }
- DLDH = 34; { double linefeeds, double high character }
-
- { This group contains valid values for "b" }
- SW = 1; { single width characters }
- DW = 2; { double width characters }
-
- Procedure Feed;
- Procedure Norm10;
- Procedure Norm12;
- Procedure Norm17;
- Procedure LQ10;
- Procedure LQ12;
- Procedure LQ17;
- Procedure DSOn;
- Procedure DSOff;
- Procedure EOn;
- Procedure EOff;
- Procedure PrBeep;
- Procedure PrBS;
- Procedure PrCR;
- Procedure DW_LineCancel;
- Procedure DW_LineStart;
- Procedure DWOn;
- Procedure DWOff;
- Procedure DHDW(a,b : byte);
- Procedure HT;
- Procedure PrLF;
- Procedure PrCondense;
- Procedure PrSpace;
- Procedure LineSpace(n: byte);
- Procedure LineNorm;
- Procedure FormLines(n : byte);
- Procedure FormInches(n :byte);
- Procedure SkipPerf(n: byte);
- Procedure SkipPerfOff;
- Procedure SubPrint;
- Procedure SuperPrint;
- Procedure CanSubNSuper;
- Procedure OverScOn;
- Procedure OverScOff;
- Procedure UnderScOn;
- Procedure UnderScOff;
- Procedure HorizMargins( L,R : byte);
- Procedure TopOfForm;
- procedure Pr;
-
-
- (*************************************************************************)
- IMPLEMENTATION
- Procedure Feed;
- begin
- write(lst,#12); { formfeed - advances to next 'top of form' }
- end;
-
- Procedure Norm10;
- begin
- write(lst,#27#73#00); { 10 cpi default print - draft mode }
- end;
-
- Procedure Norm12;
- begin
- write(lst,#155#73#08); { same as above but 12 cpi }
- end;
-
- Procedure Norm17;
- begin
- write(lst,#155#73#16); { ditto...17 cpi }
- end;
-
- Procedure LQ10;
- begin
- write(lst,#155#73#2); { letter quality 10 cpi }
- end;
-
- Procedure LQ12;
- begin
- write(lst,#155#73#10); { L.Q. 12 cpi }
- end;
-
- Procedure LQ17;
- begin
- write(lst,#155#73#18); { L.Q. 17 cpi }
- end;
-
- Procedure DSOn;
- begin
- write(lst,#155#71); { double strike on }
- end;
-
- Procedure DSOff;
- begin
- write(lst,#155#72); { DS off... what else? }
- end;
-
- Procedure EOn;
- begin
- write(lst,#155#69); { turn on emphasized print }
- end;
-
- Procedure EOff;
- begin
- write(lst,#155#70); { turn off emphasized print }
- end;
-
- Procedure PrBeep;
- begin
- write(lst,#7); { Make printer beep }
- end;
-
- Procedure PrBS; { backspace printhead - if @ posn 1, ignored.}
- begin
- write(lst,#8); { use for creating overstrike chars. }
- end;
-
- Procedure PrCR; { print head carriage return }
- begin
- write(lst,#13);
- end;
-
- Procedure DW_LineCancel; { cancel double-wide setting }
- begin
- write(lst,#20);
- end;
-
- Procedure DW_LineStart; { Start D-W setting. Cancelled with a cancel, }
- begin { carriage return, linefeed, vert.tab, formfeed,}
- write(lst,#14); { contin. DW on, or cancel DW line. }
- end;
-
- Procedure DWOn; { turns continuous double wide on. }
- begin
- write(lst,#27#87#1);
- end;
-
- Procedure DWOff; { turns continuous double wide off. }
- begin
- write(lst,#27#87#0);
- end;
-
- Procedure DHDW(a, b : byte);
- { Double Height - Double Width Proc. }
- { A, defined in the constants section, sets the style of linefeeds and }
- { character height. B sets the character width. Use this same proc to }
- { turn DH or DW off using switches for a. After using, BE SURE to set }
- { line spacing back correctly. This is the only switch I've found that }
- { will change single/double line spacing.( Other than the obvious power}
- { switch or hardware reset. }
- begin
- write(lst,#27#91#64#4#0#0#0,chr(a),chr(b));
- end;
-
- Procedure HT; { advance print head to next horiz tab setting }
- begin { default is one every 8 spaces, starting at #9 }
- write(lst,#9);
- end;
-
- Procedure PrLF; { line feed for printer }
- begin
- write(lst,#10);
- end;
-
- Procedure PrCondense; { prints @ 17 cpi - doesn't affect mode. }
- begin { if issued w/ printer in LQ,it stays in LQ }
- write(lst,#15);
- end;
-
- Procedure PrSpace; { advance print head one space horizontally}
- begin
- write(lst,#32);
- end;
-
- Procedure LineSpace(n: byte); { sets spacing between line of text. N must }
- begin { be between 1 and 85. Increments of 1/72 in.}
- if (n < 12) or (n > 85) then { Default is 12, i.e 12/72 in. }
- n := 12;
- write(lst,#27#65,chr(n));
- write(lst,#27#50);
- end;
-
- Procedure LineNorm; { resets line spacing to default @ 6 lines/in.}
- begin
- write(lst,#27#65#12);
- write(lst,#27#50);
- end;
-
- Procedure FormLines(n : byte); { Sets form length in # of lines. Also }
- begin { sets top of form at current position }
- write(lst,#27#67,chr(n)); { Will also override hardware switch in}
- end; { printer case ( #4 on IBM Pro.XL24) }
-
- Procedure FormInches(n :byte); { Sets form length in inches, increments }
- begin { of 1/72 in. Same resets as listed above}
- if n > 255 then { 1 < N < 255. }
- n := 255
- else if n < 1 then
- n := 1;
- write(lst,#27#67#0,chr(n));
- end;
-
- Procedure SkipPerf(n: byte); { n := # of lines the printer skips at }
- begin { the end of each page, causing it to }
- if n > 255 then n := 255 { skip the perforations. 1 < N < 255 }
- else if n < 1 then n := 1; { Canceled by Formlines, FormInches and}
- write(lst,#27#78,chr(n)); { SkipPerfOff. }
- end;
-
- Procedure SkipPerfOff; { cancels perforation skipping }
- begin
- write(lst,#27#79);
- end;
-
- Procedure SubPrint; { Starts printing subscript. }
- begin
- write(lst,#27#83#1);
- end;
-
- Procedure SuperPrint; { Starts printing superscript. }
- begin
- write(lst,#27#83#0);
- end;
-
- Procedure CanSubNSuper; { Cancels either sub- or superscript, }
- begin { whichever is active. If neither, then}
- write(lst,#27#84); { its ignored. }
- end;
-
- Procedure OverScOn; { Start continuous overscore }
- begin
- write(lst,#27#95#1);
- end;
-
- Procedure OverScOff; { Stop continuous overscore }
- begin
- write(lst,#27#95#0);
- end;
-
- Procedure UnderScOn; { Start continuous underscore }
- begin
- write(lst,#27#45#1);
- end;
-
- Procedure UnderScOff; { Stop continuous underscore }
- begin
- write(lst,#27#45#0);
- end;
-
- Procedure HorizMargins( L,R : byte);
- { Used as absolute displacements from left edge of paper. Use a }
- { carriage return to establish proper printhead position before }
- { printing. CAUTION!!! It is possible to set the margins too wide, }
- { making the printer run off the actual page, possibly causing }
- { DAMAGE. You have been warned!! }
-
- begin
- if ((L<255) and (L>1)) and ((R>1) and (R<255)) then
- write(lst,#27#88,chr(L),chr(R));
- end;
-
- Procedure TopOfForm; { sets current position as the top of form }
- begin
- write(lst,#27#52);
- end;
-
- procedure Pr; { test string for quick checking. }
- begin
- writeln(Lst,' A B C D ABCD abcd 1234');
- end;
-
-
- end.
-