Four-Colour Arrows in GRAPHICS 2
- Type
- Graphics
- Category
- Text-mode colour tutorial
- Author
- Marni Tapscott
- Published in
- The Creative Atari (Creative Computing Press, 1983), "Greater Graphics Control", Listing 2
- Year
- 1983
- Language
- Atari BASIC
- Requirements
- Any Atari 8-bit, 16K RAM, Atari BASIC
About the program
In GRAPHICS 1 and 2 (big text) only 64 character shapes are available at a time, and the top two bits of each character code choose its colour. Switch to the second 64-character set (POKE 756,226) to use the Atari graphics symbols and you get a well-known surprise: every empty cell fills with hearts, because the heart sits where the blank space normally is. Marni Tapscott's article "Greater Graphics Control" explains why, and this listing shows the tidy solution. Copy that half of the character set to RAM, redefine the heart as a blank, and you have a clean screen on which the arrow symbols can be plotted in all four colours.
What you need
Any Atari 8-bit with Atari BASIC.
Typing it in
Plain ASCII, with long REMs that you can leave out. Press RESET before you RUN it a second time, so that RAMTOP is not lowered twice.
How to use it
RUN it. After a moment, four arrows appear near the top-left of a full-screen GRAPHICS 2 display: green, pink, turquoise and gold on a darker green background, according to the program's REMs. Those are NTSC colour names, and a PAL machine shows different shades for the same SETCOLOR values. The program holds the picture at line 450. Press BREAK and RESET to finish.
How it works
- Line 120 lowers RAMTOP (106) by two pages. Half a character set (64 characters × 8 bytes = 512 bytes) is all that GRAPHICS 1 and 2 need. Line 130 then opens GRAPHICS 18 (2+16, no text window) below the new limit.
- Lines 150–180 copy 512 bytes from 57856, the ROM half that holds the graphics symbols and lower case, into the reserved RAM. Line 200 points CHBAS (756) at it.
- Lines 220–240 overwrite the first character, the heart, with eight zeros. That makes it a true blank.
- In GRAPHICS 2, the value given to
COLORis an ATASCII character code. The operating system converts it to an internal screen code, in which the low six bits choose the shape and the top two bits choose the colour register. 60, 28, 188 and 156 all turn into internal codes with the same low six bits (28, the arrow) and different colour bits (registers 0, 1, 2 and 3). So the four PLOTs put the same arrow on the screen in four colours. Lines 330–365 set those colours.
Variations to try
- Experiment with other
COLORvalues, as the article suggests. Each symbol comes in four versions: the normal and inverse forms of two different ATASCII codes. - The article's Listing 1 shows the simpler fix: make colour register 0 the same as the background. You lose one colour, but you don't need to redefine anything.
Listing
100 REM CHARACTER REDEFINITION
110 REM STEP ONE: SET ASIDE MEMORY FOR CHARACTER SET
120 POKE 106,PEEK(106)-2
130 GRAPHICS 2+16:REM GR.STMT.HERE PREVENTS OVERLAP OF DISPLAY LIST & CHARACTER SET
140 REM STEP TWO MOVE: CHARACTER SET INTO NEW LOCATION
150 A=PEEK(106)*256
160 FOR B=0 TO 511
170 POKE A+B,PEEK(57856+B)
180 NEXT B
190 REM STEP THREE: POKE NEW ADDRESS OF CHARACTER SET
200 POKE 756,PEEK(106)
210 REM STEP FOUR: CHANGE HEART TO BLANK SPACE
220 FOR C=0 TO 7
230 POKE A+C,0
240 NEXT C
250 REM
310 REM SET UP COLOR REGISTERS
330 SETCOLOR 0,13,8:REM GREEN
340 SETCOLOR 1,4,8:REM PINK
350 SETCOLOR 2,10,8:REM TURQUOISE
360 SETCOLOR 3,2,8:REM GOLD
365 SETCOLOR 4,12,4:REM BACKGROUND COLOR TO GREEN
370 REM
390 COLOR 60:PLOT 5,5:REM GREEN ARROW
400 COLOR 28:PLOT 6,5:REM PINK ARROW
410 COLOR 188:PLOT 7,5:REM TURQUOISE ARROW
420 COLOR 156:PLOT 8,5:REM GOLD ARROW
450 GOTO 450:REM KEEPS DISPLAY ON SCREEN
Credits
- Program listing: Four-Colour Arrows in GRAPHICS 2 — program listing (The Creative Atari (Creative Computing Press, 1983), "Greater Graphics Control", Listing 2) — Marni Tapscott
- The Creative Atari — Greater Graphics Control (atariarchives.org) — Marni Tapscott
