SPACE DUEL
You are trapped outside your space capsule and someone is firing at you.
The situation is desperate; you have only seven shots.
This could be your last stand.
To move up and down use the joystick or keys Q and A respectively; fire with W.
If you are playing against a second player, they use the keys P and ; to move up and down; 0 fires.
If both players run out of shots, the game is declared a draw.
SCREENSHOTS
SOURCE
A type-in BASIC program by Scott McCann for Tandy Color Computers with 16K RAM and Extended Color BASIC, published in TRS-80 Colour Computer Space Adventures.
Please note - this played through in 1-player mode without crashing but there may still be typoes in this code.
10 DIMA(38),B(38),C(46) 20 CLS: PRINT@10, "SPACE DUEL" 30 PRINT:PRINT" -LEFT PLAYER SHOOTS WITH 'W' AND MOVES U/D WITH 'Q'&'A'." 40 PRINT:PRINT" -RIGHT PLAYER SHOOTS WITH '0' AND MOVES U/D WITH 'P'&';'." 50 PRINT:PRINT" -JOYSTICKS MOVE PLAYER U/D AND FIRE WITH BUTTONS." 60 PRINT:PRINT"EACH PLAYER GETS 7 SHOTS. HOLD FIRE DOWN UNTIL LASER HEATS UP, THEN LET GO TO FIRE.":PRINT:PRINT"<HIT ANY KEY TO CONTINUE>"; 70 IF INKEY$="" THEN 70 80 CLS:PRINT" -WHEN PLAYING AGAINST THE COMPUTER, IT GETS AN UNLIMITED NUMBER OF SHOTS." 90 PRINT:PRINT" -A DRAW IS AWARDED IN THE EVENTTHAT BOTH PLAYERS RUN OUT OF LASER SHOTS." 100 PRINT:PRINT" -HOLDING FIRE BUTTON DOWN WILL EXPELL LASER FIRE A FEW STEPS BUT WILL NOT BE COUNTED AS A SHOT FIRED.":PRINT:PRINT"<HIT ANY KEY>"; 110 IF INKEY$ =""THEN110 120 PLAY"T19FE04FED03FEDG02FEDGD01FEDGDC03FEDCGF02DE01DE03DE04DE02DEFFD01C03DT255" 130 PMODE4,1:PCLS 140 DRAW"S4BM34,100;G4D3F1R1D1R3U1H2U2E1D3F1U5F1D4E1R1H1U1D3G2R2" 150 DRAW"D1L5G2D5F2G1D1R9U1L8E1R5U1" 160 DRAW"E2U1H1R3BR2U1NR2BL2L3E1H2U1E2U3H4NE4L2H4BD16BR3D5R4" 170 DRAW"BM222,100;F4D3G1L1D1L3U1E2U2H1D3G1U5G1D4H1L1E1U1D3F2L2" 180 DRAW"D1R5F2D5G2F1D1L9U1R8H1L5U1" 190 DRAW"H2U1E1L3BL2U1NL2BR2R3H1E2U1H2U3E4NH4R2E4BD16BL3ND2L4D5BR4H3R3" 200 DRAW"S8BM126,93;D5G8F2R1NF1BE1NR2U3R2BR2NR2D3E1F1U3BR2ND3R2D3BD2BL10R1F1R6E1R1E1R1E2H8U5L2" 210 GET(30,88)-(46,134),A, G 220 GET(210,88)-(226,134),B,G 230 GET(110,88)-(148,134),C,G 240 CIRCLE(70,161),8:PAINT(70,161),5,5 250 CIRCLE(186,33),8:PAINT(186,33),5,5 260 CLS:INPUT"1 OR 2 PLAYERS";C:IF C=1 THEN INPUT"DIFFICULTY (1-4)";D:IFD<1ORD>4THEN260 270 IFC>2ORC<1THEN 260 280 CLS:INPUT"JOYSTICKS (Y/N)";A$ 290 LX=88:RX=88:SX=88:B=22:SL=0:SR=0:LC=0:RC=0 300 SCREEN1,1:IF A$<>"Y" THEN 400 310 A=JOYSTK(0):A=JOYSTK(3) 320 IF C=2 THEN B=JOYSTK(1) 330 IF A<21 THEN LU=-8 340 IF A>42 THEN LU=8 350 IF B<21 THENRU=-8 360 IF B>42THENRU=8 370 P2=PEEK(65280):IFP2=125ORP2=253THENSL=1:LQ=47:LZ=LX+25 380 IFC=2ANDP2=254ORP2=126THENSR=1:RQ=209:RZ=RX+25 390 GOSUB470:GOTO310 400 IF PEEK(339)=254THENLU=8 410 IF PEEK(339)=251THENLU=-8 420 IFC=2AND PEEK(338)=251THENRU=-8 430 IFC=2AND PEEK(341)=223THENRU=8 440 IF PEEK(345)=251 THENSL=1:LQ=47:LZ=LX+25 450 IF PEEK(345)=253THENSR=1:RQ=209:RZ=RX+25 460 GOSUB 470:GOTO400 470 IFC=2 AND RU GOSUB570 480 IF LU GOSUB550 490 IF C=1GOSUB 710 500 IF RND(10)=5 GOSUB680 510 IF LC>6AND RC>6 THEN CLS:PRINT"'DRAW.'":FORI=1TO500:NEXT:GOTO790 520 IF SL AND LC<7 GOSUB590:GOSUB590:GOSUB590 530 IF C=2 AND SR AND RC<7GOSUB630:GOSUB630:GOSUB630 540 RETURN 550 IF LX+LU<0 OR LX+LU>148 THEN RETURN 560 LX=LX+LU:PUT(30,LX)-(46,LX+46),A,PSET:LU=0:RETURN 570 IFRX+RU<0ORRX+RU>148THENRETURN 580 RX=RX+RU:PUT(210,RX)-(226,RX+46),B,PSET:RU=0:RETURN 590 IF SL=0 THEN RETURN ELSEIF LQ+20>256ORPPOINT(LQ+20,LZ)ORLQ+20>110AND LZ>SX+4 AND LZ<SX+41 THEN PLAY"D":SL=0:LC=LC+1:RETURN 600 LINE(LQ,LZ)-(LQ+20,LZ),PSET:LINE(LQ,LZ)-(LQ+20,LZ),PRESET 610 LQ=LQ+20:IF LQ>209AND LZ>RX+12 AND LZ<RX+34THENPLAY"AEGCFFED":FORI=1TO10:PUT(210,RX+I)-(227,RX+46+I),B,PSET:PLAY"CFDE":NEXT:W$="LEFT":GOTO780 620 RETURN 630 IFSR=0 THEN RETURN ELSEIFRQ-20<0OR RQ-20<148AND RZ<SX+41 AND RZ>SX+4THEN PLAY"F":SR=0:RC=RC+1:RETURN 640 IF PPOINT(RQ-20,RZ)THEN PLAY"F":SR=0:RC=RC+1:RETURN 650 LINE(RQ,RZ)-(RQ-20,RZ),PSET:LINE(RQ,RZ)-(RQ-20,RZ),PRESET 660 RQ=RQ-20:IFRQ<47AND RZ>LX+12 AND RZ<LX+34 THENPLAY"DEFFCGEA":FORI=1TO10:PUT(30,LX+I)-(47,LX+46+I),A,PSET:PLAY"FCD":NEXT:W$="RIGHT":GOTO780 670 RETURN 680 SU=5*(2-RND(3)):IFSU=0GOTO680 690 IF SX+SU<30OR SX+SU>133 THENRETURN 700 SX=SX+SU:PUT(110,SX)-(148,SX+46),C,PSET:RETURN 710 IF LX<RX THEN RX=RX-D*2 ELSE IF LX>RX THEN RX=RX+D*2 720 IF RX<0 THEN RX=0 ELSE IF RX>148 THEN RX=148 730 GOSUB 580 740 IFSS AND RX+25>LX+8 AND RX+25<LX+26 THEN SS=0:SR=1:RQ=209:RZ=RX+25 750 IF SS=0 THEN FORI=1TO O:GOSUB630:NEXT 760 IF SR=0 THEN SS=1 770 RETURN 780 CLS:PRINTW$"HAND PLAYER WON.":FORI=1TO1000:NEXT 790 CLS:PRINT"PLAY AGAIN (Y/N)" 800 A$=INKEY$:IF A$="Y" THEN 130 ELSE IF A$="N"THEN CLS:PRINT"BYE.":END 810 GOTO800
SPEEDING UP
Add the following lines at the top to disable BREAK key checking and switch the SAM into high-speed mode:
1 IF PEEK(&H3EB9)<>&H32 THEN CLEAR200,&H3EB0:FOR I=&H82B9 TO &H831E:POKE I-&H4400,PEEK(I):NEXT ELSE 6 2 FORI=0TO2:POKE &H3EBD+I,18:NEXT:I=&H3F1E 3 POKE I,&H26:POKE I+1,3:POKE I+2,&H7E:POKE I+3,&H83:POKE I+4,&H22:POKE I+5,&H7E 4 POKE I+6,&HA4:POKE I+7,&H4C 5 POKE &H019A,&H39:POKE &H019B,&H3E:POKE &H019C,&HB9:POKE &H019A,&H7E 6 POKE 65495,0
And add the following to the end of line 800 to restore normal speed on exit:
... :POKE65494,0:END
RUNNING IN EMULATORS
You can type-in and run the BASIC directly from command line with XRoar:
$ xroar -machine cocous SPACDUEL.BAS
You can create a virtual floppy disk to load and run from in MAME:
$ decb dskini SPACDUEL.DSK $ decb copy SPACDUEL.BAS SPACDUEL.DSK,SPACDUEL.BAS -t $ mame cocoe -ramsize 16K -window -resolution 1920x1080 -skip_gameinfo -flop1 SPACDUEL.DSK RUN"SPACDUEL
Requires a cocoe.zip ROM pack in ${HOME}/mame/roms and the Toolshed utilities to build the DECB disk image.