'CONTROLS:
'ARROW KEYS - AIM UP/DOWN/LEFT/RIGHT
'SPACE      - FIRE CANNON
'ENTER      - FIRE TORPEDO
'1-9        - CHANGE ENGINE SPEED
'KEY OFF
DEFINT A-Z: DEFSNG G, J, O, S
CLS
SCREEN 0
WIDTH 40
PRINT "ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿"
PRINT "³ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿³"
PRINT "³³                                    ³³"
PRINT "³³             2060-A.BAS             ³³"
PRINT "³³               XWING                ³³"
PRINT "³³                                    ³³"
PRINT "³³     BROUGHT TO YOU BY DATATECH     ³³"
PRINT "³³                                    ³³"
PRINT "³³    MICHAEL KNOX WAUSAU WI 54403    ³³"
PRINT "³³                                    ³³"
PRINT "³³                                    ³³"
PRINT "³³       MODIFIED BY GALLEON TO       ³³"
PRINT "³³        BE QBASIC COMPATIBLE        ³³"
PRINT "³³                                    ³³"
PRINT "³³                                    ³³"
PRINT "³³    QB64 DEMO #5: X-WING FIGHTER    ³³"
PRINT "³³                                    ³³"
PRINT "³³                                    ³³"
PRINT "³ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ³"
PRINT "ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ"
PRINT
PRINT "       PRESS ANY KEY TO CONTINUE"
260 A$ = INKEY$: IF A$ = "" THEN 260
WIDTH 80
CLS
REM * STAR PILOT GAME *
REM * WRITTEN BY MICHAEL KNOX WAUSAU WI *
REM * FOR  PUBLIC DOMAIN UNLESS MOVIEMAKERS OBJECT *
REM * VERSION 2.0    JANUARY 4, 1996 *
REM * PRODUCED BY WILD BOAR PRODUCTIONS *
REM * WILD BOAR PRODUCTIONS WAUSAU WI *
REM * JANUARY 1996 *
'KEY OFF
CLS : WIDTH 80: DEF SEG = 0: A = PEEK(&H410): POKE &H410, (A AND &HCF) OR &H20
WIDTH 40: SCREEN 1: SCREEN 0: WIDTH 80: WIDTH 40: SCREEN 1: COLOR 0, 1
GOTO 1200
1100  V = V - 1: IF V < -3 THEN V = -3
RETURN
1120  W = W - 1: IF W < -5 THEN W = -5
RETURN
1140  W = W + 1: IF W > 5 THEN W = 5
RETURN
1160  V = V + 1: IF V > 3 THEN V = 3
RETURN
1180 RETURN 'KEY(1) ON: KEY(2) ON: KEY(11) ON: KEY(12) ON: KEY(13) ON: KEY(14) ON: RETURN
1190 RETURN 'KEY(1) STOP: KEY(2) STOP: KEY(11) STOP: KEY(12) STOP: KEY(13) STOP: KEY(14) STOP: RETURN
1200    LOCATE 8, 1: PRINT "****************************************";
PRINT "*                                      *";
PRINT "*      X W I N G    F I G H T E R      *";
PRINT "*                                      *";
PRINT "****************************************";
SOUND 525.25, 18.2: SOUND 783.99, 18.2 / 2: SOUND 698.46, 18.2 / 6: SOUND 659.26, 18.2 / 6: SOUND 587.33, 18.2 / 6: SOUND 1046.6, 18.2: SOUND 783.99, 18.2 / 2: SOUND 698.46, 18.2 / 6: SOUND 659.26, 18.2 / 6: SOUND 587.33, 18.2 / 6
SOUND 1046.5, 18.2: SOUND 783.99, 18.2 / 2: SOUND 698.46, 18.2 / 6: SOUND 659.26, 18.2 / 6: SOUND 698.46, 18.2 / 6: SOUND 587.33, 18.2
1270 LOCATE 16, 1: PRINT "DO YOU WANT INSTRUCTIONS (Y OR N)?";
K$ = INKEY$: IF K$ = "Y" OR K$ = "y" GOTO 6930
IF K$ <> "N" AND K$ <> "n" GOTO 1270
1300 CLS
IF RESTARTED% THEN END ELSE RESTARTED% = 1
RANDOMIZE (VAL(RIGHT$(TIME$, 2)))
'ON KEY(1) GOSUB 5350: ON KEY(2) GOSUB 5750: ON KEY(11) GOSUB 1100: ON KEY(12) GOSUB 1120: ON KEY(13) GOSUB 1140: ON KEY(14) GOSUB 1160
LOCATE 8, 1: PRINT "IMPERIAL FIGHTER:  ": DRAW2$ = "C2;BM145,59;M+0,0;BM+10,1;M+0,-2;M+2,2;M+0,-2;BM+10,-1;M+0,4;BM+6,-4;M+0,4;M+0,-2;M-6,0": GOSUB DRAW2
DIM IM(6): DIM IM1(6): DIM IM2(6): DIM IM3(6): GET (145, 59)-(145, 59), IM: GET (145, 59)-(145, 59), IM1: GET (155, 58)-(157, 60), IM2: GET (167, 57)-(173, 61), IM3
DIM IM4(13): IM4(0) = 22: IM4(1) = 7: IM4(2) = 128: IM4(3) = -32760: IM4(4) = 2048: IM4(5) = 128: IM4(6) = -22008: IM4(7) = -22358: IM4(8) = 128: IM4(9) = -32760: IM4(10) = 2048: IM4(11) = 128: IM4(12) = 8
DIM IM5(20): IM5(0) = 26: IM5(1) = 9: IM5(2) = 128: IM5(3) = -32768!: IM5(4) = 128: IM5(5) = -32768!: IM5(6) = 128: IM5(7) = -32768!: IM5(8) = 128: IM5(9) = -32768!: IM5(10) = -21846: IM5(11) = -32598: IM5(12) = 128
IM5(13) = -32768!: IM5(14) = 128: IM5(15) = -32768!: IM5(16) = 128: IM5(17) = -32768!: IM5(18) = 128: IM5(19) = -32768!
DIM IM6(44): IM6(0) = 34: IM6(1) = 17: IM6(2) = 2048: IM6(5) = 32: IM6(7) = -32768!: IM6(9) = 512: IM6(12) = -32760: IM6(14) = 8192: IM6(15) = 32: IM6(17) = 2176: IM6(20) = 2: IM6(23) = 128: IM6(25) = 8192: IM6(28) = 8
IM6(29) = 128: IM6(30) = 512: IM6(31) = 2: IM6(33) = -30720: IM6(36) = 32: IM6(38) = -32768!: IM6(40) = 512: IM6(43) = 8
DIM IM7(44)
IM7(0) = 30: IM7(1) = 21: IM7(2) = -22006: IM7(3) = -22358: IM7(4) = 32: IM7(5) = 8192: IM7(6) = -21846: IM7(7) = -32598: IM7(8) = 2048: IM7(9) = 128
IM7(10) = 2048: IM7(11) = 128: IM7(12) = 2048: IM7(13) = 128: IM7(14) = 2048: IM7(15) = 128: IM7(16) = 2048: IM7(17) = 128: IM7(18) = 2048: IM7(19) = 128
IM7(20) = 2560: IM7(21) = 32: IM7(22) = 2048: IM7(23) = 128: IM7(24) = 8704: IM7(25) = 128: IM7(26) = 2048: IM7(27) = 128: IM7(28) = 2048: IM7(29) = 128
IM7(30) = 2048: IM7(31) = 128: IM7(32) = 2048: IM7(33) = 128: IM7(34) = 2048: IM7(35) = 128: IM7(36) = 2048: IM7(37) = 128: IM7(38) = -22518: IM7(39) = -22358
IM7(40) = 2592: IM7(41) = 8192: IM7(42) = -21846: IM7(43) = -32598
DIM IM8(102)
IM8(0) = 50: IM8(1) = 29: IM8(3) = 2048: IM8(7) = 10: IM8(10) = 2048: IM8(11) = 128: IM8(14) = 8200: IM8(17) = 2048: IM8(18) = 8: IM8(21) = 514
IM8(25) = -32640: IM8(28) = 8192: IM8(29) = 32: IM8(32) = 2184: IM8(35) = 514: IM8(36) = 2: IM8(38) = 2048: IM8(39) = -32760: IM8(40) = 128: IM8(42) = 8352
IM8(43) = -32736: IM8(45) = 8194: IM8(46) = 2176: IM8(47) = 128: IM8(48) = 512: IM8(49) = 34: IM8(50) = -32766: IM8(51) = 128: IM8(52) = 10250: IM8(54) = -24448
IM8(55) = 8704: IM8(56) = 32: IM8(58) = 136: IM8(59) = -24446: IM8(61) = -32256: IM8(62) = 514: IM8(63) = 128: IM8(65) = -30592: IM8(66) = 8: IM8(68) = 8192
IM8(69) = 8224: IM8(72) = 8200: IM8(73) = 128: IM8(75) = 512: IM8(76) = 34: IM8(79) = -22528: IM8(80) = 128: IM8(83) = 8224: IM8(86) = 2048: IM8(87) = 8
IM8(90) = 2050: IM8(94) = 136: IM8(97) = 10240: IM8(101) = 8
LOCATE 10, 1: PRINT "DARTH VADER     :  ": DRAW2$ = "C2;BM145,75;M+0,0;BM+10,1;M+0,-2;M+2,2;M+0,-2;BM+11,-1;M-1,1;M+0,2;M+1,1;BM+4,-4;M+1,1;M+0,2;M-1,1;BM+1,-2;M-6,0": GOSUB DRAW2
DIM DV(6): DIM DV1(6): DIM DV2(6): DIM DV3(6): GET (145, 75)-(145, 75), DV: GET (145, 75)-(145, 75), DV1: GET (155, 74)-(157, 76), DV2: GET (167, 73)-(173, 77), DV3
DIM DV4(13)
DV4(0) = 22: DV4(1) = 7: DV4(2) = 8: DV4(3) = 8320: DV4(4) = 8192: DV4(5) = 128: DV4(6) = -22008: DV4(7) = -22358: DV4(8) = 128: DV4(9) = 8200
DV4(10) = 8192: DV4(11) = 8: DV4(12) = 128
DIM DV5(20)
DV5(0) = 26: DV5(1) = 9: DV5(2) = 8: DV5(3) = 8: DV5(4) = 32: DV5(5) = 2: DV5(6) = 128: DV5(7) = -32768!: DV5(8) = 128: DV5(9) = -32768!
DV5(10) = -21846: DV5(11) = -32598: DV5(12) = 128: DV5(13) = -32768!: DV5(14) = 128: DV5(15) = -32768!: DV5(16) = 32: DV5(17) = 2: DV5(18) = 8: DV5(19) = 8
DIM DV6(32)
DV6(0) = 30: DV6(1) = 15: DV6(2) = -22528: DV6(4) = 2: DV6(6) = 8: DV6(8) = 34: DV6(10) = -32640: DV6(12) = 8320: DV6(14) = 2176: DV6(16) = 512
DV6(19) = 2176: DV6(21) = 2080: DV6(23) = 2056: DV6(25) = 8194: DV6(27) = -32768!: DV6(29) = 2: DV6(31) = 168
DIM DV7(44)
DV7(0) = 32: DV7(1) = 21: DV7(2) = 10752: DV7(3) = -24406: DV7(4) = -32768!: DV7(5) = -30720: DV7(6) = -22014: DV7(7) = 682: DV7(8) = 520: DV7(9) = -30688
DV7(10) = 544: DV7(11) = 8224: DV7(12) = 512: DV7(13) = 32: DV7(14) = 512: DV7(15) = 32: DV7(16) = 512: DV7(17) = 32: DV7(18) = 512: DV7(19) = 32
DV7(20) = 512: DV7(21) = 136: DV7(22) = 512: DV7(23) = 32: DV7(24) = 2048: DV7(25) = 160: DV7(26) = 512: DV7(27) = 32: DV7(28) = 512: DV7(29) = 32
DV7(30) = 512: DV7(31) = 32: DV7(32) = 512: DV7(33) = 32: DV7(34) = 520: DV7(35) = 544: DV7(36) = 546: DV7(37) = 2080: DV7(38) = -21888: DV7(39) = -24534
DV7(40) = 546: DV7(41) = -32640: DV7(42) = -22006: DV7(43) = 170
DIM DV8(76)
DV8(0) = 46: DV8(1) = 25: DV8(3) = 10752: DV8(4) = 128: DV8(6) = -32768!: DV8(7) = 32: DV8(9) = -22526: DV8(10) = 8: DV8(12) = 512: DV8(13) = 2
DV8(16) = -32640: DV8(18) = 512: DV8(19) = 8224: DV8(21) = 2048: DV8(22) = 2056: DV8(24) = 8192: DV8(25) = 2082: DV8(27) = -32766: DV8(28) = -30592: DV8(30) = -32248
DV8(31) = 10240: DV8(32) = 128: DV8(33) = -30712: DV8(34) = 2048: DV8(35) = 128: DV8(36) = -24536: DV8(37) = 2048: DV8(38) = 128: DV8(39) = -32630: DV8(40) = 2048
DV8(41) = 672: DV8(42) = -32760: DV8(44) = 2184: DV8(45) = 10: DV8(47) = 8322: DV8(48) = 32: DV8(50) = -32640: DV8(51) = 128: DV8(53) = -32224: DV8(56) = -30712
DV8(59) = -24062: DV8(62) = -32768!: DV8(63) = 168: DV8(65) = 8192: DV8(66) = 136: DV8(68) = 2048: DV8(69) = 136: DV8(71) = 512: DV8(72) = 136: DV8(75) = 168
LOCATE 12, 1: PRINT "DEATH STAR      :  ": DRAW2$ = "C3;BM145,91;M+0,0;BM+11,-1;M-1,1;M+2,0;M-1,1;BM+12,-3;M+1,0;M+1,1;M-3,0;M+0,1;M+3,0;M-1,1;M-1,0": GOSUB DRAW2
DRAW2$ = "C3;BM+12,-5;M+2,0;M+1,1;M-4,0;M-1,1;M+6,0;M+0,1;M-6,0;M+0,1;M+6,0;M-1,1;M-4,0;M+1,1;M+2,0": GOSUB DRAW2
DIM DS(8): DIM DS1(8): DIM DS2(8): DIM DS3(8): DIM DS4(8): GET (145, 91)-(145, 91), DS: GET (145, 91)-(145, 91), DS1: GET (155, 90)-(157, 92), DS2: GET (167, 89)-(170, 92), DS3: GET (178, 87)-(184, 93), DS4
DIM EXPL3(18): DIM EXPL4(18): DIM EXPL5(18): DIM EXPL6(18): DIM EXPL7(18): DIM EXPL8(18)
DATA 22,11,0,0,0,8194,0,-32608,-22006,2560,-32598,-22006,128,168,8706,0,0,0,0
FOR i = 0 TO 18: READ EXPL3(i): NEXT i
DATA 22,11,-30720,2048,136,-30718,-24544,-32608,-22006,-21848,-22358,-22006,-23936,10274,-30206,2048,-32632,-30720,0
FOR i = 0 TO 18: READ EXPL4(i): NEXT i
DATA 22,11,-30712,512,136,8194,-32760,-24416,-21974,-21976,-22358,-21974,-32608,2216,-30206,512,138,-30712,128
FOR i = 0 TO 18: READ EXPL5(i): NEXT i
DATA 22,11,-30712,2048,136,8194,-24536,-32608,-22006,-21976,-22358,-22006,-24448,10408,8706,2048,-32632,-30712,128
FOR i = 0 TO 18: READ EXPL6(i): NEXT i
DATA  22,11,-30688,2048,2080,8194,-32736,-32608,-21974,-22008,-22358,-22006,-24448,10408,8706,2048,-32632,-30688,32
FOR i = 0 TO 18: READ EXPL7(i): NEXT i
DATA 22,11,-30688,2048,2184,-30718,-24544,-32608,-22006,-21848,-22358,-22006,-23936,10274,-30206,2048,-32632,-30688,32
FOR i = 0 TO 18: READ EXPL8(i): NEXT i
1920  LOCATE 17, 1: PRINT "SELECT SKILL LEVEL FROM 0 TO 3"
S$ = INKEY$: IF S$ <> "0" AND S$ <> "1" AND S$ <> "2" AND S$ <> "3" GOTO 1920
SKILL = VAL(S$): CLS
DIM LASAR(381)
LASAR(0) = 148: LASAR(1) = 40: LASAR(2) = 64: LASAR(11) = 5136: LASAR(20) = 16385: LASAR(21) = 16385: LASAR(29) = 5120: LASAR(31) = 20: LASAR(38) = 256: LASAR(39) = 64: LASAR(40) = 256: LASAR(41) = 64: LASAR(48) = 20
LASAR(50) = 5120: LASAR(57) = 16385: LASAR(60) = 16385: LASAR(66) = 5120: LASAR(70) = 20: LASAR(75) = 256: LASAR(76) = 64: LASAR(79) = 256: LASAR(85) = 4: LASAR(89) = 20480: LASAR(94) = 20480: LASAR(99) = 5
LASAR(103) = 1280: LASAR(109) = 80: LASAR(113) = 80: LASAR(118) = 1280: LASAR(122) = 5: LASAR(128) = 20480: LASAR(131) = 20480: LASAR(138) = 5: LASAR(140) = 1280: LASAR(148) = 80: LASAR(150) = 80
LASAR(157) = 1024: LASAR(159) = 1: LASAR(167) = 16385: LASAR(168) = 5120: LASAR(177) = 276: LASAR(178) = 64: LASAR(186) = 256: LASAR(187) = 84: LASAR(196) = 21505: LASAR(205) = 5120: LASAR(206) = 16385
LASAR(214) = 256: LASAR(215) = 64: LASAR(216) = 20: LASAR(224) = 4: LASAR(225) = 256: LASAR(233) = 20480: LASAR(235) = 20480: LASAR(242) = 1280: LASAR(245) = 5: LASAR(252) = 80: LASAR(255) = 80
LASAR(261) = 5: LASAR(264) = 1280: LASAR(270) = 20480: LASAR(274) = 20480: LASAR(279) = 1280: LASAR(284) = 5: LASAR(289) = 80: LASAR(294) = 80: LASAR(298) = 1: LASAR(303) = 1024: LASAR(307) = 5120
LASAR(313) = 16385: LASAR(316) = 256: LASAR(317) = 64: LASAR(323) = 20: LASAR(326) = 20: LASAR(332) = 256: LASAR(333) = 64: LASAR(335) = 16385: LASAR(342) = 5120: LASAR(344) = 5120: LASAR(352) = 16385
LASAR(353) = 256: LASAR(354) = 64: LASAR(362) = 20: LASAR(363) = 20: LASAR(371) = 256: LASAR(372) = 16448: LASAR(381) = 4096
REM * INITIALIZE VARIABLES *
M = INT(RND * 61) + 10: N = INT(RND * 21) + 10: O = INT(RND * 32001) + 70000!
E = INT(RND * 61) + 10: F = INT(RND * 21) + 10: G = 25000
H = INT(RND * 61) + 10: i = INT(RND * 21) + 10: J = INT(RND * 32001) + 40000!
Q = 5: Z = 3
IMX = 38: IMY = 21: IMR1 = 1: IMR2 = 1
DVX = 38: DVY = 21: DVR1 = 1: DVR2 = 1
IF SKILL = 0 THEN A1 = 5: A2 = 0: BYPASS = 3
IF SKILL = 1 THEN A1 = 3: A2 = 0: BYPASS = 2
IF SKILL = 2 THEN A1 = 2: A2 = 45: BYPASS = 1
IF SKILL = 3 THEN A1 = 2: A2 = 30
K$ = "5"
LINE (1, 1)-(76, 42), 3, B
DRAW2$ = "C3;BM2,21;M+0,0;BM+6,0;M+0,0;BM+6,0;M+0,0;BM+6,0;M+0,0;BM+6,0;M+0,0;BM+6,0;M+0,0;BM+12,0;M+0,0;BM+6,0;M+0,0;BM+6,0;M+0,0;BM+6,0;M+0,0;BM+6,0;M+0,0;BM+6,0;M+0,0": GOSUB DRAW2
DRAW2$ = "C3;BM38,3;M+0,0;BM+0,3;M+0,0;BM+0,3;M+0,0;BM+0,3;M+0,0;BM+0,3;M+0,0;BM+0,3;M+0,0;BM+0,6;M+0,0;BM+0,3;M+0,0;BM+0,3;M+0,0;BM+0,3;M+0,0;BM+0,3;M+0,0;BM+0,3;M+0,0": GOSUB DRAW2
LOCATE 8, 1: PRINT "REPUBLIC      X-WING     STAR FIGHTER"
LOCATE 10, 5: PRINT "TORPEDOES"
LOCATE 12, 1: PRINT "HOR.   VERT. DIRECTION"
LOCATE 15, 1: PRINT "SPEED MACH"
LOCATE 17, 1: PRINT "RADAR TARGETS"
LOCATE 18, 8: PRINT "KM TO IMPERIAL FIGHTER"
LOCATE 19, 8: PRINT "KM TO DARTH VADER"
LOCATE 20, 8: PRINT "KM TO DEATH STAR"
LOCATE 22, 1: PRINT "TIME REMAINING"
'PLAY "T250"
SEC1 = VAL(RIGHT$(TIME$, 2))
GOSUB 1180
REM * MASTER CONTROL ROUTINE *
2320  GOSUB 1190
PUT (38, 21), DS1
LOCATE 10, 1: PRINT Z
LOCATE 13, 1: PRINT W; "     "; -V
LOCATE 15, 12: PRINT Q * 10
GS = G - S: IF GS < 0 THEN GS = 0
LOCATE 18, 1: PRINT GS
JS = J - S: IF JS < 0 THEN JS = 0
LOCATE 19, 1: PRINT JS
OS = O - S: IF OS < 0 THEN OS = 0
LOCATE 20, 1: PRINT OS
LOCATE 22, 16: PRINT A1; ":"; A2NEW
SOUND 37 * Q, 1
PUT (38, 21), DS1
GOSUB 1180
REM * DISPLAY DEATH STAR *
IF O - S = 30000 OR O - S > 30000 GOTO 2840
IF O - S < 20000 AND DSTAR2 = 0 THEN DSTAR2 = 1: DSFLAG = 1: DS(0) = DS2(0): DS(1) = DS2(1): DS(2) = DS2(2): DS(3) = DS2(3)
IF O - S < 10000 AND DSTAR3 = 0 THEN DSTAR3 = 1: DSFLAG = 2: DS(0) = DS3(0): DS(1) = DS3(1): DS(2) = DS3(2): DS(3) = DS3(3)
IF O - S < 5000 AND DSTAR4 = 0 THEN DSTAR4 = 1: DSFLAG = 3: DS(0) = DS4(0): DS(1) = DS4(1): DS(2) = DS4(2): DS(3) = DS4(3): DS(4) = DS4(4): DS(5) = DS4(5): DS(6) = DS4(6): DS(7) = DS4(7): DS(8) = DS4(8)
IF FLAG1 <> BYPASS THEN FLAG1 = FLAG1 + 1: GOTO 2550
FLAG1 = 0
M = M + INT(RND * 5) - 2: N = N + INT(RND * 5) - 2
2550  M = M - W: N = N - V
IF M < 2 THEN M = 2 + INT(RND * 3)
IF M > 69 THEN M = 69 - INT(RND * 3)
IF N < 2 THEN N = 2 + INT(RND * 3)
IF N > 35 THEN N = 35 - INT(RND * 3)
GOSUB 1190
PUT (M, N), DS
IF DSNEW = 0 THEN DSNEW = 1: GOTO 2680
IF DSFLAG = 0 GOTO 2670
IF DSFLAG = 1 THEN DSFLAG = 0: PUT (MP, NP), DS1: GOTO 2680
IF DSFLAG = 2 THEN DSFLAG = 0: PUT (MP, NP), DS2: GOTO 2680
IF DSFLAG = 3 THEN DSFLAG = 0: PUT (MP, NP), DS3: GOTO 2680
2670  PUT (MP, NP), DS
2680  GOSUB 1180
MP = M: NP = N
IF O - S > 10000 OR FLAG = 1 GOTO 2840
GOSUB 1190
FOR K = 1 TO 2
LOCATE 24, 1: PRINT "*** DEATH STAR WITHIN TORPEDO RANGE ***";
DELAYPERIOD% = 2: GOSUB DELAY 'PLAY "L2 N0"
LOCATE 24, 1: PRINT "                                       ";
DELAYPERIOD% = 16: GOSUB DELAY 'PLAY "L16 N0"
NEXT K
LOCATE 24, 1: PRINT "*** DEATH STAR WITHIN TORPEDO RANGE ***";
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0"
LOCATE 24, 1: PRINT "                                       ";
GOSUB 1180
FLAG = 1
REM * DISPLAY IMPERIAL FIGHTER *
2840  GOSUB 1190
IF G - S > 26000 THEN GOSUB 1180: GOTO 3910
IF G - S < 20000 AND IMPFIGH2 = 0 THEN IMPFIGH2 = 1: IMFLAG = 1: IM(0) = IM2(0): IM(1) = IM2(1): IM(2) = IM2(2): IM(3) = IM2(3): IMX = 37: IMY = 20: IMR1 = 2: IMR2 = 2
IF G - S < 10000 AND IMPFIGH3 = 0 THEN IMPFIGH3 = 1: IMFLAG = 2: IM(0) = IM3(0): IM(1) = IM3(1): IM(2) = IM3(2): IM(3) = IM3(3): IM(4) = IM3(4): IM(5) = IM3(5): IM(6) = IM3(6): IMX = 35: IMY = 19: IMR1 = 4: IMR2 = 3
IF FLAG2 <> BYPASS THEN FLAG2 = FLAG2 + 1: GOTO 2910
FLAG2 = 0
E = E + INT(RND * 5) - 2: F = F + INT(RND * 5) - 2
2910 E = E - W: F = F - V
IF E < 2 THEN E = 2 + INT(RND * 3)
IF E > 69 THEN E = 69 - INT(RND * 3)
IF F < 2 THEN F = 2 + INT(RND * 3)
IF F > 37 THEN F = 37 - INT(RND * 3)
PUT (E, F), IM
IF IMNEW = 0 THEN IMNEW = 1: GOTO 3020
IF IMFLAG = 0 GOTO 3010
IF IMFLAG = 1 THEN IMFLAG = 0: PUT (EP, FP), IM1: GOTO 3020
IF IMFLAG = 2 THEN IMFLAG = 0: PUT (EP, FP), IM2: GOTO 3020
3010  PUT (EP, FP), IM
3020  GOSUB 1180
EP = E: FP = F
IF G - S > 5000 OR FLAG3 = 1 GOTO 3170
GOSUB 1190
FOR K = 1 TO 2
LOCATE 24, 1: PRINT "**** IMPERIAL FIGHTER ATTACKS ****";
DELAYPERIOD% = 2: GOSUB DELAY 'PLAY "L2 N0"
LOCATE 24, 1: PRINT "                                  ";
DELAYPERIOD% = 16: GOSUB DELAY 'PLAY "L16 N0"
NEXT K
LOCATE 24, 1: PRINT "**** IMPERIAL FIGHTER ATTACKS ****";
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0"
LOCATE 24, 1: PRINT "                                  ";
GOSUB 1180
FLAG3 = 1
3170 IF G > S THEN GOTO 3910
REM * IMPERIAL FIGHTER ATTACKS *
FLAG3 = 0: IMNEW = 0: IMNEW1 = 0: IMPFIGH2 = 0: IMPFIGH3 = 0: PUT (E, F), IM
GOSUB 1190
3210  DELTAX = 29 - E: DELTAY = 19 - F
IF DELTAX > 0 THEN E = E + 1
IF DELTAX < 0 THEN E = E - 1
IF DELTAY > 0 THEN F = F + 1
IF DELTAY < 0 THEN F = F - 1
IF DELTAX = 0 AND DELTAY = 0 GOTO 3320
PUT (E, F), IM: IF IMNEW1 = 0 THEN IMNEW1 = 1: GOTO 3290
PUT (EP, FP), IM
3290  EP = E: FP = F
DELAYPERIOD% = 32: GOSUB DELAY 'PLAY "P32"
GOTO 3210
3320  PUT (EP - 4, FP - 1), IM4
PUT (EP, FP), IM
DELAYPERIOD% = 4: GOSUB DELAY 'PLAY "P4"
PUT (EP - 9, FP - 2), IM5
PUT (EP - 4, FP - 1), IM4
DELAYPERIOD% = 4: GOSUB DELAY 'PLAY "P4"
PUT (EP - 12, FP - 6), IM6
PUT (EP - 9, FP - 2), IM5
DELAYPERIOD% = 4: GOSUB DELAY 'PLAY "P4"
PUT (EP - 9, FP - 7), IM7
PUT (EP - 12, FP - 6), IM6
DELAYPERIOD% = 4: GOSUB DELAY 'PLAY "P4"
PUT (EP - 20, FP - 14), IM8
PUT (EP - 9, FP - 7), IM7
DELAYPERIOD% = 4: GOSUB DELAY 'PLAY "P4"
PUT (EP - 20, FP - 14), IM8
FOR J2 = 10000 TO 100 STEP -500
SOUND J2, .001 * 18.2
NEXT J2
FOR A = 1 TO 50: NEXT A
FOR J2 = 10000 TO 100 STEP -500
SOUND J2, .001 * 18.2
NEXT J2
G = G + 25000
E = INT(RND * 61) + 10: F = INT(RND * 21) + 10
K = INT(RND * 10)
IF K > SKILL THEN 3790
'KEY(1) OFF: KEY(2) OFF: KEY(11) OFF: KEY(12) OFF: KEY(13) OFF: KEY(14) OFF
3600  CLS
PRINT "BLAM!"
FOR J2 = 1000 TO 37 STEP -10
SOUND J2, .01 * 18.2
NEXT J2
PRINT
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0": PLAY "L1 N0"
PRINT "YOU HAVE JUST BEEN SHOT DOWN BY AN";
PRINT "IMPERIAL SKY FIGHTER!"
PRINT
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0": PLAY "L1 N0"
PRINT "YOU ARE A HERO!"
PRINT
PRINT "UNFORTUNATELY, YOU ARE A DEAD HERO AND";
PRINT "DEAD HEROES DON'T WIN WARS. DARTH VADER";
PRINT "WINS!"
PRINT
PRINT "*********   YOU   LOSE!!   *********"
GOTO 5310
3790  FOR K = 1 TO 2
LOCATE 24, 1: PRINT "**** IMPERIAL FIGHTER MISSED ****";
DELAYPERIOD% = 2: GOSUB DELAY 'PLAY "L2 N0"
LOCATE 24, 1: PRINT "                                 ";
DELAYPERIOD% = 16: GOSUB DELAY 'PLAY "L16 N0"
NEXT K
LOCATE 24, 1: PRINT "**** IMPERIAL FIGHTER MISSED ****";
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0"
LOCATE 24, 1: PRINT "                                 ";
IM(0) = IM1(0): IM(1) = IM1(1): IM(2) = IM1(2): IM(3) = IM1(3): IM(4) = IM1(4): IM(5) = IM1(5): IM(6) = IM1(6)
GOSUB 1180
REM * DISPLAY DARTH VADER *
3910  GOSUB 1190
IF J - S > 26000 THEN GOSUB 1180: GOTO 5140
IF J - S < 20000 AND DVADER2 = 0 THEN DVADER2 = 1: DVFLAG = 1: DV(0) = DV2(0): DV(1) = DV2(1): DV(2) = DV2(2): DV(3) = DV2(3): DVX = 37: DVY = 20: DVR1 = 2: DVR2 = 2
IF J - S < 10000 AND DVADER3 = 0 THEN DVADER3 = 1: DVFLAG = 2: DV(0) = DV3(0): DV(1) = DV3(1): DV(2) = DV3(2): DV(3) = DV3(3): DV(4) = DV3(4): DV(5) = DV3(5): DV(6) = DV3(6): DVX = 35: DVY = 19: DVR1 = 4: DVR2 = 3
IF FLAG2 <> BYPASS THEN FLAG2 = FLAG2 + 1: GOTO 3980
FLAG2 = 0
H = H + INT(RND * 5) - 2: i = i + INT(RND * 5) - 2
3980 H = H - W: i = i - V
IF H < 2 THEN H = 2 + INT(RND * 3)
IF H > 69 THEN H = 69 - INT(RND * 3)
IF i < 2 THEN i = 2 + INT(RND * 3)
IF i > 37 THEN i = 37 - INT(RND * 3)
PUT (H, i), DV
IF DVNEW = 0 THEN DVNEW = 1: GOTO 4090
IF DVFLAG = 0 GOTO 4080
IF DVFLAG = 1 THEN DVFLAG = 0: PUT (HP, IP), DV1: GOTO 4090
IF DVFLAG = 2 THEN DVFLAG = 0: PUT (HP, IP), DV2: GOTO 4090
4080  PUT (HP, IP), DV
4090  GOSUB 1180
HP = H: IP = i
IF J - S > 5000 OR FLAG4 = 1 GOTO 4350
GOSUB 1190
IF DVGONE = 0 GOTO 4240
FOR K = 1 TO 2
LOCATE 24, 1: PRINT "**** IMPERIAL FIGHTER ATTACKS ****";
DELAYPERIOD% = 2: GOSUB DELAY 'PLAY "L2 N0"
LOCATE 24, 1: PRINT "                                  ";
DELAYPERIOD% = 16: GOSUB DELAY 'PLAY "L16 N0"
NEXT K
LOCATE 24, 1: PRINT "**** IMPERIAL FIGHTER ATTACKS ****";
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0"
LOCATE 24, 1: PRINT "                                  ";
GOTO 4330
4240  FOR K = 1 TO 2
LOCATE 24, 1: PRINT "**** DARTH VADER ATTACKS ****";
DELAYPERIOD% = 2: GOSUB DELAY 'PLAY "L2 N0"
LOCATE 24, 1: PRINT "                             ";
DELAYPERIOD% = 16: GOSUB DELAY 'PLAY "L16 N0"
NEXT K
LOCATE 24, 1: PRINT "**** DARTH VADER ATTACKS ****";
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0"
LOCATE 24, 1: PRINT "                             ";
4330  FLAG4 = 1
GOSUB 1180
4350  IF J > S THEN GOTO 5140
REM * DARTH VADER ATTACKS *
FLAG4 = 0: DVNEW = 0: DVNEW1 = 0: DVADER2 = 0: DVADER3 = 0: PUT (H, i), DV
GOSUB 1190
4390  DELTAX = 41 - H: DELTAY = 19 - i
IF DELTAX > 0 THEN H = H + 1
IF DELTAX < 0 THEN H = H - 1
IF DELTAY > 0 THEN i = i + 1
IF DELTAY < 0 THEN i = i - 1
IF DELTAX = 0 AND DELTAY = 0 GOTO 4500
PUT (H, i), DV: IF DVNEW1 = 0 THEN DVNEW1 = 1: GOTO 4470
PUT (HP, IP), DV
4470  HP = H: IP = i
DELAYPERIOD% = 32: GOSUB DELAY 'PLAY "P32"
GOTO 4390
4500  IF DVGONE = 0 THEN PUT (HP, IP - 1), DV4 ELSE PUT (HP, IP - 1), IM4
PUT (HP, IP), DV
DELAYPERIOD% = 4: GOSUB DELAY 'PLAY "P4"
IF DVGONE = 0 THEN PUT (HP + 3, IP - 2), DV5 ELSE PUT (HP + 3, IP - 2), IM5
IF DVGONE = 0 THEN PUT (HP, IP - 1), DV4 ELSE PUT (HP, IP - 1), IM4
DELAYPERIOD% = 4: GOSUB DELAY 'PLAY "P4"
IF DVGONE = 0 THEN PUT (HP + 2, IP - 6), DV6 ELSE PUT (HP + 2, IP - 6), IM6
IF DVGONE = 0 THEN PUT (HP + 3, IP - 2), DV5 ELSE PUT (HP + 3, IP - 2), IM5
DELAYPERIOD% = 4: GOSUB DELAY 'PLAY "P4"
IF DVGONE = 0 THEN PUT (HP + 1, IP - 6), DV7 ELSE PUT (HP + 1, IP - 6), IM7
IF DVGONE = 0 THEN PUT (HP + 2, IP - 6), DV6 ELSE PUT (HP + 2, IP - 6), IM6
DELAYPERIOD% = 4: GOSUB DELAY 'PLAY "P4"
IF DVGONE = 0 THEN PUT (HP + 2, IP - 6), DV8 ELSE PUT (HP + 2, IP - 6), IM8
IF DVGONE = 0 THEN PUT (HP + 1, IP - 6), DV7 ELSE PUT (HP + 1, IP - 6), IM7
DELAYPERIOD% = 4: GOSUB DELAY 'PLAY "P4"
IF DVGONE = 0 THEN PUT (HP + 2, IP - 6), DV8 ELSE PUT (HP + 2, IP - 6), IM8
FOR J2 = 10000 TO 100 STEP -500
SOUND J2, .001 * 18.2
NEXT J2
FOR A = 1 TO 50: NEXT A
FOR J2 = 10000 TO 100 STEP -500
SOUND J2, .001 * 18.2
NEXT J2
J = J + 25000
H = INT(RND * 61) + 10: i = INT(RND * 21) + 10
K = INT(RND * 10)
IF K > SKILL + 1 THEN 4910
'KEY(1) OFF: KEY(2) OFF: KEY(11) OFF: KEY(12) OFF: KEY(13) OFF: KEY(14) OFF
4780  CLS : PRINT "****  B O O M !  ****"
FOR J2 = 1000 TO 37 STEP -10
SOUND J2, .01 * 18.2
NEXT J2
PRINT
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0": PLAY "L1 N0"
IF DVGONE = 1 THEN PRINT "TOO BAD.  YOU HAVE BEEN SHOT DOWN.": GOTO 4880
PRINT "YOU HAVE JUST BEEN PERSONALLY SHOT DOWN";
PRINT "BY DARTH VADER.  THE FORCE WAS NOT WITH";
PRINT "YOU."
4880  PRINT
PRINT "*********   YOU   LOSE!!   *********"
GOTO 5310
4910  IF DVGONE = 0 GOTO 5030
FOR K = 1 TO 2
LOCATE 24, 1: PRINT "**** IMPERIAL FIGHTER MISSED ****";
DELAYPERIOD% = 2: GOSUB DELAY 'PLAY "L2 N0"
LOCATE 24, 1: PRINT "                                 ";
DELAYPERIOD% = 16: GOSUB DELAY 'PLAY "L16 N0"
NEXT K
LOCATE 24, 1: PRINT "**** IMPERIAL FIGHTER MISSED ****";
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0"
LOCATE 24, 1: PRINT "                                 ";
DV(0) = DV1(0): DV(1) = DV1(1): DV(2) = DV1(2): DV(3) = DV1(3)
GOTO 5140
5030  FOR K = 1 TO 2
LOCATE 24, 1: PRINT "**** DARTH VADER MISSED ****";
DELAYPERIOD% = 2: GOSUB DELAY 'PLAY "L2 N0"
LOCATE 24, 1: PRINT "                            ";
DELAYPERIOD% = 16: GOSUB DELAY 'PLAY "L16 N0"
NEXT K
LOCATE 24, 1: PRINT "**** DARTH VADER MISSED ****";
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0"
LOCATE 24, 1: PRINT "                            ";
DV(0) = DV1(0): DV(1) = DV1(1): DV(2) = DV1(2): DV(3) = DV1(3): DV(4) = DV1(4): DV(5) = DV1(5): DV(6) = DV1(6)
REM * X - WING FIGHTER ROUTINE *
5140  GOSUB 1180
Z$ = INKEY$

