DEFINING YOUR OWN CHARACTERS WITH IBM
MODE
Downloading fonts in IBM mode requires downloading character Dot
Pattern data and character Index Table data. Dot pattern data controls which pins fire when printing a character. Index Table data is placed in a “lookup table” that provides information on where Dot Pattern data is stored in memory and defines certain attributes of the character.
Assigning the download character set
You can define one or more download character sets for later use in IBM mode. Before you start to design your characters. you must define what character set(s) you want to download.
The character width on which you design the characters depends upon the character set as shown below:
Character set
Draft characters
LQ pica characters
LQ elite characters
LQ proportional
Character width Character ID
9 0
35
29
1
~
17-41 3
After you have decided your download character set, you must tell the printer where the download character data to be stored, and how many download character sets you will define.
The first download font area starts from <800F>h, and you must enter 0 for the Format byte. This Format byte indicates to the printer tha[ the RAM is stored the download character set.
Following the format byte. you must enter the Character ID data. If you want to define more character set, add 128 to the Character ID data.
The second area starts from <8911>h, the third area starts from <92 12>h,and the last area starts from <9B 13>h.But you need not enter the Format byte for these area.
Assigning the character dot pattern
We will use a tiny representation of a telephone symbol for our example.
1 2 3 4 5 6 7 6 91011 1213141516171619202122232425262726293031
128
64 — — —
~
32 — — —
16 — — —
8 — — —
4
2 — — —
1
I I ~ ~ ~ ~ I I I I I I I I I I I i I I I I I I I
II1 1
I ~ I
●
32333435
●
●
●
I
~ !
64
32
16
8
4
2
1
128
. .
1 -
04
32
16
6
4
2
1
128 ii figure 9-3. Telephone symbol with LQ pica
After you have designed the character pattern, you will need to compress the
Dot Pattern. Data compression allows you to store more download characters than without compression. It is a more efficient use of memory. The printer will repeat the previous dot column when the current column compression mask bit is set to “l”.
Fill up the adjacent dot even they do not print, then compare the each veritcal line to the left line. If the line is the same as the left one, write “l” in the column of the “compression mask bit”. If it is different, write “O”.
127
64
1 2 3 4 5 6 7 8 9101112131415161718192021 22232425262728293031 32333435
●
10100.00,00 1.- -1 ~ ,,,,
.——..
..—.
16
8-
4
2
1 b
128
64
32 -–-
16
8
4
-- +
I
2 : : .—
,B
..
‘“ !
!
.
—.—
. .
. ..—
. .
— ..
1$+
“r-
1.1
●
IOIO!OI.’ .1 .1.1.~.l.
—
Figure 9-4.
Fill up the adjacent dot, then write the “compression data”
After you have written the “compression mask bit” data, line up all the character data for the “compression mask bit” that requires 6’0”. The telephone symbol looks like Figure 9-5.
Data:
Figure 9-5.
Compressed character pattern of telephone symbol.
128
Now we will calculate the vertical numerical values of the columns of dots, and enter them underneath the grid. Each vertical column is first divided into three groups of eight dots. Each group of eight dots is represented by one byte. which consists of eight bits.
This is where the numbers down the left side of the grid come in. Notice that there is a number for each row of dots and that each number is twice the number below it. By making these numbers powers of two we can take any combination of dots in a vertical column and assign them a unique value.
Assigning the Index Table data
Unlike defining in the Standard mode, you must assign the Index Table with the IBM mode. This Index Table is prepared for the information of each characters attribute data, such as character type (Normal 24-dot high, or 30dot high block graphics), the dot pattern data in the memory, and the compression mask bit data.
Each character requires 9 index table data.
The first and the second bytes (m] and m2) indicates the position of the first dot pattern in the memory.
ml is the high order byte. and m2 is the low order byte.
The third byte, m3, indicates the character type and the dot pattern data width in the memory.
If the character is normal. simply enter the width of dot pattern in the memory. If the character is a block graphic. add 128 to the width of dot pattern in the memory.
Our telephone symbol is a normal character and the width of the dot pattern in the memory should be 25, so this value is 25.
The fourth byte, m4, indicates the printing attribute.
This byte indicates the character width to be printed, and information of the repetition dots for block graphics characters.
If the character is a normal character, add 192 to the character width.
If the character is a block character, and it should be printed as a line draw character, add 64 to the character width. If the block character is not a line draw character, this byte should be the same as the character width.
Our telephone symbol is a normal pica character. so the character width is 35, and this byte should be 227.
129
The remaining five bytes (m5 through m9) indicate the compression mask bits. Each bits shows the data that will translate the compressed dot pattern data back to the original character pattern.
For example, the compression mask bits of our telephone symbol are
011000000000010011110010 0000000001100000. So these bytes are 96,
4,242,0, and 96.
You must define the index table data for all characters from Oto 255. If you do not want to define a particular character, enter Ointo that index table data.
Sample program
To demonstrate how to define and to use the download characters in IBM mode, let’s use the “telephone” character and the other user-defined characters to print a small graph. This program will do just that:
1000
1010
1020
1240
1250
1260
1270
1280
1290
1300
1310
1320
1330
1340
1350
1360
1370
1380
1390
1400
1030
1040
1050
1060
1070
1080
1090
1100
1110
1120
1130
1140
1150
1160
1170
1180
1190
1200
1210
1220
1230
WIDTH “LPT 1 : “ ,255
LPRINT CHR$ (27) ; “=” ;CHR$ ( 164) ;CHR$ (9) ; “#” ;
LPRINT CHR$ (&HOF) ;CHR$ (&H80) : CHR$ (0) ;
‘ INDEX TABLE
LPRINT CHR$ ( 1 ) ;
FOR 1=0 TO 59
LPRINT STRING$ (9 , O) ;
NEXT I
FOR IT=l TO 9 : READ MM : LPRINT CHR$ (MM) ; : NEXT IT
FOR IT=l TO 9 :READ MM : LPRINT CHR$ (MM) ; :NEXT IT
FOR 1=62 TO 255
LPRINT STRING$ (9 , O) ;
NEXT I
‘ DOT PATTERN
FOR DP= 1 TO 159
READ MM
LPRINT CHR$ (MM) ;
NEX’f DP
‘ PRINTOUT PROGRAM
LPRINT CHR$ (27) ; “D” ;CHR$ ( 11 ) :CHR$(0)
LPRINT CHR$ (27) ; “k” ;CHR$(4) ;
LPRINT CHR$(27) ; “h” ;CHR$(I) ;
LPRINT “ DIFFUSION RANGES OF”
LPRINT “ CARS & TELEPHONES
LPRINT CHR$ (27) ; “h” ;CHR$(0) ;
LPRINT CHR$(27) ; “k” :CHR$ (o)
LPRINT “USA’’; CHR$(9) :
LPRINT CHR$(27) : “I” ;CHR$(6) :
FOR 1=0 TO 681 STEP 25 :LPRINT CHR$(60);
LPRINT
LPRINT CHR$(9);
FOR 1=0 TO 781 STEP 25 :LPRINT CHR$(61);
LPRINT CHR$(27) ;’’I’’;CHR$(2)
LPRINT “GERMANY’’;CHR$(9) :
LPRINT CHR$(27) ;’’I’’;CHR$(6) ;
FOR 1=0 TO 412 STEP 25 :LPRINT CHR$(60);
LPRINT
LPRINT CHR$(9);
FOR 1=0 TO 488 STEP 25 :LPRINT CHR$(61):
LPRINT CHR$(27) ;’’I’’;CHR$(2)
LPRINT “JAPAN’’;CHR$(9);
:NEXT
:NEXT
:NEXT
:NEXT
I
I
I
I
130
2090
2100
2110
2120
2130
2140
2150
2160
2170
1570
1580
1590
1600
2000
2010
2020
2030
2040
2050
2060
2070
2080
1410
1420
1430
1440
1450
1460
1470
1480
1490
1500
1,510
1520
1530
1540
1550
1560
LPRINT CHR$ (27) ; “I” :CHR$(6) :
FOR 1=0 TO 347 STEP 25 :LPRINT CHR$(60);
LPRINT
LPRINT CHR$(9):
FOR 1=0 TO 493 STEP 25 :LPRINT CHR$(61):
LPRINT CHR$(2’ ); ’’I’’ ;CHR$(2)
LPRINT CHR$(9
ScALE$=”+–+-u
; “+-” ;
:NEXT I
:NEXT I
FOR 1=0 TO 2
LPRINT ‘+-+”
LPRINT CHR$(9
FOR 1=1 TO 8
;“0 “;
:LPRItiT
LPRINT “ “;1;
NEXT I
LPRINT CHR$(27) ;’’:”;
LPRINT cHR$(27) :”S”;CHR$(0) :
LPRINT CHR$(9); ’’(IOO UNITS/1000
SCALE$;
PERSONS)”
LPRINT CHR$(27); ’’T”;
LPRINT CHR$(27);”@M
END
‘ l)ATA
‘ Index Table Data
DATA 137, 17, 25,227, 96,
96,
4,242, 0, 96
0, 80, 64, 96 DATA 137, 92, 28,227,
‘ Dot Pattern Data
Telephone symbol
:NEXT I
DATA
DATA
DATA
O,
59,
59,
15,192,
Car symbol
0,
0,
0,
DATA 127,255,192,127,243,
DATA 112,255,192,112,127,
0,
7, 0, 0,
56, 31,192,112,
15, 0, 0, 31, 0,
63,192,112,127,192,112
192,113,227,192,127,243
31, 0,
192,112,
0, 15,
63,192,
0, 0,
56,
7!
0,
,255,192
,192,127,255,192
31,192, o,
0,
0,
59,
59,
0,
15,192
0,
DATA
DATA
O,
DATA 14,127,
DATA 127,254,
0,
0,255,128,
0,
0,
0, 30,
0,255,192,
28,124,
0,127,252,
0,
0,
0,
0, 28,
1,255,192,
56,124,
96,124,
0, 0, 60,
3,255,192,
0,112,126,
0, 96,127,
0,
0,
0,
0, 63,
7,127,128
96,124,
96,127,128
DATA 96,127,192,112,127,192
DATA 3,124, 0, 0,2S4, O,
,124,127,128,
0, 0, 0
63,127, 0, 15,124,
0
0
0
0
0
131
132