24-Pin Bit Image Graphics for 24-Pin or Bubble Jet Printers in Epson Emulation

Author(s): Larry Crawford
Publication: Update Magazine
Pub Details: Update October 1993
Date: October 1993
Pages: 44-47

Larry Crawford / 357 Reynolds Rd / London Ontario Canada N6K 2P8
(519) 657-9119 PUBLIC DOMAIN 12 Oct 93

If you went for a 24-pin or bubble jet printer and had thoughts of trying to print some graphics in the 24-pin bit image mode, you were probably somewhat taken aback by the apparent comlexity of it all, just as I was.

This article should take some of the mystery out of the process. The demo program will give you the information needed to develop your own applications.

BACKGROUND

The 24 print head pins are arranged into three groups of eight. In effect, each group acts as a separate 8-pin head covering 1/3 of a print line. Thus, with one pass it is possible to achieve the vertical definition of three 8-pin passes with only one pass. Furthermore, it is possible to achieve a density of 360 dots per inch in Hex Density mode.

These attributes make the printing very fast and should allow a CAD program to produce printed circuit board layouts with good solid lines without the need for multiple passes. Unfortunately, the existing CAD programs that I have seen are all based on 72 dots per inch (dpi) horizontal density and 8/72″ vertical line spacing. The 24-pin printer does not have the 72 dpi option. Instead, it uses multiples of 60 dpi and 1/360″ paper feed. This makes the size of the printed image larger than that produced by an 8-pin printer.

Consequently, it cannot be used by software programs such as Pixel Print or CAD in their present form: a) two columns of 64 characters will not fit side by side on a page and b) the socket hole spacing on a pcb layout would be too great. It should be possible to modify the calculations performed by a CAD program to get the scale of the final image correct.

There are numerous other applications, of course, so feel free to make use of the information that follows.


As a demonstration, we will print the first line of the screen in 24-pin double density bit image graphics. The data in the conversion chart that follows is essential to the process.


Type in the following program (without the parenthetic comments, of course):

   5 REM 24-pin bit-image demo