IF LEN(Z$) = 1 THEN
IF ASC(Z$) > 48 AND ASC(Z$) <= 57 THEN Q = ASC(Z$) - 48
IF Z$ = " " THEN GOSUB 5350
IF Z$ = CHR$(13) THEN GOSUB 5750
END IF
IF LEN(Z$) = 2 THEN
IF Z$ = CHR$(0) + "H" THEN GOSUB 1100 'UP
IF Z$ = CHR$(0) + "K" THEN GOSUB 1120 'LEFT
IF Z$ = CHR$(0) + "M" THEN GOSUB 1140 'RIGHT
IF Z$ = CHR$(0) + "P" THEN GOSUB 1160 'DOWN
END IF

S = S + Q * 100
IF S > O GOTO 6410
REM * TIME ROUTINE *
SEC2 = VAL(RIGHT$(TIME$, 2))
SECNEW = SEC2
IF SECNEW = SECOLD GOTO 5280
IF SECNEW < SECOLD THEN N8 = N8 + 1
SECOLD = SEC2
A2NEW = A2 - (SEC2 + (60 * N8) - SEC1)
IF A2NEW < 0 THEN A2NEW = A2NEW + 60: A1 = A1 - 1: A2 = A2 + 60
IF A1 < 0 GOTO 6760
5280   GOTO 2320
REM * DISPLAY SKY FIGHTER *
IF J - S < 10000 THEN A = 3
5310  REM * NEW GAME *
PRINT
PRINT "HIT ENTER TO PLAY AGAIN, ESC TO GIVE UP"
'5340 B$ = INKEY$: IF B$ = CHR$(13) THEN GOTO 1300 ELSE IF B$ = CHR$(27) THEN CLS : WIDTH 80: SCREEN 0: KEY ON: GOTO 9911 ELSE GOTO 5340
5340 B$ = INKEY$: IF B$ = CHR$(13) THEN GOTO 1300 ELSE IF B$ = CHR$(27) THEN CLS : WIDTH 80: SCREEN 0: GOTO 9911 ELSE GOTO 5340
5350  REM * FIRE CANNON *
'KEY(2) STOP: KEY(11) STOP: KEY(12) STOP: KEY(13) STOP: KEY(14) STOP
PUT (2, 2), LASAR
FOR J2 = 5000 TO 100 STEP -250
SOUND J2, .01 * 18.2
NEXT J2
PUT (2, 2), LASAR
IF G - S < 26000 AND ABS(IMX - E) < IMR1 AND ABS(IMY - F) < IMR2 GOTO 5450
IF J - S < 26000 AND ABS(DVX - H) < DVR1 AND ABS(DVY - i) < DVR2 GOTO 5580
GOTO 5730
5450  FOR I9 = 1 TO 2: PUT (E - 2, F - 3), EXPL3: DELAYPERIOD% = 64: GOSUB DELAY: PUT (E - 2, F - 3), EXPL3: NEXT I9
FOR I9 = 1 TO 2: PUT (E - 2, F - 3), EXPL4: DELAYPERIOD% = 64: GOSUB DELAY: PUT (E - 2, F - 3), EXPL4: NEXT I9
PUT (E, F), IM
IF IMR2 = 1 GOTO 5540
FOR I9 = 1 TO 2: PUT (E - 2, F - 3), EXPL5: DELAYPERIOD% = 64: GOSUB DELAY: PUT (E - 2, F - 3), EXPL5: NEXT I9
FOR I9 = 1 TO 2: PUT (E - 2, F - 3), EXPL6: DELAYPERIOD% = 64: GOSUB DELAY: PUT (E - 2, F - 3), EXPL6: NEXT I9
IF IMR2 = 2 GOTO 5540
FOR I9 = 1 TO 2: PUT (E - 2, F - 3), EXPL7: DELAYPERIOD% = 64: GOSUB DELAY: PUT (E - 2, F - 3), EXPL7: NEXT I9
FOR I9 = 1 TO 2: PUT (E - 2, F - 3), EXPL8: DELAYPERIOD% = 64: GOSUB DELAY: PUT (E - 2, F - 3), EXPL8: NEXT I9
5540  G = G + 25000: E = INT(RND * 61) + 10: F = INT(RND * 21) + 10: FLAG3 = 0: IMNEW = 0: IMPFIGH2 = 0: IMPFIGH3 = 0
IMX = 38: IMY = 21: IMR1 = 1: IMR2 = 1
IM(0) = IM1(0): IM(1) = IM1(1): IM(2) = IM1(2): IM(3) = IM1(3): IM(4) = IM1(4): IM(5) = IM1(5): IM(6) = IM1(6)
GOTO 5730
5580  FOR I9 = 1 TO 2: PUT (H - 2, i - 3), EXPL3: DELAYPERIOD% = 64: GOSUB DELAY: PUT (H - 2, i - 3), EXPL3: NEXT I9
FOR I9 = 1 TO 2: PUT (H - 2, i - 3), EXPL4: DELAYPERIOD% = 64: GOSUB DELAY: PUT (H - 2, i - 3), EXPL4: NEXT I9
PUT (H, i), DV
IF DVR2 = 1 GOTO 5670
FOR I9 = 1 TO 2: PUT (H - 2, i - 3), EXPL5: DELAYPERIOD% = 64: GOSUB DELAY: PUT (H - 2, i - 3), EXPL5: NEXT I9
FOR I9 = 1 TO 2: PUT (H - 2, i - 3), EXPL6: DELAYPERIOD% = 64: GOSUB DELAY: PUT (H - 2, i - 3), EXPL6: NEXT I9
IF DVR2 = 2 GOTO 5670
FOR I9 = 1 TO 2: PUT (H - 2, i - 3), EXPL7: DELAYPERIOD% = 64: GOSUB DELAY: PUT (H - 2, i - 3), EXPL7: NEXT I9
FOR I9 = 1 TO 2: PUT (H - 2, i - 3), EXPL8: DELAYPERIOD% = 64: GOSUB DELAY: PUT (H - 2, i - 3), EXPL8: NEXT I9
5670  J = J + 25000: H = INT(RND * 61) + 10: i = INT(RND * 21) + 10: FLAG4 = 0: LOCATE 19, 8: PRINT "KM TO IMPERIAL FIGHTER";
DVNEW = 0: DVADER2 = 0: DVADER3 = 0
DVX = 38: DVY = 21: DVR1 = 1: DVR2 = 1
IF DVGONE = 0 THEN DV3(0) = IM3(0): DV3(1) = IM3(1): DV3(2) = IM3(2): DV3(3) = IM3(3): DV3(4) = IM3(4): DV3(5) = IM3(5): DV3(6) = IM3(6)
DV(0) = DV1(0): DV(1) = DV1(1): DV(2) = DV1(2): DV(3) = DV1(3): DV(4) = DV1(4): DV(5) = DV1(5): DV(6) = DV1(6)
DVGONE = 1
5730 'KEY(2) ON: KEY(11) ON: KEY(12) ON: KEY(13) ON: KEY(14) ON
RETURN
5750  REM * FIRE  TORPEDO *
'KEY(1) STOP: KEY(11) STOP: KEY(12) STOP: KEY(13) STOP: KEY(14) STOP
IF Z = 0 THEN 3600
FOR J2 = 1500 TO 100 STEP -20
SOUND J2, .01 * 18.2
SOUND 3600 - J2, .01 * 18.2
NEXT J2
Z = Z - 1
IF O - S > 10000 THEN 5990
IF POINT(38, 21) <> 3 THEN 5880
IF SKILL = 0 GOTO 6100
K = INT(RND * 10)
IF K > SKILL + 1 THEN 6100
5880   FOR K = 1 TO 2
LOCATE 24, 1: PRINT "**** TORPEDO  MISSED  ****";
DELAYPERIOD% = 2: GOSUB DELAY 'PLAY "L2 N0"
LOCATE 24, 1: PRINT "                          ";
DELAYPERIOD% = 16: GOSUB DELAY 'PLAY "L16 N0"
NEXT K
LOCATE 24, 1: PRINT "**** TORPEDO  MISSED  ****";
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0"
LOCATE 24, 1: PRINT "                          ";
IF Z <= 0 THEN 4780
GOTO 6080
5990 FOR K = 1 TO 2
LOCATE 24, 1: PRINT "**** OUT  OF  RANGE  ****";
DELAYPERIOD% = 2: GOSUB DELAY 'PLAY "L2 N0"
LOCATE 24, 1: PRINT "                         ";
DELAYPERIOD% = 16: GOSUB DELAY 'PLAY "L16 N0"
NEXT K
LOCATE 24, 1: PRINT "**** OUT  OF  RANGE  ****";
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0"
LOCATE 24, 1: PRINT "                         ";
6080 'KEY(1) ON: KEY(11) ON: KEY(12) ON: KEY(13) ON: KEY(14) ON
RETURN
6100  REM * GAME WON *
'KEY(1) OFF: KEY(2) OFF: KEY(11) OFF: KEY(12) OFF: KEY(13) OFF: KEY(14) OFF
FOR SCALE = 1 TO 24
'DRAW "C3;S=SCALE;BM38,21;NM+6,0;NM-6,0;NM+0,-3;NM+0,3;NM-6,3;NM+6,-3;NM-6,-3;NM+6,3;NM+3,-3;NM-3,3;NM+3,3;NM-3,-3;NM+6,2;NM-6,-2;NM-6,1;NM+6,-1;NM+1,3;NM-1,-3"
D2S = SCALE
DRAW2$ = "C3;BM38,21;NM+6,0;NM-6,0;NM+0,-3;NM+0,3;NM-6,3;NM+6,-3;NM-6,-3;NM+6,3;NM+3,-3;NM-3,3;NM+3,3;NM-3,-3;NM+6,2;NM-6,-2;NM-6,1;NM+6,-1;NM+1,3;NM-1,-3": GOSUB DRAW2
D2S = 0
NEXT SCALE
CLS
FOR K = 1 TO 5
SOUND 37, .1 * 18.2
SCREEN 0: WIDTH 40
FOR A = 1 TO 10: NEXT A
SCREEN 1: WIDTH 80
NEXT K
WIDTH 40
CLS : PRINT : PRINT : PRINT
PRINT "* * * * * * * * * * * * * * * * * * * *";
PRINT "*                                     *";
PRINT "*                                     *";
PRINT "*    THE  FORCE  IS  WITH  YOU  !!    *";
PRINT "*                                     *";
PRINT "* YOU HAVE DESTROYED THE DEATH STAR ! *";
PRINT "*                                     *";
PRINT "*    YOU HAVE SAVED THE REPUBLIC !    *";
PRINT "*                                     *";
PRINT "* PRINCESS LEAH WILL LOVE YOU ALWAYS! *";
PRINT "*                                     *";
PRINT "* * * * * * * * * * * * * * * * * * * *"
SOUND 525.25, 18.2: SOUND 783.99, 18.2 / 2: SOUND 698.46, 18.2 / 6: SOUND 659.26, 18.2 / 6: SOUND 587.33, 18.2 / 6: SOUND 1046.6, 18.2: SOUND 783.99, 18.2 / 2: SOUND 698.46, 18.2 / 6: SOUND 659.26, 18.2 / 6: SOUND 587.33, 18.2 / 6
SOUND 1046.5, 18.2: SOUND 783.99, 18.2 / 2: SOUND 698.46, 18.2 / 6: SOUND 659.26, 18.2 / 6: SOUND 698.46, 18.2 / 6: SOUND 587.33, 18.2
PRINT
GOTO 5310
REM * COLLISION WITH DEATH STAR *
6410 'KEY(1) OFF: KEY(2) OFF: KEY(11) OFF: KEY(12) OFF: KEY(13) OFF: KEY(14) OFF
6420  DELTAX = 35 - M: DELTAY = 18 - N
IF DELTAX > 0 THEN M = M + 1
IF DELTAX < 0 THEN M = M - 1
IF DELTAY > 0 THEN N = N + 1
IF DELTAY < 0 THEN N = N - 1
IF DELTAX = 0 AND DELTAY = 0 GOTO 6530
PUT (M, N), DS
PUT (MP, NP), DS
MP = M: NP = N
DELAYPERIOD% = 32: GOSUB DELAY 'PLAY "P32"
GOTO 6420
6530  FOR RAD = 4 TO 20
CIRCLE (38, 21), RAD, 3
DELAYPERIOD% = 32: GOSUB DELAY 'PLAY "P32"
NEXT RAD
CLS : PRINT "CRASH"
FOR J2 = 1000 TO 37 STEP -10
SOUND J2, .01 * 18.2
NEXT J2
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0": PLAY "L1 N0"
PRINT
PRINT "DARTH VADER IS LAUGHING AT YOU."
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0": PLAY "L1 N0"
PRINT
PRINT "YOU HAVE JUST COLLIDED WITH THE DEATH";
PRINT "STAR.  THEY DID NOT EVEN HEAR THE";
PRINT "COLLISION.  YOU DID NOT EVEN SCRATCH";
PRINT "THE DEATH STAR'S PAINT, BUT YOU ARE   ";
PRINT "DEAD!"
PRINT
PRINT "*********   YOU  LOSE!!   *********"
PRINT
GOTO 5310
REM * OUT OF TIME *
6760 'KEY(1) OFF: KEY(2) OFF: KEY(11) OFF: KEY(12) OFF: KEY(13) OFF: KEY(14) OFF
CLS : PRINT "TOO LATE!"
FOR J2 = 1000 TO 37 STEP -10
SOUND J2, .01 * 18.2
NEXT J2
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0": PLAY "L1 N0"
PRINT
PRINT "DARTH VADER IS LAUGHING AT YOU."
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0": PLAY "L1 N0"
PRINT
PRINT "THE DEATH STAR HAS JUST DESTROYED";
PRINT "PRINCESS LEAH AND THE ENTIRE REBEL";
PRINT "STRONGHOLD";
PRINT
PRINT "*********   YOU  LOSE!!   *********"
PRINT
GOTO 5310
6930  CLS
PRINT "       STAR  PILOT  INSTRUCTIONS"
PRINT
PRINT "    THE DEATH  STAR SPACE STATION, UNDER";
PRINT "THE COMMAND OF DARTH  VADER, IS THE MOST";
PRINT "POWERFUL  WEAPON  THE UNIVERSE  HAS EVER";
PRINT "KNOWN.   A FRONTAL  ATTACK BY  ANY OTHER";
PRINT "CRAFT WOULD BE ABSOLUTE SUICIDE. HOWEVER";
PRINT "INTELLIGENCE DELIVERED  TO  OUR REPUBLIC";
PRINT "HEADQUARTERS  BY  THE  ANDROIDS R2D2 AND";
PRINT "C3PO GIVES A FAINT  HOPE OF A SUCCESSFUL";
PRINT "ATTACK  BY A SMALL ONE OR TWO  PASSENGER";
PRINT "X-WING FIGHTER."
PRINT
PRINT "    THERE IS A SMALL, UNSHIELDED EXHAUST";
PRINT "PORT  ON  THE  SURFACE OF THE DEATH STAR";
PRINT "THAT LEADS DIRECTLY TO THE MAIN REACTOR.";
PRINT "SINCE IT IS AN EMERGENCY THERMAL PORT IN";
PRINT "CASE THE REACTOR OVERHEATS, IT COULD NOT";
PRINT "BE SHIELDED."
PRINT
INPUT "     (PRESS ENTER  TO  CONTINUE)", B$
CLS
PRINT
PRINT "    IF YOU CAN  SLIP YOUR  SMALL FIGHTER";
PRINT "PAST THE  DEATH STAR'S DEFENSES AND MAKE";
PRINT "A DIRECT HIT ON THE THERMAL EXHAUST PORT";
PRINT "WITH  A  TORPEDO, THERE IS A CHANCE THAT";
PRINT "THE  TORPEDO  WILL   PENETRATE  TO   THE";
PRINT "MAIN REACTOR AND START A CHAIN REACTION,";
PRINT "DESTROYING THE DEATH STAR."
PRINT
PRINT "    IT IS A SLIM  CHANCE,  BUT IT IS THE";
PRINT "ONLY  HOPE  THE  REPUBLIC HAS.   OBI-WAN";
PRINT "KENOBI GAVE  HIS LIFE TO GET THE MESSAGE";
PRINT "HERE, SO HE CONSIDERED IT IMPORTANT."
PRINT : PRINT : PRINT : PRINT
PRINT "PRESS ENTER FOR X-WING FIGHTER          ";
INPUT "      FAMILIARIZATION", B$
CLS
PRINT "        REPUBLIC  X-WING  FIGHTER       "
PRINT
PRINT "     THE X-WING  FIGHTER IS A SMALL  ONE";
PRINT "MAN  SPACESHIP  THAT IS,  QUITE FRANKLY,";
PRINT "OBSOLETE.  IT IS ARMED ONLY WITH A LASER";
PRINT "CANNON  AND  THREE  TORPEDOES.   USE THE";
PRINT "LASER CANNON  TO  FIGHT OFF ANY IMPERIAL";
PRINT "FIGHTERS AND SAVE THE  TORPEDOES FOR THE";
PRINT "DEATH STAR."
PRINT
PRINT "     THE  TARGET  ACQUISITION  RADAR CAN";
PRINT "DETECT IN  EXCESS OF  100,000 KILOMETERS";
PRINT "AWAY, BUT CAN ONLY DISPLAY TARGETS WITH-";
PRINT "IN  20,000 KM.   THEREFORE,  YOU WILL BE";
PRINT "WARNED OF APPROACHING  TARGETS  ON  YOUR";
PRINT "CONTROL PANEL  BEFORE THEY ARE DISPLAYED";
PRINT "ON THE RADAR SCREEN."
PRINT
INPUT "     (PRESS ENTER  TO  CONTINUE)", B$
CLS
PRINT
PRINT "     THE LASER  CANNON IS AN  ANTIQUATED";
PRINT "WEAPON.  TO  HIT AN ENEMY, YOU MUST HAVE";
PRINT "HIM  IN THE  EXACT CENTER  OF THE  CROSS";
PRINT "HAIRS ON YOUR RADAR SCREEN. THEN YOU MAY";
PRINT "FIRE THE  LASER CANNON  BY PRESSING  THE";
PRINT "SPACE BAR ON YOUR CONTROL PANEL."
PRINT
PRINT "     YOUR  THREE  TORPEDOES ARE COMPUTER";
PRINT "GUIDED,  BUT ALSO QUITE  LIMITED.   MAKE";
PRINT "SURE THAT YOU ARE WITHIN 10000 KM OF THE";
PRINT "DEATH STAR  AND THAT YOU HAVE  SOME PART";
PRINT "OF  THE SPACE STATION  IN THE CENTER  OF";
PRINT "THE  CROSS HAIRS  ON YOUR  RADAR SCREEN.";
PRINT "EVEN THEN,  SINCE IT TAKES A PERFECT HIT";
PRINT "ON THE EXHAUST PORT TO DESTROY THE DEATH";
PRINT "STAR,  YOU  MAY  REQUIRE  MORE  THAN ONE";
PRINT "TORPEDO. PRESS THE ENTER KEY TO FIRE THE";
PRINT "TORPEDO."
PRINT
INPUT "    (PRESS ENTER  TO  CONTINUE)", B$
CLS
PRINT
PRINT "    THE SPEED OF YOUR SHIP IS CONTROLLED";
PRINT "BY TYPING THE NUMBERS  1 THROUGH 9  (FOR";
PRINT "MACH  10 THROUGH 90  RESPECTIVELY).  THE";
PRINT "MOVEMENT OF YOUR  SHIP IS  CONTROLLED BY";
PRINT "THE CURSOR CONTROLS.  SINCE THESE INPUTS";
PRINT "MOVE YOUR SHIP  AND NOT THE TARGETS, THE";
PRINT "TARGETS APPEAR  TO  MOVE IN THE OPPOSITE";
PRINT "DIRECTION.   ALSO, YOU  CAN  EXPECT  THE";
PRINT "ENEMY TO TAKE EVASIVE ACTION."
PRINT
PRINT "    WHEN SELECTING THE SKILL LEVEL, 0 IS";
PRINT "THE EASIEST  GAME AND 3 IS THE  HARDEST.";
PRINT "SKILL LEVEL  0  PROVIDES THE BEST CHANCE";
PRINT "OF BEING  MISSED BY THE  FIGHTERS AND OF";
PRINT "HITTING  THE DEATH STAR.  LEVEL  0  ALSO";
PRINT "PROVIDES  THE LARGEST  TIME LIMIT BEFORE";
PRINT "THE DEATH STAR DESTROYS THE REBEL BASE."
PRINT
PRINT
INPUT "PRESS ENTER FOR  TAKE-OFF", B$
CLS
PRINT "****************************************"
PRINT
PRINT "    MAY  THE  FORCE  BE  WITH  YOU"
PRINT
PRINT "****************************************"
DELAYPERIOD% = 1: GOSUB DELAY: GOSUB DELAY 'PLAY "L1 N0": PLAY "L1 N0"
GOTO 1300
9911 CLS
END

