Nuclear Reactor
- Type
- Game
- Category
- Action collecting game
- Author
- Dennis Debro
- Published in
- Antic, April/May 1990 (Vol. 9, No. 1)
- Year
- 1990
- Language
- Atari BASIC
- Requirements
- 48K RAM, Atari BASIC, joystick in port 1
- Tags
- antic, action, maze, joystick, graphics-1, redefined-characters, atari-basic
About the program
You took a cushy job as janitor at the nuclear plant, and then came the meltdown. Just as you're enjoying your enforced holiday, the boss, who cares more about the valuable experiments left inside than about the radiation, sends you back in wearing one of the company's mobile radiation suits. Collect every white beaker on each level before time runs out. Any coins dropped by fleeing workers are yours to keep. The walls and desks glow with radiation and touching them is fatal, and deadly green creatures roam the rooms, eager to eat you. Some of them eat beakers too.
Dennis Debro was a college student in Birmingham, Alabama, and this was his first program in Antic.
Typing it in
You need 48K. Lines 90 and 130 contain machine code inside strings of inverse and control characters (a character-set copy routine and a short timing routine called X$). The magazine offered a second listing that wrote these two lines to LINES.LST for merging, and the disk version printed here includes them. In this notation {inv}…{/inv} means type with the Atari (inverse) key on, and {CTRL-H}, {CTRL-I} and so on mean hold CTRL and press the letter. In the game screen code, {inv}{CTRL-H}{/inv} is a glowing obstacle, {CTRL-I} is a coin and % is a beaker.
How to play
The program takes a few seconds to set up its character set, then shows a flashing title. Press START or the button. The monsters, coins and beakers are scattered around, the radioactive obstacles flash in rainbow colours, and you appear in the middle of the room.
Move with the joystick. The suit can't move diagonally, so diagonal pushes are ignored. Don't go too close to the left and right walls. Beakers are worth 100 points and coins 250. Finish a level and you get a bonus of (level + time left) × 100. Later levels bring more monsters (up to five) and more beakers, and there's an extra suit for every 20,000 points. You start with three suits. Touching radiation, being caught or running out of time costs one, and you start that level again.
How it works
The room is a GRAPHICS 1 screen with a redefined character set (DATA lines 660 onwards). Most of the action is done with POKE straight into screen memory rather than PRINT. Lines 150–160 poke the walls round the edge, and each monster is moved by poking character 134 at SCR+X+20*Y.
There's a nice economy in how the player is drawn. Line 250 pokes the joystick value itself, ST=PEEK(632), into the player's screen cell. The values 7, 11, 13, 14 and 15 (right, left, down, up and centred) are exactly the character codes the DATA redefines as the janitor in his suit, facing each way. So drawing the figure needs no IF statements at all. Collisions are LOCATEs of the cell you're moving into. Anything other than empty floor, a beaker, a coin or a few harmless characters is deadly.
The monsters chase you. Each turn, one monster is picked at random (and none at all on some turns, depending on the level) and moves one step towards you on each axis. The time limit uses the operating system's clock. Line 140 zeroes location 19, which goes up by one about every 4¼ seconds, and line 340 shows 25-PEEK(19) as the time left.
Variations to try
- More time: change both 25s in line 340 (and
T=25in lines 130, 420 and 510). - Change the scoring values in lines 315 and 320.
Listing
10 REM NUCLEAR REACTOR
20 REM BY Dennis Debro
30 REM (c)1990, ANTIC PUBLISHING, INC.
80 REM
90 GRAPHICS 17:POKE 559,0:CHSET=(PEEK(106)-8)*256:Z=USR(ADR("hh{inv}{CTRL-E}L{/inv}h{inv}{CTRL-E}K{/inv}h{inv}{CTRL-E}N{/inv}h{inv}{CTRL-E}M"{/inv}{CTRL-B}{inv} {/inv}{CTRL-,}{inv}1K{CTRL-Q}M{CTRL-H}PyfLfNJPp{/inv}{CTRL-.}"),57344,CHSET)
100 READ A:IF A<0 THEN 120
110 FOR J=0 TO 7:READ B:POKE CHSET+A*8+J,B:NEXT J:GOTO 100
120 DIM X$(32),X(5),Y(5),SC$(6),LVL$(2)
130 X=10:Y=12:SC=0:T=25:LVL=1:L=3:SL=10:QW=1:X$="hhhH{inv}"{/inv}9{inv} {/inv} {inv}-{/inv} {inv}R{/inv}e{CTRL-T}{inv}{CTRL-M}{/inv}{CTRL-Y}{inv}P{CTRL-M}{/inv}{CTRL-J}{inv}T{CTRL-H}PrJPm{/inv}h8{inv}i{/inv}{CTRL-A}{inv}Pd{/inv}{CTRL-.}":M=1:NS=10:NS2=NS:GOTO 600
135 GOSUB 1200
140 GRAPHICS 17:POKE 756,CHSET/256:POKE 19,0:SCR=PEEK(88)+256*PEEK(89):POKE 708,12:POKE 709,38:POKE 710,196
150 POKE 711,52:FOR I=SCR+40 TO SCR+59:POKE I,193:POKE I+420,194:NEXT I
160 FOR I=SCR+60 TO SCR+440 STEP 20:POKE I,195:POKE I+19,196:NEXT I:FOR I=1 TO (10+M)*2:X1=INT(RND(0)*18)+1
170 Y1=INT(RND(0)*20)+3:POSITION X1,Y1:? #6;"{inv}{CTRL-H}{/inv}";:FOR W=1 TO 255 STEP 20:SOUND 0,W,8,10:NEXT W:SOUND 0,0,0,0
175 NEXT I:IF M>5 THEN M=5
180 FOR I=1 TO M:X(I)=INT(RND(0)*18)+1:Y(I)=INT(RND(0)*20)+3:NEXT I:FOR I=1 TO M:P=SCR+X(I)+20*Y(I):POKE P,134
185 NEXT I:FOR I=1 TO (10+M)*2:X1=INT(RND(0)*18)+1:Y1=INT(RND(0)*20)+3:POSITION X1,Y1:? #6;"{CTRL-I}";
186 FOR W=14 TO 0 STEP -2:SOUND 0,10,10,W:NEXT W:NEXT I
190 POSITION 0,0:? #6;"{inv}score{/inv} 000000 {inv}lives{/inv} 0":POSITION 0,1:? #6;" {inv}level{/inv} 00 {inv}time{/inv} 25"
200 SC$=STR$(SC):POSITION 12-LEN(SC$),0:? #6;SC$:POSITION 19,0:? #6;L:LVL$=STR$(LVL):POSITION 9-LEN(LVL$),1
210 ? #6;LVL$:FOR I=1 TO NS:X1=INT(RND(0)*18)+1:Y1=INT(RND(0)*20)+3:IF (X1<>X) OR (Y1<>Y) THEN 221
220 X1=INT(RND(0)*18)+1:Y1=INT(RND(0)*20)+3:GOTO 230
221 FOR T=1 TO M:IF (X1<>X(T)) OR (Y1<>Y(T)) THEN 223
222 X1=INT(RND(0)*18)+1:Y1=INT(RND(0)*20)+3:GOTO 230
223 NEXT T
230 POSITION X1,Y1:? #6;"%";:FOR W=14 TO 0 STEP -2:SOUND 0,W*5,10,W:NEXT W:NEXT I
240 SOUND 0,254,10,10:SOUND 1,255,10,10:FOR I=10 TO 0 STEP -1:SOUND 0,254,10,I:SOUND 1,255,10,I
245 A=USR(ADR(X$),1):NEXT I
250 FOR I=1 TO M:P=SCR+X(I)+20*Y(I):POKE P,134:NEXT I:TP=SCR+X+20*Y:ST=PEEK(632):POKE TP,ST:IF NS2<=0 THEN 490
255 POKE 77,0
260 X=X+(ST=7)-(ST=11):Y=Y+(ST=13)-(ST=14):IF (ST=10) OR (ST=6) OR (ST=5) OR (ST=9) THEN 290
270 IF ST<>15 THEN POKE TP,0:SOUND 1,128,8,14:SOUND 1,0,0,0:GOTO 300
280 SOUND 1,0,0,0
290 ST=15:POKE TP,ST:SOUND 1,0,0,0
300 LOCATE X,Y,Z:IF (Z<>32) AND (Z<>47) AND (Z<>37) AND (Z<>9) THEN 410
310 IF INT(SC/20000)=QW AND BONUS=1 THEN GOSUB 570:BONUS=0:QW=QW+1
315 IF Z=9 THEN SC=SC+250:GOSUB 652:SC$=STR$(SC):POSITION 12-LEN(SC$),0:? #6;SC$:BONUS=1
320 IF Z=37 THEN SC=SC+100:NS2=NS2-1:GOSUB 540:SC$=STR$(SC):POSITION 12-LEN(SC$),0:? #6;SC$:BONUS=1
330 IF T<=0 THEN T=0:GOTO 410
340 T=25-PEEK(19):POSITION 16,1:? #6;T;" "
350 R=INT(RND(1)*SL)+1:IF R>M THEN 250
360 P=SCR+X(R)+20*Y(R):X(R)=X(R)+(X>X(R))-(X<X(R)):Y(R)=Y(R)+(Y>Y(R))-(Y<Y(R)):SOUND 2,250,10,10:SOUND 2,0,0,0
370 LOCATE X(R),Y(R),W:IF W=37 THEN POKE P,5:GOTO 390
380 POKE P,0
390 IF (X(R)=X) AND (Y(R)=Y) THEN 410
400 GOTO 250
410 FOR I=1 TO 255 STEP 5:SOUND 1,I,8,10:POKE 708,I:POKE 709,I:POKE 710,I:NEXT I:SOUND 1,0,0,0:L=L-1
420 POKE 708,12:POKE 709,38:POKE 710,196:POSITION 19,0:? #6;L:IF L<>0 THEN X=10:Y=12:T=25:NS2=NS:GOTO 135
430 POSITION 5,12:? #6;"{inv}game over{/inv}":RESTORE 1080:FOR I=1 TO 11:READ DA,H:SOUND 0,0,0,0
440 SOUND 1,0,0,0:SOUND 0,DA,10,10:SOUND 1,DA-1,10,10:FOR S=1 TO H*2:A=USR(ADR(X$),1):NEXT S:NEXT I
450 SOUND 0,0,0,0:SOUND 1,0,0,0:IF SC>=HS THEN HS=SC
460 A=USR(ADR(X$),1):IF (PEEK(53279)=6) OR (STRIG(0)=0) THEN 130
470 C=C+1:IF C=100 THEN C=0:GOTO 600
480 GOTO 460
490 SC=SC+(INT(T+LVL)*10):IF SC>999999 THEN SC=0:POSITION 6,0:? #6;"000000"
495 POSITION 3,11:? #6;"LEVEL COMPLETE":POSITION 2,12:? #6;"{inv}congratulations{CTRL-Z}{/inv}"
496 SC$=STR$(SC):POSITION 12-LEN(SC$),0:? #6;SC$
500 RESTORE 1070:FOR I=1 TO 12:READ DA,BS,H:SOUND 0,DA,10,10
510 SOUND 1,BS,10,8:FOR S=1 TO H*2:NEXT S:SOUND 0,0,0,0:SOUND 1,0,0,0:NEXT I:X=10:Y=12:T=25:LVL=LVL+1
515 IF LVL>99 THEN LVL=1
520 NS=NS+1:IF NS>15 THEN NS=15
525 NS2=NS:IF L>5 THEN SL=SL-1:IF SL<5 THEN SL=5
530 M=M+1:FOR I=1 TO 100:NEXT I:GOTO 135
540 FOR I=14 TO 0 STEP -2:SOUND 0,I*5,10,I:NEXT I
550 IF SC>=999999 THEN SC=0:POSITION 0,1:? #6;"000000"
560 RETURN
570 IF L<5 THEN FOR FD=1 TO 3:FOR I=15 TO 0 STEP -1:SOUND 0,20,10,I:FOR D=1 TO 2:NEXT D:NEXT I:NEXT FD
580 IF L<5 THEN L=L+1:BONUS=0:POSITION 19,0:? #6;L
590 SOUND 0,0,0,0:RETURN
600 GRAPHICS 17:POKE 756,CHSET/256:DL=PEEK(560)+256*PEEK(561)+4:POKE DL-1,71:FOR I=2 TO 5:POKE DL+I,7:NEXT I
610 POKE 708,12:POKE 709,38:POSITION 2,4:? #6;"{inv}nuclear reactor{/inv}":POSITION 2,5:? #6;"{inv}by dennis debro{/inv}"
615 FOR I=1 TO 25:SOUND 0,254,10,10:SOUND 1,255,10,10:A=USR(ADR(X$),1):NEXT I
616 FOR I=10 TO 0 STEP -1:SOUND 0,254,10,I:SOUND 1,255,10,I:A=USR(ADR(X$),1):NEXT I
620 POSITION 1,10:? #6;"TOP SCORE 000000":POSITION 0,16:? #6;"press {inv}START{/inv} to begin"
625 POSITION 17-LEN(STR$(HS)),10:? #6;HS
630 A=USR(ADR(X$),1):IF PEEK(53279)<>6 AND STRIG(0)<>0 THEN 630
650 X=10:Y=12:SC=0:T=25:LVL=1:L=3:SL=10:QW=1:X$="hhhH{inv}"{/inv}9{inv} {/inv} {inv}-{/inv} {inv}R{/inv}e{CTRL-T}{inv}{CTRL-M}{/inv}{CTRL-Y}{inv}P{CTRL-M}{/inv}{CTRL-J}{inv}T{CTRL-H}PrJPm{/inv}h8{inv}i{/inv}{CTRL-A}{inv}Pd{/inv}{CTRL-.}":M=1:NS=10:NS2=NS:GOTO 135
652 FOR I=15 TO 0 STEP -1:SOUND 0,20,10,I:NEXT I:RETURN
660 DATA 1,0,0,0,0,0,0,255,255
670 DATA 2,255,255,0,0,0,0,0,0
680 DATA 3,128,128,128,128,128,128,128,128
690 DATA 4,1,1,1,1,1,1,1,1
700 DATA 5,60,36,36,66,129,255,255,126
710 DATA 6,126,189,219,255,36,90,66,165
720 DATA 7,24,16,60,88,60,24,36,102
730 DATA 8,255,255,255,255,255,255,255,255
735 DATA 9,60,126,118,98,110,98,118,60
740 DATA 11,24,8,60,26,60,24,36,102
750 DATA 13,24,24,60,90,60,24,36,102
760 DATA 14,24,24,60,90,60,24,36,102
770 DATA 15,24,24,60,90,60,24,36,102
780 DATA 16,0,127,99,99,99,99,99,127
790 DATA 17,0,56,24,24,24,62,62,62
800 DATA 18,0,127,3,3,127,96,96,127
810 DATA 19,0,126,6,6,127,7,7,127
820 DATA 20,0,112,112,112,112,119,127,7
830 DATA 21,0,127,96,96,127,3,3,127
840 DATA 22,0,124,108,96,127,99,99,127
850 DATA 23,0,127,3,3,31,24,24,24
860 DATA 24,0,62,54,54,127,119,119,127
870 DATA 25,0,127,99,99,127,7,7,7
875 DATA 26,0,56,56,24,24,0,24,24
880 DATA 33,0,63,51,51,127,115,115,115
890 DATA 34,0,126,102,102,127,103,103,127
900 DATA 35,0,127,103,103,96,99,99,127
910 DATA 36,0,126,102,102,119,119,119,127
920 DATA 37,0,127,96,96,127,112,112,127
930 DATA 39,0,127,99,96,111,103,103,127
940 DATA 41,0,127,28,28,28,28,28,127
950 DATA 44,0,48,48,48,112,112,112,126
960 DATA 45,0,103,127,127,119,103,103,103
970 DATA 46,0,103,119,127,111,103,103,103
980 DATA 47,0,127,99,99,103,103,103,127
990 DATA 48,0,127,99,99,127,112,112,112
1000 DATA 50,0,126,102,102,127,119,119,119
1010 DATA 51,0,127,96,127,3,115,115,127
1020 DATA 52,0,127,28,28,28,28,28,28
1030 DATA 53,0,103,103,103,103,103,103,127
1040 DATA 54,0,103,103,103,103,111,62,28
1050 DATA 57,0,103,103,103,127,28,28,28
1060 DATA -1
1070 DATA 64,162,25,64,162,25,64,162,25,64,162,30,72,182,20,72,182,25,72,182,30,81,193,20,81,193,20,81,193,20
1075 DATA 81,193,20,64,217,30
1080 DATA 108,3,108,2,108,1,108,3
1090 DATA 91,2,96,1,96,2,108,1
1100 DATA 108,2,114,1,108,3
1200 GRAPHICS 18:POKE 708,70:POKE 712,14
1210 FOR I=1 TO 5:POSITION 5,5:? #6;"GET READY!"
1220 FOR W=15 TO 0 STEP -1:SOUND 0,20,10,W:NEXT W:POSITION 5,5:? #6;" ":FOR W=0 TO 15:NEXT W
1230 NEXT I:RETURN
Download
The original program from the Antic disk, to LOAD or ENTER instead of typing it: REACTOR.BAS.
Credits
- Program listing: Nuclear Reactor — program listing (Antic, April/May 1990 (Vol. 9, No. 1)) — Dennis Debro
- Picture: The flashing title screen, with its redefined, shaded lettering. — Dennis Debro (program); screenshot by the site
- Antic Software Archive — April/May 1990 - Vol. 9 No. 1 disk: REACTOR.BAS — Dennis Debro, 1990
- Antic magazine scan (OCR text layer): Antic_Vol_9-01_1990-04_King_Me_text.pdf — Internet Archive
