Classic Computer Magazine Archive ANTIC VOL. 1, NO. 3 / AUGUST 1982

Banner Maker

by Paul E. Hoffman

The following program allows you to make banners on most common printers. Although the program is short, it shows how to use a few ATARI features

. As you may know, each letter on your screen is formed in an 8 x 8 matrix in your ATARI's memory. This program takes an input string, and prints out an enlarged version of this matrix for each letter. If you use any font generating programs, the re-defined characters will be printed out.

The program:

100 Get the input string to be printed as the banner.

110-130 Major loop: get a character and determine its ATASCII value. Type the letter on the screen so you can tell how far along the banner is.

140-170 Calculate which group the current character is in, and translate CH into the keycode.

200 Loop to retrieve the eight bytes for each character, Y being the row of the character received. CHBAS, determined in line 1030, is the page where the character table begins, and CH is the character offset in the table.

210-220 Within each byte, determine which bits are set to 1 by comparing the byte to powers of two (see line 1040) in descending order from 128. If the bit is on, subtract that power of two from the byte so that the next bit may be tested. BITON (and each element of ARR) will either equal 0 or 1, depending on the value of each bit in our BYTE.

Note that line 220 tells us to put our result into the array vertically, starting in the upper right corner, a clockwise rotation of 90 degrees. You can change the rotation with the following changes:

Letter facing:      Array:
Same as font        ARR(C7X,Y)
90 deg Clockwise    ARR(C7Y,C7Y)
180 deg Clockwise   ARR(X,C7Y)
270 deg Clockwise   ARR(Y,X)
230 Get next byte.

500 Print the letter in the array. Our FOR-NEXT loops read the matrix horizontally from the top to the bottom. We must also initialize the LINE$ to be printed to spaces.

510-530 If the array element is a 1, change a segment to blocks (solid print elements, see line 1100), if it is a 0, do nothing. Loop for each bit in the row.

540-550 Print the LINE$ and loop back for the NEXT ROW.

560-600 Check if you want to go to a new page for each letter; if so, print a formfeed character. Either way, get the next character.

1030 Locate the character set in memory. This will be page 224 if it is the ATARI character set, otherwise this will point to the beginning of your set.

1040 Set up the BIT array.

1050-1080 These are variables you can set to change the printer's output. WIDTH is the number of times each segment is copied vertically (how thick it will be); SEGHT is the number of characters each element in the array will take up. For most printers, WIDTH should be about half of SEGHT, but you can get interesting results by varying this ratio.

PRTYPE$ holds the type of printer, so that the BLOCK$ and BLANK$ will correspond correctly to your printer. PAGE$ tells whether you want a page eject after each character or not. Most of the tirne you will not, but it allows you to sheet-feed your printer if you want.

SIXROW$ should be YES if you are using the ATARI character set. It will truncate the top and bottom bytes, which are zero anyway, and increase your SEGHT by the proportionate amount on 1140.

1100-1120 Sets the correct character values based on the printer type.

1130 Gives COLLOW and COLHIGH their initial values, which correspond to reading the entire 8 bytes of the character.

1140 If each character is actually just the middle six bytes from the font, it increases the segment height by 25%, and adjusts the parameters for the FOR-NEXT loop that starts on line 500.

1150-1170 Make the string BLOCK$ of block characters, length equal to SEGHT. Make the string BLANK$ be blanks, length 8': SEGHT (8 segments to a character).

The program cars be tailored to your system by changing lines 10501080, or by adding another line if you have a printer that is not mentioned in lines 1100-1120. You can determine the character for BLOCK by finding the character in the printer set which is the most filled in. For non-graphic printers, this is usually the pound sign (#). The blank is usually just a space character, ASCII 32.

Printing graphics characters takes about 3.5 times as long as nongraphic ones since the printer must make two passes on the line it is printing. It thus loses its bidirectional printing capability. Graphics characters print much darker, and make a much more readable banner.

[CODE]