10 CLS: PRINT "QWERTYUIOPASDFGHJKLZXCVBNM123456"
[this will put a single line on the screen to copy]
20 IF IN 127<>236 THEN INPUT;: PRINT #0;"PUT PRINTER ON LINE":
PAUSE 2: GO TO 20
[An important reminder since the screen will go blank and
nothing will happen if the printer is not ON.
<INPUT;> is a simple way to clear out the bottom of the
screen]
30 RESTORE 30: GO SUB 500: DATA 27,65,8,999 [set Line Feed to
8/60"]
40 LET y=175: RESTORE 40: GO SUB 500: FOR x=0 to 255: DATA
27,42,33,0,2,999 [y points to top of screen; codes are sent
to set printer for 24-pin bit-image double density: it will
expect 2x256 bytes of data: the x loop will point to all 256
pixel columns across the screen]
50 LET b1=224*POINT (x,y)+28*POINT (x,y-1)+3*POINT (x,y-2)
["b1" is the "top" byte. Following the chart, if the top 3
pixels of the screen are INK then the value assigned to "b1"
will be 224+28+3=255. Therefore, all top 8 pins of the print
head will fire]
60 LET b2=128*POINT (x,y-2)+112*POINT (x,y-3)+14*POINT (x,y-4)
+POINT (x,y-5)
["b2" is the "middle" byte. Following the chart, if the
pixels 3rd, 4th, 5th, & 6th from the top of the screen are
all INK then "b2" is assigned a value of 128+112+14+1=255.
Therefore, the middle 8 pins will all fire]
70 LET b3=192*POINT (x,y-5)+56* POINT (x,y-6)+7*POINT (x,y-7)
["b3" is the bottom byte. Following the chart, if the pixels
6th, 7th & 8th from the top of the screen are INK then "b3"
will be assigned a value of 192+56+7=255. Therefore, the
bottom 8 pins will all fire]
80 RESTORE 80: GO SUB 500: NEXT x: DATA b1,b2,b3,b1,b2,b3,999
[send the 3 bytes to the printer twice for double density]
90 INPUT;: PRINT #0;x: NEXT x [clears the bottom of the screen
then prints the pixel column # to let you know that the
computer is calculating the data bytes. Gets the next col #]
100 RESTORE 100: GO SUB 500: STOP: DATA 13,10,999
[send CARRIAGE RETURN and Line Feed]
500 READ a: IF a=999 THEN RETURN
[999 is a dummy value to signal the end of current data]
510 IF IN 127<>236 THEN GO TO 510 [if the printer is busy, wait
until it is ready for data. (<INPUT;> is a simple way of
clearing the bottom 2 lines of the screen)]
520 OUT 127,a: GO TO 500 [send data to the printer]
9999 RANDOMIZE USR 100: SAVE "l1dem.B1"

Now <GO TO 9999> to save it to disk and then <RUN>

It takes nearly a minute to get to the actual printing because of all the calculations to be done in BASIC.


If you want to print a whole screen, make the following changes:

LINE 10: Replace with: 10 LET ctr=0: RANDOMIZE USR 100: LOAD
"screen name" SCREEN$
['ctr' will keep track of the print line being
processed]
LINE 40: Replace <LET y=175> with <FOR y=175 TO 7 STEP -8: LET
ctr=ctr+1:>
[This will set up a loop to deal with all 22 screen
lines and increment the line counter]
LINE 90: Add <ctr;",";> immediately after <PRINT #0;>
LINE 100: Add <NEXT y:> immediately ahead of <STOP:>
LINE 9999: Change program name

LINEs 40 and 100 set up a loop to look at all 22 lines of the upper screen, outputting the data to the printer at the end of each line. A full screen takes over 20 minutes to copy.


To print out in triple density, change the data in line 30 to 27,42,39,0,3 and add another set of b1,b2,b3 to the data in line 80. The printer will then expect 3×256 bit image data bytes.


A much faster version gets the data from the screen file instead of the screen. It puts the data into 1 or 22 line files, ready to be loaded from disk then sent to the printer by a 205-byte m/c routine. It takes about 5 minutes to create and save the 22 files and less than one minute to print them all in triple density.

I will be happy to send you a copy of this utility on a 5-1/4″ double sided floppy in either Oliger or LARKEN format for $5.00 cash or money order. Be sure to state which DOS.


A full screen produces an image 4.25″ by 2.9″ (10.8 by 7.4 mm) and is proportioned so that squares are square and circles are round. Different screen images can be printed consecutively on the same sheet so that a composite image can be 4.25″ by any length.


8-PIN TO 24-PIN CONVERSION CHART FOR A 24-PIN PRINTER WITH EPSON EMULATION

            : 8-PIN ::          24-PIN
            : PIN#  :: PIN# : CODE :
TOP         :       ::  1   :      :
(BIT 7)>    :   1   ::  2   : 224  :
            :       ::  3   :      :
            :       ::  4   :      : "TOP BYTE"
            :   2   ::  5   :  28  :
            :       ::  6   :      :
            :       ::  7   :      :
            :   3   ::  8   :   3  :
            :       ::  1   : 128  :
            :       ::  2   :      :
            :   4   ::  3   : 112  :
            :       ::  4   :      : "MIDDLE" BYTE
            :       ::  5   :      :
            :   5   ::  6   :  14  :
            :       ::  7   :      :
            :       ::  8   :   1  :
            :   6   ::  1   :      :
            :       ::  2   : 192  :
            :       ::  3   :      :
            :   7   ::  4   :  56  : "BOTTOM" BYTE
            :       ::  5   :      :
            :       ::  6   :      :
            :   8   ::  7   :   7  :
            :       ::  8   :      :
Sample 24-pin bit image screen printouts (ST Class Magazine title and portrait, normal and inverse)
Sample 24-pin bit image screen printouts (ST Class Magazine title and portrait, normal and inverse)

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.