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);

In this command, ESC K selects single-density graphics, and n1 and n2 specify the number of columns to reserve for graphics.

Column reservation numbers

The graphics command requires more than one number to specify how many columns to reserve because although one line can use thousands of columns, the FX does not use numbers larger than 255 (decimal). Therefore, the graphics mode command uses two numbers for reserving columns.

To figure nl and n2, divide the total number of columns by 256. The result is n2; the remainder is nl. Since the command is set up for two numbers, you must supply two numbers even if you need only one.

When you need fewer than 256 columns, just make nl the number of columns you are reserving and make n2 a zero.

For example, if you wish to send 1632 columns of graphics data, nl should be 96 and n2 should be 6 because 1632 = 96 + (6 X 256).

Graphics data

After receiving a graphics command such as ESC K nl n2, the printer prints the number of codes specified by nl and n2 as graphics data, no matter what codes they are. This means that you must be sure to supply exactly the right amount of graphics data. If you supply too little, the printer stops and waits for more data and seems to be locked. The next data sent will then be printed as graphics, even if it is really text. On the other hand, if you supply too much graphics data, the excess will be printed as regular text.

Graphics programming

Here is an example that shows how a graphics command, column reservation numbers, and data can be used to print a single line of graphics. The example is a BASIC program. You can, of course, use another programming language. The principles are the same.

4-12

Using Software and Graphics