1.2.7A BASICexample
Here’sanexampleyoucantypeinrightnow,toclarifywhatwe’resaying.
It’s written in MicrosoftBASIC for a computerthat uses the MS-DOS
operatingsystem,so if youhavea differentcomputeror BASICyoumay
havetotranslateabit.We’llshowcommandsthewaythey’rewrittenforan
Epsondot-matrixprinterbecauseyourStarLaserPrinter4understandsthose
commands.
TheLPRINTcommandsallsenddatatotheprinter.If thedataissomething
youwantprintedyoujust put it in quotationmarks.If thedatais a control
codeyoujustsaywhexeitisintheASCIItable,givingitspositionasaregular
decimalnumber.
BASICusuallysendsacarriagereturnafterevery80character, tokeepthe
print positionmovingwhenit hitsthe endof aline. Unasked-forcarriage
returnscanmessup yourprinting,however,so it’sa goodhabitto putin a
WIDTHstatementas shown.Thatletsus printoverthe wholepagearea.
The<BEL>controlcode— ASCIIcode7—is sentinBASICas CHR$(7).
ThecESG codeitselfisCHR$(27).Andbecausewe’reusingthecharacter
4 as partof an cESC>command,we typeCHR$(52)insteadof“4”.
So if youstartBASICandtypethesecommands:
NEW
10 ‘ EXAMPLE
20 WIDTH “LPT1:“,255
30 LPRINTCHR$(7)
40 LPRINTCHR$(27);CHR$(52)
50 LPRINT“ITALICS!“
60 END
RUN
youmaketheprinter(inFX-850mode)firstsounditsbell-most peoplecall
it a beeper—andthenprintthe line:
ITALICS!
Generally,whenyousendacontrolorEscapecodeit staysactiveuntilyou
deactivateit. That’s whathappensin line 40 of our programabove.All
subsequenttextwillbe italicizeduntilyouchangeitbacktouprightagain.
10