Star Micronics 8 Series manual Basic example, Italics

Models: 8 Series

1 230
Download 230 pages 57.57 Kb
Page 18
Image 18

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’11showcommandsthe waythey’rewrittenfor an Epsondot-matrixprinterbecauseyourStarLaserPrinter8understandsthose 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).Andbecausewe’reusingthecharacter

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

NEW

10 ‘ EXAMPLE

20tiIDTH “LPT1 :”, 255

30LPRINT CHR$(7)

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

50LPRINT “ITALICS ! “

60END

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

Page 18
Image 18
Star Micronics 8 Series manual Basic example, Italics