# 0/145 is $9100, "SHIP1 SHAPE" 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 K$(1) = "DETAS":K$(2) = "MILAS":K$(3) = "KAMAS": CALL 35070: POKE 2072,42: POKE 2073,85: CALL 2074: PRINT VY$: VTAB (2): HTAB (10) 31 PRINT VA$4VK$VN$;" STARSHIP COMMANDER ": GOSUB 37000: PRINT VP$;: PRINT VY$: VTAB (22): HTAB (30): PRINT VA$1VK$VI$"X"VL$"RDY ";VK$;"X";VL$;"ENT"; 130 VTAB (21): HTAB (31): PRINT VN$" ";VI$;: VTAB (21): HTAB (8): PRINT "PADDLE CONTROL COUNTER ";: HCOLOR= 0: HPLOT 7,159 TO 272,159: HCOLOR= 0: HPLOT 7,167 TO 272,167 # do you want sound? (result in X) 400 GOSUB 20000: IF X = 2 THEN POKE 2050,234: POKE 2051,234: POKE 2052,234 # old game or new? (result in X) 500 GOSUB 39000: VTAB (10): HTAB (10): PRINT "OLD GAME OR NEW GAME?": GOSUB 21000: IF X = 1 THEN 2000 # new game... manual or automatic placement? (result - 1 in X0) # how many enemy ships? (sets K(n) to 0 or 1) 700 GOSUB 26000: GOSUB 22000: FOR SH = 1 TO 3: IF K(SH) = 0 THEN 830 # looping 1-3 times, select enemy ship sizes (result in KT(SH)) 820 GOSUB 23000: IF X0 THEN 830 # manual placement - distance then angle 825 GOSUB 24000: GOSUB 25000 830 NEXT SH # loop over all ships... # make sure KT(n) is zero for non-existent ships 840 FOR Z = 1 TO 3: IF K(Z) = 0 THEN KT(Z) = 0: GOTO 890 845 KC(Z) = 150 + 15 * KT(Z):MK(Z,0) = 6000 + KT(Z) * 1000: FOR X = 2 TO 3:MK(Z,X) = MK(Z,0) * .12: NEXT X:MK(Z,4) = MK(Z,0) * .1:MK(Z,1) = MK(Z,0) * .14:MK(Z,5) = MK(Z,0) * .4:MK(Z,6) = MK(Z,0):MK(Z,7) = MK(Z,0) 850 FOR X = 1 TO 7:KP(Z,X) = 1 / 7 * MK(Z,0) * .9 + RND (1) / 10: NEXT X:KP(Z,0) = MK(Z,0) * .8 + RND (1) / 10:MS(Z) = 14 - KT(Z) 890 NEXT Z 900 PRINT VA$0VN$VK$ 910 PRINT CHR$ (4)"BLOAD CHAIN,A520": CALL 520"INFO1": STOP ### load saved game 2000 PRINT VA$0VK$VN$: PRINT CHR$ (4)"BLOAD CHAIN,A520": CALL 520"GET DATA": STOP : VTAB (15): HTAB (18): PRINT VA$4VK$VI$;"YES": VTAB (17): HTAB (18): PRINT VA$4VK$VI$;"NO" ### query for sound choice (result in X) 20000 GOSUB 39000: VTAB (8): HTAB (7): PRINT "DO YOU WISH TO HAVE SOUND?": VTAB (15): HTAB (18): PRINT "YES": VTAB (17): HTAB (18): PRINT "N0" 20030 Y = 17:Z(1) = 15:Z(2) = 17:Z = 2: GOSUB 41000: RETURN ### query old or new game (result in X) 21000 VTAB (15): HTAB (18): PRINT VA$4VK$VI$;"OLD": VTAB (17): HTAB (18): PRINT VA$4VK$VI$;"NEW": GOTO 20030 ### query number of opposing ships 22000 REM 22010 GOSUB 39000: VTAB (8): PRINT TAB( 10);"ENTER THE THE NUMBER": PRINT TAB( 11);"YOU WISH TO FIGHT:": VTAB (12): HTAB (19): PRINT "0NE": VTAB (14): HTAB (19): PRINT "TWO": VTAB (16): HTAB (19): PRINT "THREE":Z(1) = 12:Z(2) = 14:Z(3) = 16:Y = 18:Z = 3: GOSUB 41000: FOR Z = 1 TO 3:K(Z) = 0: IF Z < = X THEN K(Z) = 1 22080 NEXT Z:F1 = X: RETURN ### select enemy ships size (result in KT(SH)) 23000 REM 23010 GOSUB 39000: VTAB (6): PRINT TAB( 3);"SHIP NUMBER ";SH;" WILL BE CALLED THE ";VN$VA$VL$: PRINT VA$1VL$: VTAB (7): HTAB (3): PRINT K$(SH)VA$4VK$VI$;". ENTER THE SHIP'S": PRINT TAB( 3);"CLASSIFICATION:": VTAB (12): HTAB (15): PRINT "DESTROYER": VTAB (14): HTAB (15): PRINT "CRUISER": VTAB (16): HTAB (15): PRINT "DREADNAUGHT" 23080 Z(1) = 12:Z(2) = 14:Z(3) = 16:Z = 3:Y = 14: GOSUB 41000:KT(SH) = X: RETURN ### select enemy ship distance (result in DK(SH)) 24000 REM 24010 GOSUB 39000:C = 0: VTAB (6): HTAB (8): PRINT "HOW FAR AWAY DO YOU WISH": PRINT TAB( 8);"TO BE FROM THE "K$(SH);"?" 24050 VTAB (10): PRINT TAB( 3);VA$1VL$"(USE THE PADDLE CONTROL TO ENTER": PRINT TAB( 3);"ALL YOUR NUMBERS. BY TURNING THE": PRINT TAB( 3);"PADDLE TO THE LEFT, YOU DECREASE": PRINT TAB( 3);"THE NUMBER. TURNING IT TO THE" 24090 PRINT TAB( 3);"RIGHT INCREASES IT. KEEPING IT": PRINT TAB( 3);"IN THE MIDDLE STOPS IT. WHEN": PRINT TAB( 3);"YOU WANT TO ENTER THE NUMBER,": PRINT TAB( 3);"PRESS THE BUTTON.)":PL = 100:PU = 8000:RT = 50: GOSUB 40000:DK(SH) = RC: RETURN ### select bearing to enemy ship (result in KX(SH) / KY(SH)) # uses 25000 REM 25010 GOSUB 39000:Z$ = "X": IF SH = 2 THEN Z$ = "E" 25015 IF SH = 3 THEN Z$ = "T" 25017 Y8 = 18:X8 = 30: VTAB (5): HTAB (4): PRINT "ENTER THE BEARING OF "K$(SH)" (";VA$1Z$VA$4")": VTAB (6): PRINT TAB( 4)"IN DEGREES:": VTAB (20): HTAB (2): PRINT VA$1VL$; CHR$ (143) CHR$ (143)"DISTANCE: ";DK(SH); TAB( 24);VK$"Z"VL$" = USS RANGER" CHR$ (143) CHR$ (144); 25036 VTAB (13): HTAB (1): PRINT "180 DEGREES" TAB( 30)"0 DEGREES": VTAB (13): HTAB (19): PRINT VK$"Z";:C = 1:PU = 359:PL = 0:RT = 1: GOSUB 40000:RC = RC * .0174533:KX(SH) = COS (RC) * DK(SH) + 10000:KY(SH) = SIN (RC) * DK(SH) + 10000: RETURN ### erase ship at old location (X8/y8), draw at new location (based on RC) 25500 REM 25510 VTAB (Y8): HTAB (X8): PRINT VI$VK$" ":X7 = RC * .0174533:X8 = COS (X7) * 6.85 + 20:Y8 = 13 - SIN (X7) * 6: VTAB (Y8): HTAB (X8): PRINT Z$;: PRINT VN$;: RETURN ### query for manual or automatic setup 26000 GOSUB 39000: VTAB (8): PRINT TAB( 3);"DO YOU WISH TO MANUALLY SET UP THE": PRINT TAB( 3);"SHIPS OR HAVE THE COMPUTER DO IT?": VTAB (12): PRINT TAB( 16);"MANUALLY": VTAB (14): PRINT TAB( 16);"COMPUTER":Z(1) = 12:Z(2) = 14:Z = 2:Y = 15: GOSUB 41000:X0 = X - 1 26070 RETURN ### set scroll window to (2,4) - (39,19), select bold font + inverse 37000 PRINT VY$: VTAB (22): HTAB (39): PRINT VW$;: VTAB (4): HTAB (2): PRINT VV$;VA$4VI$: RETURN ### set scroll window to (2,4) - (39,19) 38000 PRINT VY$: VTAB (19): HTAB (39): PRINT VW$;: VTAB (4): HTAB (2): PRINT VV$;: RETURN ### set bold font, inverse, caps, clear window 39000 GOSUB 38000: PRINT VA$4VI$VK$;VP$;: RETURN ### get input from range with paddle adjustment # PL holds lower bound # PU holds upper bound # RT is a multiplier # C is boolean; if false default RC to high/low # --> integer result in RC 40000 IF PU > 4000 THEN PU = 4000 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 (22): 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 # cap dynamic multiplier at 10 40045 IF ZT > 10 THEN ZT = 10 # if in middle of range then R1=0, ZT=0 40050 IF X > 20 AND X < 200 THEN R1 = 0:ZT = 0: HTAB (31): VTAB (21): PRINT VA$1VK$"L";: GOTO 40040 # R indicates direction, ZT is multiplier so we adjust non-linearly 40055 Z1$ = "J":R = - 1: IF X > 199 THEN R = 1:Z1$ = "K" # reset multiplier if we switched directions abruptly 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 (22): 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 (21): HTAB (31): PRINT VN$" ";: PRINT VA$4;: RETURN ### cap RC, update display (used by paddle reader) 40100 REM 40105 IF RC > PU THEN RC = PU 40107 IF RC < PL THEN RC = PL 40109 IF RT THEN RC = INT (RC / RT + .5) * RT 40110 IF X2 = RC THEN 40190 40112 X2 = RC:Z1 = RC: HTAB (31): VTAB (21): 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: POKE 2048,(PU - RC) / (PU - PL) * 75 + 75: POKE 2049,100 - C * 75: CALL 2050: IF C = 1 THEN GOSUB 25500 40190 RETURN ### get input from set of choices # Z holds number of menu items # Y holds htab # Z(n) holds VTAB # --> result in X 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 # print square brackets 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 # 'L' is ">" triangle 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 # button pressed; X1 indicates selected item 41180 IF X1 < 1 THEN 41185 # F is filled bracket 41183 HTAB (Y): VTAB (Z(X1)): PRINT " F"; 41185 GOSUB 45000:X = X1: RETURN ### unreachable? 43005 X2 = X2 + 1: IF X2 > 15 THEN VTAB (20): HTAB (6): PRINT VA$1VK$"L";: HTAB (34): PRINT "M":X2 = 0: POKE 2048,100: POKE 2049,30: CALL 2050 43010 IF X2 = 7 THEN VTAB (20): HTAB (6): PRINT " ";: HTAB (34): PRINT " "; 43020 IF PEEK ( - 16287) < 128 THEN 43005 43030 GOSUB 45000: PRINT VA$4VK$VI$;: RETURN ### chirp 45000 POKE 2048,30: POKE 2049,30: CALL 2050: POKE 2048,80: POKE 2049,50: CALL 2050: RETURN