The Escape Code - Star Micronics Delta User Manual

Star micronics printer user's manual
Table of Contents

Advertisement

26
Delta User's Manual
about it in Chapter 6. We just wanted to illustrate a code that
causes Delta to perform a function.
The escape code
There's one particular 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's CHR$(27). With all of Delta's advanced fea-
tures, there weren't enough single ASCII codes to go around. 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 italic print is:
(ESC) CHR$(52)
-
-
-
-
-
-
-
In a program, this would look like this:
-
NEW
18 LPRINT CHR$(27) CHR$(52);
2$3 LPRINT "TESTING"
RUN
Try this program, it will print the word TESTING in italic.
-
Some of you fast students may have noticed that CHR$(52) is
the same as "4". That's right, the program will work just as well if
line
10
is changed like this:
lpi LPRINT CHR$(27)
"4";
-
-
-
-
That's just another form of the same ASCII code, and it's all
the same to Delta.
Here's
another
shortcut
for BASIC
programmers:
since
(ESC)
is used so often, assign it to a variable. In a long program,
typing ESC$ is much easier than typing CHR$(27) each time! Now

Advertisement

Table of Contents
loading

Table of Contents