Logo (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
A flaring Atari-style emblem: a striped central column flanked by two curved arms

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.

Logo draws a shape that recalls the Atari "Fuji" emblem: a central column with two arms that flare outwards and upwards, drawn in bands of eight colours. When the shape is finished, a machine-language routine cycles the colours, so the bands seem to flow up the logo. It is the first demo in the chapter and a good one to start with.

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. Type the DATA in lines 31000–31010 carefully, because they are 6502 machine code. Line 15 READs eight values from line 1000 into A but never uses them. That is how it appears in the book, and it does no harm. Don't leave out line 1 (TRAP 80), because the program depends on it (see below).

How to use it

RUN it. When the arms reach the top of the screen, drawing stops and the colour animation begins. Press BREAK to stop.

How it works

  • Line 15 puts hue 1–8 at luminance 6 (I*16+6) into registers 705–712.
  • For each column X from 10 to 69, lines 50–52 draw a 50-pixel vertical line on both sides of the screen (at X and 79-X), with its lower end Y pixels above the bottom of the screen. Lines 54–56 repaint the central column, columns 36–43, at the same height.
  • Y is multiplied by 1.23 every column, so it grows faster and faster and the arms curve upwards more and more sharply.
  • Before X reaches 69, Y gets so big that PLOT is asked for a point above the top of the screen. That causes an error, and the TRAP 80 in line 1 catches it and jumps to the animation loop. The error ends the drawing.
  • Lines 30000–30060 READ 27 bytes from lines 31000–31010 into A$. The first 21 bytes are a small 6502 routine (PLA, LDX #0, LDY 705, a loop of LDA 706,X / STA 705,X / INX / CPX #8 / BCC, STY 712, RTS). It moves colour registers 706–712 down one place and wraps 705 round to 712, so each USR(ADR(A$)) call moves every colour one step along. Any values after the 96 (RTS) are padding.

Variations to try

  • Change the 1.23 in line 60. A smaller value gives gentler curves and lets the loop finish without the TRAP.
  • Use the values READ from line 1000: change line 15 to POKE 704+I,A+224 for a single-hue ripple, as in SAS.

Listing

1 TRAP 80
2 DIM A$(30),SINE(450)
3 GOSUB 30000
4 DEG
10 GRAPHICS 10
15 FOR I=1 TO 8:READ A:POKE 704+I,I*16+6:NEXT I
20 COLR=1:Y=1
30 FOR X=10 TO 69
40 COLOR COLR
50 PLOT X,141-Y:DRAWTO X,191-Y
52 PLOT 79-X,141-Y:DRAWTO 79-X,191-Y
54 FOR Q=36 TO 43
55 PLOT Q,191-Y:DRAWTO Q,141-Y
56 NEXT Q
60 Y=Y*1.23
65 COLR=COLR+1:IF COLR>8 THEN COLR=1
70 NEXT X
80 X=USR(ADR(A$))
90 FOR J=1 TO 12:NEXT J
100 GOTO 80
1000 DATA 2,4,6,8,6,4,2,2
30000 REM *** SET UP ASSY PROGRAM
30010 RESTORE 31000
30020 FOR Z=1 TO 27
30030 READ X:A$(Z)=CHR$(X)
30040 NEXT Z
30050 RESTORE
30060 RETURN
31000 DATA 104,162,0,172,193,2,189,194,2,157,193,2,232,224,8,144,245,140,200
31010 DATA 2,96,65,65,65,65,65,65

Credits