A BASIC example
Here’s an example you can typo in right now, to clarify what we’re saying.
It’s
writtenin MicrosoflBASICfor a computerthat uses the MS-DOS
operatingsystem,so if youhavea differentcomputeror BASICyoumay
havetotranslateabit.We’11showcommandsthewaythey’rewrittenforan
Epsondot-matrixprinterbecauseyourStarLaserPrinter8understandsthose
commands.
TheLPRINTcommandsallsenddatatotheprinter.Ifthedataissomething
youwantprintedyoujust putit in quotationmarks.If thedatais a control
codeyoujustsaywhereitisintheASCIItable,givingitspositionasaregular
decimalnumber.
BASICusuallysendsacarnagereturnafterevery80characters,tokeepthe
print positionmovingwhenit hitstheendof a line.Unasked-forcarriage
returnscanmessupyourprinting,however,so ii’sa goodhabitto putin a
WIDTHstatementas shown.Thatletsus printoverthewholepagearea.
The<BEL>controlcode—ASCIIcode7— issentinBASICasCHR$(7).
The<ESC>codeitselfisCHR$(27).Andbecausewe’reusingthecharacter
4 as
part of an <ESC>command,we typeCHR$(52)insteadof “4”.
Soif youstartBASICandtypethesecommands:
NEW
10 ‘ EXAMPLE
20 tiIDTH “LPT1 :”, 255
30 LPRINT CHR$(7)
40 LPRINT CHR$(27) ;CHR$(52)
50 LPRINT “ITALICS ! “
60 END
RUN
youmakethe printer(inEX-800mode)firstsoundits bell—mostpeople
callit a beeper—andthenprinttheline:
ITALICS!
Generally,whenyousenda controlorEscapecodeit staysactiveuntilyou
deactivateit. That’swhathappensin line 40 of our programabove.All
subsequenttextwillbeitalicizeduntilyouchangeitbackto uprightagain.
10