User'S Manual: Not Intended For Sale
User'S Manual: Not Intended For Sale
USER’S MANUAL
PN 80820128
Federal Communications Commission
Radio Frequency Interference
Statement
Thw rquipment generates and uses radio frequency energy and if not installed and used
properly. that is. in strl~“l accordance Lvith the manufacturer’s instructions, may cause in-
terference to radio and [etexxion reception. It has been type tested and found to comply
with the limits for a Ctavs B computing device in accordance wth the specifications in
Subpart J of Part 15 of FCC Rules, ivhich are designed to provide reasonable protection
against such inrerfcl-ence in a residential installation. Ho~vever. there is no guarantee
that interfrr-ence ~?ll not occur- in a particular installation. If this equipment does ~tuse
interference to radio or telex-ision reception. which can be determined by turning the
equipment off and on. the user is encouraged to try to correct the interference by one or
more of the folk)\\-ing measures:
l Reorient the receiving antenna
oRelocate the computer \vith respect to the receiver
l Slovv the computer away from the receiver
l Ptug the computer into a different outlet so that computer and receiver are on dif-
fercnt branch circuits.
If necessary. the user should consult the dealer or an experienced radioitete\,isiorl techni-
cian for additional suggestions. The user map find the following booklet. prepared h!
the Federal Communications Commission helpful: “Ho\r to Identify and Kesotve Radw
T\’ Interference Prohlrms. ” This hooklet is available from the I’.S. Government
PI-inting Office. LVashington. D.C.. 20402. Stock No. 001-000-00345-4.
For compliance with Federal Noise Interference Standard. this equipment requires a
shielded cable.
Self Declaration
Radio interferences regarding this equipment has heen eliminated according to Vfg
lO-l6/1984 announced hy the DBP.
DBP has been informed about the introduction of this special equipment and has been
conceded the right to esamiw the whole series.
It is upon the responsibility of thv user to assume that his own asscmhted system is in ac
cordance with the technical regulations under Vfg lOltiilYX4.
To observe FTZ-regulations it is necessary. to establish all connections io the printer
\vith shielded cable.
Trademark Acknowledgement
NX-10, grafstar: Star Micronics Co., Ltd.
r\pple, Apple II, ;2pple II - , Apple II e, Applesoft: Apple computer Inc
Commodore C-&l: Commodore Business Slachines. Inc.
Compaq: Compaq Computer Corporation
CI’IM: Digital Research
IBM Personal Computer, IHM LX: International Kusinehs Machines Corp.
Kaypro: Kaypro Corporation
Microsoft Rr\SIC: Microsoft Corporation
Osborne 1 : Osborne Compu~el- Corporation
TRS-80: Radio Shack. a division of Tandy Corporation
NOTICE
l A1l rights reserved. Reproduction of any part of this manual in any form what-
soever, without STAR’s express permission is forbidden.
l The contents of this manual are subject to change without notice.
l All efforts have been made to ensure the accuracy of the contents of this manual at
the time of going to press. However, should any errors be detected, STAR would
be greatly appreciate being informed of them.
l The above notwithstanding, STAR can assume no responsibility for any errors in
this manual.
Table of Contents
Chapter 1 Setting Up Your Printer
Where shall we put it?
What have we here?
Removing the printer cover
Removing the packing tube
Installing the ribbon cartridge
Chapter 2 Getting to Know Your Printer 7
Controls and parts of the printer
Parts of the printer
Controls and indicators
Extra functions
Other controls
Selecting and loading paper
Loading single sheets
Loading sprocket-feed paper
Adjusting the print head
Connecting the printer
Extra functions with the control panel
Self-tests
Hex dump
Panel mode
Italic mode
Italic and Panel mode
Setting print start position
Setting the left and right margins
Chapter 3 Basic Printing 23
Some basics of BASIC
A new language!
First steps
ASCII codes and the CHR$ function
Control codes
The escape codes
A note on command syntax
Some special kinds of text
Near Letter Quality characters
Italic printing
Underlining
Superscripts and subscripts
Changing the print pitch
Expanded print
Condensed print
Proportional printing
Making words stand out
Mixing print modes
Chapter 4 Formatting Text 41
Lines and line spacing
Starting a new line
Reverse line feeds
Changing the line spacing
Moving down the page without a carriage
return
Page control
Form feed
Reverse form feed
Changing the page length
Top and bottom margins
Setting left and right margins
Horizontal and vertical tabs
Horizontal tabs
One-time horizontal tabs
Vertical tabs
Vertical tab channels
Centering and aligning text
Chapter 5 Special Features of the Printer 61
Now hear this
Resetting the printer
Putting your printer to sleep
Printing the bottom of the sheet
Backspace, delete, and cancel text
Printing zeroes
Immediate-print
Adjusting the width of space between
characters
Uni-directional printing
The seven bit dilemma
Block graphics characters and special
symbols
International character sets
Printing characters in the control code area
Printing BIG characters
The optional sheet feeder
The macro control code
Reading a hex dump
Chapter 6 Creating Your Own Characters 81
Dot matrix printing
The print matrix
Defining your own characters
Rule 1: Draft download characters are eight
dots high
Rule 2: Dots cannot overlap
Add up each column of dots
Assigning a value to your character
Download character definition command
Printing download characters
Defining proportional characters
Defining NLQ download characters
., .,. .
SETTING UP YOUR
PRINTER
l Setting it up.
.. -- -_ _
F‘igure l- 1. Check to make sure you have all four items: 1) printer,
2) paper guide, 3) ribbon cartridge, and 4) user’s manual.
...
-..
.
--
Figure 1-3. Remove the protective tube from the carriage rail.
c_
/ Figure 1-4. Press the cartridge into place until the holdmg springs
snap into place.
Print head
Figure 1-5. All you have to do is to slide the print head carriage
manually to your right or left, then the ribbon slips down by itself into
its proper position.
.,
CHAPTER 2
GETTING TO KNOW
YOUR PRINTER
l Adjustment;
’ I nterf
’ Power switch
\
Power cord
I. I
n Extra functions
There are eleven more functions that are not directly
specified on the control panel. You can use six of them by press-
ing a key (or keys) when you turnon the power; five others are
activated by pressing two control keys at once.
For details, please refer to the end of this chapter.
n Other controls
There are other controls, not connected to the control panel
board. Some of the more important ones are:
II -
Release lever
L---L
I
Figure 2-3.
continuous
. ’ Paper bail
Use friction feed for single sheets and tractor feed for
paper.
1. Move the sprockets on the tractor feed unit all the way to
the ends.
2. Slide the sheet guide all the way to the right.
3. With the ribs of the paper guide toward you and the
sliding adjuster at the bottom left, insert the guide into
the slot at the back of the printer cover.
Sheet guide
/ Sprocket
‘igure 2-4. Raise the paper guide for loading single sheets.
L .. . . . . .. *.
Figure 2-5. l’rop up the paper guide by inserting me guise stana in
the notches provided for it.
‘igure 2-6. You can insert a sheet of paper by using the release
lever.
14
1. Turn on the printer and set the release lever for sprocket-
feed paper.
2. If the paper guide is installed, remove it.
3. Place a stack of fan-fold paper behind the printer.
4:Open the sprocket covers, on the right and left sprocket
units, as shown in Figure 2-7.
15
The distance between the print head and the platen must-be
adjusted to accommodate papers of different thicknesses. To
make this adjustment, move the adjustment lever, which is
under the printer cover and immediately in front of the release
lever (Figure 2-9). Pulling the adjustment lever towards you will
widen the gap; pushing it away from you will narrow the gap.
There are four positions; you can feel the lever clicking into - --
the various notches. The first step (illustrated) is the one most
commonly used for single sheets of paper.
You shouldn’t have any trouble finding the right gap setting
for your paper. If necessary, experiment; you’ll soon find the
best position for the paper you’re using.
Now that you have assembled your printer, it’s time to use it
for what you bought it for - print information from your com-
puter. But first you have to connect it to your computer. Please
follow the instructions in the order listed below.
17
*_
.
/-
Figure 2-10. This is how you connect the cable.
Italic mode _I
L Panel mode
Italic and Panel mode
n Self-tests
Your printer has two built-in programs that print out sample
lines of letters, numbers, and other characters-to show you
that everything’s in good working order. Self-test 1 is the long
version, and self-test 2 is the short one. You can use either one
to show the characters available in the printer, to check the in-
stallation of the ribbon and paper, and to check the adjustment
of the head-to-platen gap.
Best of all, you don’t have to wait another minute-you can
print the self-test without hooking up the printer to your com-
puter! It’s as simple as 1, 2, 3. . .
'igure 2-12. The self-tests show you what the printer can print.
Were you surprised? It’s fast, isn’t it? About 120 characters a
second, to be exact.
When you want to terminate the self-test function, turn off the
power switch.
n Hex dump
Can you guess what a “hex dump” is? No, it’s not where
witches throw away useless spells. A hex dump is an advanced
ability of your printer that you can use, in certain cases, to find a
problem with your system. Fortunately, such problems rarely
arise but the hex dump is available if one does. We’ll go over
hex dump in Chapter 4. Right now, we’ll just tell you how to
make a hex dump:
W Panel mode
As you’ll learn in Chapter 5, this printer has many software
controls. But if you want to print in one mode, ignoring the con-
trol codes, the “Panel” mode takes effect for you. To set the
“Panel” mode, follow the procedures:
< Notice that this mode stays on until you turn off the printer.
n Italic mode
Sometimes, you may want to print with italic characters with
Draft mode as the power-on default. You can set the Italic mode
with the following procedures:
~---____
Figure 2-13. You can set many functions by the combinations of
the control panel keys while in the Off Line mode.
MEMO
CHAPTER 3
BASIC PRINTING
tax;
l Near letter quality (NLQ) characters;
Printing in italics,
Underlining,
Superscripts and subscripts,
Boldface and emphasized text,
Mixing print modes.
H A new language!
Many people who meet BASIC for the first time are in-
timidated. Some are put off by the idea of learning any new
. . .,I
; 24
n First steps
The first things that a beginner learns to do are to list a pro-
gram and to print a character string. Certainly these are the
easiest operations one can do, but even they may depend on
what computer you have. In Microsoft BASIC, we can list all
the steps in a program by entering LIST. This lists them on the
CRT screen; if we want to print them on a printer, we prefix the
command with an L (enter LLIST).
The Microsoft BASIC command for outputting information is
PRINT. Like the LIST command, this displays the information
on the CRT screen so we have to add an L (+ LPRINT) if we
want to use the printer. Just put whatever you want to print
between quotes and after LPRINT (anything enclosed in quotes
is called a character string). For example, we would use
LPRINT “Hello!” to output “Hello!” to the printer. We’ll see
later how to LPRINT things other than character strings.
We started with Microsoft BASIC because it is the most wide-
ly used version of BASIC around. The programs in this manual
are written in Microsoft BASIC so they should run on most com-
puters. But if strange things happen when you try to run a pro-
gram, check the BASIC manual that came with your computer.
Let’s talk about Apple II computers for a minute. These
enormously popular computers use their own brand of BASIC.
To use an Apple II, enter the following -
PR#l -
PR#l
LIST PRINT "Hello! It
PR#O PR#O -
OPEN4,4 OPEN4,4
CMD4 CMD4
LIST PRINT "Hello! 'I
CLOSE 4 CLOSE4
Here, the first line says that the printer is device number 4,
the second directs output to it, the third does the printing, and
the last line closes down device number 4.
Appendix H gives more information about listing programs on
the various computers. Find the part that applies to your com-
puter and try it.
Now that we know how to address the printer, let’s try listing
a BASIC program. Load a program into memory ready to pro-
gram printer operation - just as soon as we learn a little bit
about the ASCII codes.
n Control codes
ASCII codes with values of 32 or less do not have their own
keys. These codes control many of the printer’s functions, so we
call them control codes. To enter a control code from the
keyboard, we have to press two keys at the same time - the
“control” key and one other. The other key determines what
code is sent - pressing the control (CTRL) key and A sends
ASCII code 1, CTRL B sends ASCII code 2, and so on.
Your printer has a lot of control codes to let you do some real-
ly nifty things. Let’s try one that we’ve mentioned several times
already:
That’s the printer’s bell (we call it that even though it sounds
like a buzzer). We’ll learn more about it in later (we just wanted
to show you a control code that would get your attention right
away).
There are four common ways of referring to a control code:
the name of the code or its abbreviation, the decimal ASCII
value, the hexadecimal ASCII value, and the “CTRL-” value.
For example, the ASCII code that causes the printer to advance
the paper one line is decimal 10. This code may be referred to
by any of the following.
27
(ESC) “W” 1
28
LPRINT CHR$(27>;"W";CHR$(l>
LPl-lINTCHR$(27);"W';CHR$(49)
LPRINT CHR$(27);"Wl"
Even though, there are many commands that require the use
of ASCII code 0; the character “0” (ASCII code 48) cannot be
substituted. In these cases, instead of an unadorned 0 we will
show ‘CHR$(O) each time these commands are referenced.
That’s it for the basics. You are now ready to learn how to use
the many features of your printer.
But for the final printout, try NLQ. The program below shows
how.
Table 3-1
Near letter quality commands
Function Control code
Near letter quality ON (ESC) “x” 1
’ Near letter quality OFF (ESC) “~“0
n Italic printing
Italic letters are letters that are slanted to the right. Your
printer can print all of its letters except NLQ characters in italic
as well as the roman (standard) letters you are accustomed to.
Italics can be used to give extra emphasis to certain words. The
command codes to turn italic on and off are shown in Table 3-2.
Table 3-2
Italic commands
.
Function Control code
Italic ON (ESC) “4”
Italic OFF (ESC) “5”
W Underlining
Not only can your printer print all styles of printing in both
roman and italic, but it can underline them too. The control
codes are shown in Table 3-3.
Table 3-3
Underline commands
Function Control code
Underline ON (ESC) “-“l
Underline OFF (ESC) “-“0
Table 3-4
Superscripts and subscripts commands
Function Control code
Superscript ON (ESC>“S”O
Subscript ON (ESC)“? 1
Super and subscript OFF (ESC)“T”
I i ne .
32
Table 3-5
Print pitch commands
Pitch Characters/inch Control code
Pica 10 (ESC) “P”
Elite 12 (ESC) “M”
Try this program to see how these two pitches work. Be sure
to set the printer to draft mode.
W Expanded print
Each of the print pitches can be enlarged to twice its normal
width. This is called expanded print. Try this program to see
how it works:
Table 3-6
Expanded print commands
n Condensed print
Each of the print pitches also can be condensed to its normal
width. This is called condensed print. Try this program to see
how it works:
n Proportional printing
Have you ever noticed in books and magazines? Doesn’t it
look nice? The main reason is that each character is given an
amount of space proportional to its actual width. A typewriter
(and most printer), on the other hand, give every character the
same amount of space, no matter how wide it is. (Pica pitch, for
example, gives a “w” and an “i” l/10 of an inch each. Look these
letters closely and you’ll see that a “w” is two or three times as
wide as an “i”.)
Well, you too enjoy professional-looking proportional print-
ing. You can turn proportional printing on and off with the
following command.
Table 3-8
Proportional commands
-
Function Control code
Proportional ON (ESC)“p”l
Proportional OFF -
(ESC)“p”O
Line 20 selects the elite pitch and line 40 turns on the propor-
tional printing with (ESC)“p”l. Line 50 prints a line with pro-
portional elite pitch. Then, line 60 selects the pica pitch, so that
line 70 prints a line with proportional pica pitch. Finally, line 80
resets the proportional printing and line 90 prints a line in nor-
mal pica pitch.
NOTE: When you change the print pitch by the MODE key on
the control panel, this proportional spacing should be
automatically cancelled.
-.
MAKING WORDS STAND OUT
Your printer has very good print density when it’s just print-
ing regularly. But sometimes you may want something to stand
<out from the rest of the page. This printer provides two ways to
do this: boldface and emphasized print. Both of these go over
the characters twice, but they use slightly different methods to
darken the characters. Let’s try them and see what the dif-
ference is.
The following table shows the control codes for getting into
and out of boldface and emphasized modes.
Table 3-9
Print emphasis commands
-
38
more efficiently.
You have at your disposal a unique command that lets you
choose any valid combination of print modes and pitch. This is
the Master Print mode command. It looks like this:
(ESC) “!” n
Table 3-10
Values of mixing print styles for Master Print
1 Bit 1 Print stvle-
Decimal value 1
1 Elite print 1
2 Proportional print 2
3 Condensed mint 4
14 1 Emphasized print I 8 I
5 Boldface print 16
6 Expanded print 32
7 (Not used)
18 I‘ Underline ’ 128 1
CHR$(27);“!“;CHR$(49)
To better understand the way the print modes work, consider
that each mode except pica (pica is the default) has a separate
switch that can turned on and off via software. Once the switch
is on, it stays on until turned off. When two modes that conflict
are turned on at the same time, the printer must choose which
one to use.
For example, suppose you turn on both Elite and Emphasized
modes. Since these cannot combine the printer must make a
choice; in this case, the printer chooses Elite.
Summary notes
1) Pica is the default pitch and is active when Elite is turned
off.
2) When two modes conflict, the one of lesser priority is
cancelled. For example, Condensed and Emphasized can
not be printed at the same time, printing is Emphasized.
3) Elite cancels Emphasized.
4) Underline, and Expanded modes combine with any print
modes.
5) Emphasized will not mix with Elite or Condensed.
CHAPTER 4
FORMATTING TEXT
NEW
10 ( Demo of line spacing
20 FOR I=1 TO 25
IF 1=13 THEN 60
2 LPRINT CHR$(27);"A";CHR$(I);
LPRINT "THIS LINE SPACING IS SET TO";1
2: NEXT I
70 LPRINT "LINE SPACING IS SET TO 1/6 INCH
(NORMAL) .I!
80 LPRINT CHR$(27);"2"
90 END
! ‘f
.J!!
,’ :
I .!i
.-
..,.II \ IIn
IIMF \ .:L
L I NE
I- I lIEi: SfYl” 1-C:) :LiI
I- :I:NE S Et::
“I- ‘Tel 1I
l-l-l I s I.._I tw SF AC 1:NC< I 5 SET 1-a 112
T 1-lI: S I_ :I:i’.lE SI:-’A[:: :CN[17 :I:S S Et:T ‘1”
cl 1.4.
T t.41:S I....1:NE: SI”‘A!I I NG :I:s SE:T 1-o 1.5
T t-1I s I- :I:IIE 6~’ A c :I:la(~7 :I:s I-;if:.T T [:I 1 6
1:I\1E..: SF-’G C:1:l’\lG :I.SZ cz;1x:-r -r f-1 3,7
T ti :CS I__.
Line 40 changes the line spacing. The command (ESC)“A”
CHR$(n) changes the line spacing to n/72 of an inch. The loop
that is started in line 20 increases the value of n (the variable I in
this program) each time it is executed. So the line spacing in-
creases as the program continues. Line 30 just shortcuts the
loop when I= 13, since BASIC won’t let us send CHR$(13)
without adding an unwanted CHR$(lO) to it. Finally, the (ESC)
“2” in line 80 resets the line spacing to 6 lines per inch. This is a
shortcut that is the same as (ESC)“A”CHR$(12).
When you run this program with the DIP switch l-6 off (IBM
mode), you cannot get the printout as shown above.
The (ESC) “A” CHR$(n) command in IBM mode only defines
the line spacing as n/72 of an inch; the (ESC) “2” command
changes the line spacing to the amount defined by the previous
(ESC) “A”.
So: you need to change the following lines to the previous pro-
gram as shown below for the IBM mode:
40 LPRINT CHR$(27>;"A";CHR$(I);CHR$(27);w2';
80 LPRINT CHR$(27); "A";CHR$(12);CHR$(27);"2"
You may wonder why they picked l/72 of an inch as the incre-
ment for the line spacing command. There’s a good reason: the
dots that the printer makes are l/72 inch apart. So this means
that you can vary the line spacing in increments as fine as one
dot - unless you want finer spacing, like one third dot spac-
ing.
40 LPRINT CHR$(27);"3";CHR$(I);
. and run the program again. Now the results will look like this:
45
The program works just the same as before, but the line spac-
ing are just one-third what they were. This is because (ESC j“3”
CHR$(n) sets the line spacing to n/216 inch.
Table 4-2 shows all the line spacing commands, including
several “shortcut” commands for commonly used line spacings.
Table 4-2
Line spacing commands
NEW
10 ' Demo of'one-time line feeds
20 LPRINT "LINE NUMBER 1."
;; LPRINT "LINE NUMBER 2.";
' One-time line feed
50 LPRINT CHR$(27>;"J";CHR$(loO);
60 LPRINT "LINE NUMBER 3."
70 LPRINT "LINE NUMBER 4."
80 END
i-:1:IW I\Il.JMEE:FII. I
I__I Ntx I’dJMBER 2 n
I....I NE NIJMBEH 3.
L.:I:NE: NCJMBER 4 ,s
L:CNE W..IME:EK 3 m
I__1 :;.IE tqI,_!
plE:E:Fi. it ”
Iem1:i\!- i’%]
I,..!
1’1E:1:F: j, .
iv 1 NE N!..!tqE:ER :z .
47
PAGE CONTROL
n Form feed
The simplest forms control code is the form feed. Form feed
(or < FF > ) is CHR$(12) and causes the printer to move the
paper to the top of the next sheet. Try it by changing lines 40
and 50 to this:
40 t form feed
50 LPRINT CHR$(12);
Before you run the program, turn your printer off and adjust
the paper so that the top of the sheet is even with the top of the
ribbon guide on the print head, then turn the printer back on. If
you don’t remember how to do this, review Chapter 2. When
you run the program, the results will look like this:
u I
---- J -------------
o 1.
:.:1.
1 ‘TNE
Nf-
.- iVl.JlviHl~R
IWMBER 3..
2.
,
f 0 I
0 I .t w-c -----------
0 pi;;; ;;;g ;I
I
.
The form feed (CHR$(12)) in line 50 caused the printer to
move to the top of a new page before printing the last two lines.
Table 4-3
Form feed commands
1Function 1Control code
Advance paper to top of next
CHR$(12)
paw
Reverse paper to top of current
(ESC)CHR$(12)
page
Table 4-4
Form length control
Function Control code
Set the page length to n lines (ESC)“C”CHR$(n)
Set the page length to n inches (ESC)“C”CHR$(O)CHR$(n)
NEW
10 ' Demo of variable form lenffths
20 LPRINT CHR$(27>;"C";CHR$(O>jCHR$(7);
30 LPRINT "PAY TO THE ORDER OF:"
40 LPRINT CHR$(12);
2; ;;;INT "FAY TO THE ORDER OF:"
-
This program should print “PAY TO THE ORDER OF:”
twice, and they should be 7 inches apart. Line 20 sets the form -
length to 7 inches. After line 30 prints, line 40 sends a form feed
.-
49
advance the paper to the top of the next form. Line 50 then
prints its message.
After you have run this program, turn off the printer and ad-
just the top of form position. When you turn the printer back on
the page length will reset to its normal setting (usually 11 in-
ches).
Table 4-5
Top and bottom margin commands
In both cases the value of n tells your printer how many lines
to skip, although there is a slight difference in the usage. When
you set the top margin with (ESC)“r”CHR$(n), the value of n
tells the printer what line to start printing on. When you set the
bottom margin with (ESC)“N”CHR$(n), the value of n tells the
printer how many blank lines should be left at the bottom of the
page.
Let’s try a simple application to see how these margins work.
Enter this program, which will print 150 lines without top and
bottom margins.
10 ' Demo of top and bottom margins
60 LPRINT CHR$(12); :' form feed
70 FOR I=1 TO 150
80 LPRINT "THIS IS LINE";1
90 NEXT I
110 LPRINT CHR$(12) :' form feed
120 END
When you run this program it will print 150 lines right down
the page and across the perforations. When it’s done line 110
sends a form feed to advance to the top of the next page. Look at
the lines that have printed near the perforations. Separate the
sheets and see if any of the lines have been torn in half. These
are the problems that the top and bottom margins will solve.
Now add the following lines to your program. (Don’t forget
the semicolons or you won’t get quite the same results that we
did.)
Now when you run the program, your printer skip the first six
lines and the last six lines on each page. Always send a form
feed after setting the top margin, or it will not work on the first
page printed. That’s because the top margin only takes effect
after a form feed.
Line 50 sets the top margin, line 30 sets the bottom margin,
and line 100 clears both margins when we are done.
THIS IS LINE 1
THIS IS ILINE 2
THIS IS LINE :
THIS IS ILINE 4
THIS I5 LINE 5
THIS IS ILINE 6
THIS IS LINE 7
THIS IS LINE R
THIS IS LINE 9
; THIS LINE 50
I THIS LINE 51
’ rHIS LINE 52
; THIS LINE 53
, THIS LINE 54
I THIS LINE 55
I
O1
ITHIS IS LINE 56
-.
b-
THIS IS LINE 164
THIS IS LINE 105
0 THIS IS LINE 106
THIS IS LINE 107
THIS IS LINE 108
0 THIS IS LINE 109
THIS IS LINE 116
0
---
0
b.
0
THIS IS LINE 111
-.
0 THIS IS LINE 112
THIS IS LINE 113
THIS IS LINE 114
0 THIS IS LINE 115
THIS IS LINE lib
THIS IS LINE 117
0 THIS IS LINE 118
THIS IS LINE 119
- THIS IS LINE 120
9
L_
SETTING LEFT AND RIGHT MARGINS
The left and right margins of this printer work just like a
typewriter - once they are set all the printing is done between
them. The commands to set the margins are given in the follow-
ing table:
Table 4-6
Left and right margin commands
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
XxXXXXXXXxXXXXXxxxXXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
xxxxxxxxxxxxxxxxxxxx
53
When you want to reset the margins to the default values, you
have two choices. You can either turn the printer off and back
on, or you can set margin values equal to the default values.
This means that you should set a left margin of 0 and right
margin of 80 in pica pitch.
If you change the pitch of your printing after you set your
margins, the margins will not change. They stay at the same
place on the page. So if you set the margins to give you 65 col-
umns of printing when you are using pica type, then you change
to elite type you will have room for more than 65 columns of
elite printing between the margins.
,M Horizontal tabs
Horizontal tabs are set automatically every eight positions. To
move the print head to the next tab position, send CHR$(S).
Try this program to see how the default tabs work.
Even though the words are different length, they are spaced
out evenly by the horizontal tabs.
Now add the following line to your program to set different
horizontal tabs:
15 LPRINT CHR$(27);"D";CHR$(7);CHR$(l4);CHR$(21);
CHR$(O)
The words are now closer together, but still evenly spaced.
Turn your printer off and on again to reset the default tabs.
Table 4-7
Horizontal tab commands
Function Control code
Advance to next tab position CHWW
(ESC)“D”CHR$(nl)
Set tabs at nl, n2, etc.
CHR$(nZ).....CHR$(O)
Table 4-8
One-time horizontal tabs
Function Control code
Absolute horizontal tab (ESC) ‘3” CHR$(nl) CHR$(nZ)
Relative horizontal tab (ESC) “\” CHR$(nl) CHR$(nZ:
,.
55
The relative horizontal tab command can move the print head
right form the current position. The formula for calculating how
much the print head moves is the same as in the absolute
horizontal tab command. However, the units by which the print
head actually moves vary’in l/120-inch units.
10 FOR I=1 TO 3
20 LPRINT "Relative";
30 LPRINT CHR$(27>;'\';CHR$(I*2O);CHR$(O);
40 LPRINT 'Horizontal";
50 LPRINT CHR$(27);"\';CHR$(I*lO);CHR$(O);
60 LPRINT "Tab."
70 NEXT I
80 LPRINT
90 END
W Vertical tabs
Vertical tabs have the same kinds of uses that horizontal tabs
do - they just work in the other direction. Horizontal tabs allow
you to reach a specific column on the page no matter where you
start from. Vertical tabs are the same. If you have a vertical tab
set at line 20, a vertical tab (or <VT >) will move you to line 20
whether you start from line 5 or line 19.
The vertical tab is not set at the power-on default. If you send
a CHR$(ll), which is the ASCII code for <VT > , before we
have set up tabs advance the paper one line. Enter this program
to see how this works.
Now, let’s set some vertical tabs of our own. Add these lines
to the program:
20 LPRINT CHR$(27>;"B";CHR$(lo);CHR$(20);
30 LPRINT CHR$(4O);CHR$(5O);CHR$(O);
wx.m-1-i-4 -rAb.
.,
Now when you run the program the first page looks just like
before, but line 80 sends one more <VT> than there are tabs.
This doesn’t confuse your printer - it advances the paper to the
next tab position which happens to be the first tab position on
the next page. That’s nice, isn’t it?
Table 4-9
Vertical tab commands
Table 4-10 -.
Vertical tab channel commands
Function Control code
Set vertical tabs at nl, n2, etc. (ESC)“b”CHR$(nO) CHR$W)
as channel n0 CHR$(nZ).....CHR$(O)
Select vertical channel n0 (ESC)“I”CHR$(nO)
When you run this program you should get like this.
Table 4- 11
Aligning commands
Function Control code
Left-aligned printing (ESC)“a”CHR$(O)
Centered printing (ESC)“a”CHR$(l)
Right-aligned printing (ESC)“a”CHR$(2)
When you run this program, you should get like this:
SPECIAL FEATURES OF
THE PRINTER
l Uni-directional printing;
l International character sets;
l Macro instruction;
sound the bell for a quarter of a second. This can be used to re-
mind an operator to change the paper or to make another adjust-
ment to the printer.
You can try this by typing:
LPRINT CHR$(7)
Table 5-1
Some miscellaneous commands
n Printing zeroes
Believe it or not, there are two types of zeroes. There is of
course the type we use every day - 0 - and this is what your
printer will print if you don’t do anything.
The other type is used almost exclusively in computers and
engineering. It is called the “slash zero” and is written like this -
0. The line through the number is supposed to prevent you from
misreading it as the letter “0”. Back before high-quality
printers were available, this was a good idea but you really have
no need for it (although you may want to use the slash zero for
special effect).
W Immediate-print
This printer can print at fine rate of 120 characters per se-
cond. But it will also print more slowly at the speed of your typ-
ing. In immediate-printmode, the printhead prints one character
at a time, as you send it. This printer also moves the paper up so
that you can see the current line and then down to continue
printing.
65
10 LPRINT CHR$(27);"il";
n Uni-derectional printing
Uni-directional printing is a big word that means printing in
one direction only. Your printer normally prints when the print-
head is moving in both directions. But once in a while you may
have an application where you are more concerned about how
the vertical lines align than with how fast it prints. This printer
lets you make this choice. The table below shows the commands
for controlling how this printer prints.
Table 5-2
Printing directin commands
Function Control code
Print ih one direction (ESC) “U”l
Print in both directions (ESC) “U”0 -
One time mint in one direction (ESC) “0’
Here is what you will get. The top line is printed bi-directional-
ly, and the bottom is printed uni-directionally. You will have to
look hard because there isn’t much difference.
10 LPRINT CHR$(27);"0";
20 LPRINT CHR$(27);"6";
30 FOR J=3 TO 6
40 LPRINT " d';J;CHR$(J.);CHR$(9);
50 NEXT J
60 LPRINT " 20 ";CHR$(20)
70 LPRINT
80 LPRINT " 21 ';CHR$(21);CHR$(g);
90 LPRINT " 26 ";
100 LPRINT CHR$(26)
1'20LPRINT
130 FOR ~=128 TO 254 STEP 5
140 FOR I=J TO J+4
150 IF I>254 THEN 170
160 LPRINT I;CHR$(I);CHR$(g);
170 NEXT I
180 LPRINT : LPRINT
190 NEXT J
I;:-
::>
69
Figure 5-l shows what this program will print. If your chart
doesn’t 1001like this because it has regular letters and numbers
instead of the special symbols, then your computer is only using
seven bits. You can get the correct printout by changing line
160 to this:
10 LPRINT CHR$(27);"6"; -.
20 LPRINT CHR$(218);CHR$(l96);CHR$(l96);
cHR$(l96);CHR$(l96);CHR$(l96);CHR$(19l)
30 LPRINT CsR$(l79);CHR$(53);CHR$(32);cHR$(32);
CHR$(32);CHR$(32);CHR$(l79)
40 LPRINT CHR$(l79);CHR$(32);CHR$(5);CHR$(32);
CHR$(5);CHR$(32);cHR$(l79)
50 LPRINT CHR$(l79);CHR$(32);CHR$(32);cHR$(5);
. CHR$(32);CHR$(32);CHR$(179)
60 LPRINT CHR$(l79);CHR$(32);CHR$(5);CHR$(32);
CHR$(5>;CHR$(32>;CHR$(179)
70 LPRINT CHR$(l79);CHR$(32);CHR$(32);CHR$(32); -
CHR$(32>;CHR$(53);CHR$(179)
80 LPRINT CHR$(l92>;CHR$(l96);CHR$(l96);
CHR$(l96>;CHR$(l96>;CHR$(l96);CHR$(217) -
90 LPRINT CHR$(27);"7"
71
If you have a 7-bit interface, add the following lines to the pro-
gram given above:
15 LPRINT CHR$(27);">";
95 LPRINT CHR$(27);"="
Table 5-4
International character set commands
I Countrv
Table 5-5
International character sets
Country ~35~36~64~91~92~93~94~96~123~124~125~12
U.S.A I#lsl@lcl\lll*l’lcl:l,l~
IFrance
IGermany l#l$lsl~l~lul^l’l~lal~lR -
England f al~lrl~lil~l~l~l~l~l-
.I. G I.
Demarktype I #$@E~L-zi;;-
Sweden #rl~At5AUBZ~Bi.i
Italy
130 NEXT I
140 LPRINT CHR$(144);CHR$(145);
150 FOR I=149 TO 159
160 LPRINT CiSS(I);
170 NEXT I
180 LPRINT CH?.$(27);"10"
190 END
When you run this program you should get like this:
Table 5-6
Control code area colmmands
Function Control c
Printable code area expansion (ESC)“G”
..
Control code area expansion 1 (ESC>“7”
C I (ESC)“I”l
kkct undefinedcodesas characters
(Cancelundefinedcodesas characters I (ESC)“I”O
-.
Table 5-7
Big character cornmands
Function Control c
Double-high enlarged print (ESC)“h”( :HR$UJ I
Quad-high enlarged print (ESC)“h”CHR$(2)
1Double-highlower-halfenlarged mint 1 (ESC)“h”( :HR$(3)
.Double-highupper-halfenlarged print (ESC)“h”CHR$(4)
Quad-highlower-halfenlarged print (ESC)“h”( ;HR$(5) I
Quad-highupper-halfenlarged print (ESC)“h”CHR$(G)
I Cancel enlarged print 1 (ESC)“h”( ZHR$(O)
When you run this program, you will get like this:
As you can see, when the big character command is used, the
baseline for each character does not align. When you want to
?lign the baseline, try this program:
Table 5-8
Automatic sheet feeder commands
When the automatic sheet feeder is installed, you must set the
DIP switch 1-5 on to detect the paper-out condition.
In addition, following functions are ignored when the auto-
matic sheet feeder is installed:
Setting of the page length
Top and bottom margins
Vertical tab settings
Table 5-9
Macro instruction commands
To see how this works we can build a macro that will reset the
printing style to normal, no matter what style it may be to start
with. The following program will define a macro to do this.
10 LPRINT CHR$(2'7);"Q";CHR$(40);
20 LPRINT CHR$(27);"af';CHR$(2>;
30 LPRINT CHR$(27);"-1";
40 LPRINT CHR$(27>;"h";CHR$(l);
50 LPRINT "TESTING ABCD"
60 LPRINT CHR$(27>;"t";CHR$(l);
;; g;I?INT"TESTING ABCD"
TIES-b I--....
_.__.,_-.-,.. INI:
- _.-.....-..-..,. AIBC::ll2
“___I-.......-...
lIZ.S'T
1:IG AECI?
Or:, 0 1 02 03 Q4 05 06 07 00 09 OA OB IX 0D I:Ii? 0E
0F 10 11 12 13 14 15 16 17 18 19 lB 1C ID 1E if- ............
’ 20 21 22 23 24 25 26 27 28 27 20 28 2C 2D 2E “F ‘;~~k*zv o*+,-./
‘I.0 31 32 33 34 35 36 37 38 39 74 3f1 7.C 3D TE :.F ,:,I 2.3456789: : .C= %--
40 41 42 43 44 45 46 47 4R 49 40 4R 4C 41, 4E 4F- I~nBTDEFStiI.J~L.FINO
50 51 52 s3 54 55 56 97 50 59 sa 5R SC 51) 51-I 5f- KIRRTUVWXY7C\l”-
60 61 h:! 63 64 65 66 67 6R 67 60 6B 6C 6D 6E 6r ‘ahcdefghiiI.lmno
70 71 72 73 74 7s 7h 77 7R 79 7FI 7H 7C 7D 7E 7F pqr.‘.tLlvW:<y;ICI:“.
En 01 82 93 84 85 Oh 87 RR 87 RR Elf3 BC nu RI7 I-IF . . . . . . . . . . . . . . . .
71.1 91 92 93 94 95 96 97 9R 99 90 9B 91: 9D 9E 9F . . . . . . . . . . . . . . . .
ra1.J at A2 a.3 A4 05 aa 07 At3 A9 Ah AR FIG RD AE nF . . . . . . . . . . . . . . . .
HO Bl B? R3 B4 85 86 R7 BEI B9 PA RB EC BD BE Bt- . . . . . . . . . . . . . . . .
CO Cl C2 C3 C4 C5 C6 C7 CO C9 CF\ CR CC CD CE r:F . . . . . . . . . . . . . . . .
DO Dl DI! D3 D4 D5 Dh D7 DO D9 DA DR DC DD DE DF ................
EO El E2 E3 E4 E5 E6 E7 ES E9 EA EB EC ED Et: EF ................
F0 Fl F2 F3 F4 F5 F6 F7 FB F9 Fe FB FC f=D FE FF ................
0D UFI ..
CREATING YOUR
OWN CHARACTERS
I
Figure 6- 1. The letter “C” is created by printing 15 dots.
5gure 6-2. As the printhead moves across the page, each of the
wires prints one row of dots.
All of the standard characters that this printer prints are form-
ed from patterns of dots that are permanently stored in the
printer’s ROM (read-only memory). This includes all of the stan-
dard ASCII characters, and special characters, the international
83
L ___ _ . -..
Figure 6-3. Dots can be inside boxes or straddle the vertical lines
of the grid.
m,m,m,m.m,m,m,m,m,m,,m,,
ASCII Code
Descender
32 Start column
End column
16
Total
i
ETigure 6-4. Use this grid (or one similar to it) to define your owr 1
draft characters.
m,m,m,m.m,m,m,m,m,m,,,m.,
64 Descender 1
32 Start column
End column
16
blal
m m, m, m, m. m. m m, m. m m
ASCII Code
WRONG!
64 Descender
32 Start column
End column
16
Tolal
i
Figure 6-6.
cots cannot overlap; those in immediately adjacent
“half columns” will be ignored when the character is printed.
128 O-128
64 0 - 64 0 - 64
32 0 - 32 . - 32 l - 32
/ 16 0 - 16 0 - 16
/- 8 O-8 o-8
4 o-4 O-4
! 2 o-2 O-2 o-2
1 O-l O-1
~ ___
Sum 103 58 255
Figure 6-7. By adding the values of each dot in a column, you’ll get
a unique description for any combination of dots.
87
128
m. m, m, m. m, m, m, mR mp m,,. m,,
ASCII Code
I
64 Descender
32 Start column
End column
16
/
pigure 6-8. Add the values of the dots in each column and write
the sum of each column at the bottom.
89
(ESC)“&“CHR$(O) nl n2 m0 ml m.2 m3 m4 m5 m6 m7 m8 m9
ml0 ml1
Figure
date
6-10.
0 000
Starting
print column
1011
Ending
print column
CHR$(27);CHR$(38);CHR$(O);CHR$(GO);CHR$(6O);CHR$(l39)
;CHR$(2);CHR$(5);CHR$(8);CHR$(241);CHR$(O);CHR$(O)
;CHR$(241);CHR$@);CHR$(5);CHR$(2);CHR$(O)
10 LCRINT CHR$(27);"&";CHR$(O);CHR$(60);CHR$(62);
20 FOR N=60 TO 62
30 FOR M=O TO 11
40 READ MM
50 LPRINT CHR$(MM);
60 NEXT M
70 NEXT N
80 LPRINT
90 END
100 DATA 139, 2, 5, 8,241, 0, 0,241, 8, 5,
2, 0
110 DATA 139,124, 0, 66, 4, 64, 36, 16, 2, 16,
12, 0
120 "@A 139, 46, 16, 2, 60, 0, 48, 0, 48, 0,
9 0
(ESC)“%“CHR$(n);CHR$(O)
10 LPRINT CHR$(27>;"%1";CHR$(O);
20 LPRINT CHR$(6O>;CHR$(61>;CHR$(62)
30 LPRINT CHR$(27>;"%O";CHR$(O)
40 END
(If it doesn’t, check the last program we ran for errors, then
rerun it.)
10 LPRINT CHR$(27);"%1";CHR$(O)
20 FOR I=32 TO 126
2; ;;X";N; U-W(I);
50 LPRINT
60 FOR I=160 TO 254
'7; g;;"; CHR$(I);
90 LPRINT
100 LPRINT CHR$(27);"%O";CHR$(O)
110 END
92
(ESC)“:“CHR$(O);CHR$(O);CHR$(O)
Figure 6- 11. Printout of the dqwnload character set, into which all
the ASCII characters have been copied, and the (, = and > have been
changed.
70 NEXT M
80 NEXT N
90 LPRINT
100 DATA 139, 2, 5, 8,241, 0, 0,241,
8, 5, 2, 0
110 DATA 139,124, 0, 66, 4, 64, 36, 16,
16 12
120 DA% 139: 46: 160, 2, 60, 0, 48, 0,
130 L%NT"~H~~~27;~"D"-cHR$(ll)CHR$(0)
140 LPRINT CHR$(27)f"h";CHR$(l);'
150 LPRINT " U.S. EXPORTS"
160 LPRINT cHR$(27>;"h";c~~$(o);
170 LPRINT CHR$(27);"~l";CHR$(O);
180 LPRINT "AUTOS";CHR$(9);
190 FOR I=.4 TO 9.3 STEP .4
200 LPRINT CHR$(61);
210 NEXT I
220 LPRINT
230 LPRINT "CHEMICALS";CHR$(g);
240 FOR I=.4 TO 8.7 STEP .4
250 LPRINT cHR$(So);
260 NEXT I
270 LPRINT
280 LPRINT "GUNS";CHR$(g);
290 FOR I=.4 TO 1.4 STEP .4
300 LPRINT CHR$(62).;
310 NEXT I
320 LPRINT
330 LPRINT CHR$(g);"+--";
340 SCALE$=“--+--‘I
350 FOR I=2 TO 8 STEP 2
360 LPRINT SCALE$;
370 NEXT ‘I
380 LPRINT "--+"
390 LPRINT CHR$(9);" ";
400 FOR I=2 TO 8 STEP 2
410 LPRINT " ";I;
420 NEXT I
430 LPRINT CHR$(27);"$O";CHR$(O)
440. LPRINT CHR$(27);"SO";
450 LPRINT CHR$(9);"MILLIONS OF DOLLARS"
460 LPRINT cH~$(27);"~"
470 END
94
character width is five dots (so you could not, for instance,
specify a starting column of 6 and an ending column of 8, even
though those are both within the acceptable range). If you in-
advertantly give an incorrect width value, however, your printer
is forgiving: it will automatically revert to the default width of
eleven dot columns.
Just as there was an easy trick for figuring the attribute byte
earlier, you still don’t need to know a thing about binary
arithmetic. Merely multiply the starting column by 16, add the
ending coulmn number, and add 128 if the character is not a
descender. If you prefer a formula: (descender * 128)+(start *
16)+ end.
One thing to remember about defining proportional
characters: a character cannot be wider than the specified
width. That seems obvious enough! For example, if you specify
a width of 6 for a character (starting in column 1 and ending in
column 6), the seventh through eleventh of dots (if you specified
any) will not print. You must, however, send information (even
if it is 0) for those columns when you defined a character; your
printer expects eleven characters following the (ESC)“&”
CHR$(O) nl n2 m0 sequence.
In most cases, the width you select should actually be one dot
wider than the number of columns that the character actually oc-
cupies. This is so that there will be a space (of one dot) between
3 characters when you print them. If you specify a width which is
exactly the same as the number of columns in the character
definition, the characters will touch when they print (this is
sometimes desirable - for border characters or for large
download characters that are more than eleven dots wide).
128
128
84
ASCII Code:
64
32 Descender:
32
16 Start column:
16
8
End column:
8
4
4
II
MO = Descender * 128 + (Start * 16 ) + End
2
2
1
1
TOtd
1st
2nd
Figure 6-12. Use this grid (or one similar to it) to define your own
NLQ characters.
As you noticed when the NLQ characters are printed, they are
printing in twice; the first line of data is printed, the paper is
moved up a distance of l/2 dot, then the second data line is
printed. So, we’ve written the numbers on the horizontal lines.
To calculate the data numbers for this column, you see which
dots are used in the box and add their values together. Then you
go down the dots on the horizontal lines and add their values
together as shown in Figure 6-13.
Now we’ll show you how to use the NLQ character definition
with a flask as shown in Figure 6-13. Figure 6-13 shows the
design drawn on a grid and the data numbers printed at the
bottom of each column.
If you look at each column individually, you can see how the
data numbers were calculated.
97
Descender: 2.
Start column:
End column:
Figure 6- 13. Add the values of the dots in each box and line col-
umn and write the sum of each column at the bottom.
Now enter the following program and run it. It has the data
numbers for the NLQ flask character. For a character of your
own, change the DATA numbers and the character definition
$osition.
10 LPRINT ~~~$(27)pXl";
20 LPRINT CHR$(27);"&";CHR$(O>;CHR$(6O);CHR$(6O);
30 FOR M=O TO 22
40 READ MM
2; ;;;;"; CHR$(MM) ;
70 LPRINT
80 LPRINT CHR$(27);"xO"
90 END
100 DATA 139, 2, 5, 8,241, 0, 0,241, 8,
5, 2, 0
110 DATA 6, 8, 16,224, 0, 0,224, 16, 8,
6, o
120 DATA 139,124, 0, 66, 4, 64, 36, 16, 2,
16, 12, o
130 DATA 120, 4, 0, 4, 0, 96, 4, 0, 4,
8, 0
140 DATA 139, 46, 16, 2, 60, 0, 48, 0, 48,
o, 48, o
150 DATA 92, 32, 4, 60, 0, 48, 0, 48, 0,
48, 0
When you want to print the defined character, you must select
the NLQ mode first, then select the download characters. If you
don’t select the NLQ mode, the download characters are not
printed even you selected the download character set.
To demonstrate how to use the NLQ download characters,
let’s use this character set to print a small graph. Try this pro-
gram.
10 LPRINT CHR$(27
20 LPRINT CHR$(27 ;CHR$(O);CHR$(O);
30 LPRINT CHR$(27 ;cHR$(60);CHR$(62 );
40 FOR N=60 TO 62
50 FOR M=O TO 22
60 READ MM
7’; i;;;N; CHR$(MM);
90 NEXT N
100 EPRINT
110 DATA 139, 2, 5, 8,241, 0, 0,241, 8,
5, 2, 0
120 DATA 6, 8, 16,224, 0, 0,224, 16, 8,
.-
6, 0 .
130 DATA 139,124, 0, 6.6, 4, 64, 36, 16, 2,
16, 12, o
140 DATA 120, 4, 0, 4, 0, 96, 4, 0, 4,
8, 0
150 D;TA4;39, 46, 16, 2, 60, 0, 48, 0, 48,
0
160 DA{A 42, 32, 4, 60, o, 48, 0, 48, o,
48
i70 LP;IN; CHR$(27);"D"*CHR$(ll)~CHR$(O)
180 LPRINT CHR$(27);"h";CHR$(l);'
190 LPRINT ' U.S. EXPORTS"
200 LPRINT CHR$(27>;"h";CHR$(O>;
210 LPRINT CHR$(27);"%l";CHR$(O);
220 LPRINT "AUTOS";CHR$(9); -
230 FOR I=.4 TO 9.3 STEP .4
99
MEMO
-
CHAPTER 7
DOT GRAPHICS
l High-resolution graphics.
(ESC,)“*“CHR$(O) nl n2 ml m2 ...
Just like many of the other codes you have learned, the com-
mand starts with an escape sequence ((ES,>“*” in this case).
This is followed by CHR$(O), which specifies normal density
(the other densities are described later in this chapter). But
unlike the other codes there can be any number of graphics data
bytes following the command. That’s where nl and n2 come in;
they are used to tell the printer how many bytes of graphics data
to expect.
Table 7-1
Calculating nl and n2.
kf the numb
-- ______._ --.
Now if you run the program you should get a printout that
looks like this:
14 (1;)bJ ! ._--“-----___ _....----.-- _.,, “I_ t.,, 1 cz; I[ cr; (1; R /g,-(- !
“..... .........-“’
But there is one thing to be careful of: all graphics data must
print on the same line. The graphics command is turned off at
the end of each line, even if you have specified that more
graphics codes follow. To see what we mean, change line 30 to
plot 1000 points and run the program.
30 WID=lOOO
wciw ’ --.--
TH I s 1s ‘eEflTT--------.---
This will make the sine wave pattern long enough to go off the
page.
As you can see, your printer printed graphics up to the end of
the line, then ignored the rest of the graphics data and returned
to normal text on the next line.
106
Since you control the firing of every pin, you can print nearly
anything with your printer that can draw (and probably better, if
you’re like most computer users!). You can be used for creating
“computer art” or drawing maps. Or, as we’ll show you here,
you can use dot graphics to print your logo at the top of each let-
ter you print.
Designing an image to print with dot graphics is much like
designing download characters. The best way to start is to lay
out your image on graph paper. Since you can print eight rows
(seven with a 7-bit interface) of dots with each pass of the print
head, draw a heavy horizontal line every eight rows on your
graph paper. And it may be helpful to write the dot values
(128,64,32, etc.) down the left side of each row. Then after
you’ve filled in the “dots” that you want to print, it’s time to get
out the old calculator again! Just as you did with download
characters, add up the values of each column of dots; this makes
up one byte.
!
! s&s
-- ~--~~~~~ ~~~~~~ _J
Figure 7-2. By laying out the logo on graph paper, you can
calculate all of the graphics data.
107
If you are using with the IBM mode (DIP switch l-6 off), _
change the following lines to the program given above.
-
109
20 LINE.8$=CHR$(27)+CHR$(65)+CHR$(8)+CHR$(27)+
CHR$(5Oj
40 LINE.l2$=CHR$(27>+CHR$(65)+CHR$(l2)tCHR$(27)t
CHEI$(50)
This section of the manual gets into more serious BASIC pro-
gramming just because it’s required in order to have the com-
puter act as a plotter driver. Don’t be intimidated; while it’s
beyond the scope of this manual to teach BASIC, if you try the
examples and take it slowly you should be doing some fancy plot-
ting of your own before you know it.
If designing and calculating dot graphics images by laying
them out on graph paper seems too tedious to you, then let the
computer do the work for you! With your computer doing the
calculations and your printer plotting the output, you can come
up with some terrific business graphs, charts, and mathematical
function plots.
The best way to do this is to set up an array in memory. This
is your “graph paper.” The first thing to do is to determine how
big you want your output to be; this will determine the size of
your array. (If you have grandiose plans to fill an entire page
with plotter output, you better have lots of memory in your com-
puter. With 60 dots per inch horizontally and 72 dots per inch
vertically, it takes at least 540 bytes of memory for each square
inch of plotted area. That doesn’t sound so bad - but an area 8
inches square requires over 32K!)
Your array should be two-dimensional (just like graph paper)
where one dimension will be the number of columns of dots and
the other dimension is the number of printing lines (remember
that you can have up to eight rows of dots per printed line).
Here’s a program that will use calculated-shape graphics to
plot a circle. As you’ll see, by changing a few lines it can be used
to plot virtually any shape.
10 1 Plotting program
20 1 Set program constants
30 MAXCOL%=75 : MAXROW%=
40 DIM BIT%(MAXCOL%,MAXROW%)
50 MASK%(l)=64 : MASK%(4)=8
60 MASK%(2)=32 : MASK%(5)=4
70 MASK%(3)=16 : MASK%(6)=2
80 LX=~O : LY=20
90 LXFAC=72/LX : LYFAC=~'~'/LY
100 1 Plot curve
110 GOSUB 600
120 1
130 1 Send bit image map to printer
140 LPRINT CHR$(27);"A";CHR$(6);
150 FOR ROW%=0 TO MAXROW%
160 A$=""
170 LPRINT CHR$(27) ;"*";CHR$(O);CHR$(MAXCOL%);
CHR$(O) ;
180 FOR COL%=l TO MAXCOL%
190 A$=A$+CHR$(BIT%(COL%,ROW%))
200 NEXT COL%
210 LPRINT A$;" It
220 NEXT ROW%
230 LPRINT CHR$(27>;"A";CHR$(l2);
240 END
250 1
If you are using with the IBM mode (DIP switch 1-6 off),
change the following lines to the program given above.
tocalculate starting and ending points for a line (in our circle the
“lines” are very short - sometimes the starting and ending
points are the same). The coordinates of the starting point of the
line are assigned to variables Xl and Y 1. The line ends at point
X2, Y2. When these coordinates have been calculated, a
subroutine call is made to line 250. This subroutine calculates
the coordinates of individual points along that line.
After these coordinates have been determined, the subroutine
at line 400 is called. This routine turns “on” an individual dot in
our array called BIT%. (Keep in mind that no printing has been
done yet; the computer is still drawing the image on its “graph
paper” in memory.) The way an individual dot is turned on is us-
ing the logical OR function in line 470.
600 '
610 ' Subroutine to plo,t a star
620 1
630 RAD=9
640 FOR ANG%=O TO 360 STEP 45
650 RANG=ANG%*3.14159/180
660 RANG2=(ANG%+l35)*3.14159/180
670 Xl=RAD*COS(RANG)tlO
680 Yl=RAD*SIN(RANG)+lO
6go X2=RAD*COS(RANG2)+10
700 Y2=RAD*SIN(RANG2)+10
710 GOSUB 250
720 NEXT ANG$
730 RETURN
I
113
600 ’
610 ) Subroutine to plot a sine wave
620 )
630 x1=0 : Yl=lo : x2=20 : Y2=10
640 GOSUB 250
650 x1=10 : Y~=O : x2=10 : Y2=20
650 GOSUB 250
670 X1=0 : Yl=lO
680 FOR X2=0 TO 20 STEP .2
6go Y2=lO-g"SIN(3.ltil59~X2/10)
700 GOSUB 250
710 NEXT X2
720 RETURN
Up until now all of the dot graphics printing we have done has
been with your printer’s normal density mode. This can give
you some pretty sharp images at great speed. Sometimes
though, you may want to create an image with even higher
resolution. This printer has seven graphics modes you can use;
they’re summarized in Table 7-2.
. ..
114
Table 7-2
Dot graphics commands
115
I.
,-...,.n
(ESC) I‘*” CHR$(3)
_-------.
-- ---- ----...._-----
m__=--__
‘--._ _--
Table 7-3
Alternative graphics commands
Density Single command Individualcommand
(ESC)“*” CHWW) ~1 n2 (ESC)<<K,, lzl n2ml m2 ...
Normal
ml m2 . . .
(ES(I)“*”
Double CHR$(l) ” x2? (ESC)“L” nl nZ ml m2 . . .
ml m.2 . . .
Double with (ESC)“*” CHR$(2) nl n2 xESC)“Y,, nl n2 ml m2
...
double-speed ml m2 . . .
(ES(Z)“*” CHR$(3) nl n2
Quadruple (ESC)“Z” nl 722ml m2 . . .
ml m2 . . .
(ES(Z)“*” CHR$(4) nl n2 none
CRT
ml m2 . . .
(ES(I)“*” CHR$(5) nl 722 nOne
Plotter
ml m2 . . .
(ES(X)“*” CHRW) ~1 ~2 nOne
CRT type II ml m2 . ..
,
120
At the end of this chapter, we’ll discuss two modes that the
printer offers to help you solve potential graphics problems. A
redefining code allows you to change the density for graphics
programs that use one of the four alternate codes. The g-pin
graphics mode allows you to use all nine pins on each line and
thus speed up screen dumps.
Table 7-4
More graphics commands
Function Control code
Redefine the graphics mode (ESC)“?” n0 nl
(ESC)” - ” CHR$(nO) nl n2
g-pin graphics
ml m2
128
64
32
16
First byte
8
4
2
1
128 Second byte
(only the top bit is used)
Figure 7-3. Your printer takes 2 bytes to fire all 9 pins in case of
the g-pin graphics mode.
In addition, you can select the print density by the value of nO.
When nU is 0 the normal density is selected, and when nO is 1
the double density is selected.
Since computers are faster than printers, there is no signifi-
cant time loss in printing a single line of graphics with 9 pins.
You get 9 dots per line in about the same time as you get 8 dots
in the other graphics modes.
122
MEMO