Star Micronics Radix User Manual page 155

Table of Contents

Advertisement

Printing With Dot Graphics
141
Just like many of the other codes you have learned, the com-
mand starts with an escape sequence (( ESC) "K" in this case).
But unlike Radix's other codes there can be any number of graph-
ics data bytes following the command. That's where nl and n2
come in; they are used to tell Radix how many bytes of graphics
data to expect.
Specifying the number of cohnns
of dots
To figure the values of nl and n2, you'll need to figure out how
wide your graphic image will be (remember that there are 60 col-
umns of dots per inch in normal density). Then comes the fun
part: converting one number (the number of columns of dots) into
two! Why is it necessary to use two numbers to tell Radix the
number of graphics codes to expect? Because the largest number.
we can send in one byte (that's what the BASIC CHR$( ) function
sends: one byte) is 255. And with normal density graphics it's pos-
sible to have a graphics image as wide as 480 dots on Radix-10 or
816 dots on Radix-15 So to figure out how many columns of
graphics data to expect, Radix multiplies n2 by 256 and adds the
value of n1 to the product. If you divide the number of columns by
256, then n2 is the quotient and
nl
is the remainder (why not let
your computer figure it out for you: if the number of columns is
assigned to variable X, then Nl =X MOD 256 and N2 = INT(X/
256)). Table 12-1 might make things even easier.
Table
12-l
Calculating
nl and n2
If the number of columns,
x. rannes from:
then nl is:
and n2 is:
I
I
1to 255
I
x
I
0
I
256to511
x - 256
1
512to 767
x - 512
2
766to1023
x - 768
3
1024to1279
x - 1024
4
1260to1535
I
x - 1260
5
1
1536to1791
x - 1536
6
1792to2047
x - 1792
7
2046to2303
x - 2048
8
2304to 2559
x - 2304
I
9
1
2560to2815
x - 2560
10
2816to 3071
x - 2816
11
3072to3264
x - 3072
12
I

Advertisement

Table of Contents
loading

Table of Contents