A BASIC example
Here's an example you can typo in right now, to clarify what we're saying.
It's
written in MicrosoflBASIC for a computerthat uses the MS-DOS
operatingsystem,so if you have a differentcomputeror BASICyou may
haveto translatea bit.We'11 s howcommandsthe waythey'rewrittenfor an
Epsondot-matrixprinterbecauseyourStarLaserPrinter8understands those
commands.
TheLPRINTcommandsallsenddatato theprinter.If thedatais something
you wantprintedyoujust put it in quotationmarks.If the data is a control
codeyoujust saywhereitisintheASCIItable,givingitspositionasaregular
decimalnumber.
BASICusuallysendsa carnagereturnafterevery80characters,to keepthe
print positionmovingwhenit hits the end of a line. Unasked-forcarriage
returnscan mess up yourprinting,however,so ii's a goodhabitto put in a
WIDTHstatementas shown.That lets us print over the wholepage area.
The<BEL>controlcode— ASCIIcode7— is sentin BASICas CHR$(7).
The<ESC>codeitselfis CHR$(27). A ndbecausewe'reusingthecharacter
4 as
part
of an <ESC>command,we type CHR$(52)insteadof "4".
So if you start BASICand type thesecommands:
NEW
10 ' EXAMPLE
20 tiIDTH "LPT1 :", 255
30 LPRINT CHR$ (7)
40 LPRINT CHR$ (27) ; CHR$(52)
50 LPRINT "ITALICS ! "
60 END
RUN
you make the printer(in EX-800mode)first soundits bell—most people
call it a beeper—and thenprint the line:
ITALICS!
Generally,when yousenda controlor Escapecodeit staysactiveuntilyou
deactivateit. That's what happensin line 40 of our program above. All
subsequenttext willbe italicizeduntilyouchangeit back to uprightagain.
10