20 HIMEM: 35070:ADRS = 35070: CALL ADRS: POKE 232,0: POKE 233,145: 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):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) 40 DEF FN RF(X) = ((3700 - X) / 3700) ^ 2.86: SCALE= 1: ROT= 0:K$(1) = "DETAS":K$(2) = "MILAS":K$(3) = "KAMAS": GOTO 18000 ### status/speed 10000 GOSUB 39000: GOSUB 38000: GOSUB 22000: GOSUB 43000: RETURN ### status/evasive 11000 GOSUB 20000: GOSUB 43000: RETURN ### status/distance 12000 GOSUB 21000: GOSUB 43000: RETURN ### status/engine 13000 GOSUB 24000: GOSUB 43000: RETURN ### status/position 14000 GOSUB 26000: GOSUB 43000: RETURN ### status/navigat 15000 GOSUB 25000: GOSUB 43000: RETURN ### return to main menu 16000 REM 16010 PRINT VN$VK$V0$: FOR Z = 1 TO 4:K$(Z) = "": NEXT Z: PRINT CHR$ (4);"BLOAD CHAIN,A520": CALL 520"MAIN MENU": STOP ### main UI loop 18000 Y = 30: FOR Z = 1 TO 10:Z(Z) = Z + 2: IF Z > 6 THEN Z(Z) = Z(Z) + 2 # if no power to light engines, disable auto and evasive nav (but not manual nav??) 18020 NEXT Z:Z = 10: IF EN(11) = 0 OR MN = MS THEN Z(7) = - Z(7):Z(9) = - Z(9) 18030 GOSUB 39000 18200 GOSUB 41000:CO = X: GOSUB 38000: ON CO GOSUB 15000,13000,12000,10000,14000,11000,19000,27000,23000,16000: GOTO 18000 ### action/auto n. 19000 GOSUB 25000: GOSUB 39000: PRINT VA$1VL$VN$; TAB( 5);"ENTER PILOT": PRINT VA$4VK$" AUTOMATIC": PRINT " SEMI-AUTOMATIC";:Z(1) = 22:Z(2) = 23:Z = 2:Y = 2: GOSUB 41000:X7 = X: GOSUB 44000:AL = SH: GOSUB 22000: ON X7 GOTO 19100,19200 # auto nav 19100 C = - 2:PL = 0:PU = 1725: GOSUB 39000: PRINT TAB( 5);VL$"ENTER DISTANCE":RT = 25:RC = PL:X0 = PL: GOSUB 40000:ED = RC:EP = 2: GOTO 19400 # semi-auto nav 19200 C = 3:PL = MN:PU = MS:RT = 1: GOSUB 39000: PRINT TAB( 5);VL$"ENTER SPEED":RC = PL:X0 = PL:RT = 0: GOSUB 40000:AS = RC:EP = 1 19400 GOSUB 39000: PRINT VA$1VN$VL$; TAB( 5);"ENTER POSITION": PRINT VA$4VK$;" CURRENT": PRINT " PROJECTED";:Y = 2:Z(1) = 22:Z(2) = 23:Z = 2: GOSUB 41000:AP = X - 1: GOSUB 25000: RETURN ### erase and redraw distance marker 19500 X8 = X0: HCOLOR= 4: GOSUB 27350:X0 = RC:X8 = X0: HCOLOR= 7: GOSUB 27350: RETURN ### erase and redraw speed marker 19600 X9 = X0: HCOLOR= 4: GOSUB 27300:X0 = RC:X9 = X0: HCOLOR= 7: GOSUB 27300: RETURN ### status/evasive impl 20000 REM 20005 HCOLOR= 5: PRINT VA$1VL$VN$VY$;: FOR X1 = 6 TO 16: VTAB (X1): HTAB (3): PRINT ABS (11 - X1) * 3: NEXT X1: FOR X1 = 44 TO 124: HCOLOR= 5:X2 = X1 + 4: IF X2 / 8 < > INT (X2 / 8) THEN HCOLOR= 6 20041 HPLOT 31,X1 TO 155,X1: NEXT X1: HCOLOR= 7:X5 = 266.4 * EV:X2 = X5 / 2:X1 = 30: HPLOT X1,84: FOR X3 = 1 TO 2: FOR X4 = 0 TO 315 STEP 45:X2 = SIN (X4 * DR) * X5 + 84:X1 = X1 + 7: HPLOT TO X1,X2: NEXT X4: NEXT X3: HPLOT TO X1 + 7,84: HPLOT TO X1 + 12,84: ROT= 16: SCALE= 1: HCOLOR= 7: DRAW 4 AT X1 + 35,77: DRAW 4 AT X1 + 35,78: VTAB (18): HTAB (6): PRINT VA$4VK$;"EVASIVE ACTION: "; FN RD(EV * 100)" ";: RETURN ### status/distance impl 21000 REM 21005 FOR X1 = 1 TO 3: IF K(X1) = 0 THEN DK(X1) = 1 21007 NEXT X1 21010 W(4) = DK(1):W(5) = DK(2):W(6) = DK(3):W(1) = 1:W(2) = 2:W(3) = 3: FOR X1 = 1 TO 2: FOR X2 = 1 TO 2: IF W(X2 + 3) < W(X2 + 4) THEN 21040 21030 X3 = W(X2):W(X2) = W(X2 + 1):W(X2 + 1) = X3:X3 = W(X2 + 3):W(X2 + 3) = W(X2 + 4):W(X2 + 4) = X3 21040 NEXT X2: NEXT X1: FOR X1 = 1 TO 3: GOSUB 38000: PRINT VA$4VN$VK$; TAB( 6);"RELATIVE DISTANCES": PRINT VA$1VL$;: FOR X1 = 1 TO 3: IF K(W(X1)) THEN VTAB (X1 + 2): HTAB (23): PRINT K$(W(X1)) 21205 NEXT X1: VTAB (9): PRINT VA$1VL$;: FOR X1 = 1 TO 3: IF K(W(X1)) THEN PRINT TAB( 3)K$(W(X1)) TAB( 9) FN RD(DK(W(X1))) TAB( 14);"MEGAMETERS" 21230 NEXT X1:X1 = DK(W(3)) * 1.1 + 1:X2 = X1 / 120: FOR X3 = 3 TO 14: HCOLOR= 7: IF X3 / 2 = INT (X3 / 2) THEN HCOLOR= 6 21285 FOR X4 = 40 TO 42: HPLOT X3 * 10,X4 TO X3 * 10 + 9,X4: NEXT X4: NEXT X3: PRINT VA$1VL$;: VTAB (7): PRINT "SCALE: ="X2 * 10" MEG": FOR X4 = 51 TO 53: HPLOT 56,X4 TO 65,X4: NEXT X4: HCOLOR= 7: ROT= 16: DRAW 4 AT 25,34: DRAW 4 AT 25,33: FOR X1 = 1 TO 3: IF K(W(X1)) = 0 THEN 21370 21340 X5 = DK(W(X1)) / X2 + 30: HCOLOR= 8 - X1:X6 = 12 + X1 * 8: HPLOT X5,39 TO X5,X6: HPLOT X5 + 1,39 TO X5 + 1,X6: HPLOT TO 148,X6 21370 NEXT X1: VTAB (13): HTAB (14): PRINT VA$4VK$VN$;"SA";: HTAB (22): PRINT "SA": PRINT " SHIP HEADING SPEED": PRINT VA$1VN$VL$;: FOR Z = 1 TO 3: IF K(W(Z)) THEN PRINT " "K$(W(Z)); TAB( 13) FN RD( FN D(YA(W(Z)) + EH)) TAB( 21);:Z1 = INT ( ABS (DK(W(Z))) ^ (1 / 3) * SGN (DK(W(Z))) * 100) / 100: IF Z1 > MS THEN Z1 = MS 21422 IF Z1 < MN THEN Z1 = MN 21423 IF K(W(Z)) THEN PRINT INT (Z1 * 100) / 100 21425 NEXT Z: HPLOT 8,94 TO 194,94: FOR Z = 112 TO 136 STEP 8: FOR Z = 112 TO 136 STEP 8: HPLOT 8,Z TO 194,Z: NEXT Z: HPLOT 63,96 TO 63,136: HPLOT 143,96 TO 143,136: PRINT VA$4;: RETURN ### status/speed impl 22000 REM 22010 GOSUB 38000: PRINT VA$1VL$VN$;: VTAB (17): FOR X4 = - 6 TO 12 STEP 2: IF LEN ( STR$ (X4)) < 2 THEN HTAB (9 + X4): PRINT X4;: GOTO 22025 22022 HTAB (8 + X4): PRINT X4; 22025 NEXT X4: VTAB (18): VTAB (2): FOR X4 = 1800 TO - 300 STEP - 150: HTAB (22): PRINT X4: NEXT X4: VTAB (19): HTAB (7): PRINT VA$4"LIGHT SPEED";:Z1$ = "DISTANCE": FOR Z4 = 1 TO 8: VTAB (4 + Z4): HTAB (27): PRINT MID$ (Z1$,Z4,1);: NEXT Z4: HCOLOR= 2: HPLOT 17,126: FOR X4 = - 6 TO 12 STEP .5:X = 22 + (X4 + 6) * 7:Y = 108 - (X4 ^ 3) / 18.75: IF X4 = 0 THEN HPLOT TO X,Y: HCOLOR= 3: HPLOT X,Y 22120 HPLOT TO X,Y: NEXT X4: HCOLOR= 7:X6 = 128: FOR X4 = - 6 TO 12 STEP 2:X = 22 + (X4 + 6) * 7:Y = 108 - (X4 ^ 3) / 18.75: HPLOT X,Y TO X,X6: NEXT X4: HCOLOR= 6 22200 FOR X3 = - 300 TO 1800 STEP 150:Y = 108 - X3 / 18.75:X = 22 + (( ABS (X3) ^ (1 / 3) * SGN (X3) + 6) * 7): HPLOT X,Y TO 152,Y: NEXT X3:X1 = INT (21 + (MS + 6) * 7):Y1 = INT (108 - (MS ^ 3) / 18.75):X2 = INT (22 + (MN + 6) * 7):Y2 = INT (109 - (MN ^ 3) / 18.75): IF X1 / 2 = INT (X1 / 2) THEN X1 = X1 + 1 22280 IF X2 / 2 = INT (X2 / 2) THEN X2 = X2 + 1 22285 HCOLOR= 4: HPLOT X1 - 1,Y1 TO X1 - 1,Y2 TO X2 - 1,Y2 TO X2 - 1,Y1 TO X1 - 1,Y1: HPLOT X1 + 1,Y1 TO X1 + 1,Y2: HPLOT X2 + 1,Y1 TO X2 + 1,Y2: HCOLOR= 5: HPLOT X1,Y1 TO X1,Y2 TO X2,Y2 TO X2,Y1 TO X1,Y1:Y1 = INT (106 - (EW ^ 3) / 18.75):X1 = INT (20 + (EW + 6) * 7): HCOLOR= 6 22320 HPLOT X1 - 10,Y1 - 7 TO X1,Y1: HPLOT X1 - 5,Y1 TO X1,Y1 TO X1,Y1 - 4: HPLOT X1 + 1,Y1 TO X1 + 1,Y1 - 4: HPLOT X1 - 11,Y1 - 7 TO X1 - 1,Y1: GOSUB 39000: PRINT TAB( 2)"SPEED: " INT (EW * 1000) / 1000: PRINT TAB( 2)"DISTANCE: " INT ((EW ^ 3) * 1000) / 1000: PRINT VA$4;: RETURN ### action/evasive 23000 REM 23010 C = 0:RC = FN RD(RC) * 100: GOSUB 38000: GOSUB 20000:ZT = 1:PL = 0 23020 X0 = EN(10): IF X0 > AL(10) THEN X0 = AL(10) 23030 X0 = INT (X0): IF X0 > 15 * E(10) * SQR (CE(3,DT(3))) THEN X0 = E(10) * 15 * SQR (CE(3,DT(3))) 23035 X0 = INT (X0):PU = X0:RT = 1 23040 IF X0 > 0 THEN GOSUB 40000:EV = FN RD(RC) / 100: GOSUB 20000 23090 RETURN ### status/engine impl 24000 PRINT VN$;: GOSUB 38000: HTAB (7): PRINT VA$4VK$;"ENGINE STATUS": PRINT VA$1VL$;: PRINT " LIGHT ENGINES" TAB( 22);:Z1$ = "GREEN":Z = 1: IF EN(11) = 0 THEN Z1$ = "WHITE":Z = 7 24035 IF D(11) > 0 THEN Z1$ = "BLUE":Z = 6: IF D(11) = 3 THEN Z1$ = "RED":Z = 5 24040 PRINT Z1$: HCOLOR= Z: FOR Z1 = 17 TO 24: HPLOT 112,Z1 TO 147,Z1: NEXT Z1: PRINT " ION ENGINES " TAB( 22);:Z1$ = "GREEN":Z = 1: IF EN(10) = 0 THEN Z1$ = "WHITE":Z = 7 24055 IF D(10) < > 0 THEN Z1$ = "RED":Z = 5 24060 PRINT Z1$: HCOLOR= Z: FOR Z1 = 26 TO 32: HPLOT 112,Z1 TO 147,Z1: NEXT Z1: VTAB (6): PRINT VA$4VK$;: HTAB (11): PRINT "POWER"VL$VA$1: PRINT "ENGINES POWER 0";VA$2" 2 4 6 8 0";VA$1;:Z1 = EN(11) / MP(11):Y = 57:Z = 5: GOSUB 24900: PRINT " LIGHT" TAB( 11) FN RD(EN(11)): PRINT " ION" TAB( 11) FN RD(EN(10)):Z1 = EN(10) / MP(10):Y = 65:Z = 5: GOSUB 24900 24120 PRINT : PRINT VA$4VK$ TAB( 9);"EFFICENCY": PRINT VA$1VL$;: PRINT "ENGINES EFFIC 0";VA$2" 2 4 6 8 0";VA$1;: PRINT " LIGHT" TAB( 11) FN RD(E(11) * 100)"%":Z1 = E(11):Y = 97:Z = 6: GOSUB 24900: PRINT " ION" TAB( 11) FN RD(E(10) * 100)"%":Z1 = E(10):Y = 105:Z = 6: GOSUB 24900: PRINT : PRINT VA$4VK$ TAB( 10);"DROIDS" 24175 PRINT VA$1VL$"ENGINES" TAB( 14);"DROIDS": PRINT " LIGHT"; TAB( 9);: IF RT(11) > 0 THEN FOR Z = 1 TO RT(11) + RT(12): PRINT VK$"W";: NEXT Z: PRINT TAB( 25);RT(11) + RT(12)VL$; 24185 PRINT : PRINT " ION" TAB( 9);: IF RT(10) > 0 THEN FOR Z = 1 TO RT(10): PRINT VK$"W";: NEXT Z: PRINT TAB( 25)RT(10)VL$; 24890 RETURN ### draw bar chart for engine status 24900 HCOLOR= Z:Z1 = Z1 * 70 + 122: FOR Z2 = Y TO Y + 6: HPLOT 122,Z2 TO Z1,Z2: HCOLOR= 7: HPLOT Z1,Z2 TO 192,Z2: HCOLOR= Z: NEXT Z2: RETURN ### show nav status: current speed/heading, future speed/heading 25000 REM 25010 GOSUB 38000: HCOLOR= 5: FOR Z = 14 TO 25: HPLOT 8,Z TO 194,Z: NEXT Z: VTAB (3): HTAB (6): PRINT VA$4VK$VN$"NAVIGATION SYSTEM": VTAB (8): HTAB (2): PRINT VA$4VK$VN$;"SYSTEM: ";: HPLOT 9,54 TO 193,54 TO 193,139 TO 9,139 TO 9,54: ON EP + 1 GOTO 25050,25100,25150 # manual nav 25050 PRINT "MANUAL": VTAB (11): HTAB (2): PRINT "SPEED: ";EW: HTAB (2): PRINT "FUTURE SPEED: " FN RD(FS * 10) / 10: VTAB (15): HTAB (2): PRINT "HEADING:"; FN RD(EH): HTAB (2): PRINT "FUTURE HEADING: "; FN RD(FA) 25060 GOTO 25900 # semi-auto nav 25100 PRINT "SEMI-AUTOMATIC": VTAB (11): HTAB (2): PRINT "SHIP: ";K$(AL): VTAB (14): HTAB (2): PRINT "SPEED: ";AS: GOTO 25180 # auto nav 25150 PRINT "AUTOMATIC": VTAB (11): HTAB (2): PRINT "SHIP: ";K$(AL): VTAB (14): HTAB (2): PRINT "DISTANCE:";ED 25180 VTAB (17): HTAB (2): PRINT "POSITION:";: IF AP = 0 THEN PRINT "CURRENT" 25200 IF AP = 1 THEN PRINT "PROJECTED" 25900 RETURN ### status/position impl # get distance scale in SR 26000 POKE 232,0: POKE 233,145: GOSUB 26900 ## 26005 HCOLOR= 1: GOSUB 39000:Z5 = 2: IF SR < 1000 THEN Z5 = 1: IF SR < 400 THEN Z5 = 0 # draw our ship with appropriate angle 26025 GOSUB 39000:SX = 68 / SR:SY = 60 / SR: ROT= 0: SCALE= 1: HCOLOR= 7:X = EH: GOSUB 46000: ROT= R * 8:X = 102 - X(Z5 + 3,R): HCOLOR= 6: DRAW 4 + Z5 AT X,80 - Y(Z5 + 3,R): IF R < > 0 OR R < > 4 THEN DRAW 4 + Z5 AT X,79 - Y(Z5 + 3,R) 26038 IF INT (R / 2) < > R / 2 THEN DRAW 4 + Z5 AT X,81 - Y(Z5 + 3,R) # draw enemy ships, and store rounded AB/AE in X1/X2 26050 GOSUB 26600: IF X2 < X1 THEN X2 = X2 + 360 # draw nav arc 26344 HCOLOR= 7: HPLOT X3,X4:X3 = (X1 - X2) / 14: FOR X4 = X2 TO X1 STEP X3: HPLOT TO COS (X4 * DR) * 75 + 102,80 - SIN (X4 * DR) * 65: NEXT X4: HPLOT TO COS (X1 * DR) * 75 + 102,80 - SIN (X1 * DR) * 65: PRINT VA$4VN$VK$; 26370 GOSUB 39000: VTAB (22): PRINT "HEADING: "; FN DG( FN RD(EH)); TAB( 15);" DEGREES";: VTAB (21): HTAB (1): PRINT VA$1VL$" SCALE: " FN RD(SR / 2);" MGM": HCOLOR= 5: HPLOT 77,164 TO 111,164: RETURN ### draw enemy ships if in range; leaves rounded-off AB/AE in X1/X2 26600 Z5 = 2: IF SR < 1000 THEN Z5 = 1: IF SR < 400 THEN Z5 = 0 26603 SX = 68 / SR:SY = 60 / SR: SCALE= 1: HCOLOR= 7: FOR Z = 1 TO 3: IF DK(Z) > SR OR (CO = 1 AND SH < > Z) OR K(Z) = 0 THEN 26680 26620 X = KH(Z): GOSUB 46000: ROT= R * 8:Y = 80 - (KY(Z) - EY) * SY - Y(Z5,R):X = 102 + (KX(Z) - EX) * SX - X(Z5,R): IF X > 200 OR Y > 160 OR X < 1 OR Y < 1 THEN 26680 26630 X = INT (X + .5):Y = INT (Y + .5): IF (X / 2 = INT (X / 2)) THEN X = X + 1 26650 DRAW Z5 + 1 AT X,Y: IF R < > 0 OR R < > 4 THEN DRAW Z5 + 1 AT X,Y - 1 26670 IF INT (R / 2) < > R / 2 THEN DRAW Z5 + 1 AT X,Y + 1 26680 NEXT Z # draw lines from ship to end of nav arc :X1 = FN RD(AB):X2 = FN RD(AE):X = X1: GOSUB 26800:X7 = X3:X8 = X4:X9 = X5:X0 = X6:X = X2: GOSUB 26800: HCOLOR= 5: HPLOT X3,X4 TO X5,X6: HPLOT X7,X8 TO X9,X0: HPLOT X3 + 1,X4 TO X5 + 1,X6: HPLOT X7 + 1,X8 TO X9 + 1,X0: RETURN ### compute shield arc line x3,x4 to x5,x6 26800 X3 = COS (X * DR) * 75 + 102:X5 = COS (X * DR) * 19 + 102:X4 = 80 - SIN (X * DR) * 65:X6 = 80 - SIN (X * DR) * 15: RETURN ### select automatic or manual distance calibration for status/position # returns distance in SR 26900 GOSUB 38000: GOSUB 39000: PRINT VA$4VK$VN$;" AUTOMATIC": PRINT " MANUAL":Y = 2:Z(1) = 21:Z(2) = 22:Z = 2: VTAB (23): HTAB (5): PRINT VA$1VN$;VL$"ENTER CONTROL TYPE";: GOSUB 41000:CO = X: IF X = 1 THEN 26950 26910 C = 0:RT = 50:PU = 6000:PL = 100: GOSUB 39000: PRINT VA$1;VL$;VN$;: PRINT TAB( 6)"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 ### action/manual n 27000 REM # select speed; if min==max then we don't allow speed change 27020 X9 = 0:X8 = 0:X0 = 0: IF MN = MS THEN FS = EW: GOTO 27170 27100 C = 2: GOSUB 22000:X = 0:PU = MS:PL = MN:RT = 0:RC = MN: GOSUB 40000:FS = RC # select course; if min~=max we don't allow course change 27170 IF ABS (AB - AE) < 2 THEN GOTO 27290 # initialize distance traveled to current speed cubed, draw speed graph 27175 GOSUB 38000:SR = ABS (FS) ^ 3 + 5:X = 2: POKE 232,0: POKE 233,145: GOSUB 26005 # X0 gets current heading; get new heading between X1 and X2 into RC, and store in FA (future angle) :X0 = FN RD(EH):X9 = 0:X8 = 0:C = 1:PU = X2:PL = X1:RT = 1: GOSUB 40000:FA = FN D(RC) # set EP to manual, normalize FA 27290 EP = 0: GOSUB 39000: PRINT VA$4VK$;"TURNING OVER TO MANUAL":FA = FN D(FA): RETURN ### draw speed marker 27300 X = 22 + (X9 + 6) * 7: HPLOT X,136 TO X + 3,142 TO X - 3,142 TO X,136: RETURN ### draw distance marker 27350 Y = 108 - X8 / 18.75: HPLOT 182,Y TO 186,Y + 3 TO 186,Y - 3 TO 182,Y: RETURN ### erase and redraw speed and distance markers 27400 X9 = X0:X8 = X0 ^ 3: HCOLOR= 4: GOSUB 27300: GOSUB 27350: HCOLOR= 7:X0 = RC:X9 = X0:X8 = X0 ^ 3: GOSUB 27300: GOSUB 27350: RETURN # erase old & draw new nav direction line when choosing course; redraw enemy ships too 27500 Y = 4: GOSUB 27700:Z0 = RC: GOSUB 26600:Y = 7: GOSUB 27700: RETURN # draw nav direction line at angle Z0 when choosing course; updates Z0 to RC 27700 HCOLOR= Y:X3 = COS (Z0 * DR):X4 = SIN (Z0 * DR): HPLOT X3 * 70 + 102,80 - X4 * 61 TO X3 * 25 + 102,80 - X4 * 20:Z0 = RC: RETURN ### set window to (2,2) - (28,19) (main display area) 36000 PRINT VN$VY$;: VTAB (19): HTAB (28): PRINT VW$;: VTAB (2): HTAB (2): PRINT VV$;: RETURN ### set window to (4,21) - (28,23) (lower area with 3 item selection) 37000 PRINT VN$VY$;: VTAB (23): HTAB (28): PRINT VW$;: VTAB (21): HTAB (4): PRINT VV$;: RETURN ### set window to (2,2) - (28,19) (main display area), and clear it 38000 GOSUB 36000: PRINT VP$;: RETURN ### set window to (4,21) - (28,23) (lower area with 3 item selection), and clear it 39000 GOSUB 37000: PRINT VP$;: RETURN ### select value from range # C indicates modifier: # C = -2: (action/auto n distance) call 19500; Z1 is rounded # C = 0: (action/evasive; distance for manual status/position) start RC in the middle of the range; Z1 is rounded # C = 1: (action/manual n select course) call 27500; reverse meaning of paddle; Z1 is rounded; Z1 is clipped to positive degree range # C = 2: (action/manual n select speed) call 27400; RC is rounded # C = 3: (action/auto n/semi-auto speed) call 19600; RC is rounded 40000 T2 = 10000 40005 Z1$ = "": PRINT VY$;VA$1;VL$;VN$;:R = PU - PL: IF C = 0 THEN RC = PL + R / 2 40020 GOSUB 40100: IF RT = 0 THEN RT = .1 40025 VTAB (23): HTAB (30): PRINT VI$;VK$;"Y";: HTAB (36): PRINT "X";VN$:X = 135: GOSUB 40100:ZT = 0:R1 = 0 40040 X = PDL (0): IF PEEK ( - 16287) > 127 THEN 40080 40045 IF C = 1 THEN X = 256 - X 40047 IF ZT > 10 THEN ZT = 10 40050 IF X > 20 AND X < 200 THEN R1 = 0:ZT = 0: HTAB (31): 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 (30): PRINT VK$;VI$;"X";: HTAB (36): PRINT "Y";: POKE 2048,50: POKE 2049,30: CALL 2050: POKE 2048,60: POKE 2049,50: CALL 2050: VTAB (22): HTAB (31): PRINT VN$" ";: PRINT VA$4;: RETURN 40100 REM 40105 IF RC > PU THEN RC = PU 40107 IF RC < PL THEN RC = PL 40108 IF C > 1 THEN RC = INT (.5 + RC * 10) / 10 40109 IF RT THEN RC = INT (RC / RT + .5) * RT 40110 IF T2 = RC THEN 40190 40112 T2 = RC:Z1 = RC: IF C = 1 THEN Z1 = FN D(Z1) 40115 IF C < 2 THEN Z1 = FN RD(Z1) 40117 HTAB (31): VTAB (22): PRINT VA$;1;VK$;Z1$;" ";VL$;Z1;:Y3 = LEN ( STR$ (Z1)): IF Y3 > 6 THEN 40190 40124 Z = 6 - Y3: FOR Y2 = 1 TO Z: PRINT " ";: NEXT Y2:Z9 = 150: IF C THEN Z9 = 10 40125 POKE 2048,(PU - RC) / (PU - PL) * 76 + 75: POKE 2049,Z9: CALL 2050: IF C = 1 THEN GOSUB 27500 40126 IF C = 2 THEN GOSUB 27400 40130 IF C = - 2 THEN GOSUB 19500 40140 IF C = 3 THEN GOSUB 19600 40190 RETURN ### select from menu 41000 REM 41006 PRINT VY$VA$1VK$VI$;:Z1$ = "J":Y3 = - 1: FOR Z2 = 1 TO Z: IF Z(Z2) > 0 AND Y3 > 0 THEN X1 = Z2: GOTO 41030 41016 IF Z(Z2) > 0 THEN Y3 = Z2 41020 NEXT Z2:X1 = Y3: 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 43000 GOSUB 37000: VTAB (23): HTAB (4): PRINT VA$;1;VL$"PRESS BUTTON"; 43005 X2 = X2 + 1: IF X2 > 15 THEN VTAB (23): 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 (23): HTAB (2): PRINT " ";: HTAB (18): PRINT " "; 43020 IF PEEK ( - 16287) < 128 THEN 43005 43030 GOSUB 38000: GOSUB 45000: RETURN ### select ship for auto distance / nav; returned in SH 44000 REM 44005 GOSUB 39000: PRINT VA$1VN$VL$ TAB( 8);"ENTER SHIP";:Y = 30:Z(1) = 17:Z(2) = 18:Z(3) = 19: 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 ### convert angle in degrees to 0-7 for ROT; returned in R 46000 R = 2 - INT (( FN D(X) + 45 / 2) / 45): IF R < 0 THEN R = 8 + R 46030 RETURN