Maze Maniac
- Type
- Game
- Category
- Maze game / page-flipping demonstration
- Author
- Scott McKissock
- Published in
- Antic, August 1983 (Vol. 2, No. 5), "In the Public Domain"
- Year
- 1983
- Language
- Atari BASIC
- Requirements
- Joystick in port 1, Atari BASIC
- Tags
- antic, page-flipping, display-list, lms, savmsc, graphics-4, maze, joystick, atari-basic
About the program
Scott McKissock, a high-school sophomore at Camp Lejeune, North Carolina, wrote this maze game. Antic's August 1983 graphics issue printed it with a short explanation of page flipping by David Duberman and a "take-apart" of the program. The magazine warned that the screen goes blank for about 30 seconds before the game starts, while the six mazes are built.
You move a dot through a maze. Walk off any edge and you appear instantly in another maze, each with its own colour and one prize, a small cross. Collect all six prizes before the clock runs out, and the rooms are restocked for the next level with five fewer seconds on the clock. The catch is that the rooms are linked in a fixed but non-obvious way, so you have to discover and remember which exit leads where. The magazine called it "devilishly hard".
What you need
A joystick in port 1 and Atari BASIC.
Typing it in
Almost plain ASCII. The two inverse-video messages ({inv}…{/inv}) in lines 220 and 630 are typed with the Atari key. The DATA in lines 500–565 holds the wall layouts in a compact form: pairs of start and end positions for horizontal lines, then for vertical lines. Each wall is drawn four times, mirrored about both axes, so the mazes are symmetrical. Line 0 is a REM and can be left out.
How to play
Wait for the first maze to appear. Then steer the dot with the joystick. The TIME counter at the top falls about once a second. Scores are added up at the end of each level from the time left, the level and the prizes collected. At GAME OVER, press START to play again.
How it works
- Page flipping. The six mazes are drawn into six separate 2-page areas just below the top of memory (cleared by line 710). Line 100 opens GRAPHICS 20 (GRAPHICS 4 without a text window) and patches the display list. To show a different maze, the program changes one byte, the high byte of the screen address in the display list (
POKE DL,SAV-2*R). ANTIC immediately displays the other picture. - Drawing off-screen. BASIC draws wherever locations 88–89 (SAVMSC) point. Lines 310 and 499 POKE location 89 to aim PLOT and DRAWTO at a hidden page. The article explains both addresses.
- The room map. The arrays
U(),D(),L()andR()(lines 730–750) say which room lies above, below, left and right of each room. Change them to make your own puzzle. - Collisions.
LOCATEreads the pixel the dot is about to enter. A wall sends it back, and the prize's coordinates are checked separately (line 65). - A split display list (line 100) keeps the TIME line, drawn in a separate text mode, fixed at the top while the mazes change underneath.
Listing
0 REM FROM ANTIC -- THE ATARI RESOURCE
1 GOTO 700
10 X=40:Y=23:POKE DL,SAV-2*R:POKE 89,SAV-2*R
15 T=TT:POKE 87,1:POSITION 11,0:? #6;T:POKE 87,4
20 IF PEEK(20)>58 THEN T=T-1:SOUND 0,T+20,10,PZ+1:POKE 20,0:POKE 87,1:GOTO 40:REM CHECK TIME
25 S=STICK(0):V=(S=13)-(S=14):H=(S=7)-(S=11):COLOR 0:PLOT X,Y:X=X+H:Y=Y+V:LOCATE X,Y,Z:IF Z<>0 THEN 65
30 COLOR 3:PLOT X,Y
35 IF Y=2 THEN COLOR 0:PLOT X,Y:Y=43:SCR=2*U(R):R=U(R):GOTO 60
36 IF Y=44 THEN COLOR 0:PLOT X,Y:Y=3:SCR=2*D(R):R=D(R):GOTO 60
37 IF X=79 THEN COLOR 0:PLOT X,Y:X=2:SCR=2*R(R):R=R(R):GOTO 60
38 IF X=1 THEN COLOR 0:PLOT X,Y:X=78:SCR=2*L(R):R=L(R):GOTO 60
39 GOTO 20
40 POSITION 11,0:? #6;T;" ":POKE 87,4:REM CHANGE TIME
45 IF T=0 THEN COLOR 0:PLOT X,Y:GOTO 600:REM GAME OVER?
50 IF SCR=-1 THEN SOUND 0,0,0,0:GOTO 25
55 POKE DL,SAV-SCR:SCR=-1:SETCOLOR 0,R*2,6:GOTO 20
60 POKE 87,1:POKE 89,SAV-SCR:GOTO 40
65 IF Q(R)*8+7>X OR Q(R)*8+9<X OR B(R)*4+4>Y OR B(R)*4+6<Y THEN X=X-H:Y=Y-V:GOTO 30:REM CHECK FOR PRIZE
70 Q=Q(R)*8+8:B=B(R)*4+5:Q(R)=0:B(R)=0:PZ=PZ+1
75 FOR P=1 TO PZ:SOUND 0,60,10,15:FOR N=1 TO 25:NEXT N:SOUND 0,0,0,0:FOR N=1 TO 20:NEXT N:NEXT P
80 COLOR 0:PLOT Q,B-1:PLOT Q,B+1:PLOT Q-1,B:PLOT Q+1,B:IF PZ=6 THEN 200
90 GOTO 20
100 GRAPHICS 20:DL=PEEK(560)+PEEK(561)*256+5:POKE DL-2,70:POKE DL+44,65:POKE DL+45,PEEK(560)
110 POKE DL+46,PEEK(561):R=1:IF ST=0 THEN SAV=PEEK(DL):POKE 89,SAV-2:GOTO 400:REM CHANGE DISPLAY LIST
120 R=6:X=40:Y=23:POKE DL,SAV-2*R:GOTO 10
200 GOSUB 300
210 TT=TT-5:L=L+1:REM LEVEL FINISHED
220 POKE 106,P106-18:GRAPHICS 18:POSITION 2,1:? #6;"{inv}CONGRATULATIONS!{/inv}"
230 POKE 708,118:POSITION 1,3:? #6;"YOU HAVE COMPLETED LEVEL ";L
240 SCORE=SCORE+T*L+PZ:POSITION 6,6:? #6;"SCORE ";SCORE:POSITION 5,9:? #6;"{inv}PRESS FIRE{/inv}"
250 POKE 710,10:POKE 106,P106:PZ=0:IF STRIG(0)=0 THEN GOTO 100
260 POKE 710,14:GOTO 250
300 POKE 106,P106:POKE 87,4:COLOR 3:R=1:REM PUT IN NEW PRIZES
310 SOUND 0,R*40,10,6:SOUND 1,R*40+2,10,6:POKE 106,P106-2*R:POKE 89,SAV-2*R:POKE DL,SAV-2*R
320 Q(R)=INT(RND(0)*9):B(R)=INT(RND(0)*9):Q=Q(R)*8+8:B=B(R)*4+5:LOCATE Q,B,Z
330 IF Z<>0 THEN 320
350 PLOT Q-1,B:PLOT Q+1,B:PLOT Q,B+1:PLOT Q,B-1:R=R+1:IF R<7 THEN GOTO 310
360 R=6:SOUND 0,0,0,0:SOUND 1,0,0,0:POKE 89,SAV-2*R:RETURN
400 POKE 87,1:POSITION 6,0:? #6;"TIME: ":POKE 87,4:COLOR 1:Y=3:REM DRAW SCREENS
410 READ X,XD:IF X=0 THEN 440
420 PLOT X,Y:DRAWTO XD,Y:PLOT 80-X,Y:DRAWTO 80-XD,Y:PLOT X,46-Y:DRAWTO XD,46-Y:PLOT 80-X,46-Y:DRAWTO 80-XD,46-Y
430 GOTO 410
440 IF XD<>0 THEN Y=Y+4*XD:GOTO 410
450 X=2
460 READ Y,YD:IF Y=0 THEN 490
470 PLOT X,Y:DRAWTO X,YD:PLOT X,46-Y:DRAWTO X,46-YD:PLOT 80-X,46-Y:DRAWTO 80-X,46-YD:PLOT 80-X,Y:DRAWTO 80-X,YD
480 GOTO 460
490 IF YD>0 THEN X=X+4*YD:GOTO 460
495 IF R=6 THEN POKE 89,SAV-2*R:POKE DL,SAV-2*R:POKE 559,34:GOSUB 300:ST=1:GOTO 10
499 R=R+1:POKE 106,P106-2*R:POKE 89,SAV-2*R:GOTO 400
500 DATA 2,10,14,22,26,38,0,1,2,10,0,1,2,14,0,1,2,22,0,1,2,26,0,0,3,7,11,15,19,27,0,3,3,11
505 DATA 0,2,3,11,0,1,3,19,0,3,3,21,0,0
510 DATA 2,10,14,22,26,38,0,1,26,38,0,1,22,40,0,1,2,10,14,38,0,1,2,38
515 DATA 0,0,3,7,11,15,19,27,0,2,3,15,0,1,3,15,0,2,3,11,0,1,3,7,0,0
520 DATA 2,10,14,22,26,38,0,3,2,22,26,38,0,1,2,34,0,0,3,7,11,15,19,23,0,5,3,15,0,1,3,15,0,3,15,23,0,0
530 DATA 2,10,14,22,26,38,0,1,22,40,0,1,14,40,0,1,2,6,10,38,0,1,6,38,0,0,3,7,11,15,19,23,0,1,15,19,0,1
535 DATA 3,15,0,1,3,11,0,3,0,0
540 DATA 2,10,14,22,26,38,0,1,2,22,0,1,6,26,0,1,2,38,0,1,6,38,0,0
545 DATA 3,7,11,15,19,27,0,6,3,11,0,3,3,15,19,23,0,0
550 DATA 2,10,14,22,26,38,0,1,2,26,30,40,0,1,6,30,34,40,0,1,2,34,0,1,6,38,0,1,10,38,0,0
555 DATA 3,7,11,15,19,27,0,1,19,23,0,5,3,7,0,1,7,11,0,1,11,15,0,1,15,19,0,0
560 DATA 2,10,14,22,26,38,0,1,2,26,30,40,0,1,6,30,34,36,0,1,2,34,0,1,6,36,0,0
565 DATA 3,7,11,15,19,27,0,1,19,23,0,5,3,7,0,1,7,11,0,1,11,15,0,1,15,19,0,0
600 R=0:POKE 106,P106:COLOR 0:REM GAME OVER
610 R=R+1:POKE 106,SAV-2*R:POKE 89,SAV-2*R:Q=Q(R)*8+8:B=B(R)*4+5:PLOT Q,B-1:PLOT Q,B+1:PLOT Q-1,B:PLOT Q+1,B
615 IF R<6 THEN GOTO 610
620 GOSUB 300
630 POKE 106,P106-18:GRAPHICS 18:POKE 708,56:POSITION 5,2:? #6;"{inv}game over{/inv} SCORE ";SCORE+PZ
640 POSITION 4,8:? #6;"{inv}PRESS{/inv} {inv}START{/inv}"
650 IF PEEK(53279)=6 THEN POKE 106,P106:L=0:PZ=0:TT=100:SCORE=0:GOTO 100
660 GOTO 650
700 POKE 559,0:SCR=-1:TT=100:P106=PEEK(106)
710 ER=P106-16:FOR I=ER*256 TO (ER+16)*256:POKE I,0:NEXT I:REM CLEAR MEMORY FOR SCREENS
720 DIM U(6),D(6),L(6),R(6),Q(6),B(6)
730 U(1)=4:D(1)=4:L(1)=3:R(1)=2:U(2)=5:D(2)=5:L(2)=1:R(2)=3
740 U(3)=6:D(3)=6:L(3)=2:R(3)=1:U(4)=1:D(4)=1:L(4)=6:R(4)=5
750 U(5)=2:D(5)=2:L(5)=4:R(5)=6:U(6)=3:D(6)=3:L(6)=5:R(6)=4
760 POKE 106,P106:GOTO 100
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: MZMANIAC.BAS.
Credits
- Program listing: Maze Maniac — program listing (Antic, August 1983 (Vol. 2, No. 5), "In the Public Domain") — Scott McKissock
- Picture: One of the six rooms, with its prize, a few seconds into the game. — Scott McKissock (program); screenshot by the site
- Antic article text (August 1983 - Vol. 2 No. 5) — Maze Maniac game — Scott McKissock, 1983
- Antic Software Archive — disk files (August 1983 - Vol. 2 No. 5): MZMANIAC.BAS — AtariMagazines.com (Kevin Savetz), 1983
- Antic magazine scan (OCR text layer): Antic_Vol_2-05_1983-08_Graphics_text.pdf — Internet Archive
