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
Six shaded golden tubes on a dark brown background, the nearest one upright on the left and the others leaning further to the right, each with an elliptical opening at the top

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 9 gives 80 × 192 pixels, each with 16 brightness levels of the hue set by SETCOLOR 4,1,0 (hue 1, a gold).
  • The outer loop steps AS from 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)))/2 is half the height of an ellipse at slice B, 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 C rises 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,0 makes blue tubes and SETCOLOR 4,12,0 green ones.
  • Change S=10 to 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