Go to the Previous PageGo to the Main ViewGo to the Next PageGo to a printer friendly version of this document
Chapter 4 Graphics and Custom Characters
(User's Guide ML393/ML393C)

The MICROLINE 393's high resolution 24-pin graphics modes use all the pins to create a column of 24 dots. The 8-pin modes use the 24 pins to imitate the dot patterns of 9-pin printers, which print columns of only 8 dots. Obviously, images produced in the 24-pin modes can be sharper and more detailed than 8-pin images. The advantage of the 8-pin modes is that you can use a graphics software package that doesn't support 24-pin graphics, since your printer's 8-pin modes conform to more established standards.

In the 8-pin graphics modes, where only 8 bits may be used per column, a single byte of data (8 bits) represents one column of printed graphics.

In the high resolution 24-pin modes, the printer coordinates the printhead's movement with the flring of pins in such a way that the printed dots appear in a single column 24 dots high. For this reason, 3 bytes of data (for a total of 24 bits) are needed for each column of high resolution graphics.

Programming Graphics in BASIC

One important thing to remember when you're programming graphics is not to include extraneous line feeds in your programs. Using a semicolon after the data in an LPRINT statement will keep the print position on the same line.

However, there is an additional complication: by default, BASIC assigns to all printers a maximum line length of 80 characters. After the printer has received 80 bytes of data, it will automatically perform a carriage return and line feed. Since graphics data typically consists of many bytes, it's quite easy to exceed this limit. The resulting output will be garbled. You can work around this problem by setting the line length to the maximum allowable value, 255. Put one of these statements at the beginning of your program.

- For parallel printers

WIDTH "LPT1:",255

- For serial printers that have been opened as #1:

WIDTH #1,255

High Resolution Graphics
Begin high resolution graphicsE A
ESC * m n1 n2 [graphics data]
27 42 m n1 n2 [graphics data]
n1, n2=0 to 255
Begin high resolution graphicsP
ESC [ g n1 n2 m [graphics data]
27 91 103 n1 n2 m [graphics data]
n1, n2=0 to 255
The high resolution graphics commands give you the flexibility to choose between 24-pin and 8-pin modes. The 24-pin graphics mode uses the full potential of the ML 393 printhead. There are five 24-pin print densities available. Higher densities are achieved by increasing the number of dots that appear horizontally on one line.

In both the Epson/lBM XL24 AGM and IBM Proprinter XL24 versions, the variable m is used to specify the density of the graphic image. For our example, which uses the Epson LQ emulation, we'll print in 24-pin hex density, so we'll assign to m a value of 40. (As you can see in the table of density codes, we'd have to use 12 for the value of m for the Proprinter emulation.)

Graphics TypeHorz. density dpiEpson/IBM XL24IBM XL24 AGM
Single densily (8-pin)6000
double density (8-pin)12011
High speed double density (8-pin)12022
Quadruple density (8-pin)24033
CRT I (8-pin)804
CRT II (8-pin)906
Single density (24-pin)60328
Double density (24-pin)120339
CRT III (24-pin)9038
Triple density (24-pin)1803911
Hex density (24-pin)3604012

Once you've selected the density you want to use, you have to design your graphic image. Begin by mapping out the pattern you want to print on a piece of graph paper. We're using a triangle.

The variables n1 and n2 tell the printer how many columns of data you'll be sending. Remember, for the 24-pin modes, each column is made up of three bytes; 8-pin modes have one byte of data per column. To calculate the values for these variables, first determine how many columns of dots there will be in your graphics image. Divide this number by 256 and assign the whole number result to n2; assign the remainder to n1. In our triangle example, each triangle requires 48 columns. We will be printing a row of 6 triangles, however, so the total number of columns in the image is 288 (6x48). Dividing 288 by 256 gives a value of 1 for n2 with a remainder of 32, which we'll assign to n1.

Now that we've selected our density and decided how wide the image will be, we can write a BASIC statement that sends the command to begin high resolution graphics:

Epson LQ/IBM Proprinter X24/XL24 AGM:
LPRINT CHR$(27);"*";CHR$(40);CHR$(32);CHR$(1);
IBM Proprinter X24/XL24:
LPRINT CHR$(27);"[g";CHR$(32);CHR$(1);CHR$(12);

Note: Be sure to include the semicolon (;) at the end of this statement. That way, the printer won't insert a carriage return and line feed before your graphics data.

Since our example illustrates 24-pin graphics, each column is made up of three groups of eight dots, arranged vertically. To print each column, you'll need to send 3 bytes of data. The flrst byte you send controls the top eight dots in the column, the second byte controls the middle, and the third controls the bottom eight dots. (See the flgure at the top of this document.)

The listing below is the BASIC program for the Epson and IBM XL24 AGM emulations that generates a row of six triangles in hex density, the most condensed of the 24-pin modes. To print the pattern at another density, change the value of D in line 10 to one of the other density codes.

When you're Typing in the program, you don't have to include lines beginning with REM or the comments that appear after an apostrophe (') in a program line. You can also combine the DATA statements into longer lines; we've separated them into groups of three bytes so you can tell where each column begins and ends.

10 D=40 'Density code for hex density (Epson/IBM XL24 AGM)
20 REM For IBM XL24 emulation, D=12
30 WIDTH "LPT1:",255 'Set printer for maximum line width
40 LPRINT CHR$(27);"*";CHR$(D);CHR$(32);CHR$(1);
50 REM CHR$(D) is the density; in this case D=40 for hex density
60 REM CHR$(32) and CHR$(1) indicate the number of columns 288=32+(1x256)
70 REM For IBM XL24 emulation use
80 REM LPRINT CHR$(27);"[g";CHR$(32);CHR$(1);CHR$(D);
90 FOR I=1 TO 6 'Repeat triangle pattern six times
100 FOR J=1 TO 48 'Each triangle has 48 columns
110 READ A,B,C 'Read the three bytes in the column
120 LPRINT CHR$(A);CHR$(B);CHR$(C); t Send the bytes to the printer
130 NEXT J 'Now print the next column
140 RESTORE 'Go back to the beginning of the DATA statements
150 NEXT I 'Now print the next triangle
160 END
170 DATA 0, 0, 1
180 DATA 0, 0, 3
190 DATA 0, 0, 7
200 DATA 0, 0, 15
210 DATA 0, 0, 31
220 DATA 0, 0, 63
230 DATA 0, 0, 127
240 DATA 0,0, 255
250 DATA 0, 1, 255
260 DATA 0, 3, 255
270 DATA 0, 7, 255
280 DATA 0, 15, 255
290 DATA 0, 31, 255
300 DATA 0, 63, 255
310 DATA 0, 127, 255
320 DATA 0, 255, 255
330 DATA 1, 255, 255
340 DATA 3, 255, 255
350 DATA 7, 255, 255
360 DATA 15, 255, 255
370 DATA 31, 255, 255
380 DATA 63, 255, 255
390 DATA 127, 255, 255
400 DATA 255, 255, 255
410 DATA 255, 255, 255
420 DATA 127, 255, 255
430 DATA 63, 255, 255
440 DATA 31, 255, 255
450 DATA 15, 255, 255
460 DATA 7, 255, 255
470 DATA 3, 255, 255
480 DATA 1, 255, 255
490 DATA 0, 255, 255
500 DATA 0, 127, 255
510 DATA 0, 63, 255
520 DATA 0, 31, 255
530 DATA 0, 15, 255
540 DATA 0, 7, 255
550 DATA 0, 3, 255
560 DATA 0, 1, 255
570 DATA 0, 0, 255
580 DATA 0, 0, 127
590 DATA 0, 0, 63
600 DATA 0, 0, 31
610 DATA 0, 0, 15
620 DATA 0, 0, 7
630 DATA 0, 0, 3
640 DATA 0, 0, 1

Your printout will look like this:

Print Registration

The PRINT REGISTRATION Menu Select item is a bit image graphics option that is only used with bidirectional printing. It lets you fine tune the horizontal printing position of a graphic image or table where precise column alignment is important. You'll probably need to experiment with the different settings to find which works best for your printouts. One way to determine the best value is by printing several columns of vertical bar characters (|) at each registration value. Use the setting that produces the straightest vertical column. The Print Registration Settings table on the next page shows how the values affect alignment.

Quasi 8-bit Graphics

Select quasi 8-bit graphicsE P A
ESC y n
27 121 n
n=1: Turn on quasi 8-bit graphics
n=0: Turn off quasi 8-bit graphics
This command sets 8-pin single density graphics to print with four pins to each dot instead of one. The result is a darker and better deflned image. To use this feature, set n to 1. Any 8-bit single density graphics command will then print in the quasi 8-bit mode. Turn the feature off by reentering this command with n set to 0.

Print Registration Settings

SettingResulting Movement
+50.25 mm to the right
+40.20 mm to the right
+30.15 mm to the right
+20.10 mm to the right
+10.05 mm to the right
0no movement
-10.05 mm to the left
-20.10 mm to the left
-30.15 mm to the left
-40.20 mm to the left
-50.25 mm to the left

8-Pin Graphics

Begin single density graphicsE P A
ESC K n1 n2 Igraphics data]
27 75 n1 n2 [graphics data]
n1, n2=0 to 255
Begin double density graphicsE P A
ESC L n1 n2 [graphics data]
27 76 n1 n2 Igraphics data]
n1, n2=0 to 255
Begin high speed, double density graphicsE P A
ESC Y n1 n2 [graphics data]
27 89 n1 n2 Igraphics data]
n1, n2=0 to 255
Begin quadruple density graphicsE P A
ESC Z n1 n2 [graphics data]
27 90 n1 n2 [graphics data]
n1, n2=0 to 255
These graphics modes correspond to the 8-pin modes in high resolution graphics. They are available in all three emulations and are supported by most current DOS-based graphics software.

As with high resolution graphics, you design your pattern as a series of columns of dots. Since these are 8-pin modes, each column is one byte high; otherwise, the data is structured just like 24-pin graphics data

The variables n1 and n2 tell the printer how many bytes of graphics data to expect. Remember, the 8-pin modes have one byte of data per column. To calculate the values for these variables, first determine how many columns of dots there will be in your graphics image. Divide this number by 256 and assign the whole number result to n2; assign the remainder to n1.

Reassign graphics codesE
ESC ? n m
27 63 n m
n="K' "L" 'Y' or "Z"

In the Epson emulation, you can reassign any of the eleven 8- and 24-pin high resolution graphics modes to one of the 8-pin graphics commands (ESC K, ESC L, ESC Y or ESC Z).

For n, substitute one of the four letters (K, L, Y or Z, decimal 75, 76, 89 or 90) to indicate which of the four 8-pin commands you're redefining. The variable m stands for the density code of the mode that you are assigning to the redefined code. (See the Epson column of the High Resolution Graphics Density Codes table on page 69.) Then, when you are ready to print a graphics pattern, send the redefined low resolution command, followed by the graphics data.


The following BASIC statement reassigns 24-pin hex density to the command ESC L:

LPRINT CHR$(27)?"L"CHR$(40)
Oki Data has taken care to insure that the information is complete, accurate and up-to-date. However, Oki Data assumes no responsibility for errors or omissions which may occur. All the information provided is subject to change from time to time at the sole discretion of Oki Data.
Copyright 2022, Oki Data, Americas, Inc.