TextPlot
Charles Brannon
TextPlot is a machine language graphics utility that lets you mix text and graphics. It is designed to work with the four-color graphics modes three, five, and seven. It will place any ATASCII character--upper/lowercase, graphics, numbers, and special symbols in normal or reverse field--on the graphics screen in any of three colors. The size of the characters varies in proportion to the pixel size: GRAPHICS 3 characters are four timesas large as those in GRAPHICS 7, whose characters are the same size and proportions as those in GRAPHICS 2 (text mode). Through standard display list modification, any of the three sizes of text can be mixed with the other modes. TextPlot enables you to use a total of eighttext modes. (See the description of the "bonus" text modes later.)
Text On Graphics Lines
TextPlot, unlike the text modes, can be mixed on the same line with normal graphics. You can label charts and graphs, or quickly draw pictures with the graphics characters and then embellish them. TextPlot even works with an alternate character set, so you can design special "shapes" and move them around the screen for high-speed animation. The text in graphics mode three is huge,a real eyecatcher. Unlike the other text modes, TextPlot lets you position any character at any possible vertical resolution (although horizontally it's the same). And all this was without modifying the display list!
Luckily, TextPlot is easy to use. You load it into memory (it goes into the reserved memory at $600 hex) with a BASIC loader or BINARY LOAD, via DOS. You then select the graphics mode in which to use it with the ordinary GRAPHICS command. (TextPlot works in either full-screen or window modes.) You then "plot" each character with the command:
A = USR(1536,chr,color,column,row)
Don't let this machine language call intimidate you. It merely enables a USeR command. The other variables for the function communicate with TextPlot. If you leave one out, or add an extra one, TextPlot will ring the bell to warn you.
CHR: The ASCII value of the desired character [like ASC("K")].
COLOR: The color of the character (just like the COLOR statement, 1-3).
COLUMN: The horizontal position of the character. This-depends on the mode:
Mode 3 5 6 7 8 |
Max Columns 5 10 10 20 20 |
Max Rows 16 40 88 88 184 |
ROW: The vertical position of the character. This also depends on the mode (see above), and is the line at which you want the character to start. Remember that each character is just eight lines of dots, so they can start at any pixel position vertically. The horizontal resolution is limited by the internal storage of graphics information on the screen.
So, to place a blue capital letter "A" on the screen in graphics mode three, at the second column and tenth row, use the command:
A = USR(1536,65,3,2,10)
where 65 is the ATASCII value of "A"; 3 is the color; 2 is the column; 10 is the row. Strings of text can be placed on the screen as well:
DIM T$(20)
T$ = "That's Incredible!"
GRAPHICS 7 + 16
FOR I = 1 TO LEN(T$)
A = ASC(T$(I,I))
V = USR(1536,A,1,I,T,2)
NEXT I
Notice that you can use any variable with the USR function, not just A.
Bonus Text Modes
TextPlot was designed for the four-color graphics modes. Strange things can happen if you use it in any other mode. In modes six and eight, however, you will indeed get text. In GRAPHICS 6, the characters are the same size as those in GRAPHICS 5. There is a blank line between each row of dots in each character. A character plotted in COLOR 1 or COLOR 2 will also skip horizontally. COLOR 3 will create characters divided into "bands." The effect is similar to the IBM logo (see Figure 1). This same oddity results in "artifacting" in GRAPHICS 8. What does that mean? You get three colors of text in GRAPHICS 8! Depending on background and dot colors, COLOR 1 is purple, COLOR 2 is green, and COLOR 3 is white. (See Chapter 6 for more information on artifacting.) The text is twice the width of GRAPHICS 0 characters, but the same height, just like GRAPHICS 1. Other strange patterns and effects can be generated by using numbers other than 0-3 in the color assignment. A seven creates a "3-D" overlay effect, for example.
I have included a sample program that lets you type on the screen using a flashing cursor. It works in graphics mode seven. You can use all the standard keys, but only a few of the editing keys work. What can I say? It's not supposed to be a word processor! The lines from 20000 and up will place TextPlot into memory at page six. You can save them to disk or tape and merge them with other programs using the LIST/ENTER combination.
For Cassette Rewind cassette, press PLAY & RECORD, and enter: LIST"C:",20000,32767 Press RETURN twice. To merge with a program already in memory: Rewind tape, press PLAY, enter: ENTER "C:" and press RETURN twice. |
For Disk Enter: LIST"D:TXTPLT.ENT", 20000,32767 and press RETURN. Enter: ENTER "D:TXTPLT.ENT" and press RETURN. |
Advanced readers may want to know how TextPlot works (if you haven't figured it out already). You are probably familiar with how to plot characters on the GRAPHICS 8 screen by PEEKing the character generator and then placing these bit patterns directly into the screen memory for GRAPHICS 8. It works because each byte in GRAPHICS 8 (and modes four and six, too) displays eight dots, or pixels. A one-bit in the byte means a "lit" pixel and a zero is a dark ("background") dot. The four color modes have to split the load between two bytes. Each byte displays four pixels. Two bits hold the color (binary): 01 color one, 10 color two, 11 color three. (See Figure 2.) TextPlot uses the character generator (indirectly through CHBAS, 756 decimal) to get the bit map and then "pulls" the byte accordion-style into two color bytes. Theoretically, any character could be a mixture of the three colors, but it's hard to implement and use. (Unless you use Antic Display modes 4 or 5....)
Using TextPlot As A BINARY FILE
The Atari DOS lets you store machine language files on the disk and load them back, both by DOS menu selections. You can even have TextPlot load in automatically with the DOS, if you're sure you'll always need it. After placing TextPlot into RAM, go to DOS with the command: DOS. If you have DOS 2.0S, there will be a pause as the Disk Utility Package loads. The DOS menu should be displayed. Type K
TXTPLT.OBJ,0600,06FF
If you want TextPlot to automatically load with DOS, enter:
AUTORUN.SYS,0600,06FF
instead. If you don't do this, you'll have to go to DOS and enter L (Load) and reply with TXTPLT.OBJ to load it and B
Figure 1.
GRAPHICS 6Figure 2.
Download P095L1.BAS (Saved BASIC)
Download / View P095L1.LST (Listed BASIC)
Return to Table of Contents | Previous Section | Next Section