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) 30 CX(3) = 1: FOR Z = 0 TO 31:Z1(Z) = 0: NEXT Z:Z8 = 0: DEF FN RF(X) = ((3700 - X) / 3700) ^ 2.86: SCALE= 1: ROT= 0: GOTO 23000 # notreached 9999 GOTO 9999 ### return to MAIN MENU ### gosub target (23040) 10000 FOR Z = 1 TO 4:K$(Z) = "": NEXT Z: FOR Z = 1 TO 9:Z$(Z) = "":Z1$(Z) = "": NEXT Z: PRINT VA$0;VN$VK$: PRINT CHR$ (4);"BLOAD CHAIN,A520": CALL 520"MAIN MENU": STOP : GOSUB 22000: GOSUB 22700: RETURN ### sub-menu: power / redistrib menu 15000 REM # select system, result in CO; set Z6=1 if user selects weapons (else means shields?) 15030 GOSUB 27000:Z6 = 0: IF CO = 2 THEN Z6 = 1 15100 ON CO GOSUB 21000,21000,21200,21300: RETURN ### display positron/shield power 20000 GOSUB 39000: PRINT VA$1VL$VN$;:Z6 = Z6 * 5: IF Z6 THEN PRINT "PSTRN "; 20006 IF Z6 = 0 THEN PRINT "SHIELD"; 20010 PRINT " ALC ACT "VA$2" 2 4 6 8 0";: FOR Z = 1 TO 4: PRINT VA$4VK$VN$;: PRINT : PRINT " "Z;VA$1VL$; TAB( 8); FN RD(AL(Z + Z6)); TAB( 13); FN RD(EN(Z + Z6)): NEXT Z: PRINT :Z1$ = "BATT.":X = AL(15):Y = EN(15): GOSUB 29500: PRINT : PRINT "TOTAL":Z4 = Z1(8):Z1$ = "POWER":X = EN:Y = EN: GOSUB 29500: HCOLOR= 6: FOR Z = 19 TO 99 STEP 16: HPLOT 7,Z TO 191,Z: NEXT Z: GOSUB 29000 20215 FOR Z = 1 TO 4:Z5 = AL(Z + Z6) / MP(Z + Z6):Z4 = 0:Z3 = 7:Z2 = Z * 16 + 5: GOSUB 25000:Z1(Z * 2 - 1) = Z5:Z5 = EN(Z + Z6) / MP(Z + Z6):Z4 = 0:Z3 = 5:Z2 = Z2 + 7: GOSUB 25000:Z1(Z * 2) = Z5: NEXT Z:Z2 = 85:Z5 = AL(15) / MP(15):Z4 = 0:Z3 = 7: GOSUB 25000:Z(9) = Z5:Z2 = 92:Z5 = EN(15) / MP(15):Z4 = 0:Z3 = 5: GOSUB 25000:Z1(10) = Z5 20510 Z2 = 109:Z5 = EN / MP:Z3 = 7: GOSUB 25000:Z1(11) = Z5:Z2 = 116:Z5 = EN / MP:Z3 = 5: GOSUB 25000:Z1(12) = Z5: RETURN ### display engine power 20600 GOSUB 39000: PRINT VA$1VL$VN$;: PRINT "ENGINE ALC ACT "VA$2" 2 4 6 8 0": PRINT VA$1;: PRINT : PRINT V1$VL$"LIGHT":Z1$ = "ENGINE":X = AL(11):Y = EN(11): GOSUB 29500: PRINT : PRINT : PRINT "ION":Z1$ = "ENGINE":X = AL(10):Y = EN(10): GOSUB 29500: PRINT :Z1$ = "BATT.":X = AL(15):Y = EN(15): GOSUB 29500 20672 PRINT : PRINT "TOTAL":Z1$ = "POWER":X = EN:Y = EN: GOSUB 29500: HCOLOR= 6: FOR Z = 19 TO 83 STEP 32: HPLOT 7,Z TO 191,Z: NEXT Z: HPLOT 7,99 TO 191,99: GOSUB 29000:Z5 = AL(11) / MP(11):Z4 = 0:Z3 = 7:Z2 = 37: GOSUB 25000:Z1(1) = Z5:Z5 = EN(11) / MP(11):Z2 = 44:Z3 = 5: GOSUB 25000:Z1(2) = Z5 20750 Z5 = AL(10) / MP(10):Z4 = 0:Z3 = 7:Z2 = 69: GOSUB 25000:Z1(3) = Z5:Z3 = 5:Z5 = EN(10) / MP(10):Z4 = 0:Z2 = 76: GOSUB 25000:Z1(4) = Z5:Z2 = 85:Z5 = AL(15) / MP(15):Z4 = 0:Z3 = 7: GOSUB 25000:Z1(5) = Z5:Z2 = 92:Z5 = EN(15) / MP(15):Z3 = 5: GOSUB 25000:Z1(6) = Z5 20785 Z2 = 109:Z5 = EN / MP:Z3 = 7: GOSUB 25000:Z1(7) = Z5:Z2 = 116:Z5 = EN / MP:Z3 = 5: GOSUB 25000:Z1(8) = Z5: RETURN ### display support power 20800 GOSUB 39000: PRINT VA$1VL$VN$;: PRINT "SYSTEM ALC ACT"VA$2" 2 4 6 8 0": PRINT VA$1;: PRINT "LIFE":Z1$ = "SUPPRT":X = AL(12):Y = EN(12): GOSUB 29500: PRINT : PRINT "GENRL":Z1$ = "OPERAT":X = AL(13):Y = EN(13): GOSUB 29500: PRINT :Z1$ = "COMMUN":X = EN(14):Y = AL(14): GOSUB 29500: PRINT :Z1$ = "BATT." 20840 X = AL(15):Y = EN(15): GOSUB 29500: PRINT : PRINT "TOTAL":Z1$ = "POWER":X = EN:Y = EN: GOSUB 29500: GOSUB 29000: HPLOT 7,19 TO 191,19: HPLOT 7,43 TO 191,43: HPLOT 7,67 TO 191,67: HPLOT 7,83 TO 191,83: HPLOT 7,99 TO 191,99:Z4 = 0:Z5 = AL(12) / MP(12):Z2 = 29:Z3 = 7: GOSUB 25000:Z1(1) = Z5 20900 Z5 = EN(12) / MP(12):Z2 = 36:Z3 = 5: GOSUB 25000:Z1(2) = Z5:Z5 = AL(13) / MP(13):Z2 = 53:Z3 = 7: GOSUB 25000:Z1(3) = Z5:Z5 = EN(13) / MP(13):Z2 = 60:Z3 = 5: GOSUB 25000:Z1(4) = Z5:Z5 = AL(14) / MP(14):Z2 = 69:Z3 = 7: GOSUB 25000:Z1(5) = Z5 20940 Z5 = EN(14) / MP(14):Z2 = 76:Z3 = 5: GOSUB 25000:Z1(6) = Z5:Z5 = AL(15) / MP(15):Z2 = 85:Z3 = 7: GOSUB 25000:Z1(7) = Z5:Z5 = EN(15) / MP(15):Z2 = 92:Z3 = 5: GOSUB 25000:Z1(8) = Z5:Z5 = EN / MP:Z2 = 109:Z3 = 7: GOSUB 25000:Z1(9) = Z5:Z5 = EN / MP:Z2 = 116:Z3 = 5: GOSUB 25000:Z1(10) = Z5: RETURN ### gosub target for power/redistrib of shields and positrons # Z6 is 0 or 5 for shield or positron # D is zero if display-only 21000 GOSUB 20000:Z1$ = "SHIELD ": IF Z6 THEN Z1$ = "POSITRON " 21002 IF D = 0 THEN GOSUB 43000: GOTO 21090 21003 FOR Z = 1 TO 4:Z(Z) = 1: IF D(Z + Z6) THEN Z(Z) = - 1 21004 NEXT Z:Z(5) = 1: FOR Z = 1 TO 4:Z$(Z) = Z1$ + STR$ (Z): NEXT Z:Z$(5) = "RETURN":ZY = 5:Z = 5: GOSUB 47000: IF X = 5 THEN 21090 21016 GOTO 21020 21018 Z = 5: GOSUB 41000: IF X = 5 THEN 21090 21020 Z7 = X:Z8 = X * 2 - 1 + Z6:ZA = X + Z6:C = 1:X4 = X:PU = MP(ZA):Z1(Z8) = AL(ZA) / MP(ZA): IF PU > AL(15) + AL(ZA) THEN PU = AL(15) + AL(ZA) 21022 RT = 20:PL = 0:PU = INT (PU / 20) * 20: IF PU > 0 THEN GOSUB 40000:AL(15) = X9:AL(ZA) = RC 21040 GOTO 21018 21090 C = 0: RETURN ### called from 40100; updates battery, bar charts, and such 21100 Z2 = Z7 * 16 + 5:Z4 = Z1(Z8):Z3 = 7:Z5 = RC / MP(ZA):Z1(Z8) = Z5: GOSUB 25000: VTAB (Z7 * 2 + 2): HTAB (9): PRINT RC;:X6 = LEN ( STR$ (RC)): IF X6 < 4 THEN FOR X7 = 1 TO 4 - X6: PRINT " ";: NEXT X7 21150 AL(15) = FN RD(AL(15) + AL(ZA) - RC):AL(ZA) = RC:Z4 = Z1(ZY * 2 - 1):Z2 = 85:Z5 = AL(15) / MP(15):Z1(ZY * 2 - 1) = Z5: GOSUB 25000: VTAB (12): HTAB (9): PRINT AL(15);:X6 = LEN ( STR$ (AL(15))): IF X6 < 4 THEN FOR X7 = 1 TO 4 - X6: PRINT " ";: NEXT X7 21189 X9 = AL(15): RETURN ### gosub target for power/redistrib of engines 21200 GOSUB 20600:Z$(1) = "LIGHT ENGINES":Z$(3) = "RETURN":Z$(2) = "ION ENGINES": IF D = 0 THEN GOSUB 43000: GOTO 21290 # disallow allocation for damaged systems 21203 Z(1) = 1:Z(2) = 1: IF D(11) = 3 THEN Z(1) = - 1 21204 Z(3) = 1: IF D(10) THEN Z(2) = - 1 21205 Z = 3: GOSUB 47000:ZY = 3: IF X = 3 THEN 21290 21213 PL = 0: GOTO 21217 21215 C = 1:Z = 3: GOSUB 41000: IF X = 3 THEN 21290 21217 Z8 = X * 2 - 1:X4 = X:ZA = 12 - X:Z7 = X4 * 2:PU = MP(ZA): IF PU > AL(15) + AL(ZA) THEN PU = AL(15) + AL(ZA) 21225 C = 1:Z3 = 5:RT = 10:PU = INT (PU): IF PU > 0 THEN GOSUB 40000:AL(15) = X9:AL(ZA) = RC 21250 GOTO 21215 21290 C = 0: RETURN ### gosub target for power/redistrib of support 21300 GOSUB 20800:Z$(1) = "LIFE SUPPPORT":Z$(2) = "GENERAL OPERATIONS":Z$(3) = "COMMUNICATIONS":Z$(4) = "RETURN": IF D = 0 THEN GOSUB 43000: GOTO 21390 21302 FOR Z = 1 TO 3:Z(Z) = 1: IF D(Z + 11) THEN Z(Z) = - 1 21303 NEXT Z:Z(4) = 1:PL = 0:Z = 4:ZY = 4: GOSUB 47000: IF X = 4 THEN 21390 21305 GOTO 21315 21315 C = 1:X4 = X:ZA = 11 + X:Z8 = X * 2 - 1:Z7 = X + .5: IF X > 1 THEN Z7 = Z7 + .5 21317 PU = MP(ZA): IF PU > AL(15) + AL(ZA) THEN PU = AL(15) + AL(ZA) 21320 RT = 1:PL = 0: IF ZA = 14 THEN RT = 40 21325 PU = INT (PU / 5) * 5: IF (PU > 0 AND X4 = 3) OR PU > 10 THEN GOSUB 40000:AL(15) = X9:AL(ZA) = RC 21330 GOTO 21302 21390 C = 0: RETURN ### outer UI loop # set window, clear it # select from 1=power, 2=damage, 3=redistrib, 4=repair, 5=return; set D=1 if we're modifying the system 23000 GOSUB 38000:Y = 30:Z(1) = 3:Z(2) = 4:Z(3) = 8:Z(4) = 9:Z(5) = 13:Z = 5: GOSUB 41000:D = 1:C2 = X: IF C2 < 3 THEN D = 0 # total up energy allocations 23005 EN = 0: FOR Z1 = 1 TO 15:EN = EN + AL(Z1): NEXT Z1: IF EN(13) < 5 OR AL(13) < 5 THEN Z(4) = - 9 23040 ON C2 GOSUB 15000,27300,15000,27300,10000: GOTO 23000 24000 REM 24005 GOSUB 37000: VTAB (19): PRINT VA$1;: FOR Z1 = 1 TO 4: VTAB (Z1 + 18): HTAB (1): PRINT VL$"POSTRN "Z1;:Z3 = Z1 + 5: GOSUB 27100:Z1(Z1) = Z3: NEXT Z1:C1 = 5: IF D THEN GOSUB 24600 24020 IF D = 0 THEN GOSUB 43000 24030 RETURN ### damage/repair shields 24100 GOSUB 38000: GOSUB 26700: GOSUB 37000: VTAB (19): PRINT VA$1;: FOR Z1 = 1 TO 4: VTAB (Z1 + 18): HTAB (1): PRINT VL$"SHIELD ";Z1;:Z1(Z1) = Z1:Z3 = Z1: GOSUB 27100: NEXT Z1:C1 = 5: IF D THEN GOSUB 24600 24115 IF D = 0 THEN GOSUB 43000 24120 RETURN ### damage/repair engines ### set Z1(1) = 11, Z1(2) = 12, Z1(3) = 10 <-- indices into RT(n) for the three menu slots # set up the lower area 24200 GOSUB 38000: GOSUB 26700: GOSUB 37000: VTAB (19): PRINT VA$1; # draw the systems : VTAB (19): HTAB (1): PRINT VL$"PRT ENG";:Z3 = 11: GOSUB 27100:Z1(1) = 11: PRINT "STB ENG";:Z3 = 12: GOSUB 27100:Z1(2) = 12: PRINT "ION ENG";:Z3 = 10: GOSUB 27100:C1 = 4:Z1(3) = 10: IF D THEN GOSUB 24600 24235 IF D = 0 THEN GOSUB 43000 24240 RETURN 24300 GOSUB 37000: VTAB (19): PRINT VA$1;: VTAB (19): HTAB (1): PRINT "TORPEDO";:Z3 = 5: GOSUB 27100:C1 = 2:Z1(1) = 5: IF D THEN GOSUB 24600 24315 IF D = 0 THEN GOSUB 43000 24320 RETURN ### select number of droids to assign to system (0-7, limited by free droid count CA) ### Z1(n) holds the index into RT of the system in the given menu slot 24400 C = 2:PL = 0:PU = 7: IF CA + RT(Z1(CO)) < PU THEN PU = CA + RT(Z1(CO)) 24440 RT = 1: GOSUB 40000: RETURN ### print updated droid count (on system and in "free" list); used when adjusting #of droids assigned 24500 GOSUB 37000:Z3 = Z1(CO):CA = CA + RT(Z3) - RC: VTAB (18 + CO):RT(Z3) = RC: GOSUB 27100: GOSUB 36000: GOSUB 26600: PRINT VY$VA$1VL$;: RETURN ### select system to adjust droid count 24600 VTAB (C1 + 18): HTAB (1): PRINT VA$1VL$"RETURN"; 24620 FOR Z = 1 TO C1:Z(Z) = Z + 18: NEXT Z:Z = C1:Y = 2: GOSUB 48000: GOSUB 41000:CO = X1: IF CO < > C1 THEN GOSUB 24400: GOTO 24620 24690 RETURN ### damage/repair weapons 24700 Z(1) = 1:Z(2) = 1:Z(3) = 1:Z$(1) = "POSITRON":Z$(2) = "TORPEDO":Z$(3) = "RETURN":Z = 3: GOSUB 47000: IF X = 3 THEN 24790 24710 GOSUB 38000: GOSUB 26700: ON X GOSUB 24000,24300: GOTO 24700 24790 RETURN ### draw bar chart chunk (for allocated or actual) 25000 Z9 = Z4 * 70 + 121:Z0 = Z5 * 70 + 121: FOR X8 = Z2 TO Z2 + 5: HCOLOR= Z3: IF Z9 > Z0 THEN HCOLOR= 4 25040 IF Z9 < > Z0 THEN HPLOT Z9,X8 TO Z0,X8: NEXT X8 25045 RETURN ### draw ship damage state ### note shape 6 is a rectangle with every-other pixel set, so draw once for orange, twice for white # ship outline 26000 GOSUB 39000: HCOLOR= 6: HPLOT 50,34 TO 82,22 TO 90,26 TO 90,30 TO 130,30 TO 130,24 TO 150,24 TO 150,50 TO 130,50 TO 130,44 TO 90,42 TO 90,48 TO 82,52 TO 50,40 TO 70,40 TO 70,34 TO 50,34: HPLOT 130,28 TO 90,28 TO 94,22 TO 136,22 TO 136,24 26060 HPLOT 130,46 TO 90,46 TO 94,52 TO 136,52 TO 136,50: HPLOT 110,28 TO 110,30: HPLOT 118,28 TO 118,30: HPLOT 110,46 TO 110,44: HPLOT 118,46 TO 118,30 # draw shields 3 / 1 / 4 / 2 :Z4 = 3: GOSUB 26900: FOR Z1 = 10 TO 20: HPLOT 50,Z1 TO 156,Z1: NEXT Z1:Z4 = 1: GOSUB 26900: FOR Z1 = 20 TO 30: HPLOT Z1,10 TO Z1,64: NEXT Z1 26100 Z4 = 4: GOSUB 26900: FOR Z1 = 160 TO 170: HPLOT Z1,10 TO Z1,64: NEXT Z1:Z4 = 2: GOSUB 26900: FOR Z1 = 54 TO 64: HPLOT 50,Z1 TO 156,Z1: NEXT Z1 # port light engine uses damage color if damage is 2 or 3 : HCOLOR= 7: IF D(11) = 2 OR D(11) = 3 THEN HCOLOR= 5 # starboard light engine uses damage color if damage is 1 or 3 26130 FOR Z1 = 23 TO 27: HPLOT 96,Z1 TO 126,Z1: NEXT Z1: HCOLOR= 7: IF D(11) = 1 OR D(11) = 3 THEN HCOLOR= 5 26150 FOR Z1 = 47 TO 51: HPLOT 96,Z1 TO 126,Z1: NEXT Z1 # draw ion engine :Z4 = 10: GOSUB 26900: FOR Z1 = 30 TO 42: HPLOT 138,Z1 TO 150,Z1: NEXT Z1 # draw torpedo tubes : ROT= 0: SCALE= 1: FOR Z1 = 1 TO 6:Z2 = (Z1 - 1) * 9 + 12:Z3 = 0:Z4 = 6: IF D(5) > = Z1 THEN Z4 = 5:Z3 = 1 26160 POKE 232,102: POKE 233,08: HCOLOR= 7: DRAW 6 AT 35,Z2: IF Z3 = 0 THEN DRAW 6 AT 34,Z2 26185 NEXT Z1 # draw positrons (6/7/8/9) : IF D(6) = 0 THEN DRAW 6 AT 72,34 26195 DRAW 6 AT 73,34: IF D(7) = 0 THEN DRAW 6 AT 80,42 26205 DRAW 6 AT 81,42: IF D(8) = 0 THEN DRAW 6 AT 80,24 26215 DRAW 6 AT 81,24: IF D(9) = 0 THEN DRAW 6 AT 118,34 26225 DRAW 6 AT 119,34 # draw section lines for "available repair droids" : HCOLOR= 5: HPLOT 7,74 TO 195,74: HPLOT 7,92 TO 195,92: HPLOT 7,108 TO 195,108: GOSUB 26600: POKE 232,0: POKE 233,145: RETURN ### draws "free" repair droids 26600 VTAB (11): HTAB (1): PRINT VA$0VK$"AVAILABLE REPAIR DROIDS:"CA" ";: VTAB (13): PRINT VA$1VK$;: HTAB (2):Z1$ = "W": FOR Z1 = 1 TO 25: IF CA < Z1 THEN Z1$ = " " 26640 PRINT Z1$;: NEXT Z1: VTAB (15): HTAB (2):Z1$ = "W": FOR Z1 = 26 TO 50: IF CA < Z1 THEN Z1$ = " " 26660 PRINT Z1$;: NEXT Z1: RETURN ### draw repair frame in lower section 26700 GOSUB 38000: VTAB (18): HTAB (2): PRINT VA$1VL$"SYSTEM DM RP DROIDS": HCOLOR= 6: HPLOT 22,143 TO 194,143: HPLOT 82,136 TO 82,183: HPLOT 112,136 TO 112,183: HPLOT 140,136 TO 140,183: RETURN ### set hcolor for system in Z4 depending on whether or not it's damaged (!= 0) 26900 HCOLOR= 7: IF D(Z4) THEN HCOLOR= 5 26910 RETURN ### select system, 1=shields, 2=weapons, 3=engines, 4=support; returns value in CO 27000 Z = 4:Y = 30:Z(1) = 16:Z(2) = 17:Z(3) = 18:Z(4) = 19: GOSUB 41000:CO = X: RETURN ### print DM, RP, and repair droids assigned to system Z3 27100 HTAB (11): PRINT RP(Z3);: HTAB (15): PRINT RT(Z3);: HTAB (19): PRINT VK$;:Z1$ = "W": FOR Z2 = 1 TO 7: IF Z2 > RT(Z3) THEN Z1$ = " " 27120 PRINT Z1$;: NEXT Z2: PRINT VL$;: RETURN ### sub-menu: damage / repair # if general operations power is too low, repairs are not possible # entering repair menu costs 5 power for general ops 27300 IF D = 1 AND (EN(13) < 5 OR AL(13) < 5) THEN RETURN 27303 IF D THEN EN(13) = EN(13) - 5:AL(13) = AL(13) - 5 27305 GOSUB 26000:Z = 3:Z(1) = 16:Y = 30:Z(2) = 17:Z(3) = 18: GOSUB 41000:CO = X: PRINT VN$;: ON CO GOSUB 24100,24700,24200: RETURN 29000 HCOLOR= 6: HPLOT 136,17 TO 136,127: HPLOT 150,17 TO 150,127: HPLOT 164,17 TO 164,127: HPLOT 178,17 TO 178,127: HPLOT 192,17 TO 192,127: HPLOT 50,8 TO 50,127: HPLOT 86,8 TO 86,127: HPLOT 120,8 TO 120,127: RETURN 29500 PRINT Z1$ TAB( 8) FN RD(X) TAB( 13) FN RD(Y): RETURN 29999 GOTO 29999 ### set window to (2,2) - (27,16) - large upper display area 36000 PRINT VY$;: VTAB (2): HTAB (2): PRINT VV$;: VTAB (16): HTAB (27): PRINT VW$;: RETURN ### set window to (4,18) - (25,23) - small lower adjustment area 37000 PRINT VY$;: HTAB (4): VTAB (18): PRINT VV$;: VTAB (23): HTAB (25): PRINT VW$;: RETURN ### set window to (4,18) - (25,23), clear screen 38000 GOSUB 37000: PRINT VN$VP$;: RETURN ### set window to (2,2) - (27,16), clear screen 39000 GOSUB 36000: PRINT VN$VP$;: RETURN ### select value from range (power, droids) ### C = 0 ? ### C = 1 adjust energy level (AL(ZA))? ### C = 2 adjust robot count 40000 REM 40017 PRINT VY$VA$1VL$VN$;:R = PU - PL: IF C = 0 THEN RC = PL + R / 2 40018 IF C = 1 THEN RC = AL(ZA) # re-draw droid count and free droid list 40019 IF C = 2 THEN RC = 0: GOSUB 24500 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 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;: FOR Y0 = 1 TO 100: NEXT Y0: RETURN 40100 REM 40105 IF RC > PU THEN RC = PU 40107 IF RC < PL THEN RC = PL 40108 IF RT THEN RC = INT (RC / RT) * RT 40110 IF X2 = RC THEN 40130 40112 X2 = RC:Z1 = FN RD(RC): HTAB (31): VTAB (22): PRINT VA$;1;VK$;Z1$;" ";VL$;Z1;:Y3 = LEN ( STR$ (Z1)): IF Y3 > 6 THEN 40130 40124 Z = 6 - Y3: FOR Y2 = 1 TO Z: PRINT " ";: NEXT Y2: POKE 2048,(PU - RC) / (PU - PL) * 76 + 75: POKE 2049,30: CALL 2050: IF C = 2 THEN GOSUB 24500 40128 IF C = 1 THEN GOSUB 21100 40130 RETURN ### select menu item 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: FOR Y0 = 1 TO 100: NEXT Y0: RETURN 42015 GOSUB 41000:CO = X1: GOSUB 39000: GOTO 42015 ### simple button press 43000 GOSUB 37000: VTAB (23): HTAB (1): PRINT VA$1VL$" ";: HTAB (4): PRINT "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 ### chirp 45000 POKE 2048,30: POKE 2049,30: CALL 2050: POKE 2048,80: POKE 2049,50: CALL 2050: RETURN ### manage bottom window (select from 5 entries) 47000 GOSUB 48000: GOSUB 38000: FOR Z1 = 1 TO Z: HTAB (1): VTAB (18 + Z1):Z(Z1) = (18 + Z1) * Z(Z1): PRINT VA$4VK$VN$" "Z$(Z1);: NEXT Z1:Y = 2: GOSUB 41000: RETURN ### print 5 empty boxes in bottom window area 48000 PRINT VY$VA$1VK$VI$;: FOR Z1 = 1 TO 5: VTAB (18 + Z1): HTAB (3): PRINT "E";: NEXT Z1: RETURN