Animation 130 XE

Type
Demo
Category
Extended-memory page-flipping animation
Published in
Bajtek (Poland), 1989; modified by GIA Software and reprinted on the Czech disk magazine Flop, issue 5
Year
1989
Language
Atari BASIC
Requirements
Atari 130XE (or any XL/XE with 130XE-compatible banked memory); Atari BASIC

About the program

The 130XE's extra 64K is reached through a 16K window at $4000–$7FFF, selected through the PORTB register (54017). ANTIC can be told to read from the selected bank as well, so the extra memory can hold several complete screens and the program can flip between them instantly. This short demo shows the idea in plain BASIC. Its REMs credit "(c) 1989 BAJTEK", the Polish computer magazine, and then in Czech: Upraveno: GIA Software, "modified by GIA Software". The warning in lines 7–9 (Pozor! Tento program pracuje pouze s pocitacem ATARI 130 XE) means "Warning! This program only works with the Atari 130XE". It was reissued on the Czech disk magazine Flop 5.

Typing it in

The REM box in lines 1–3 is drawn with line-graphics characters: {CTRL-Q}, {CTRL-R}, {CTRL-E}, {CTRL-Z} and {CTRL-C} are corners and horizontal bars (hold CTRL and press the letter). The box is purely decorative, so plain dashes will do. Everything else is ordinary ASCII. Line 130 is an empty REM separator.

Type the program carefully. A typo in line 30 or 40 POKEs the wrong value into PORTB and can switch the OS ROM or BASIC out, which crashes the machine. SAVE it first.

How to use it

At Zadej pocet stran N= ("enter the number of sides, N=") type a whole number of 3 or more. The program then draws a wire-frame prism with N sides eight times in GRAPHICS 8, each time rotated a little further, which takes a while in BASIC. When all eight frames are done, the animation starts. Hold SELECT to make it faster or START to slow it down.

How it works

  • F=106 is RAMTOP. Setting RAMTOP to 128 ($8000) or 96 ($6000) before each GRAPHICS 8+16 makes the OS build the screen inside the $4000–$7FFF bank window, so two 8K hi-res screens fit in every 16K bank.
  • The PORTB values 193, 197, 201 and 205 differ only in bits 2–3, which select extended banks 0–3. Bits 4 and 5 are clear, so both the CPU and ANTIC see the selected bank. Eight frames are drawn: four banks times two screen positions.
  • After the last frame, line 110 changes the meaning of the variables. F now points at 561 (the display list's high byte) and H at the delay routine at line 50, so the same loop in lines 30–40 now plays back the frames. It switches PORTB to each bank in turn and moves the display-list pointer between the two screens.
  • Line 120 also pokes 0 into location 77 on every pass, which keeps the attract-mode colour cycling from kicking in while you watch.

Variations to try

  • Try different N values. A triangle (3) and a many-sided "cylinder" (20+) look quite different in motion.
  • Draw something other than a prism in lines 90–100. The frame-flipping part doesn't care what's on each screen.

Listing

1 REM {CTRL-Q}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-E}
2 REM | ANIMATION 130 XE |
3 REM {CTRL-Z}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-R}{CTRL-C}
4 REM (c) 1989 BAJTEK
5 REM Upraveno:
6 REM GIA Software
7 REM Pozor!
8 REM Tento program pracuje pouze
9 REM s pocitacem ATARI 130 XE.
10 GRAPHICS 0:?:?:? " Zadej pocet stran N=";:INPUT N:IF N<3 OR N>INT(N) THEN 10
20 F=106:T=128:D=193:H=80:A=120:B=30:Q=35:P=160:KT=360/N:N=KT/16:DEG
30 FOR K=0 TO 8 STEP 8:E=4-K:POKE F,T-4*K:FOR J=0 TO 3:IF J THEN D=D+E
40 POKE 54017,D:GOSUB H:NEXT J:NEXT K:POKE L,P:GOTO A
50 FOR I=1 TO N:IF PEEK(53279)=5 THEN IF N>0 THEN N=N-0.3
60 IF PEEK(53279)=6 THEN N=N+0.3
70 NEXT I:RETURN
80 GRAPHICS 8+16:COLOR 1:SETCOLOR 2,0,0
90 FOR I=0 TO 360 STEP KT:X=P+A*COS(I+N):Y=Q+B*SIN(I+N):IF I THEN PLOT R,S:DRAWTO X,Y:DRAWTO X,Y+A:DRAWTO R,S+A
100 R=X:S=Y:NEXT I:FOR I=1 TO 300:NEXT I:N=N+KT/8:IF N<KT THEN RETURN
110 L=F:F=561:T=96:H=50:RETURN
120 L=77:P=0:A=30:N=10:GOTO A
130 REM *****************************

Credits