PCjs Machines

Home of the original IBM PC emulator for browsers.

Logo

Challenger 1P BASIC Programs

SPACEWAR.BAS

OSI Challenger 1P

Challenger 1P
Speed:
Stopped

Listing

[From OSIweb]

 100 REM **********************************
 101 REM **** SPACE WAR PROGRAM 1980.  ****
 102 REM **** FROM C.T. MAR 80 PAGE 28 ****
 103 REM **********************************
 104 GOSUB 1400
 105 PRINT "D0 YOU NEED INSTRUCTIONS,Y OR N?"
 106 REM ------TAKES IN EXCESS OF 4.5 KBYTES---
 107 AA=125
 108 YY=238:ZZ=162
 109 REM AA=P.E.T No224.
 110 GOSUB 2000
 120 IF LEFT$(A$,1)="N" THEN 370
 121 IF LEFT$(A$,1)="Y" THEN 130
 122 PRINT" WELL IS THAT YES OR NO.!!! TRY AGAIN."
 125 GOTO 110
 130 REM
 135 PRINT" YOU ARE THE SOLE DEFENCE OF ROME!"
 140 PRINT
 150 PRINT"YOUR SHIP IS THE '";CHR$(YY);"' AT THE TOP"
 160 PRINT"OF YOUR VIEWSCREEN"
 170 PRINT"YOUR TASK IS TO DESTROY AS MANY OF THE"
 180 PRINT"ALIEN'S SHIPS AS POSIBLE, OR ELSE!"
 190 PRINT"THEY COME IN TWO SIZES, AS SHOWN."
 200 PRINT"NO1 IS SHORTRANGE, NO2 IS LONGRANGE."
 210 PRINT"NO1. ";CHR$(176);CHR$(233);CHR$(178);
 215 PRINT TAB(19);"NO2. ";CHR$(176);CHR$(8);CHR$(178)
 217 PRINT"     ";CHR$(146);CHR$(32);CHR$(147);
 218 PRINT TAB(19);"     ";CHR$(190);CHR$(ZZ);CHR$(189)
 220 PRINT"THEY MOVE UP FROM THE BOTTOM OF YOUR"
 230 PRINT"SCREEN AND YOU USE THE 'SPACE' KEY"
 240 PRINT"TO LAUNCH YOUR LASER BOLT."
 245 PRINT
 250 PRINT"      HIT ANY KEY TO CONTINUE"
 260 GOSUB 2000
 265 POKE 11,112:POKE 12,23:X=USR(X)
 275 PRINT"IF YOU DO NOT SCORE A DIRECT HIT YOU"
 280 PRINT"WILL NOT DESTROY THE ALIEN CRAFT."
 285 PRINT
 290 PRINT"YOU CAN CHANGE THE DIRECTION THAT YOU"
 300 PRINT"ARE MOVING IN WITH THE 'R' KEY."
 305 PRINT
 310 PRINT"REMEMBER THAT THE ALIENS SPEED UP "
 320 PRINT"THE MORE YOU SHOOT THEM DOWN AND "
 330 PRINT"WHEN THEY FIRE THEY NEVER MISS!"
 335 PRINT:PRINT
 340 PRINT"      HIT ANY KEY TO PLAY"
 350 GOSUB 2000
 360 GOTO 370
 370 REM SET UP VARIABLES
 380 J=50:R=INT((44)*RND(1))+1
 390 REM CLEAR SCREEN ROUTINE
 400 POKE 11,112:POKE 12,23:X=USR(X)
 410 X=53261:M=1:T=60
 420 IF X<53261 THEN M=1
 430 IF X>53307 THEN M=-1
 440 REM CHECK FOR DIRECTION KEY
 450 IF A=223 THEN 470
 460 GOTO 490
 470 IF M=1 THEN M=-1:GOTO 490
 480 M=1
 490 X=X+M:POKE X,YY:POKE X-1,32:POKE X+1,32
 500 IF PEEK(X+320)=233 OR PEEK(X+320)=8THEN990
 510 IF PEEK(X+640)=33 THEN K=x+600:GOTO 1000
 520 IF FF=0 THEN 550
 530 IF FF=1 THEN GOSUB 630
 540 IF FF=1 THEN 420
 550 TT=(J-H):T=T+1:IF T<TT THEN 600
 560 N=INT((3)*RND(1)):IF N=1 THEN 580
 570 PRINTTAB(R);CHR$(176);CHR$(233);CHR$(178)
 571 PRINTTAB(R);CHR$(146);CHR$(32);CHR$(147)
 575 GOTO 590
 580 PRINTTAB(R);CHR$(176);CHR$(8);CHR$(178)
 581 PRINTTAB(R);CHR$(190);CHR$(ZZ);CHR$(189)
 590 T=0:R=INT((45)*RND(1))+1
 600 GOSUB 1500
 610 IF A=239 THEN FF=1:F=X+64:GOSUB 630
 620 GOTO 420
 630 IF RI=1 OR LE=1 tHEN 1200
 640 F=F+64
 650 GOSUB 1500:IF A=223 THEN 660
 651 REM MAYBE ^ SHOULD GOTO 680
 660 GOTO 700
 670 IF M=1 THEN M=-1:GOTO 700
 680 M=1
 690 REM DIRECT HIT?
 700 IF PEEK(F)=233 OR PEEK(F)=8 THEN H=H+1:GOTO 870
 710 POKE F-128,32
 720 REM NEAR MISS?
 730 IF PEEK(F)<>176 THEN 780
 740 POKE F-64,139:POKE F-65,190:POKE F-1,134
 750 FOR Q=0 TO 80:NEXT:POKE F-64,32:POKE F-65,32:POKE F-1,32
 760 D=1:RI=1:F=F-1:GOTO 820
 770 POKE F-128,32
 780 IF PEEK(F)<>178 THEN 820
 790 POKE F-64,139:POKE F-63,189:POKE F+1,134
 800 FOR Q=0 TO 80:NEXT:POKE F-64,32:POKE F-63,32:POKE F+1,32
 810 D=1:LE=1:F=F+1
 820 IF F>54203 THEN FF=0:D=0:RI=0:LE=0:POKE F-64,32:RETURN
 830 IF D=1 THEN RETURN
 840 POKE F,43:POKE F-64,139:POKE F-128,32
 850 RETURN
 860 REM DESTROY ALIEN ROUTINE
 870 POKE F-64,32:POKE F-128,32
 880 FOR Q=0 TO 1
 890 POKE F-1,43:POKE F+64,232:POKE F+1,169
 900 POKE F,AA:POKE F+63,90:POKE F+65,187
 910 POKE F-1,187:POKE F+64,142:POKE F+1,AA
 920 POKE F,238:POKE F+63,43:POKE F+65,170
 930 POKE F-1,32:POKE F+64,32:POKE F+1,32
 940 POKE F,32:POKE F+63,32:POKE F+64,32
 950 NEXT Q:FF=0
 960 IF F=K-64 THEN 640:REM ACTUALY IT WAS 63999
 970 D=0:RI=0:LE=0:RETURN
 980 REM DESTROY DEFENDER ROUTINE
 990 K=X+256:REM SHOULD BE 280:
 1000 IF PEEK(K)=238 THEN 1030
 1010 POKE K,AA:POKE K+64,32
 1020 K=K-64:GOTO 1000
 1030 POKE K+64,32
 1040 FOR W=1 TO 20:POKE K,229:FOR O=1 TO 10:NEXT O
 1050 POKE K,238:FORO=1 TO 10:NEXT O:NEXT W
 1060 REM END GAME PRINTOUT
 1070 POKE 11,112:POKE 12,23:X=USR(x)
 1071 PRINT"    YOU DESTROYED";H;"OF THE ALIENS"
 1075 PRINT
 1080 REM KEYBOARD TRAP
 1090 FOR Y=1 TO 10:GOSUB 1500:NEXT Y
 1100 IF H2<H THEN H2=H:PRINT
 1101 PRINT"    IT IS THE BEST SCORE SO FAR":GOTO 1120
 1110 PRINT:PRINT"    THE BEST SCORE IS";H2
 1120 PRINT:PRINT"    TO PLAY AGAIN PRESS ANY KEY"
 1130 PRINT:PRINT"  AFTER 30 SECONDS I WILL SHUT DOWN"
 1140 FOR TI=1 TO 160
 1150 GOSUB 1500:IF A<>255 THEN 1170
 1160 NEXT TI:PRINT
 1165 PRINT"    BYE NOW!":END
 1170 REM RESET VARIABLES THEN RESTART
 1180 J=50:H=0:D=0:RI=0:LE=0:GOTO 380
 1190 REM REBOUND BOLT ROUTINES
 1200 IF LE=1 THEN K=65:GOTO 1220:REM K=41 IN MAG
 1210 K=63:REM K=39 IN MAG
 1220 F=F+K:IF F>54203 THEN POKEF-K,32:FF=0:D=0:RI=0:LE=0:RETURN
 1230 IF PEEK(F)<>32 THEN POKE F-K,32:H=H+1:GOTO 1250
 1240 POKE F,46:POKE F-K,32:RETURN
 1250 IF PEEK(F+1)=233 OR PEEK(F+1)=8 THEN F=F+1:GOTO 870
 1260 IF PEEK(F)=233 OR PEEK(F)=8 THEN 870
 1270 IF PEEK(F-1)=233 OR PEEK(F-1)=8 THEN F=F-1:GOTO 870
 1280 IF PEEK(F-65)=233 OR PEEK(F-65)=8 THEN F=F-65:GOTO 870
 1290 IF PEEK(F-63)=233 OR PEEK(F-63)=8 THEN F=F-63:GOTO 870
 1300 IF PEEK(F+65)=233 OR PEEK(F+65)=8 THEN F=F+65:GOTO 870
 1400 FOR I=6000 TO 6030
 1410 READ J:POKE I,J:NEXT I
 1415 RESTORE:RETURN
 1420 DATA 169,0,133,225,168,169,208,133,226,169,32
 1430 DATA 145,225,200,192,0,208,249,166,226,224
 1440 DATA 211,240,6,232,134,226,24,144,237,96
 1500 T(1)=253:T(2)=251:T(3)=247:T(4)=239
 1510 T(5)=223:T(6)=191:T(7)=127
 1520 POKE 530,1:FOR Q=1 TO 7:POKE 57088,T(Q)
 1530 A=PEEK(57088):IF A<>255 THEN 1540
 1535 NEXT Q
 1540 POKE 530,0:RETURN
 2000 POKE 11,0:POKE 12,253:X=USR(X)
 2010 A=PEEK(531)
 2020 A$=CHR$(A)
 2050 RETURN