Rainbow (GTIA Demo)
- Type
- Graphics
- Category
- GTIA colour-cycling demo
- Author
- Unknown (early GTIA demonstration program, author not identified in the book)
- Published in
- The Creative Atari (Creative Computing Press, 1983), "Design Philosophy and GTIA Demos"
- Year
- 1983
- Language
- Atari BASIC
- Requirements
- GTIA chip (any XL/XE or later 400/800); 16K RAM; Atari BASIC
About the program
The demos come from the "Design Philosophy and GTIA Demos" chapter of The Creative Atari. The column's writer explained that Atari had started fitting the new GTIA chip to all Atari 800s in January 1982, and that the chip added three graphics modes. He didn't know who had written these little demonstration programs. He guessed they came from somebody at Atari with an early sample of the chip, and he asked the author to get in touch so that he could give credit.
Rainbow (its first line calls it a "GTIA TEST") is the most direct of the demos. It paints 15 vertical bars across the screen, using GRAPHICS 10 colours 1 to 8 and back down to 1, and fills each bar solid. Then it keeps adding 16 to every colour register, so all the bars march through the Atari's hues together. It's a handy quick check that a machine really has a GTIA. On a CTIA machine you won't see nine separate colours.
What you need
- A GTIA machine: any XL/XE, a 400/800 built from 1982 on, or an emulator such as Altirra. CTIA machines run the program but show the wrong colours.
- 16K RAM, Atari BASIC.
Typing it in
The listing is plain ASCII. "S:" is the screen device, and #6 is the channel that GRAPHICS opens. Line 116 has ten values, but only nine are read. The printed page is hard to read at this point, and its sixth value may be 80 rather than 90. That value only sets one starting colour, so either is fine.
How to use it
RUN it. Each bar is outlined and filled in turn. Then the colours cycle for ever. Press BREAK to stop.
How it works
- Line 115 READs nine colour values into registers 704–712. In GRAPHICS 10 those are the background and the eight drawing colours.
- Lines 130–150 and 230–250 draw each bar's right-hand edge with
PLOT/DRAWTOand plot its bottom-left corner. They thenPOSITIONthe cursor at the top-left corner and callXIO 18,#6,0,0,"S:". That is the OS fill command. It fills to the right of the line between the last point plotted and the cursor position, using the colour stored in location 765 (POKE 765,X). - Line 300 tidies the bottom edge with a background-coloured line.
- Lines 400–420 add 16 to each register, which keeps the luminance and moves the hue one step. Values over 255 wrap to 26.
Variations to try
- Change the step from 16 to 2 in line 400 to make the bars pulse in brightness instead of hue.
- Add
POKE 77,0in line 420 (as Ring does) so that the attract mode never dims the screen.
Listing
100 REM GTIA TEST
115 GRAPHICS 10:FOR Z=704 TO 712:READ R:POKE Z,R:NEXT Z
116 DATA 0,26,42,58,74,90,106,122,138,154
130 FOR X=1 TO 8:COLOR X:POKE 765,X
140 PLOT X*4+5,0:DRAWTO X*4+5,159:PLOT X*4+1,159:POSITION X*4+1,0:XIO 18,#6,0,0,"S:"
150 NEXT X
230 FOR X=8 TO 15:COLOR 16-X:POKE 765,16-X
240 PLOT X*4+5,0:DRAWTO X*4+5,159:PLOT X*4+1,159:POSITION X*4+1,0:XIO 18,#6,0,0,"S:"
250 NEXT X
300 COLOR 0:PLOT 65,159:DRAWTO 0,159
400 FOR X=1 TO 8:Z=PEEK(704+X):Z=Z+16:IF Z>255 THEN Z=26
420 POKE 704+X,Z:NEXT X:FOR Y=1 TO 5:NEXT Y:GOTO 400
Credits
- Program listing: Rainbow (GTIA Demo) — program listing (The Creative Atari (Creative Computing Press, 1983), "Design Philosophy and GTIA Demos") — Unknown (early GTIA demonstration program, author not identified in the book)
- Picture: Rainbow: the filled bars, just before the hue cycling starts. — Unknown (early GTIA demonstration program, author not identified in the book) (program); screenshot by the site
- The Creative Atari — Design Philosophy and GTIA Demos (atariarchives.org) — Unknown (early GTIA demonstration program, author not identified in the book)
- The Creative Atari — book index (atariarchives.org) — AtariArchives.org
- COMPUTE!'s Second Book of Atari Graphics — GTIA: An Illustrated Overview — AtariArchives.org