'PAUSES FOR THE DURATION OF PLAY "P?" WHERE DELAYPERIOD%=?
'EG. DELAYPERIOD%=1: GOSUB DELAY
DELAY:
TIMERTICKS% = 1 / DELAYPERIOD% * 18.2
IF TIMERTICKS% = 0 THEN TIMERTICKS% = 1
LASTTIMERVALUE! = TIMER
FOR TIMERTICK% = 1 TO TIMERTICKS%
DO: TIMERVALUE! = TIMER: LOOP WHILE TIMERVALUE! = LASTTIMERVALUE!
LASTTIMERVALUE! = TIMERVALUE!
NEXT
RETURN

'DRAW2 IS A WORKAROUND FOR THE DRAW STATEMENT USING STRING DRAW2$
'*VERY LIMITED FUNCTIONALITY*
DRAW2:
IF D2S = 0 THEN D2S2! = 1 ELSE D2S2! = D2S / 4
D2D$ = ""
DO WHILE LEN(DRAW2$)
D2$ = LEFT$(DRAW2$, 1): DRAW2$ = RIGHT$(DRAW2$, LEN(DRAW2$) - 1)
IF D2$ = "C" THEN
D2V = VAL(DRAW2$): D2L = LEN(LTRIM$(RTRIM$(STR$(D2V)))): DRAW2$ = RIGHT$(DRAW2$, LEN(DRAW2$) - D2L)
D2COL = D2V
D2D$ = D2D$ + "C" + STR$(D2COL)
END IF
IF D2$ = "B" THEN D2NODRAW = 1: D2D$ = D2D$ + "B"
IF D2$ = "N" THEN D2NOMOVE = 1: D2D$ = D2D$ + "N"
IF D2$ = "M" THEN
D2D$ = D2D$ + "M"
D2$ = LEFT$(DRAW2$, 1)
IF D2$ = "+" OR D2$ = "-" THEN
D2RELATIVE = 1
IF D2$ = "+" THEN DRAW2$ = RIGHT$(DRAW2$, LEN(DRAW2$) - 1): D2D$ = D2D$ + "+"
END IF
D2V = VAL(DRAW2$): D2L = LEN(LTRIM$(RTRIM$(STR$(D2V)))): DRAW2$ = RIGHT$(DRAW2$, LEN(DRAW2$) - D2L)
D2X = D2V
D2D$ = D2D$ + STR$(D2X) + ","
DRAW2$ = RIGHT$(DRAW2$, LEN(DRAW2$) - 1) 'SKIP COMMA
D2V = VAL(DRAW2$): D2L = LEN(LTRIM$(RTRIM$(STR$(D2V)))): DRAW2$ = RIGHT$(DRAW2$, LEN(DRAW2$) - D2L)
D2Y = D2V
D2D$ = D2D$ + STR$(D2Y)
'ASSUME NODRAW AND NOMOVE ARE USED EXCLUSIVELY
IF D2NOMOVE = 0 AND D2NODRAW = 0 THEN
IF D2RELATIVE THEN LINE -STEP(D2X * D2S2!, D2Y * D2S2!), D2COL ELSE LINE -(D2X, D2Y), D2COL
END IF
IF D2NODRAW THEN
IF D2RELATIVE THEN PSET STEP(D2X * D2S2!, D2Y * D2S2!), D2COL ELSE PSET (D2X, D2Y), D2COL
END IF
IF D2NOMOVE THEN
'ASSUME RELATIVE
LINE -STEP(D2X * D2S2!, D2Y * D2S2!), D2COL: LINE -STEP(-D2X * D2S2!, -D2Y * D2S2!), D2COL
END IF
D2RELATIVE = 0: D2NODRAW = 0: D2NOMOVE = 0
END IF
LOOP
RETURN

