10 HIMEM: 35070:ADRS = 35070: CALL ADRS: DEF FN DG(H) = (H / 360 - INT (H / 360)) * 360: DEF FN D(H) = FN DG( FN DG(H + 360)): DEF FN RD(X) = INT (X + .5): DEF FN RN(X) = INT ( RND (1) * X + 1): DEF FN RF(X) = ((3700 - X) / 3700) ^ 2.86:VA$ = CHR$ (129):VN$ = CHR$ (142):VI$ = CHR$ (137):VP$ = CHR$ (144):VY$ = CHR$ (153):VV$ = CHR$ (150):VW$ = CHR$ (151):VK$ = CHR$ (139):VL$ = CHR$ (140) 20 CX(7) = 1 800 K$(1) = "DETAS":K$(2) = "MILAS":K$(3) = "KAMAS": GOTO 42000 9999 GOTO 9999 ### fire control / positron # show probabilities, select target 12000 GOSUB 22000: GOSUB 44000 # if no positron can target this ship, or no positrons have energy, error and bail :S = SH:XC = - 1: PRINT VA$1;VL$;VN$;: FOR Z = 0 TO 3: IF PW(S,Z) < = 0 OR EN(6 + Z) < 20 OR F(Z) < > 0 THEN NEXT Z: GOSUB 38000: PRINT "UNABLE TO TARGET";: GOSUB 28000: GOSUB 14000: GOSUB 28000: GOTO 12060 # find positrons with energy that can target selected ship, offer selection 12025 Y = 2: FOR Z = 1 TO 4:Z(Z) = 15 + Z: IF PW(S,Z - 1) < = 0 OR EN(5 + Z) < 20 OR F(Z - 1) > 0 THEN Z(Z) = - Z(Z) 12040 NEXT Z:Z = 4: GOSUB 41000 # target ship SH with positron X2 (0-3) :X2 = X - 1:F(X2) = S:AL(X2 + 6) = AL(X2 + 6) - 20:EN(X2 + 6) = EN(X2 + 6) - 20 # if we have enough energy, ask if we want to lock : IF EN(6 + X2) > = 20 AND AL(6 + X2) > = 20 THEN Z(1) = 22:Z(2) = 23:Y = 2:Z = 2: GOSUB 41000: IF X = 1 THEN LW(X2) = S:EN(X2 + 6) = EN(X2 + 6) - 20:AL(X2 + 6) = AL(X2 + 6) - 20 12060 GOSUB 39000: GOSUB 38000: RETURN ### fire control / torpedo / fire 12300 GOSUB 23000: GOSUB 44000:S = SH:ZC = 0: FOR Z = 4 TO 9: IF PW(S,Z) > 0 THEN ZC = ZC + 1 12310 NEXT Z:LM = 0: FOR Z = 1 TO LP: IF LP(Z) > 1 THEN LM = LM + 1 12311 NEXT Z: IF ZC < LM THEN LM = ZC # if no ready-to-fire tube, or target is more than 5000 units away, don't fire 12315 PRINT VA$1VL$VN$;:LM = LM - FH: IF LM < = 0 OR DK(S) > 5000 THEN GOSUB 38000: PRINT "UNABLE TO FIRE";: GOSUB 14000: GOSUB 28000: GOTO 12390 12325 GOSUB 38000: PRINT "ENTER # TO FIRE";:Y = 2: FOR Z = 1 TO LM:Z(Z) = 7 + Z: NEXT Z:Z = LM: GOSUB 41000:X2 = X: GOSUB 38000: PRINT VA$VL$"ENTER SPREAD";: FOR Z = 1 TO X2:Z(Z) = 7 + Z: NEXT Z:Z = X2: GOSUB 41000:X3 = X 12327 X4 = 0 # if we have enough energy in light engines, ask if they want to lock the target (set X4 if yes) 12330 IF EN(11) > = X2 * 20 AND AL(11) > = X2 * 20 AND DK(S) < 2000 THEN GOSUB 38000: PRINT VA$1VL$VN$;"LOCK?";:Z(1) = 22:Z(2) = 23:Z = 2: GOSUB 41000:X4 = 0:Z4 = 0: IF X = 1 THEN X4 = 1 # set the lock flag and target for each tube. If locked (X4), deduct 20 power from battery (bug?) # set SP(n) to the torpedo spread 12360 FOR Z = FH + 1 TO FH + X2:LW(Z + 3) = 0:F(Z + 3) = S:SP(Z - FH) = X3: IF X4 THEN LW(Z + 3) = S:EN(15) = EN(15) - 20:AL(15) = AL(15) - 20 12365 NEXT Z:FH = FH + X2 12390 GOSUB 38000: GOSUB 39000: RETURN ### fire control / torpedo / load # draw torp stat 12600 GOSUB 24000 # X2 is 6 - (#of damaged tubes) - (#of loaded tubes) :X2 = 6 - D(5) - LP # adjust X2 according to power in light engine -- must have 20 per tube :X = INT (EN(11) / 20): IF X2 > X THEN X2 = X 12602 IF X2 > AL(11) / 20 THEN X2 = INT (AL(11) / 20) 12605 GOSUB 38000: IF X2 < 1 THEN PRINT "UNABLE TO LOAD";: GOSUB 14000: GOSUB 28000: GOTO 12690 12620 PRINT "LOAD TUBES";: FOR Z = 1 TO X2:Z(Z) = (7 + Z): NEXT Z:Z = X2:Y = 2: GOSUB 41000 # for each loaded tube, set LP(n), deduct from light engine power, and update LP : FOR Z = LP + 1 TO LP + X:LP(Z) = 1: NEXT Z:EN(11) = EN(11) - X * 20:AL(11) = AL(11) - X * 20:LP = LP + X 12690 GOSUB 38000: GOSUB 39000: RETURN ### chirp 14000 POKE 2048,255: POKE 2049,255: CALL 2050: RETURN ### return to main menu 15000 FOR Z = 1 TO 4:K$(Z) = "": NEXT Z: FOR Z = 1 TO 9:Z$(Z) = "":Z1$(Z) = "": NEXT Z: PRINT CHR$ (4);"BLOAD CHAIN,A520": CALL 520"MAIN MENU" ### report/posit stat 21000 REM 21005 GOSUB 39000: VTAB (5): PRINT VA$2VK$" HIJKL ";VA$1"1 2 3 4": VTAB (7): PRINT VL$;" STAT": VTAB (9): PRINT " POWER"VA$2: VTAB (11): PRINT VA$1;VL$;" EFF%": VTAB (13): PRINT " SHIP" # "vwx" = "dwn" - system damaged 21007 VTAB (15): PRINT " LOCK": FOR Z = 1 TO 4:Z1 = (Z - 1) * 3 + 8: HTAB (Z1): VTAB (7): IF D(Z + 5) THEN Z1$ = "VWX": GOTO 21120 # "rs" = "emp" - not enough energy to fire 21110 IF EN(Z + 5) < 20 THEN Z1$ = "RS ": GOTO 21120 # "pq" = "rdy", "tu" = "fire" 21113 Z1$ = "PQ ": IF F(Z - 1) THEN Z1$ = "TU " 21120 PRINT VA$2;Z1$: PRINT VA$1;: HTAB (Z1): VTAB (9): PRINT FN RD(EN(Z + 5)): HTAB (Z1): VTAB (11): PRINT FN RD(E(Z + 5) * 100): HTAB (Z1): VTAB (13): PRINT VA$1;: IF F(Z - 1) = 0 THEN PRINT VA$1;"-": GOTO 21220 21190 PRINT LEFT$ (K$(F(Z - 1)),1) 21220 Z1$ = "-": IF F(Z - 1) > 0 THEN Z1$ = "N": IF LW(Z - 1) > 0 THEN Z1$ = "Y" 21235 HTAB (Z1): VTAB (15): PRINT VA$1;Z1$: NEXT Z : HCOLOR= 1: HPLOT 49,30 TO 180,30: HPLOT 49,43 TO 180,43: HPLOT 49,60 TO 180,60: HPLOT 49,75 TO 180,75: HPLOT 49,90 TO 180,90: HPLOT 49,105 TO 180,105: HPLOT 49,122 TO 180,122: HPLOT 95,30 TO 95,121: HPLOT 117,30 TO 117,121: HPLOT 139,30 TO 139,121: HPLOT 159,30 TO 159,121 21240 VTAB (3): HTAB (1): PRINT VA$4VK$VI$;" POSITRON STATUS ";VN$;: RETURN ### report/posit prob 22000 POKE 232,0: POKE 233,145: ROT= 0: SCALE= 1: GOSUB 39000: PRINT VA$0;VN$;VK$: VTAB (2): HTAB (6): PRINT "POSITRON": VTAB (3): PRINT TAB( 5);"PROBABILITY": VTAB (5): PRINT VA$1VL$;"SHIP "; 22010 PRINT VA$2VK$"ABC ";: PRINT VL$;"YZ";: PRINT VA$2;VK$;":;< ";: PRINT "TX": VTAB (6): PRINT VA$1VL$;"NAME # # % ";VA$2" LMNO": FOR S = 1 TO 3: IF K(S) = 0 THEN 22245 22120 X1 = (S - 1) * 4 + 8: VTAB (X1): HTAB (1):Z1$ = "ABCD": IF S < 3 THEN Z1$ = "EFG ": IF S = 2 THEN Z1$ = "HIJ " 22170 PRINT VA$2;VL$;Z1$;: HTAB (7): PRINT VA$0;XS(S);VA$1;VL$; # show positron probability for ship S, positron P : FOR P = 0 TO 3: IF PW(S,P) < = 0 THEN 22240 # positron number 22200 VTAB (X1):X1 = X1 + 1: HTAB (10): PRINT P + 1; # probability : HTAB (12): PRINT FN RD(PW(S,P) * 100); # max damage : HTAB (16): PRINT FN RD(MH(S,P)); 22240 NEXT P 22245 NEXT S 22250 HCOLOR= 1: HPLOT 49,28 TO 181,28: HPLOT 49,52 TO 181,52: HPLOT 49,84 TO 181,84: HPLOT 49,116 TO 181,116: HPLOT 81,28 TO 81,143: HPLOT 107,28 TO 107,143: HPLOT 125,28 TO 125,143: HPLOT 149,28 TO 149,143: HCOLOR= 7 22260 IF K(1) THEN DRAW 1 AT 55,63 22290 IF K(2) THEN DRAW 1 AT 55,95 22300 IF K(3) THEN DRAW 1 AT 55,127 22990 RETURN ### report/torp prob 23000 REM 23002 GOSUB 39000: VTAB (2): HTAB (7): PRINT VA$0VK$VN$"TORPEDO": PRINT TAB( 5)"PROBABILITY": VTAB (7): HTAB (1): PRINT VA$4;1: FOR Z1 = 2 TO 6: VTAB (5 + Z1 * 2): HTAB (1): PRINT Z1: NEXT Z1: PRINT VA$1;VL$;: VTAB (4): HTAB (1): PRINT "S": VTAB (5): HTAB (1): PRINT "P" : FOR Y = 1 TO 3: IF K(Y) = 0 THEN 23300 # print ship name 23160 VTAB (4): HTAB (4 + (Y - 1) * 6): PRINT VA$2;VL$;: IF Y = 1 THEN PRINT "EFG" 23180 IF Y = 2 THEN PRINT "HIJ" 23190 IF Y = 3 THEN PRINT "ABCD" 23200 VTAB (5): HTAB (3 + (Y - 1) * 6): PRINT VA$1VL$;"P% MH" # loop over all 6 tubes; if probability is > 0 then show : FOR X = 1 TO 6:Z1$ = " -": IF PW(Y,X + 3) > 0 THEN Z1$ = STR$ ( FN RD(PW(Y,X + 3) * 100)) 23230 HTAB (2 + (Y - 1) * 6): VTAB (4 + X * 2): PRINT Z1$;: HTAB (5 + (Y - 1) * 6): VTAB (5 + X * 2):Z1$ = " -": IF MH(Y,X + 3) > 0 THEN Z1$ = STR$ ( FN RD(MH(Y,X + 3))) 23260 PRINT Z1$;: NEXT X 23300 NEXT Y: HCOLOR= 1: HPLOT 49,24 TO 181,24: FOR Z1 = 40 TO 136 STEP 16: HPLOT 49,Z1 TO 181,Z1: NEXT Z1: FOR Z1 = 55 TO 192 STEP 21:Z3 = 24:Z2 = Z1: IF INT (Z1 / 2) = Z1 / 2 THEN Z2 = Z2 - 1:Z3 = 40 23360 HPLOT Z2,Z3 TO Z2,136: NEXT Z1: RETURN ### report/torp stat 24000 POKE 232,102: POKE 233,8: GOSUB 39000: ROT= 0: SCALE= 1: HCOLOR= 7: DRAW 5 AT 78,15: VTAB (6): PRINT VN$;VA$0;VK$;" TORPEDO STATUS": VTAB (7): HTAB (1): PRINT VN$;VA$1VL$: PRINT "TORPEDO 1 2 3 4 5 6";: PRINT : PRINT "STATUS": PRINT : PRINT "SHIP": PRINT 24020 PRINT "LOCK": PRINT : PRINT "TIME IN": PRINT "TUBE"; # loop over all tubes # torp status: DW=damaged, EM=not loaded, LD=just loaded, RD=ready to fire, FR=scheduled to fire : FOR Z = 1 TO 6:Z1$ = "DW": IF 7 - D(5) > Z THEN Z1$ = "EM": IF LP > = Z THEN Z1$ = "RD": IF Z < = FH THEN Z1$ = "FR" 24465 IF LP(Z) = 1 THEN Z1$ = "LD" 24470 VTAB (10): HTAB (Z * 2 + 6): PRINT Z1$ # if torp tube is firing, show target : VTAB (12): HTAB (Z * 2 + 7):Z1$ = "-": IF FH < Z THEN 24550 24520 IF F(Z + 3) THEN Z1$ = LEFT$ (K$(F(Z + 3)),1) 24550 PRINT Z1$ # show torp tube locked status, if it's firing and it's locked : VTAB (14): HTAB (2 * Z + 7):Z1$ = "N": IF Z > FH THEN Z1$ = "-": GOTO 24600 24590 IF LW(Z + 3) > 0 THEN Z1$ = "Y" 24600 PRINT Z1$ # show time in tube :Z1$ = STR$ (LP(Z) - 1): IF LP(Z) = 0 THEN Z1$ = "-" 24630 VTAB (16): HTAB (7 + 2 * Z): PRINT Z1$: NEXT Z: HCOLOR= 1: FOR Z = 97 TO 167 STEP 14:Z2 = Z: IF INT (Z / 2) = Z / 2 THEN Z2 = Z2 + 1 24730 HPLOT Z2,56 TO Z2,135: NEXT Z: FOR Z = 56 TO 136 STEP 16: HPLOT 49,Z TO 181,Z: NEXT Z: RETURN ### report/target info # select target ship (SH), get shield facing us (X1, from YS) # switch 3/4 because shape table uses different rotations? 25000 POKE 232,102: POKE 233,08: GOSUB 39000: GOSUB 44000: GOSUB 39000:X1 = YS(SH): IF X1 = 3 THEN X1 = 4: GOTO 25010 25007 IF X1 = 4 THEN X1 = 3 25010 IF X1 = 2 THEN X = 75:Y = 24 25013 IF X1 = 3 THEN X = 88:Y = 26 25040 IF X1 = 1 THEN X = 89:Y = 24 25050 IF X1 = 4 THEN X = 73:Y = 24 25060 HCOLOR= 7: ROT= 0: SCALE= 1: DRAW X1 AT X,Y: VTAB (8): HTAB (1): PRINT "VVVVVVVVVVVVVVVVVV";XS(SH);: FOR Z = 2 TO 7: VTAB (Z): HTAB (19): PRINT "U";: NEXT Z: PRINT VL$: VTAB (17): HTAB (19): PRINT VW$;: VTAB (9): HTAB (1): PRINT VV$;VI$;VP$;: VTAB (9): HTAB (1): PRINT "SHIELD BEARING:";VA$4;XS(SH);VA$1; 25125 VTAB (10): HTAB (1): PRINT "ANGLE BEARING:";VA$4; FN RD(YA(SH));: VTAB (11): HTAB (1): PRINT VA$1;"DISTANCE:";VA$4; FN RD(DK(SH));: VTAB (12): HTAB (1): PRINT VN$;VA$1;" VEGAN VESSEL DATA ";VI$;: VTAB (13): HTAB (1): PRINT "SHIP ID:";VA$4VK$K$(SH)VL$;: VTAB (14): HTAB (1): PRINT VA$1;"SPEED:";VA$4;KW(SH); 25175 VTAB (15): HTAB (1): PRINT VA$1;"HEADING:";VA$4 FN RD(KH(SH));: VTAB (16): HTAB (1): PRINT VA$1;"SHIELD FACING": PRINT " USS RANGER:";VA$4;YS(SH);: PRINT VA$1VL$;VN$;: VTAB (20): HTAB (1): PRINT TAB( 4);"PRESS BUTTON";: PRINT VN$;VY$;: VTAB (2): HTAB (8): PRINT VV$;: VTAB (18): HTAB (19): PRINT VW$;:X = 0: PRINT VA$1;VK$; # animate triangles while we wait for button 25330 VTAB (5): HTAB (1 + X): PRINT "L";: HTAB (18 - X): PRINT "M": HTAB (9): VTAB (2 + INT (X / 2)): PRINT "J";: HTAB (9): VTAB (7 - INT (X / 2)): PRINT "K";: POKE 2048,70: POKE 2049,30: CALL 2050: IF PEEK ( - 16287) > 127 THEN 25980 25400 VTAB (5): HTAB (1 + X): PRINT "N";: HTAB (18 - X): PRINT "N";: HTAB (9): VTAB (2 + INT (X / 2)): PRINT "G";: HTAB (9): VTAB (7 - INT (X / 2)): PRINT "G";:X = X + 1: IF X > 3 THEN X = 0 25460 GOTO 25330 25980 GOSUB 45000: GOSUB 38000: GOSUB 39000: RETURN ### report/position 26000 POKE 232,0: POKE 233,145: GOSUB 26900: HCOLOR= 1: GOSUB 39000 # draw our ship, selecting appropriately scaled version :Z5 = 2: IF SR < 1000 THEN Z5 = 1: IF SR < 400 THEN Z5 = 0 26010 VTAB (18): HTAB (1): PRINT VA$1VL$VN$;" SCALE "; FN RD(SR);: HCOLOR= 1: HPLOT 112,136 TO 161,136:SX = MX(Z5) / SR:SY = MY(Z5) / SR: ROT= 0: SCALE= 1: HCOLOR= 3:X = EH: GOSUB 46000: ROT= R * 8:X = 115 - X(Z5,R): IF X / 2 = INT (X / 2) THEN X = X + 1 26035 DRAW 4 + Z5 AT X,72 - Y(Z5,R): HCOLOR= 3 # draw enemy ships that are in range : FOR Z = 1 TO 3: IF DK(Z) > SR OR (CO = 1 AND SH < > Z) OR K(Z) = 0 THEN 26300 26220 X = KH(Z): GOSUB 46000: ROT= R * 8:Y = 72 - (KY(Z) - EY) * SY - Y(Z5,R):X = 115 + (KX(Z) - EX) * SX - X(Z5,R): IF X > 200 OR Y > 160 OR X < 1 OR Y < 1 THEN 26300 26227 X = INT (X + .5): IF (X / 2 = INT (X / 2) AND (Z5 = 0 OR Z5 = 2)) OR (X / 2 < > INT (X / 2) AND Z5 = 1) THEN X = X + 1 26240 DRAW Z5 + 1 AT X,Y 26300 NEXT Z: RETURN ## select range for position report; returned in SR 26900 GOSUB 39000:Y = 28:Z(1) = 19:Z(2) = 20:Z = 2: GOSUB 38000: PRINT VA$1VN$;VL$"ENTER CONTROL TYPE";: GOSUB 41000:CO = X: IF X = 1 THEN 26950 26920 RT = 50:PU = 6000:PL = 100: GOSUB 38000: PRINT VA$1;VL$;VN$;: PRINT "ENTER DISTANCE";: GOSUB 40000:SR = RC: GOTO 26990 26950 GOSUB 44000:SR = DK(SH) + DK(SH) * .1 + 1E - 10: IF SR < 1 THEN SR = 1 26990 RETURN ### fire control / torpedo 27000 REM 27010 Z(1) = 22:Z(2) = 23:Z = 2:Y = 9: GOSUB 41000: IF X = 1 THEN 12600: GOTO 27090 27030 GOSUB 12300 27090 RETURN ### delay 28000 FOR Z = 0 TO 250: NEXT Z: RETURN 38000 PRINT VY$VN$;: VTAB (20): HTAB (8): PRINT VV$;: HTAB (19): PRINT VW$VP$: RETURN 39000 PRINT VN$VY$: VTAB (2): HTAB (8): PRINT VV$: VTAB (18): HTAB (19): PRINT VW$: PRINT VP$: RETURN ### enter value with paddle (only used for report/position with manual control) 40000 Z1$ = "" 40017 PRINT VY$;VA$1;VL$R = PU - PL:RC = PL + R / 2: GOSUB 40100Z1$ = "": IF RT = 0 THEN RT = 1 40025 VTAB (23): HTAB (20): PRINT VA$1VI$;VK$;"Y";: HTAB (30): PRINT "X";VN$:ZT = 0:R1 = 0 40040 X = PDL (0): IF PEEK ( - 16287) > 127 THEN 40080 40045 IF ZT > 10 THEN ZT = 10 40050 IF X > 20 AND X < 200 THEN R1 = 0:ZT = 0: HTAB (28): VTAB (22): PRINT VA$1VK$"L";: GOTO 40040 40055 Z1$ = "J":R = - 1: IF X > 199 THEN R = 1:Z1$ = "K" 40060 IF R < > R1 THEN ZT = 0 40065 R1 = R:RC = RC + RT * (2 ^ INT (ZT / 2)) * R:ZT = ZT + 1: GOSUB 40100: GOTO 40040 40080 VTAB (23): HTAB (20): PRINT VK$;VI$;"X";: HTAB (30): PRINT "Y";: POKE 2048,50: POKE 2049,30: CALL 2050: POKE 2048,60: POKE 2049,50: CALL 2050: VTAB (22): HTAB (28): PRINT VI$" ";: GOSUB 39000: PRINT VA$4;: RETURN ## helper 40100 REM 40102 RC = INT (RC / RT + .5) * RT 40105 IF RC > PU THEN RC = PU 40107 IF RC < PL THEN RC = PL 40112 X2 = RC:Z1 = FN RD(RC): HTAB (28): VTAB (22): PRINT VA$;1;VK$;Z1$;" ";VL$;Z1;:Z3 = LEN ( STR$ (Z1)): IF Z3 > = 5 THEN 40130 40124 Z = 5 - Z3: FOR Z2 = 1 TO Z: PRINT " ";: NEXT Z2: POKE 2048,(PU - RC) / (PU - PL) * 75 + 76: POKE 2049,100: CALL 2050 40130 RETURN ### select menu item 41000 REM 41006 PRINT VY$VA$1VK$VI$;:Z3 = - 1: FOR Z2 = 1 TO Z: IF Z(Z2) > 0 AND Z3 > 0 THEN X1 = Z2: GOTO 41030 41016 IF Z(Z2) > 0 THEN Z3 = Z2 41020 NEXT Z2:X1 = Z3: GOTO 41180 41030 Z1 = 250 / Z: FOR Z2 = 1 TO Z: HTAB (Y + 1): VTAB ( ABS (Z(Z2))): PRINT "E";: NEXT Z2 41079 X = INT ( PDL (0) / Z1 + .5): IF X > Z THEN X = Z 41080 IF X < 1 THEN X = 1 41081 IF Z2 > 20 THEN HTAB (Y): VTAB ( ABS (Z(X1))): PRINT " ";: POKE 2048,X1 * 5 + 50: POKE 2049,15: CALL 2050:Z2 = 0: HTAB (Y): PRINT "L"; 41082 Z2 = Z2 + 1: IF X < 1 THEN X = 1 41085 IF PEEK ( - 16287) > 127 THEN 41180 41090 IF Z(X) < 1 THEN GOTO 41079 41100 IF X1 < > X THEN HTAB (Y): VTAB (Z(X1)): PRINT " "; 41105 X1 = X: HTAB (Y): VTAB (Z(X)): PRINT "L";: GOTO 41079 41180 IF X1 < 1 THEN 41185 41183 HTAB (Y): VTAB (Z(X1)): PRINT " F"; 41185 GOSUB 45000:X = X1: RETURN ### main UI loop 42000 GOSUB 38000 42010 Y = 28: FOR Z = 1 TO 6:Z(Z) = Z + 2: NEXT Z:Z(7) = 12:Z(8) = 13:Z(9) = 16:Z = 9:: GOSUB 41000:CO = X: GOSUB 39000: ON CO GOSUB 21000,22000,24000,23000,26000,25000,12000,27000,15000: IF CO < 6 THEN GOSUB 43000 42020 GOTO 42000 ### wait for button press 43000 GOSUB 38000: PRINT TAB( 4)VA$;1;VL$"PRESS BUTTON"; 43005 X2 = X2 + 1: IF X2 > 15 THEN VTAB (20): HTAB (2): PRINT VA$(1);VK$;"L";: HTAB (18): PRINT "M";:X2 = 0: POKE 2048,100: POKE 2049,30: CALL 2050 43010 IF X2 = 7 THEN VTAB (20): HTAB (2): PRINT " ";: HTAB (18): PRINT " "; 43020 IF PEEK ( - 16287) < 128 THEN 43005 43030 GOSUB 38000: GOSUB 39000: GOSUB 45000: RETURN ### select target ship; returned in SH 44000 REM 44005 GOSUB 38000: PRINT VA$1;VN$;VL$;"ENTER SHIP";:Y = 2:Z(1) = 3:Z(2) = 4:Z(3) = 5: FOR Z = 1 TO 3: IF K(Z) = 0 THEN Z(Z) = - Z(Z) 44040 NEXT Z:Z = 3: GOSUB 41000:SH = X: RETURN ### chirp 45000 POKE 2048,30: POKE 2049,30: CALL 2050: POKE 2048,80: POKE 2049,50: CALL 2050: RETURN 46000 REM 46010 R = 2 - INT (( FN D(X) + 45 / 2) / 45): IF R < 0 THEN R = 8 + R 46030 RETURN