100 REM 110 REM PENNY ARCADE 120 REM 130 REM BY BILL BUDGE 140 REM # Set the Applesoft end-of-program and variable-start pointers (PRGEND, VARTAB, # ARYTAB, and STREND) to $1320. 1020 POKE 175,32: POKE 176,19: POKE 105,32: POKE 106,19 1030 POKE 107,32: POKE 108,19: POKE 109,32: POKE 110,19 # Enable text mode and clear the text screen. 1040 POKE - 16298,0: HOME # Disable ONERR GOTO. 1050 POKE 216,0: REM OFF THE ON ERR # Enable text mode and clear the text screen (again). # Print the title screen, then the instructions. 1100 TEXT : CALL - 936: PRINT : PRINT : PRINT : PRINT : PRINT : PRINT : PRINT " PENNY ARCADE": PRINT 1110 PRINT " BY": PRINT : PRINT " BILL BUDGE": PRINT : PRINT : PRINT 1120 PRINT " COPYRIGHT 1979 APPLE COMPUTER INC." 1130 PRINT : VTAB 23: PRINT " PRESS 'RETURN' TO CONTINUE...";: GET A$: IF ASC (A$) < > 13 THEN 1130 1140 HOME 1150 VTAB 3: HTAB 11: PRINT "*** INSTRUCTIONS ***" 1160 PRINT 2000 PRINT : PRINT " THE OBJECT OF THE GAME IS TO GET THE": PRINT 2010 PRINT " BALL INTO THE OPPONENTS GOAL. DO THIS": PRINT : PRINT " FIVE TIMES AND YOU WIN! USE THE GAME": PRINT 2020 PRINT " PADDLES TO DEFEND YOUR GOAL.": PRINT : PRINT : PRINT " NEXT YOU WILL BE SHOWN A SERIES OF": PRINT 2030 PRINT " PLAYING FIELDS -- TO SELECT ONE, PRESS": PRINT : PRINT " ANY KEY WHEN THE FIELD THAT YOU WANT": PRINT 2040 PRINT " IS DISPLAYED." 2050 PRINT : VTAB 23: PRINT " PRESS 'RETURN' TO CONTINUE...";: GET A$: IF ASC (A$) < > 13 THEN 2050 # Clear the text screen. 4090 CALL - 936 # Clear and show the hi-res screen. # Show the fancy hi-res animation. # Delay briefly, then clear the hi-res screen. 5000 CALL 7062: CALL 7462: FOR I = 1 TO 2000: NEXT I: CALL 7062 # Switch to the hi-res screen (redundant). 5010 GOSUB 5900 # Show the four different game fields. For each, we set a pointer to the game # board data and call a routine to display it. 5020 GAME = 0 5030 POKE 224,182: POKE 225,27 5040 CALL 6994 5050 VTAB 23: HTAB 13: PRINT "BUMPER POOL " 5060 GOSUB 5200 5070 POKE 224,98: POKE 225,28 5080 CALL 6994 5090 VTAB 23: HTAB 13: PRINT " HOCKEY " 5100 GOSUB 5200 5110 POKE 224,158: POKE 225,28 5120 CALL 6994 5130 VTAB 23: HTAB 13: PRINT " SCRAMBLE " 5140 GOSUB 5200 5150 POKE 224,250: POKE 225,28 5160 CALL 6994 5170 VTAB 23: HTAB 13: PRINT " TENNIS " 5180 GOSUB 5200 5190 GOTO 5020 # Increment the game number, then do a short delay while polling the keyboard. # If a key is hit, pop the caller off the stack and branch. # Otherwise, clear the screen and return to the caller for the next field. 5200 GAME = GAME + 1 5210 FOR I = 1 TO 100 5220 X = PEEK ( - 16384) 5230 POKE - 16368,0 5240 IF X < = 127 THEN 5270 5250 POP 5260 GOTO 5300 5270 NEXT I 5280 CALL 7062 5290 RETURN # Query the difficulty level (1-10). 5300 PRINT "WHAT DIFFICULTY LEVEL" 5310 INPUT "(1-EASIEST, 10-HARDEST)";DFF 5320 IF DFF > 10 OR DFF < 1 THEN 5300 # Initialize scores for player 1 / 2. 5330 S1 = 0:S2 = 0 # Set initial velocity (moving right). 5340 POKE 228,127: POKE 229,0 # UPDOWN is a constant. 5350 UPDOWN = 120 # Configure difficulty. 5360 DFF = 10 + DFF * 5 5370 POKE 6762,DFF: POKE 6800,DFF # Configure field. 5380 POKE 6723,UPDOWN: POKE 6727,UPDOWN 5390 POKE 6732,256 - UPDOWN: POKE 6736,256 - UPDOWN # If it's HOCKEY, branch. 5400 IF GAME = 2 THEN 5440 # Define left/right paddle positions. # Configure non-hockey victory condition pointer. 5410 LE = 7:RE = 247 5420 POKE 6771,189: POKE 6830,189 5430 GOTO 5460 # Configure slightly differently for HOCKEY. # Define left/right paddle positions. # Configure hockey victory condition pointer. 5440 LE = 90:RE = 166 5450 POKE 6771,203: POKE 6830,203 # Set left/right paddle positions. 5460 POKE 6589,LE: POKE 6652,RE 5470 POKE 6680,LE - 3: POKE 6684,LE + 3: POKE 6688,RE - 3: POKE 6692,RE + 3 # Ask about gravity, which adds 1 to the Y velocity every 5 frames. 5480 INPUT "SHOULD THERE BE GRAVITY?";A$ 5485 HOME # Set initial paddle positions. # (Setting 65 and 66 has no effect. There doesn't seem to be any # reason to set 66/68 in a loop, or to call the paddle draw routine. # It works fine if you just POKE 67 and 68.) 5490 POKE 65,27: POKE 67,27 5500 PRINT 5510 FOR I = 27 TO 11 STEP - 8 5520 POKE 66,I: POKE 68,I 5530 CALL 6526 5540 NEXT I # Initialize score display. 5545 VTAB 23 5550 PRINT "PLAYER #1";: HTAB 27: PRINT "PLAYER #2" ### Main play loop ### # Initialize ball position (current and new). # Print scores. If somebody gets to 5, game over. 5560 POKE 224,128: POKE 225,38: POKE 226,128: POKE 227,38 5570 VTAB 24: HTAB 4: PRINT S1;: HTAB 31: PRINT S2; 5580 IF S1 = 5 OR S2 = 5 THEN 5840 5590 IF LEFT$ (A$,1) = "Y" THEN 5700 # No gravity path... # Draw paddles for 200 frames. 5600 FOR I = 1 TO 200 5610 CALL 6526 5620 NEXT I # Start game (without gravity). 5630 CALL 6748 # A point was scored (or ESC was hit). Start by making a sound. 5640 GOSUB 5750 # Set ball Y velocity to zero. We retain whatever X velocity the ball had # when the point was scored. This is okay because all scoring zones are # triggered by horizontal movement. 5650 POKE 229,0 # Assign a point based on which side of the field the ball was on. 5660 IF PEEK (224) < 127 THEN S2 = S2 + 1 5670 IF PEEK (224) > 127 THEN S1 = S1 + 1 # Erase the ball and loop. 5680 CALL 6882 5690 GOTO 5560 # With gravity path... # Draw paddles for 200 frames. 5700 FOR I = 1 TO 200 5710 CALL 6526 5720 NEXT I # Start game (with gravity). 5730 CALL 6786 # Jump to point-scored code. 5740 GOTO 5640 # Point scored, make some noise. 5750 FOR I = 1 TO 2 5760 FOR J = 1 TO 10 5770 Z = PEEK ( - 16336) - PEEK ( - 16336) 5780 NEXT J 5790 FOR J = 1 TO 5 5800 Z = PEEK ( - 16336) - PEEK ( - 16336) + PEEK ( - 16336) - PEEK ( - 16336) 5810 NEXT J 5820 NEXT I 5830 RETURN # Game over. Clear the screen and ask if they want to go again. 5840 PRINT : INPUT "MORE PONG?";A$ 5845 HOME 5850 PRINT : PRINT : CALL 7062 5860 IF LEFT$ (A$,1) = "Y" THEN 5020 # Nope, switch to text mode and say goodbye. 5870 POKE - 16303,0: POKE - 16298,0 5880 CALL - 936: PRINT "BYE!" 5890 END # Show the mixed-mode hi-res screen ($c057, $c053, $c050). 5900 REM 6020 POKE - 16297,0: POKE - 16301,0: POKE - 16304,0 6030 RETURN