Tubes (Graphics 9 Demo)
- Type
- Graphics
- Category
- GTIA shaded-graphics demo
- Author
- Oliver Baczkowski
- Published in
- Antic, November 1984 (Vol. 3, No. 7), I/O Board letters page ("Graphics 9 Demo")
- Year
- 1984
- Language
- Atari BASIC
- Requirements
- GTIA chip (any XL/XE, or a 400/800 with GTIA), 16K RAM, Atari BASIC
- Tags
- antic, io-board, gtia, graphics-9, shading, short-program, demo, oliver-baczkowski, 1984
About the program
"Greetings from Berlin!" began a short letter to Antic's I/O Board in November 1984. Oliver Baczkowski sent nine lines of BASIC as a demonstration of GRAPHICS 9, the GTIA mode that gives 16 shades of a single colour. The disk file is called TUBES.BAS, and the name fits. The program draws six golden tubes, the nearest standing upright and the rest leaning further and further to the right. Shading makes each one look round, with a highlight down the front and a darker opening at the top.
What you need
A machine with the GTIA chip: any XL or XE, or a 400/800 fitted with one. On an old CTIA machine, GRAPHICS 9 gives a plain screen instead of the shading. In an emulator, any XL/XE setup works.
Typing it in
It's plain text, so type it as shown. Note that AS is an ordinary variable name. After drawing, line 90 loops for ever to keep the picture on screen. Press BREAK to stop.
How it works
GRAPHICS 9gives 80 × 192 pixels, each with 16 brightness levels of the hue set bySETCOLOR 4,1,0(hue 1, a gold).- The outer loop steps
ASfrom 55 down to 5 in steps of 10, so the six tubes are drawn from back to front and each new one covers the last. - The inner loop makes 25 vertical slices per tube.
D=INT(SQR(B*(24-B)))/2is half the height of an ellipse at sliceB, which gives the oval opening at the top (lines 60–70). - Line 80 draws each slice from the rim down to a point near the bottom left, so the tubes slant and fan out.
- The shade
Crises from 0 to 11 across the first half of the tube, jumps to 15 and falls back to 3 (line 30). That gives the bright stripe that makes the tube look round. The rim uses the opposite shade,15-C, so the inside looks hollow.
Variations to try
- Change the hue in line 10:
SETCOLOR 4,9,0makes blue tubes andSETCOLOR 4,12,0green ones. - Change
S=10to 5 for a dozen tightly packed tubes.
Listing
10 GRAPHICS 9:SETCOLOR 4,1,0:S=10
20 FOR AS=55 TO 0 STEP -S:FOR B=0 TO 24:C=B
30 IF B>11 THEN C=24-B:C=C+3
40 Z=AS+B
50 D=INT(SQR(B*(24-B)))/2:COLOR 15-C
60 PLOT Z,AS+7-D
70 DRAWTO Z,AS+7+D:COLOR C
80 DRAWTO B,180-AS+3:NEXT B:NEXT AS
90 GOTO 90
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: TUBES.BAS.
Credits
- Program listing: Tubes (Graphics 9 Demo) — program listing (Antic, November 1984 (Vol. 3, No. 7), I/O Board letters page ("Graphics 9 Demo")) — Oliver Baczkowski
- Picture: The finished picture, drawn in the 16 shades of GRAPHICS 9. — Oliver Baczkowski (program); screenshot by the site
- Antic, November 1984 (Vol. 3 No. 7): I/O Board - Graphics 9 Demo, letter from Oliver Baczkowski (atarimagazines.com) — Oliver Baczkowski, 1984
- Antic disk, November 1984 - Vol. 3 No. 7: TUBES.BAS (detokenized listing) — AtariMagazines.com (Kevin Savetz), 1984
