Player Behind a False Background (De Re Atari)
- Type
- Graphics
- Category
- Player/playfield priority demo
- Author
- Chris Crawford (Section 4 of De Re Atari)
- Published in
- De Re Atari: A Guide to Effective Programming (Atari Program Exchange, APX-90008, 1982), Section 4, "Player-Missile Graphics" (applications)
- Year
- 1982
- Language
- Atari BASIC
- Requirements
- Any Atari 8-bit, 16K RAM, Atari BASIC
About the program
De Re Atari ("All About Atari") was written by Atari's Software Development Support Group as a training manual for professional programmers. Early versions went to registered developers in 1981, and the 1982 edition was sold through the Atari Program Exchange as APX-90008. In the applications part of the player/missile chapter, Chris Crawford points out that a player is only eight bits wide, even at quadruple width. Then he shows a way round it. Paint the whole screen in a playfield colour that looks like background, give that playfield priority over the player, and the player vanishes. Wherever you then draw real background, the player shows through. The shape of the "hole" sets the shape of what you see, at full playfield resolution.
What you need
Any Atari 8-bit with Atari BASIC.
Typing it in
Plain ASCII. The REM commentary after lines 1–8, 90, 160, 190 and 200 can be left out. Note that line 90 backs off 20 pages from RAMTOP rather than 8. The comment explains that GRAPHICS 7 needs more room, because its screen memory sits just below RAMTOP.
How to use it
RUN it. The screen fills with colour 3 line by line, which takes a few seconds in BASIC. Then a slanted purple-pink parallelogram appears in the black area. It is the part of the quadruple-width player that shows through the window drawn in lines 210–250. Above and below the playfield, in the blue border, you can see the rest of the player, because nothing there has priority over it. Press RESET to clear it.
How it works
- Lines 10–80 set GRAPHICS 7, make the true background blue (
SETCOLOR 4,8,4) and make register 2 black. Register 2 is the one thatCOLOR 3uses in GRAPHICS 7. Filling the whole screen withCOLOR 3then gives a black false background. - Lines 90–170 set up player/missile memory and fill player 0's area with 255, a solid vertical bar.
- Line 190 sets the player to quadruple width (SIZEP0, 53256 = 3), 32 colour clocks across.
- Line 200 POKEs 4 into GPRIOR (623). Priority 4 puts all playfields in front of all players, so the black playfield hides the player.
- Lines 210–250 draw with
COLOR 4in GRAPHICS 7. That is BASIC's way of plotting true background, and it cuts a slanted window through the false background. The player shows through the window only.
Variations to try
- Draw a circle or text-like shapes in lines 210–250 instead. The player will show through any shape you cut.
- Animate the player with
POKE HPOSP0,Xin a loop. The window stays put while the colour slides behind it.
Listing
1 RAMTOP=106:REM OS top of RAM pointer
2 PMBASE=54279:REM ANTIC player-missile RAM pointer
3 SDMCTL=559:REM Shadow of DMACTL
4 GRACTL=53277:REM CTIA graphics control register
5 HPOSP0=53248:REM Horizontal position register of P0
6 PCOLR0=704:REM Shadow of player 0 color register
7 SIZEP0=53256:REM Player width control register
8 GPRIOR=623:REM Priority control register
10 GRAPHICS 7
20 SETCOLOR 4,8,4
30 SETCOLOR 2,0,0
40 COLOR 3
50 FOR Y=0 TO 79:REM This loop fills the screen
60 PLOT 0,Y
70 DRAWTO 159,Y
80 NEXT Y
90 A=PEEK(RAMTOP)-20:REM Must back up further for GR. 7
100 POKE PMBASE,A
110 MYPMBASE=256*A
120 POKE SDMCTL,46
130 POKE GRACTL,3
140 POKE HPOSP0,100
150 FOR I=MYPMBASE+512 TO MYPMBASE+640
160 POKE I,255:REM Make player solid color
170 NEXT I
180 POKE PCOLR0,88
190 POKE SIZEP0,3:REM Set player to quadruple width
200 POKE GPRIOR,4:REM Set priority
210 COLOR 4
220 FOR Y=30 TO 40
230 PLOT Y+22,Y
240 DRAWTO Y+43,Y
250 NEXT Y
Credits
- Program listing: Player Behind a False Background (De Re Atari) — program listing (De Re Atari: A Guide to Effective Programming (Atari Program Exchange, APX-90008, 1982), Section 4, "Player-Missile Graphics" (applications)) — Chris Crawford (Section 4 of De Re Atari)
- Picture: Only the window cut into the false background reveals the player; in the border it shows through unobstructed. — Chris Crawford (Section 4 of De Re Atari) (program); screenshot by the site
- De Re Atari — Section 4: Player-Missile Graphics (atariarchives.org) — Chris Crawford (Section 4 of De Re Atari)
- De Re Atari — preface (section authors) — AtariArchives.org
- comp.sys.atari.8bit FAQ (De Re Atari editions: C060070 1981 developer versions, APX-90008 1982) — Michael Current (comp.sys.atari.8bit FAQ), 1981
