# Game Frame — Ecto Blaster

Works with DOS 3.3 and ProDOS.
by STEPHAN SCHWIRZKE

II Computing Volume 1 Number 1
October / November 1985

The house is dark, and worse, it’s haunted! Ghosts appear out of nowhere and rush about trying to drive you away. You have been called in to rid the house of these ectoplasmic interlopers, which you can only do by de-energizing them as they come towards you.

You are armed with the latest anti-ghost weapon. Its laser-driven sight projects a “prohibited” sign wherever the joystick directs. When you press the joystick button, a gout of entropy juice squirts out from your position at the bottom of the screen towards the place marked by your sight. Ifthe juice hits a ghost, the ghost shrivels and disappears. Every time you successfully blast a ghost, a candle lights on the chandelier so you can see a bit more of the room you are in. When all ten candles are lit, you win the game. But every time a ghost gets past you, a skull is added at the bottom of the screen. Collect ten skulls and you lose.

Those of you without a joystick can play from the keyboard by using the alternative lines 320-400 (see listing), and by changing line 4050 to read GET A\$: GOTO 60.

Keys I, J, K and M control direction of your sight, and the space bar substitutes for the trigger button. There is no TYPO II table for the keyboard alternative. To use TYPO II, enter the entire program for joystick, verify its accuracy, then carefully replace the joystick lines with the keyboard lines.

### About the author

Stephan Schwirzke is a college student studying computer science. He’s currently writing an arcade game in assembly language.

### Some Important Variables:

S = number of current shape being drawn
A(S)=O shape not being drawn
A(S)=1 shape being drawn
X = horizontal position of sight
Y = vertical position of sight
S4= speed adjustment in line 5005
to increase difficulty

G(S)= horizontal position of ghost
U(S)= vertical position of ghost
J(S)= scale of ghost
U(S)= speed of ghost
Q(S)= previous scale of ghost (used to erase)

### Explanation of Program Lines:

80 draws bullet and explosion
90-140 checks for hit
150-170 adjusts difficulty (speed, rate of scaling)
180-200 lights candle
210-270 explodes ghost
280-300 clears room to brightest color, gets rid of any leftover ghost
320-410 reads joystick (or keyboard)
430 erases and draws laser sight
440-550 erases and draws ghosts, adjusts scale, moves ghost left or right, determines if ghost has escaped
1000-1050 resets variables for new ghost
2000-2190 resets variables to draw room
3000-3040 sets up collision values
3050-3100 values used to check for collisions, plot room colors, and POKE machine language sound routine
3110-3140 shape tables
4000-4040 “you lose” message
4050-4060 awaits button press for new game

II

### Program Listing:

