1.2.7A BASICexample

Here’san exampleyou can typein rightnow, to clarifywhatwe’resaying. It’s written in Microsoft BASIC for a computerthat uses the MS-DOS operatingsystem,so if you have a differentcomputeror BASICyou may haveto translatea bit. We’llshowcommandsthe waythey’rewrittenfor an Epsondot-matrixprinterbecauseyourStarLaserPrinter4understandsthose commands.

TheLPRINTcommandsall senddatato theprinter.If thedatais something you want printedyoujust put it in quotationmarks. If the data is a control codeyoujust saywhexeitisintheASCIItable,givingitspositionasaregular decimalnumber.

BASICusuallysendsa carriagereturnafterevery 80character, to keepthe print positionmovingwhenit hits the end of a line. Unasked-forcarriage returnscan mess up yourprinting,however,so it’s a goodhabitto put in a WIDTH statementas shown.That lets us print over the wholepage area.

The <BEL>controlcode— ASCIIcode7 —is sentin BASICas CHR$(7). ThecESG codeitselfis CHR$(27).Andbecausewe’reusingthecharacter

4as part of an cESC> command,we type CHR$(52)insteadof “4”. So if you start BASICand type thesecommands:

NEW

10 ‘ EXAMPLE

20 WIDTH “LPT1:“,255

30 LPRINTCHR$(7)

40LPRINTCHR$(27);CHR$(52)

50 LPRINT“ITALICS!“

60END RUN

youmaketheprinter(inFX-850mode)firstsounditsbell-most peoplecall it a beeper—and then print the line:

ITALICS!

Generally,when yousend a controlor Escapecodeit staysactiveuntilyou deactivateit. That’s what happensin line 40 of our programabove. All subsequenttext willbe italicizeduntilyouchangeit back to uprightagain.

10

Page 16
Image 16
Star Micronics 4 manual 7A BASICexample, Italics