Star Micronics SR-10/I5 user manual NEW 10 LPRINT CHR$7 RUN, ESC CHR$69, LPRINT CHR$27 CHRS69

Models: SR-10/I5

1 130
Download 130 pages 19.46 Kb
Page 40
Image 40
NEW

r; ‘_

w Control codes

SR-lo/15 uses many of the non-printing ASCII codes for control codes. These codes perform a function rather than printing a character. Let’s try an easy one right now:

NEW

10 LPRINT CHR$(7)

RUN

Where did that noise come from? That’s SR-10/15’s bell. We will learn more about it in Chapter 8. We just wanted to illustrate a code that causes SR-lo/15 to perform a function.

nThe escape code

There’s one ASCII code that we are going to be using more than all the rest. This is ASCII 27, which is called escape. In BASIC it is CHR$(27). With all of SR-10/15’s advanced features, there weren’t enough single ASCII codes to access all of them. So escape is used to start sequences of control codes that open a wider range of functions to us.

While you must call this code CHR$(27) in BASIC, we are going to refer to it as < ESC > in this book. This will make it much easier to recognize when we use it.

A typical escape code sequence starts with < ESC > which is followed by one or more CHR$ codes. As an example, the escape code sequence to turn on emphasized print is:

 

-

<ESC> CHR$(69)

-

 

-

In a program, this would look like this:

NEW

 

10 LPRINT CHR$(27) CHRS(69);

 

24)LPRINT "TESTING"

 

RUN

-

 

-

Try this program. It will print the word TESTING in em-

 

phasized print.

-

30

Page 40
Image 40
Star Micronics SR-10/I5 user manual NEW 10 LPRINT CHR$7 RUN, ESC CHR$69, LPRINT CHR$27 CHRS69, 24LPRINT TESTING