`10 REM * ECTO BLASTER20 REM * BY STEPHAN SCHWIRZKE30 REM * (C) 1985 ANTIC PUBLISHING INC.40 REM * II COMPUTING VOL.1 NO.150 REM60 CLEAR : RESTORE : HOME : NORMAL70 HGR2 : HCOLOR= 4: HPLOT 1,1: CALL 62454: GOSUB 2000: XDRAW 1 AT X,Y: GOTO 31080 POKE 24655,XX * 50: POKE 24702,15: CALL 24650: SCALE= XX: XDRAW 5 AT X2 + 9,C: RETURN90 FOR P = 1 TO N100 IF A(P) = 0 THEN NEXT : RETURN110 IF X2 > H(J(P)) + G(P) THEN NEXT : RETURN120 IF X2 + F < G(P) THEN NEXT : RETURN 130 IF Y2 > T(J(P)) + U(P) THEN NEXT : RETURN140 IF Y2 + F < U(P) THEN NEXT : RETURN 150 D = D + 1: IF D = 2 THEN S4 = S4 + 5 160 IF D = 3 THEN N = 2::S4 = S4 + 5 170 IF D = 5 THEN S4 = S4 + 5:N = 3:L1 = 15:L2 = 45:L3 = 60:L4 = 75:L5 = 90 180 ROT= 1: SCALE= 1 190 XDRAW 4 AT 101 + ND,28:ND = ND + 8 200 POKE 228,RM(ND / 8): GOSUB 2140 210 B = 8 220 B = B - 2 230 IF B = 0 AND B2 = 1 THEN A(P) = 0:B2 = 0: SCALE= Q(P): GOTO 270 240 IF B = 0 THEN B2 = 1:B = 8: GOTO 220 250 SCALE= B 260 XDRAW 2 AT G(P),U(P): GOTO 220 270 XDRAW 2 AT G(P),U(P): IF ND > < 80 THEN POKE 24655,50: POKE 24702,105: CALL 24650: NEXT : RETURN 280 FOR Z = 1 TO 10: POKE 228,Z: GOSUB 2140: POKE 24702,76 / Z: CALL 24650: NEXT 290 FOR Z = 1 TO 3: SCALE= Q(Z): IF A(Z) = 1 THEN XDRAW 2 AT G(Z),U(Z) 300 NEXT : POKE 228,255: GOSUB 2140: GOTO 4050 310 FOR S = 1 TO N 320 IF PEEK (PK) > T3 AND C = 0 THEN X2 = X:Y2 = Y + 9:C = 185:XX = 1330 IF C - 30 < = Y2 AND C > 0 THEN XX = 3:C = Y2340 Y1 = Y:X1 = X:V = PDL (1)350 IF C > 0 THEN GOSUB 80360 IF V > I AND Y < T1 THEN Y = Y + M 370 IF V < E AND Y > T THEN Y = Y - M380 H = PDL (0)390 IF H > I AND X < T2 THEN X = X + M 400 IF H < E AND X > T THEN X = X - M410 IF C > 0 THEN GOSUB 80:C = C - 45: IF C = Y2 - 45 THEN GOSUB 90:C = 0420 ROT= 1: SCALE= 1430 XDRAW 1 AT X1,Y1: XDRAW 1 AT X,Y440 IF A(S) = 0 THEN GOSUB 1000450 SCALE= Q(S): XDRAW 2 AT G(S),U(S)460 G(S) = G(S) + W(S): IF G(S) > J1 THEN W(S) = - W(S):G(S) = J2:NG(S) = - 1470 IF G(S) < J3 THEN W(S) = - W(S):G(S) = J4:NG(S) = 1 480 SCALE= J(S):Q(S) = J(S) 490 XDRAW 2 AT G(S),U(S) 500 L(S) = L(S) + DF 510 IF L(S) = L4 THEN J(S) = 5 520 IF L(S) > L5 THEN A(S) = 0: XDRAW 2 AT G(S),U(S): SCALE= 1: POKE 24655,140: CALL 24650: XDRAW 6 AT 100 + SE,180:SE = SE + 10: IF SE = 100 THEN 4000530 IF L(S) = L1 THEN J(S) = 2540 IF L(S) = L2 THEN J(S) = 3:W(S) = W(S) + 10 * NG(S)550 IF L(S) = L3 THEN J(S) = 4:W(S) = W(S) + 20 * NG(S)560 NEXT : GOTO 3101000 SCALE= 1: ROT= 1:RK = INT ( RND (1) * 100) + 20:R1 = INT ( RND (1) * 190) + 201010 H3 = FRE (1)1020 A(S) = 1: XDRAW 2 AT R1,RK:U(S) = RK:G(S) = R1:W(S) = S4:J(S) = 1:Q(S) = J(S)1030 RK = INT ( RND (1) * 20): IF RK > 10 THEN W(S) = - W(S):NG(S) = - 11040 NG(S) = 1:L(S) = 01050 RETURN2000 X = 141:Y = 80:X1 = X:Y1 = Y2010 HCOLOR= 32020 SCALE= 1: ROT= 1:M = 18:S4 = 10:DF = 15:N = 12030 PK = - 16287:F = 14:I = 200:E = 100:T = 20: GOSUB 30002040 ND = 0:T3 = 127:T2 = 260:J1 = 240:J2 = 205:J3 = 10:J4 = 402050 T1 = 155:CL = 24576:TN = 24608:GP = 246092060 L1 = 30:L2 = 60:L3 = 90:L4 = 120:L5 = 1502070 HPLOT 101,40 TO 175,40: HCOLOR= 7: HPLOT 137,15 TO 137,0: HCOLOR= 6: HPLOT 101,40 TO 137,15 TO 175,40: HCOLOR= 32080 FOR Z = 1 TO 80 STEP 82090 DRAW 3 AT 101 + Z,402100 DRAW 4 AT 101 + Z,402110 NEXT2120 HCOLOR= 72130 POKE 228,1282140 HPLOT 2,1 TO 278,1 TO 278,191 TO 2,191 TO 2,12150 HPLOT 100,70 TO 178,70 TO 178,121 TO 100,121 TO 100,702160 HPLOT 2,1 TO 100,70: HPLOT 278,1 TO 178,70: HPLOT 278,191 TO 178,121: HPLOT 2,191 TO 100,1212170 HPLOT 30,60 TO 60,75 TO 60,95 TO 30,110 TO 30,602180 HPLOT 140,121 TO 140,101 TO 152,101 TO 152,1212190 RETURN3000 FOR Z = 1 TO 53010 READ H(Z),T(Z): NEXT3020 FOR Z = 1 TO 10: READ RM(Z): NEXT3030 FOR Z = 0 TO 51: READ S3040 POKE 24650 + Z,S: NEXT3050 DATA 10,11,15,20,20,29,30,45,39,55,129,137,139,160,141,1563060 DATA 157,197,253,255,173,126,96,24,105,140,141,127,96,44,48,1923070 DATA 173,126,96,72,206,126,96,208,251,104,141,126,96,44,48,1923080 DATA 173,127,96,72,206,127,96,208,251,104,141,127,96,206,126,963090 DATA 240,5,76,74,96,208,214,963100 REM SHAPE TABLES3110 POKE 232,0: POKE 233,33120 FOR Z = 0 TO 159: READ S3130 POKE 768 + Z,S: NEXT3140 RETURN3150 DATA 6,0,14,0,57,0,94,0,106,0,112,0,136,0,146,146,18,36,76,1043160 DATA 64,3,13,104,141,86,113,17,54,215,250,18,159,31,31,128,31,64,3,133170 DATA 108,108,108,108,31,248,250,250,250,106,73,64,24,72,73,4,0,73,169,2553180 DATA 31,110,45,45,77,62,31,31,31,119,45,45,45,53,255,219,247,205,109,1053190 DATA 245,63,63,63,175,41,13,53,255,191,77,73,4,0,35,36,36,36,5,1683200 DATA 54,54,54,38,0,49,85,62,30,220,36,0,35,44,54,5,32,216,11,233210 DATA 54,14,7,192,77,64,150,34,216,27,64,3,150,34,0,64,24,24,45,1733220 DATA 246,190,63,28,92,28,100,54,13,108,62,31,86,3,104,30,64,24,144,04000 HGR : XDRAW 6 AT 140,14010 FOR Z = 1 TO 150 STEP 24020 XDRAW 6 AT 140,Z4030 XDRAW 6 AT 140,Z + 2: FOR F = 1 TO 18: NEXT : NEXT4040 POKE 24655,200: CALL 24650: VTAB (21): HTAB (17): PRINT "YOU LOSE"4050 IF PEEK ( - 16287) > 127 THEN GOTO 604060 GOTO 4050`

#### A.P.P.L.E.

The A.P.P.L.E. Website is run by the Apple Pugetsound Program Library Exchange Users Group and is open to all Apple and Macintosh fans and their friends.