1
Discovering"Hidden" Graphics
Gregory L. Kopp
GRAPHICS 1 and 2, the large-text modes, split the normal character set in two and allow only half to be used at once. Both modes also handle colors differently. Here's how to take advantage of those quirks.
If you were a stumbling, beginning BASIC programmer like I was, you probably tried to enter a few "improper" graphics commands which resulted in curious and unexpected displays on your television screen. Before I understood the function and proper use of POKE 756 (which displays lowercase letters and special graphics characters in text modes 1 and 2), I stubbornly tried to put control characters onscreen withoutthe requisite POKE, which produced only seemingly random keyboard characters and frustration instead.
Much later, the thought nevertheless occurred to me that I might have accidentally discovered some "hidden" (or at least undocumented) graphics capability of my Atari. In the experimental binge to which owners of microcomputers are sometimes given, I used the PRINT #6; command to enter each keyboard character while pressing CTRL at the same time. Discovery! Although the Atari special graphics characters appeared in the PRINT #6; statement, the actual screen display consisted of keyboardcharacters, but notthe characters for the keys I entered.
Dutifully noting the results (Tables 1 and 2), I pondered the apparent micro-fluke, these "hidden" characters, then asked myself the inevitable scientific question: "So what?" Two uses came fairly quickly to mind--the first purely cosmetic, the second functional.
If I could change these hidden characters from "default green" to other colors, I could eliminate the irksome problem encountered in modes 1 and 2 of having punctuation and numbers displayed in different colors from the text lettering. The INVERSE key! Sure enough, PRINTing the graphics characters in inverse changed my hidden green characters to red. Now I could choose from normal character (orange), inverse normal (blue), CTRL character (green) and inverse CTRL (red). Experimenting further, I discovered I could achieve anyAtari color by use of a SETCOLOR 0 to 3 or POKE 708 to 711 command to change each respective character. No more would I have to sheepishly explain to those not-of-the-computer-persuasion why my apostrophe or my "1" was blue while my text was red!
So much for cosmetics. If you are not bothered by the inconsistent color text problem, then use the last two paragraphs as speed-reading exercises. However, if you have purchased software for redefining character sets (see Chapter 3), you may already have thought of the second application. Instead of redefining your lowercase character set (and thereby "losing" it) to achieve new characters, you may use "hidden graphics" to redefine the number set, selected punctuation marks, or arithmetic signs. While this could be done normally, using "hidden graphics" allows you to display numbers, punctuation, or signs in fourcolors instead of only two. (If you have not run Program 1 yet, try it. Then try to produce four different color 1's the conventional way.)
A Second Approach
Now enter and run Program 2.
If you are trying to figure out how we got all those alphabet characters using PLOT and COLOR statements, read on.
As any intermediate programmer can tell you, you cannot plot points in modes 1 and 2. You get absolutely nothing displayed if you try it. Of course, the stumbling beginner might think the reason you get nothing is that you did not enter a COLOR statement. Sandwiching COLOR 1 between the lines and trying again, you discover that you have plotted a ! instead of a point. "Pixel-head!" you chide yourself. "You can't use PLOT in modes 1 and 2!" You note this in your reference manual and rank yourself a step closer to intermediate programmer, missing the opportunity to discover more hidden graphics.
The Atari will plot a characterin modes 1 and 2 at whatever position the programmer commands. The nature and color of that character are determined by a single COLOR statement. Using the COLOR Statement Graphics Chart (Table 3) you can display any Atari keyboard character (POKE 756, 226 for lowercase) by using the associated COLOR statement, then plotting X,Y coordinates to place it at the desired position on the screen.
Once again, SETCOLOR 0 to 3 or POKE 708 to 711 can be used to color each individual character, includinglowercase characters which are normally limited to only two colors. (Note: These SETCOLORs and POKEs work only when using GR. 1 or 2 + 16.) Again, redefined characters may be used and this time manipulated arithmetically. Game writers, rejoice!
While the PRINT #6; approach displays numbers, punctuation and arithmetic signs, the COLOR/PLOT technique allows access to upper- and lowercase letters as well. Preference for one method over the other will vary from user to user and application to application, as you will see once you have tried them a few times.
Table 1. Regular and Hidden Colors | |||
---|---|---|---|
Character Normal "Hidden" Inverse, normal Inverse, "hidden" |
(Default) orange green blue red |
SETCOLOR 0 1 2 3 |
POKE 708 709 710 711 |
Table 2. Hidden Graphics | ||
---|---|---|
To Get Character 0 1 2 3 4 5 6 7 8 9 : ! ,, # $ % & ' ( ) * + ' - . / [ @ ^ < > = ? _ ; ] |
Color Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Red Green Green Red |
Press Keys CTRL P INVERSE CTRL P CTRL Q INVERSE CTRL Q CTRL R INVERSE CTRL R CTRL S INVERSE CTRL S CTRL T INVERSE CTRL T CTRL U INVERSE CTRL U CTRL V INVERSE CTRL V CTRL W INVERSE CTRL W CTRL X INVERSE CTRL X CTRL Y INVERSE CTRL Y CTRL Z INVERSE CTRL Z CTRL A INVERSE CTRL A CTRL B INVERSE CTRL B CTRL C INVERSE CTRL C CTRL D INVERSE CTRL D CTRL E INVERSE CTRL E CTRL F INVERSE CTRL F CTRL G INVERSE CTRL G CTRL H INVERSE CTRL H CTRL I INVERSE CTRL I CTRL J INVERSE CTRL J CTRL K INVERSE CTRL K CTRL L INVERSE CTRL L CTRL M INVERSE CTRL M CTRL N INVERSE CTRL N CTRL O INVERSE CTRL O CTRL; INVERSE CTRL; CTRL . INVERSE CTRL . ESC then BACK S ESC then CTRL + DELETE ESC then CTRL + minus ESC then SHIFT + DELETE ESC then CTRL + plus ESC then CTRL + TAB ESC then CTRL + equals ESC then SHIFT + INSERT ESC then CTRL + asterisk ESC then SHIFT + TAB ESC then TAB ESC then CTRL + INSERT ESC then ESC ESC then CTRL + CLEAR ESC then CTRL + 2 |
*greens manipulated by SE.1 and POKE 709
reds manipulated by SE.3 and POKE 711
Table 3. COLOR Statements Graphics Chart
(SETCOLOR #) (POKE register) (default) |
0 708 green |
1 709 yellow |
2 710 red |
3 711 blue |
---|
COLOR Number* | Character | |||||
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 tt 126 127 |
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 t 156 157 158 159 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 |
(space) ! " (quotes) # $ % & ' (apostrophe) ) ( * + , (comma) - (minus) . (period) / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ / ] ^ _ (underline) |
*Use this statement format: Color nn: PLOT x, y. For example, to put a green A on the screen, use: COLOR 97: PLOT 0, 0
COLOR 155: PLOT x, y puts a carriage return on the screen at the PLOT location. If you are also going to PRINT to the graphics screen using PRINT #6; "n", this command puts the PRINT #6 cursor in column 0 of the line after the line specified in PLOT x, y. In other words, if your program executes this line:
GRAPHICS 2:PRINT #6, "ABC", :COLOR 155:PLOT 0,5:PRINT #6, "DEF" the letters ABC will be in line 0 and the letters DEF will be in line 6. To put a red semicolon on the screen, you must POKE the number 219 into the appropriate place in screen memory.
tt COLOR 125:PLOT x, y clears both the text window and the graphics screen. To put a green ] on the screen you must POKE the number 125 into the appropriate place in screen memory.
Program 1. Hidden Graphics--1
Download P016L1.BAS (Saved BASIC)Download / View P016L1.LST (Listed BASIC)
Program 2. Hidden Graphics--2
Download P016L2.BAS (Saved BASIC)Download / View P016L2.LST (Listed BASIC)
Return to Table of Contents | Previous Section | Next Section