Classic Computer Magazine Archive COMPUTE! ISSUE 61 / JUNE 1985 / PAGE 102

TI SuperFont

Patrick Parrish

A powerful feature of the TI-99/4A is its ability to redefine the character set. With "TI SuperFont," a comprehensive character-definition program, you can harness this capability. Requires Extended BASIC and a joystick (printer optional).

The character graphics capabilities of the TI-99/4A are well known. But to redefine a character on the TI by the usual means (see the TI User's Reference Guide, pages II-76 to II-79), you must follow a tedious, multi-step procedure. First, you plot the character in an 8 × 8 grid. Next, you convert each row of the grid into a two-digit hexadecimal number and then sequentially combine the numbers from each row to generate a pattern identifier, or coded representation of the character. Finally, you place this pattern identifier along with a chosen ASCII value for the character in a CALL CHAR statement. Anyone who has repeatedly endured this process can attest to its drudgery.

Fortunately, the process is easily computerized, and several character-definition programs have been written for the TI. Until now, however, these programs have not taken full advantage of the TI's capabilities. With "TI SuperFont" (Program 1), once-tedious character manipulations can now be undertaken with ease.

Sixteen Commands

SuperFont, originally written for the Atari by Charles Brannon, first appeared in the January 1982 issue of COMPUTE! and featured 18 commands for redefining characters. After using this outstanding program on several occasions, I was convinced that TI users deserved a utility as versatile and convenient. That's how TI SuperFont was born.

In converting SuperFont, a few commands with less value to the TI user were eliminated while certain more practical commands were added. As it turned out, the real challenge was to fit the program into a TI without memory expansion. The final version leaves only a hundred or so bytes to spare. However, certain adjustments must be made if you are using a disk drive with the program. Before loading and running SuperFont, type CALL FILES(l). This will free up memory ordinarily reserved for additional disk file manipulation.

TI SuperFont offers the following 16 commands or modes:


When the program is run, this command menu is displayed on the screen. Above it is an 8 × 8 grid which serves as a workspace for redefining each character. To the right of the grid, the current mode and, in some cases, a prompt will be displayed. Below this is printed the entire TI character set (codes 32-143) with each subset (eight characters) denoted by a different background color. (If you find the colors annoying, remove the FOR-NEXT loop in line 300.)

Several commands require that you pick a character from the TI character set. In these instances, a box-shaped sprite (CHR$(143)) appears over the last character referenced from the set (defaults to space). Position the sprite with the joystick over the desired character and press the fire button. Unless indicated otherwise, each command returns you to the EDIT mode upon completion.

Now let's examine each command, beginning with EDIT. (The ALPHA-LOCK key should be up when making menu selections.)

EDIT is the basic editing command. After you press E, SuperFont requests you to choose a character from the character set. The character selected is copied into the grid and the box-shaped sprite appears. This is actually like a cursor, controlled with the joystick. Press the fire button to set a point (if a point is clear) or reset a point (if a point is already set). You can draw lines by holding down the button while moving the joystick. When you're pleased with the appearance of the shape in the grid, press ENTER to redefine the character. (To completely redesign a character from scratch, use the CLEAR command, described below.)

INPUT lets you type in a pattern identifier and assign it to a particular character code. After selecting INPUT, choose a character from the set with the joystick and then type in the hexadecimal code for the redefined character. The hexadecimal code can be typed in upper- or lowercase (a routine at line 960 automatically converts the code to uppercase). The INPUT command is handy when attempting to associate a pattern identifier with a CHR$ code in someone else's program.

RESTORE CH restores the current character to its original configuration. This command is useful if you've mangled a character or changed the wrong one.

RESTORE CHSET restores the entire character set to its initial appearance.

COPY copies a character to a second location in the character set. SuperFont prompts you for the first character (the one to be moved) and the second character (the destination character). This command is handy for arranging your customized characters to fit the various color codes.

WRITE DATA displays the pattern identifier for each selected character along with its ASCII value. Very handy when comparing characters or for providing a few character codes for another program.

MIRROR produces a mirror image of the current character in the grid.

REVERSE puts the current character in the grid in reverse field: All dots become blanks, and all blanks become dots.

ROTATE turns the current character 90 degrees clockwise.

CLEAR completely clears out the current character. For creating new characters from scratch.

INSERT places a row of blanks in the current character. Move the cursor in the grid with the joystick to the row where you wish to insert the blanks and press ENTER. All rows below will scroll down and the bottom row will be lost.

DELETE is the opposite of INSERT. Position the cursor on a row in the grid and press ENTER. The row will be eliminated and all other rows will scroll upward. DELETE and INSERT can be used with ROTATE to scroll characters left or right in the grid (of course, one row will be lost in both cases).

LOAD FONT loads a previously SAVEd character set (a font) from tape or disk. SuperFont prompts you for the device and filename. Be sure to type this in the standard format (that is, CS1 or DSK1.FILENAME). Again, capital letters need not be used. The routine that converts from lower- to uppercase takes care of this for you. If you're using tape, the screen will be restored after the tape system messages have been printed (the same occurs with SAVE FONT, discussed below). When loading is complete, a command prompt appears.

SAVE FONT saves to tape or disk (in a data file format) only those characters which have been altered since SuperFont was run. Since each character code is saved as a separate record, a large set may take 30 minutes to save. As with LOAD FONT, you will be prompted for the device and filename. If you accidentally hit L (for LOAD FONT) or S from the main menu, simply press ENTER to abort the command when prompted for the device and filename.

Once saved, character sets can be loaded into any program where they're needed (we'll consider this in greater detail shortly). As with LOAD FONT, a command prompt appears when the operation is complete.

PRINT CH prints the current character in an 8 × 8 grid along with its ASCII and pattern identifier codes, then returns you to the main menu. Be sure to modify line 1260 to correspond to the specifications of your printer.

PRINT CHSET is the same as the previous command, except it prints every character which has been modified.

The commands offered by SuperFont are versatile, but you may want to add others. Since the program uses most of the TI's memory, unless you have additional RAM you'll have to substitute your own routine for an existing one. Fortunately, the program is modular in structure. Just follow the branching IF statements from line 360 to 920 for the current commands. If you do alter the program, test it thoroughly to make sure you still have plenty of memory left.

Redesigning a character with "TI SuperFont."

Retrieving A Font Or Screen

After you've saved a newly created character set, how do you go about recovering it for use in another program? Program 2 shows how this is done.

In line 130, the device and filename for the character set file is defined as B$ (the filename used here is FONT). If you store this file on tape rather than disk, line 130 should read B$ = "CS1". Lines 140–160 load in the new character set and print it on the screen. Line 170 sets up a delay so you can see that the character set has successfully loaded.

With SuperFont, you can perform many chores with ease. You can customize your character set (ever wished for true lowercase?), create graphics characters and animated figures (space creatures!), or just play around. The uses of this utility are endless. I'm sure you'll have as much fun discovering them as I have.