The graphics command format

There are several different graphics commands giving different horizontal dot densities and printing speeds. Because the format is almost the same for all the commands, however, the example here keeps things simple by using only the single-density graphics command, ESC K. In single-density graphics, there are 60 dots per inch horizontally.

The command to enter single-density graphics mode is ESC K nl n2. In BASIC the command is given in this format:

LPRINT CHR$(27);"K";CHR$(n1);CHR$(n2);

ESC K specifies single-density graphics, and the next two numbers (n1 and n2) specify the number of columns reserved for graphics.

Column reservation numbers

Even in single-density graphics mode, one 8-inch line can accommodate 480 columns of graphics; in quadruple-density, almost 2000 columns can fit on the same 8-inch line. Since the printer does not use decimal numbers larger than 255, the graphics commands use two numbers for reserving columns.

Because the commands are set up for two numbers, you must supply two even if you need only one. When you need fewer than 256 columns, it is easy to determine n1 and n2: nl is the number of columns you are reserving and n2 is zero. For example, to send data for 200 columns of graphics, n1 is 200 and n2 is 0.

For more than 256 columns of graphics data, n2 is the number of complete groups of 256 columns, and nl is the number of columns to complete the line. For example, to send 1632 columns of graphic data, n1 is 96 and n2 is 6 because 96 + (6 x 256) = 1632.

You can calculate both nl and n2 by dividing the total number of columns by 256. The quotient is n2 and the remainder is n1. If you are using a programming language with MOD (modulus) and INT (integer) functions, you can use the following formulas, in which n is the total number of columns.

n1 = n MOD 256

n2 = INT (n/256)

Graphics and User-defined Characters

5-5