Advertisement
grebenkov

Torpedo Fire (1981, SSI, Apple II) source code

Mar 6th, 2017
1,328
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  REM PROG=P0
  2.  2  POKE 214,128
  3.  5  POKE 24576,0: POKE 230,32: TEXT : HOME : FOR A = 768 TO 790: READ B: POKE A,B: NEXT
  4.  70  HTAB 4: VTAB 12: INVERSE : PRINT " LOADING INITIALIZATION PHASE ": NORMAL
  5.  80  CALL 768: &  RUN "P1",24577
  6.  1000  DATA 160,0,169,32,132,0,133,1,152,145,0,200,208,251,230,1,165,1,201,96,208,242,96
  7.  
  8.  
  9.  REM PROG = P1
  10.  4  LOMEM: 38400
  11.  2573
  12.  17487 E%(15),X%(15),Y%(15),SCALE%(15),XROT%(15),YROT%(15),ZROT%(15),SX%(15),SY%(15)
  13.  20 RESET% = 7932:CLR% = 7951:HIRES% = 7983:CRNCH% = 7737:TXTGEN% = 768
  14.  50 I =  FRE (0)
  15.  52 PI = 355 / 113
  16.  60  &  RECALL "HT": CALL 3072
  17.  150  FOR I = 16386 TO 16406
  18.  152  READ J
  19.  154  POKE I,J
  20.  156  NEXT
  21.  158  DATA 173,48,192,136,208,5
  22.  160  DATA 206,1,64,240,9,202,208
  23.  162  DATA 245,174,0,64,76,2,64,96
  24.  163  DATA  210,50,210,50,190,50,170,50,210,50,170,50,190,50
  25.  164  DATA  250,170,185,70,200,20,190,50,150,150,190,200
  26.  165  DATA  210,50,190,50,170,50,150,20,190,50,150,100
  27.  166  FOR X1 = 2450 TO 2487: READ X: POKE X1,X: NEXT
  28.  170  GOTO 180
  29.  175  POKE 16384,XA: POKE 16385,XB: CALL 16386: RETURN
  30.  180  POKE 772,20: PRINT  CHR$ (5): PRINT  CHR$ (3);"9": PRINT  CHR$ (2);"0": PRINT  CHR$ (3);"3": PRINT  CHR$ (12): PRINT  CHR$ (16)
  31.  185  PRINT "   !.#$%&'()*+,-"
  32.  190  PRINT "  0123456789:;<="
  33.  195  PRINT "  @ABCDEFGHIJKLM"
  34.  200  PRINT "  PQRSTUVWXYZ"; CHR$ (91); CHR$ (92);"]"
  35.  202  PRINT "  ";
  36.  205  FOR LM = 96 TO 110
  37.  207  PRINT  CHR$ (LM);
  38.  208  NEXT
  39.  209  PRINT "": PRINT "  ";
  40.  210  FOR LM = 112 TO 126
  41.  212  PRINT  CHR$ (LM);
  42.  214  NEXT
  43.  216  PRINT ""
  44.  220  POKE 772,28: PRINT  CHR$ (18): PRINT  CHR$ (0)
  45.  225  PRINT "   Strategic Simulations Incorporated"
  46.  230  HTAB 17: PRINT "presents"
  47.  232  HTAB 12: PRINT "a game designed by"
  48.  236  HTAB 16: PRINT "John Lyon"
  49.  245  GOSUB 20080
  50.  250  GOSUB 41000
  51.  270  VTAB 16: HTAB 1: PRINT
  52.  272  PRINT " (C) 1981   Strategic Simulations Inc."
  53.  300  PRINT : PRINT "You may:"
  54.  304  PRINT " 1. Play the Introductory scenario ?"
  55.  306  PRINT " 2. Re-start a game you've saved ?"
  56.  308  PRINT " 3. Create a new scenario (Shipyard) ?"
  57.  309  PRINT " 4. Play a scenario you've created ?"
  58.  13925  PRINT " 5. Read last minute ERRATA ?"
  59.  312  PRINT "Which ?";: GOSUB 25000
  60.  313  IF AA$ = "5" THEN  GOSUB 60000: GOTO 250
  61.  314  IF AA$ = "1" THEN AA$ = "INTRO-GAME": GOTO 11100
  62.  316  IF AA$ = "2" THEN 380
  63.  318  IF AA$ = "3" THEN 330
  64.  319  IF AA$ = "4" THEN 11000
  65.  320  PRINT : PRINT : PRINT "Come on you TURKEY, enter a number from 1 to 5"
  66.  322  GOSUB 20000
  67.  324  GOTO 250
  68.  330  PRINT : PR# 0: IN# 0: REM RUN SCENARIO MAKER
  69.  332  TEXT : HOME :I =  FRE (0)
  70.  334  HTAB 9: VTAB 12: INVERSE : PRINT " LOADING SCENARIO MAKER ": NORMAL
  71.  335  GOTO 12000
  72.  336  STOP
  73.  380  REM
  74.  382  PRINT : PRINT : PRINT "Please remove the GAME disc and insert  the disc with the game SAVEd on it."
  75.  390  PRINT : PRINT "Hit 'RETURN' when ready-";: GOSUB 25000
  76.  392  PRINT : PRINT : & C AT
  77.  400  PRINT : PRINT : PRINT "Enter NAME file saved under-": PRINT : GOSUB 25000
  78.  410 F0% = 1
  79.  500  PRINT : &  READ AA$
  80.  512  INPUT SA: INPUT SB: INPUT SC: INPUT SD: INPUT SE: INPUT SF: INPUT SG
  81.  514  INPUT SH: INPUT SI: INPUT SJ: INPUT SK: INPUT SL: INPUT SM: INPUT SN: INPUT SO
  82.  516  INPUT SP: INPUT SQ: INPUT SR: INPUT SS: INPUT ST: INPUT SU: INPUT SV: INPUT SW
  83.  518  INPUT SX: INPUT SY: INPUT SZ: INPUT SA%: INPUT SB%: INPUT SC%: INPUT SD%: INPUT SE%: INPUT SF%: INPUT S9
  84.  520  INPUT UT: INPUT QP%: INPUT VU%: INPUT VS%
  85.  2573  INPUT NE%: INPUT NT%: INPUT NF%: INPUT NS%
  86.  3176  GOSUB 30000: REM PARAMETERS
  87.  530  FOR I = 0 TO UT: INPUT U$(I): NEXT
  88.  532  FOR I = 0 TO UT: INPUT UX(I): NEXT
  89.  534  FOR I = 0 TO UT: INPUT UY(I): NEXT
  90.  540  FOR I = 0 TO 20: INPUT WX(I): NEXT
  91.  542  FOR I = 0 TO 20: INPUT WY(I): NEXT
  92.  544  FOR I = 0 TO 20: INPUT WZ(I): NEXT
  93.  546  FOR I = 0 TO 20: INPUT WT%(I): NEXT
  94.  550 J = CO%
  95.  560  FOR I = 0 TO J: INPUT MO$(I): NEXT
  96.  562  FOR I = 0 TO J: INPUT FO$(I): NEXT
  97.  570  INPUT WI%: INPUT TI%
  98.  580  FOR I = 0 TO 19: INPUT TX(I): NEXT
  99.  18025  FOR I = 0 TO 19: INPUT TY(I): NEXT
  100.  584  FOR I = 0 TO 19: INPUT TZ%(I): NEXT
  101.  588  INPUT TA$: INPUT QS%: INPUT TD$
  102.  590 J = NS%: FOR I = 0 TO J: INPUT TB$(I): NEXT
  103.  592  FOR I = 0 TO J: INPUT TS$(I): NEXT
  104.  600  INPUT PS$: INPUT PU$: INPUT CT%: INPUT QB%
  105.  700  &  END
  106.  710  IF AA$ = "Game Data" THEN QP% = 0
  107.  720  IF F0% = 0 THEN 1310
  108.  722 F0% = 0
  109.  730  PRINT : PRINT "Please insert the GAME disc"
  110.  740  PRINT : PRINT "Hit RETURN when ready ";: GOSUB 25000
  111.  750  FOR U = 0 TO UT
  112.  760 XN(U) = UX(U):YN(U) = UY(U):U$ = U$(U)
  113.  770 UN$ =  LEFT$ (U$,1) +  MID$ (U$,SI,2) +  MID$ (U$,SN,3)
  114.  780  IF U < US% THEN 800
  115.  790  IF  MID$ (U$,SM,3) <  > "000" THEN UN$ =  LEFT$ (U$,1) +  MID$ (U$,SK,2) +  MID$ (U$,SN,3)
  116.  800 UN$(U) = UN$
  117.  810  NEXT
  118.  820  PRINT : PR# 0: IN# 0
  119.  830  TEXT : HOME :I =  FRE (0): IF QS% <  > 69 THEN 900
  120.  840  VTAB 12: HTAB 12: INVERSE : PRINT " LOADING 'ACE' ": NORMAL
  121.  850  &  GOTO "SOL"
  122.  900  VTAB 12: HTAB 10: INVERSE : PRINT " LOADING ORDERS PHASE "
  123.  910  HTAB 13: PRINT " SUBMARINE SIDE ": NORMAL
  124.  920  &  GOTO "P3"
  125.  1310  PRINT : PRINT : PRINT "Do you wish to play against a (H)uman or against the (C)omputer  ": GOSUB 25000
  126.  1312  GOSUB 31340
  127.  1320  IF AA$ = "H" THEN 1350
  128.  1330  IF AA$ = "C" THEN QS% = 69: GOSUB 40000: GOTO 1350
  129.  1332  PRINT : PRINT "Please enter a 'C' or an 'H'": GOSUB 20180: GOTO 1310
  130.  1350  PRINT : PRINT "Do you wish to play a (D)ay or a (N)ight scenario ";: GOSUB 25000
  131.  1360  IF AA$ = "D" OR AA$ = "N" THEN TD$ = AA$: GOTO 1372
  132.  1370  PRINT : PRINT "Only 'D N' allowed": GOSUB 20180: GOTO 1350
  133.  1372  PRINT : PRINT "Do you wish the 'BEGINNER'S OPTION' (See ERRATA) ": PRINT "Enter Y if Yes ";: GOSUB 25000: IF AA$ = "Y" THEN QB% = 69
  134.  1380  IF QS% <  > 69 THEN  GOSUB 42000
  135.  10200  PRINT : PR# 0: IN# 0
  136.  10210  GOSUB 17000
  137.  10500  TEXT : HOME :I =  FRE (0)
  138.  10510  HTAB 5: VTAB 12: INVERSE : PRINT " LOADING INITIAL SEARCH PHASE ": NORMAL
  139.  10600  &  GOTO "P5"
  140.  11000 : REM READ & SET-UP SCENARIO ***************
  141.  11010  PRINT : PRINT "Please remove game disc and insert the   disc with the new scenario."
  142.  11020  PRINT : PRINT "Hit 'RETURN' when ready. ";: GOSUB 25000
  143.  11022  PRINT : & C AT
  144.  11030  PRINT : PRINT "Enter the NAME of this scenario. ": GOSUB 25000
  145.  11100  PRINT : &  READ AA$
  146.  11112  INPUT SA: INPUT SB: INPUT SC: INPUT SD: INPUT SE: INPUT SF: INPUT SG
  147.  11114  INPUT SH: INPUT SI: INPUT SJ: INPUT SK: INPUT SL: INPUT SM: INPUT SN: INPUT SO
  148.  11116  INPUT SP: INPUT SQ: INPUT SR: INPUT SS: INPUT ST: INPUT SU: INPUT SV: INPUT SW
  149.  11118  INPUT SX: INPUT SY: INPUT SZ: INPUT SA%: INPUT SB%: INPUT SC%: INPUT SD%: INPUT SE%: INPUT SF%: INPUT S9
  150.  11120  INPUT UT: INPUT NE%: INPUT NT%: INPUT NF%: INPUT NS%
  151.  11130  GOSUB 30000: REM DIM'S & PARAMETERS
  152.  11140  FOR I = 0 TO UT: INPUT U$(I): NEXT
  153.  11150  FOR I = 0 TO UT: INPUT UX(I): NEXT
  154.  11160  FOR I = 0 TO UT: INPUT UY(I): NEXT
  155.  11170  INPUT TF$
  156.  11200  &  END
  157.  11202  IF AA$ = "INTRO-GAME" THEN 1310
  158.  11210  PRINT : PRINT "Please insert the game disc."
  159.  11220  PRINT : PRINT "Hit 'RETURN' when ready. ";: GOSUB 25000
  160.  11300  GOTO 1310
  161.  12000  REM POKE THE SHIT OUT OF THIS THING *************
  162.  12050  POKE 2048,0: &  RUN "P1A",2049
  163.  17000  REM  GARBAGE **
  164.  17030  PRINT : PR# 0: IN# 0
  165.  17040  TEXT : HOME
  166.  17070  PRINT : &  RECALL "MODULE.TWO.D"
  167.  17080  CALL RESET%: CALL CRNCH%: CALL CRNCH%
  168.  17999  RETURN
  169.  20000  IF Q9% <  > 0 THEN  RETURN
  170.  20002  FOR LM = 1 TO 2: FOR X1 = 1 TO 50: NEXT
  171.  20004  FOR X2 = 1 TO 6:XA =  PEEK ((X2 - 1) * 2 + 2114):XB =  PEEK ((X2 - 1) * 2 + 2115): GOSUB 175: NEXT
  172.  20006  NEXT
  173.  20010  RETURN
  174.  20040  IF Q9% <  > 0 THEN  RETURN
  175.  20042  FOR LM = 1 TO 2: FOR X1 = 1 TO 50: NEXT
  176.  20044  FOR X2 = 1 TO 7:XA =  PEEK ((X2 - 1) * 2 + 2100):XB =  PEEK ((X2 - 1) * 2 + 2101): GOSUB 175: NEXT
  177.  20046  NEXT
  178.  20050  RETURN
  179.  20080  IF Q9% <  > 0 THEN  RETURN
  180.  20082  FOR LM = 1 TO 2: FOR X1 = 1 TO 50: NEXT
  181.  20084  FOR X2 = 1 TO 6:XA =  PEEK ((X2 - 1) * 2 + 2476):XB =  PEEK ((X2 - 1) * 2 + 2477): GOSUB 175: NEXT
  182.  20088  NEXT
  183.  20090  RETURN
  184.  20180  IF Q9% <  > 0 THEN 20195
  185.  20181  FOR LM = 1 TO 25
  186.  20182  POKE 16384,200: POKE 16385,6: CALL 16386
  187.  20184  POKE 16384,175: POKE 16385,2: CALL 16386
  188.  20186  NEXT LM
  189.  20190  RETURN
  190.  20195  FOR LM = 0 TO 1000: NEXT
  191.  20197  RETURN
  192.  25000 J = 1:AA$ = "": POKE 16384,27: POKE 16385,5: CALL 16386
  193.  25005 K = 1
  194.  25006 I =  PEEK ( - 16384): IF I > 127 THEN 25017
  195.  25007  INVERSE : PRINT " "; CHR$ (8);: NORMAL
  196.  25008 K = K + 1: IF K < 10 THEN 25006
  197.  25010 K = 1
  198.  25013 I =  PEEK ( - 16384): IF I > 127 THEN 25017
  199.  25014  PRINT " "; CHR$ (8);
  200.  25015 K = K + 1: IF K < 5 THEN 25013
  201.  25016  GOTO 25005
  202.  25017  POKE  - 16368,0:I = I - 128:C$ =  CHR$ (I)
  203.  25018  IF C$ =  CHR$ (13) THEN 25035
  204.  25019  PRINT C$;
  205.  25020  IF C$ =  CHR$ (8) THEN 25040
  206.  25025 AA$ = AA$ + C$: IF J > 20 THEN 25000
  207.  25030 J = J + 1: GOTO 25005
  208.  25035  PRINT " ";: RETURN
  209.  25040 J = J - 1: IF J < 2 THEN 25000
  210.  25045  NORMAL : PRINT "  "; CHR$ (8);:AA$ =  LEFT$ (AA$,J - 1): HTAB ( POS (0)): GOTO 25005
  211.  30000  REM SHIP TABLES *****************
  212.  30020  DIM U$(UT),UX(UT),UY(UT),XN(UT),YN(UT)
  213.  30500  REM NE% = # OF ESCORTS
  214.  30502 UE% = 0: REM U$ IDX TO 1ST ESCORT
  215.  30510  REM NT% = # OF TANKERS
  216.  30512 UT% = NE%: REM  U$ IDX TO 1ST TANKER
  217.  30520  REM NF% = # OF FREIGHTERS
  218.  30522 UF% = UT% + NT%
  219.  30530  REM NS% = # OF SUBS
  220.  30532 US% = UF% + NF%
  221.  30600  DIM MO$(NE% + NS%),FO$(NE% + NS%),FS$(NE% + NS%): REM MOVE &  FIRE ORDERS
  222.  30602  DIM TU%(NE% + NS%): REM TIME USED FOR EACH ORDER
  223.  30610 CO% = NE% + NS%: REM IDX TO O$ FOR CONVOY
  224.  31200  REM DEPTH CHARGE DATA
  225.  31210  DIM WX(20),WY(20),WZ(20),WT%(20)
  226.  31300  REM TORPEDO DATA ********************
  227.  31310  DIM TX(20),TY(20),TZ%(20)
  228.  31320 TA$ = "0000000000000000000000": REM  TIMES FOR 19 TORPEDOES
  229.  31330  DIM TB$(NS%),TS$(NS%)
  230.  31331  GOTO 32000
  231.  31340 A = NS% - 1
  232.  31350  FOR I = 0 TO A
  233.  31360 J = I + US%:B =  VAL ( MID$ (U$(J),SD%,1)):S =  VAL ( MID$ (U$(J),SE%,1))
  234.  31370 A$ = "X         X":TB$(I) = A$:TS$(I) = A$
  235.  31380 K = B: GOSUB 31800:TB$(I) = A$:K = S:A$ = TS$(I): GOSUB 31800:TS$(I) = A$
  236.  31390  NEXT
  237.  31400  RETURN
  238.  31800 J = 1: IF K = 0 THEN  RETURN : REM  K=# OF TUBES TO LOAD
  239.  31810 A$ =  LEFT$ (A$,J) + "L" +  RIGHT$ (A$,10 - J)
  240.  31820 J = J + 1: IF J <  = K THEN 31810
  241.  31830  RETURN
  242.  32000  REM UN$ STRING ************
  243.  2573 } REM 1=GRAPHICS ID
  244.  32020  REM 2-3=CURRENT SPEED
  245.  32030  REM 4-6=CURRENT DIRECTION
  246.  32100  DIM UN$(UT)
  247.  39999  RETURN
  248.  40000 UU = US% - 1:X = 0:Y = 0:Y0 = 0: REM SOL SET-UP **
  249.  40010  FOR U = 0 TO UU
  250.  40012  IF UX(U) = 69000 THEN 40050
  251.  40020  IF UX(U) > X THEN X = UX(U)
  252.  40030  IF UY(U) > Y THEN Y = UY(U)
  253.  40040  IF UY(U) < Y0 THEN Y0 = UY(U)
  254.  40050  NEXT
  255.  40100 UU = US%
  256.  40110  FOR U = UU TO UT
  257.  40112 U$(U) =  LEFT$ (U$(U),SN - 1) + "270" +  RIGHT$ (U$(U),S9 - SN - 2)
  258.  40120 D = 1000 *  RND (1):UX(U) = X + 2000 + D
  259.  40130 Y1 = Y + 1000 + 500 *  RND (1): IF  RND (1) > .5 THEN Y1 = Y0 - 1000 - 500 *  RND (1)
  260.  40140 UY(U) = Y1 *  RND (1)
  261.  40150  NEXT
  262.  40200  RETURN
  263.  41000  FOR I = 0 TO 2000: NEXT : VTAB 10
  264.  41010  PRINT  CHR$ (3);"0": PRINT  CHR$ (2);"0"
  265.  41020  PRINT  CHR$ (12): VTAB 4
  266.  41030  PRINT  CHR$ (5): PRINT  CHR$ (3);"2"
  267.  41032  FOR I = 0 TO 3: PRINT  CHR$ (9);: NEXT
  268.  41040  PRINT "TORPEDO FIRE"
  269.  41090  PRINT  CHR$ (18): PRINT  CHR$ (3);"9"
  270.  41100  RETURN
  271.  42000  PRINT  CHR$ (12)
  272.  42010  PRINT "Surface side turn away": PRINT
  273.  42020  PRINT "Sub side enter 2 letter PASSWORD ";: GOSUB 25000:A =  LEN (AA$): IF A <  > 2 THEN 42000
  274.  42030 PU$ = AA$: PRINT  CHR$ (12)
  275.  42040  PRINT "Sub side turn away"
  276.  42050  PRINT : PRINT "Surface side enter 2 letter PASSWORD ";: GOSUB 25000:A =  LEN (AA$): IF A <  > 2 THEN  PRINT  CHR$ (12): GOTO 42040
  277.  42060 PS$ = AA$: RETURN
  278.  60000  PRINT  CHR$ (12)
  279.  60010  PRINT "* BEGINEER'S OPTION - If an underwater    weapon (DC,AT or K-Gun) detonates       within 250 yards of a sub then:"
  280.  60020  PRINT "  1. Damage is caused if the X,Y             distance is less than 75 yards and      the depth differential is less than     75 feet."
  281.  60030  PRINT "  2. The X,Y distance is displayed           during the COMPUTER ACTIVITY PHASE."
  282.  60040  PRINT "* 6.21 Ahead-Throw weapons sink at a      rate of 10 feet per second. If a sub's";
  283.  60050  PRINT "  X,Y is within 50 yards and the depth   differential is within 50 feet then the charge detonates. It will automatically detonate when 1000 feet underwater."
  284.  60090  VTAB 24: HTAB 1: PRINT "Hit RETURN to continue. ";: GOSUB 25000: RETURN
  285.  
  286.  
  287.  REM PROG = P1A
  288.  4 I =  FRE (0)
  289.  69 PI = 3.14159
  290.  70  GOTO 10000
  291.  1000  HOME : PRINT "MAP OF 500 YARD SQUARES"
  292.  1200  FOR U = 0 TO UT
  293.  1210 I = 10 - UY(U) / 500: IF I < 1 OR I > 20 THEN 1230
  294.  1212 J = 20 + UX(U) / 500: IF J < 1 OR J > 40 THEN 1230
  295.  1220  VTAB I: HTAB J: PRINT  MID$ (U$(U),SB,1)
  296.  1230  NEXT
  297.  1240  RETURN
  298.  10000  TEXT : HOME :I =  FRE (0): REM MAIN **
  299.  10020  VTAB 12: HTAB 12: INVERSE : FLASH
  300.  10030  PRINT " S S I    SHIPYARD "
  301.  10040  NORMAL : VTAB 18: PRINT "YOU MAY": PRINT : PRINT "  1. CREATE A NEW SCENARIO": PRINT "  2. MODIFY AN EXISTING SCENARIO": PRINT : PRINT "WHICH ";: INPUT A$
  302.  10050  IF A$ = "1" THEN 10100
  303.  10060  IF A$ = "2" THEN 40000
  304.  10070  PRINT "ONLY '1 2' ALLOWED": GOSUB 52000: GOTO 10000
  305.  10100  GOSUB 11000: REM SET UP
  306.  10110  GOSUB 51000: REM GET INIT DATA
  307.  34826 ' GOSUB 22000: REM  SET UP CLASS
  308.  52746 ' TEXT : HOME
  309.  55306 ' GOSUB 13000: REM MENU CONTROL
  310.  15370 ( TEXT : HOME
  311.  17930 ( PRINT "DO YOU WISH TO WRITE THE FILE NOW ?"
  312.  20490 ( PRINT : PRINT "ENTER Y/N ";: INPUT A$
  313.  23050 ( IF A$ = "N" THEN 10200
  314.  25610 ( IF A$ <  > "Y" THEN  GOSUB 52000: GOTO 10300
  315.  28170 ( GOTO 50000: REM WRITE DATA FILE
  316.  40970 ( GOTO 19000: REM BACK TO P1
  317.  63498 * GOSUB 14000: GOTO 11440: REM SET UP **
  318.  522 + HOME
  319.  11100  PRINT : PRINT "HOW MANY ESCORT SHIPS (1-9) ";: INPUT A$
  320.  11110 E =  VAL (A$): IF E < 1 OR E > 9 THEN  GOSUB 52000: GOTO 11100
  321.  11120  PRINT : PRINT "HOW MANY TANKERS (0-9) ";: INPUT A$
  322.  11130 T =  VAL (A$): IF T < 0 OR T > 9 THEN  GOSUB 52000: GOTO 11120
  323.  11140  PRINT : PRINT "HOW MANY FREIGHTERS (0-9) ";: INPUT A$
  324.  11150 F =  VAL (A$): IF F < 0 OR F > 9 THEN  GOSUB 52000: GOTO 11140
  325.  11160  PRINT : PRINT "HOW MANY SUBS (1-9) ";: INPUT A$
  326.  11170 S =  VAL (A$): IF S < 1 OR S > 9 THEN  GOSUB 52000: GOTO 11160
  327.  11200 UT = E + T + F + S - 1: IF T = 0 THEN UT = UT + 1
  328.  11202  IF F = 0 THEN UT = UT + 1
  329.  11210  DIM U$(UT),UN$(UT),UX(UT),UY(UT),XN(UT),YN(UT)
  330.  11250 U = 0:I = 1:A$ = "DUMMY"
  331.  11260 U$(U) = "2E" +  STR$ (I) + A$
  332.  11270 U = U + 1:I = I + 1: IF I <  = E THEN 11260
  333.  11280 I = 1
  334.  11290 U$(U) = "0T" +  STR$ (I) + A$
  335.  9226 ,U = U + 1:I = I + 1: IF I <  = T THEN 11290
  336.  11786 ,I = 1
  337.  14346 ,U$(U) = "1F" +  STR$ (I) + A$
  338.  16906 ,U = U + 1:I = I + 1: IF I <  = F THEN 11320
  339.  19466 ,I = 1
  340.  22026 ,U$(U) = "3S" +  STR$ (I) + A$
  341.  24586 ,U = U + 1:I = I + 1: IF I <  = S THEN 11350
  342.  34826 , PRINT : PRINT "(F)AST OR (S)LOW CONVOY ";: INPUT A$
  343.  37386 , IF A$ = "F" THEN CS$ = "12": RETURN
  344.  39946 , IF A$ = "S" THEN CS$ = "08": RETURN
  345.  42506 , PRINT "ONLY 'F S' ALLOWED": GOSUB 52000: GOTO 11400
  346.  11440  PRINT : PRINT "SURFACE SIDE CHOOSE NATIONALITY"
  347.  11450  PRINT "(A)MERICAN (B)RITISH (G)ERMAN (J)APAN"
  348.  11460  INPUT A$
  349.  11470  IF A$ = "A" OR A$ = "B" OR A$ = "G" OR A$ = "J" THEN 11490
  350.  11480  PRINT "ENTER 'A B G J' DUMMY": GOSUB 52000: GOTO 11440
  351.  11490 NS$ = A$: IF A$ = "N" THEN  PRINT "NO CODE YET": STOP
  352.  11500  PRINT : PRINT "SUB SIDE CHOOSE NATIONALITY"
  353.  11510  PRINT "(A)MERICAN (B)RITISH (G)ERMAN (J)APAN"
  354.  11520  INPUT A$
  355.  2573 - IF A$ = "A" OR A$ = "B" OR A$ = "G" OR A$ = "J" THEN 11550
  356.  11540  PRINT "ENTER 'A B G J' DOPE": GOSUB 52000: GOTO 11500
  357.  11550 NU$ = A$: IF A$ = "N" THEN  PRINT "NO CODE YET": STOP
  358.  11560  PRINT : PRINT "CHOOSE A TIME PERIOD FROM BELOW": PRINT "1) 1939 - 1941": PRINT "2) 1942 - 1943": PRINT "3) 1944 - 1945": INPUT A$
  359.  11570  IF A$ = "1" OR A$ = "2" OR A$ = "3" THEN 11590
  360.  11580  PRINT "ONLY '1 2 3' ALLOWED": GOSUB 52000: GOTO 11560
  361.  11590 TP$ = A$: GOSUB 15000: GOTO 11100
  362.  12000  VTAB 23: REM MOD SHIP DATA **
  363.  12020  PRINT "ENTER SHIP ID (Q=QUIT M=MAP) ";: INPUT A$
  364.  12030  IF A$ = "M" THEN  GOSUB 1000: GOTO 12000
  365.  12040  IF A$ = "Q" THEN  RETURN
  366.  12050 U = 0
  367.  12060  IF A$ =  MID$ (U$(U),SB,2) THEN 12100
  368.  12070 U = U + 1: IF U <  = UT THEN 12060
  369.  12080  GOSUB 52000: GOTO 12000
  370.  12100  GOSUB 60000
  371.  12110  INPUT A$: IF A$ = "Q" THEN 12000
  372.  12120 A =  VAL (A$): IF A > 0 AND A < 4 THEN 12140
  373.  12130  GOSUB 52000: GOTO 12100
  374.  12140  ON A GOTO 20100,20200,20900
  375.  13000  GOSUB 12000
  376.  13010  RETURN
  377.  14000  REM EXPLAIN PROCESS
  378.  14100  TEXT : HOME
  379.  14110  HTAB 10: INVERSE : PRINT "SHIPYARD OVER VIEW": NORMAL
  380.  14120  PRINT : PRINT "1. CHOSE SIDES AND TIME PERIOD."
  381.  14130  PRINT : PRINT "2. PICK THE # OF SHIPS OF EACH TYPE."
  382.  14140  PRINT : PRINT "3. CHOSE THE CLASS OF ESCORTS AND SUBS."
  383.  14142  PRINT : PRINT "4. PLACE THE SHIPS ON THE MAP."
  384.  14150  PRINT : PRINT "5. SAVE THE FLEETS YOU'VE JUST CREATED."
  385.  14160  PRINT : PRINT "HIT 'RETURN' TO BEGIN";: INPUT A$: RETURN
  386.  15000  REM PREPAR FOR DIM ARRAYS
  387.  15010  HOME
  388.  15100  PRINT "THE COMPUTER NEEDS YOU TO CHOSE THE # OF SHIPS OF EACH OF THE 4 TYPES.": PRINT
  389.  15110  PRINT : PRINT "HIT 'RETURN' TO CONTINUE ";: INPUT A$
  390.  15120  RETURN
  391.  19000  HOME : REM RUN P0 **
  392.  19100  &  RUN "P0"
  393.  20100  PRINT "ENTER NEW X CO-ORDINATE ";: INPUT A$: REM  NEW X
  394.  20110 X =  VAL (A$): IF X >  - 20000 AND X < 20000 THEN 20130
  395.  20120  PRINT "X MUST BE FROM -19000 TO 19000": GOSUB 52000: GOTO 20100
  396.  20130 UX(U) = X:XN(U) = X: GOTO 12100
  397.  20200  PRINT "ENTER NEW Y CO-ORDINATE ";: INPUT A$: REM  NEW Y
  398.  20210 Y =  VAL (A$): IF Y >  - 20000 AND Y < 20000 THEN 20230
  399.  20220  PRINT "Y MUST BE FROM -19000 TO 19000": GOSUB 52000: GOTO 20200
  400.  20230 UY(U) = Y:YN(U) = Y: GOTO 12100
  401.  20900  HOME : VTAB 5: HTAB 15: INVERSE : FLASH : PRINT " WARNING ! ": NORMAL
  402.  20902  VTAB 10: PRINT "THIS IS A VERY POWERFULL OPTION.  IT    ALLOWS YOU TO CHANGE ANY FIELD IN THE   SHIP DESCRIPTION STRING. WHICH MEANS YOUCAN MAKE MISTAKES THAT WILL CAUSE THE   GAME TO 'BLOW UP' AT A LATER TIME."
  403.  20904  VTAB 18: INVERSE : FLASH : PRINT "SSI WILL NOT BE RESPONSIBLE FOR RESULTS IF YOU USE THIS OPTION": NORMAL
  404.  20906  VTAB 23: PRINT "HIT 'RETURN' OR (Q)UIT ";: INPUT A$: IF A$ = "Q" THEN 12100
  405.  20907  GOSUB 60000
  406.  20908  VTAB 22: HTAB 1: PRINT "ENTER POSITION OF FIELD ";
  407.  20910  PRINT "           ";: HTAB 25: INPUT A$: IF A$ = "Q" THEN 12100
  408.  20920 A =  VAL (A$): IF A > 1 AND A < S9 THEN 20940
  409.  20930  PRINT "# MUST BE 2-51": GOSUB 52000: GOTO 12100
  410.  20940  PRINT "ENTER # OF CHARACTERS TO BE CHANGED ";: INPUT A$: IF A$ = "Q" THEN 12100
  411.  20950 B =  VAL (A$): IF B > 0 AND B < 4 THEN 20970
  412.  20960  PRINT "BIGGEST FIELD = 3": GOSUB 52000: GOTO 12100
  413.  20970  IF A + B > S9 THEN  PRINT "FIRST & LAST CHARACTERS NOT CHANGEABLE": GOTO 20930
  414.  20972  PRINT "ENTER NEW FIELD ";: INPUT A$: IF A$ = "Q" THEN 12100
  415.  20980 U$ =  LEFT$ (U$,A - 1) +  RIGHT$ (A$,B) +  RIGHT$ (U$,S9 - A - B + 1)
  416.  20990 U$(U) = U$: GOTO 12100
  417.  22000  TEXT : HOME :B = 1:U = 0: REM CLASS **
  418.  22100  INVERSE : VTAB 10: HTAB 9: PRINT "ESCORT SELECTION PHASE": NORMAL : PRINT : PRINT "CHOSE ESCORT E";B;" FROM BELOW"
  419.  22110  IF NS$ = "A" THEN N = 7: GOTO 22150
  420.  22120  IF NS$ = "B" THEN N = 18: GOTO 22300
  421.  22130  IF NS$ = "G" THEN N = 22: GOTO 22400
  422.  22140  IF NS$ = "J" THEN N = 31: GOTO 22500
  423.  22145  STOP
  424.  22150  PRINT : PRINT "  1. BENSON": PRINT "  2. FLETCHER": PRINT "  3. FLUSH DECK": PRINT "  4. BUCKLEY": PRINT "  5. EDSALL": PRINT "  6. SUB CHASER": PRINT "  7. FRIGATE"
  425.  22160  PRINT : PRINT "WHICH ";: INPUT A$
  426.  22170 A =  VAL (A$): IF A > 0 AND A < 8 THEN 22190
  427.  22180  PRINT "ONLY 1 THRU 7 ALLOWED": GOSUB 52000: HOME : GOTO 22100
  428.  22190 U$ = S$(A - 1):I =  VAL ( MID$ (U$,SC,1)):J =  VAL (TP$): IF J >  = I THEN 22200
  429.  22192  GOSUB 52100: HOME : GOTO 22100
  430.  22200  GOSUB 53100
  431.  22210 U$(U) = U$:U = U + 1:B = B + 1: IF B <  = E THEN  HOME : GOTO 22100
  432.  22220  GOTO 22600
  433.  22300  PRINT : PRINT "  1. TRIBAL": PRINT "  2. BATTLE": PRINT "  3. BLACK SWAN": PRINT "  4. FLOWER": PRINT "  5. RIVER": PRINT "  6. LOCH"
  434.  22310  PRINT : PRINT "WHICH ";: INPUT A$
  435.  22320 A =  VAL (A$): IF A > 0 AND A < 7 THEN 22340
  436.  22330  PRINT "ONLY 1 THRU 6 ALLOWED": GOSUB 52000: HOME : GOTO 22100
  437.  22340 U$ = S$(A - 1 + 12):I =  VAL ( MID$ (U$,SC,1)):J =  VAL (TP$): IF J >  = I THEN 22350
  438.  22342  GOSUB 52100: HOME : GOTO 22100
  439.  22350  GOSUB 53100
  440.  22360 U$(U) = U$:U = U + 1:B = B + 1: IF B <  = E THEN  HOME : GOTO 22100
  441.  22370  GOTO 22600
  442.  22400  VTAB 12: PRINT "GERMAN ESCORTS ARE ALL CLASS = Z-23"
  443.  22402  PRINT "THE COMPUTER WILL FILL THEM IN FOR YOU"
  444.  22410  FOR I = 0 TO 1000: NEXT
  445.  22420 U$ = S$(21): GOSUB 53100
  446.  22430 U$(U) = U$:U = U + 1:B = B + 1: IF B <  = E THEN 22420
  447.  22440  PRINT : PRINT "HIT 'RETURN' WHEN READY ";: INPUT A$: GOTO 22600
  448.  22500  PRINT : PRINT "  1. AKITSUKI": PRINT "  2. HATSUHARU": PRINT "  3. KAMIKAZE": PRINT "  4. MATSU"
  449.  22510  PRINT : PRINT "WHICH ";: INPUT A$
  450.  22520 A =  VAL (A$): IF A > 0 AND A < 5 THEN 22540
  451.  22530  PRINT "ONLY 1 THRU 4 ALLOWED": GOSUB 52000: HOME : GOTO 22100
  452.  22540 U$ = S$(A - 1 + 27):I =  VAL ( MID$ (U$,SC,1)):J =  VAL (TP$): IF J >  = I THEN 22550
  453.  22542  GOSUB 52100: HOME : GOTO 22100
  454.  22550  GOSUB 53100
  455.  22560 U$(U) = U$:U = U + 1:B = B + 1: IF B <  = E THEN  HOME : GOTO 22100
  456.  22600  HOME : VTAB 10: PRINT "THE COMPUTER IS PUTTING YOUR TANKERS AND FREIGHTERS IN FOR YOU"
  457.  22610  FOR I = 1 TO 1000: NEXT
  458.  22620 B = 1
  459.  22630 U$ = S$(N): GOSUB 53100:I = SH: GOSUB 53000
  460.  22640 U$(U) = U$:U = U + 1:B = B + 1: IF B <  = T THEN  GOTO 22630
  461.  22650 B = 1: IF T = 0 THEN UX(U - 1) = 69000:T = 1
  462.  22660 U$ = S$(N + 1): GOSUB 53100:I = SH: GOSUB 53000
  463.  22670 U$(U) = U$:U = U + 1:B = B + 1: IF B <  = F THEN  GOTO 22660
  464.  22672  IF F = 0 THEN UX(U - 1) = 69000:F = 1
  465.  22680  PRINT : PRINT "HIT 'RETURN' WHEN READY ";: INPUT A$
  466.  22700 B = 1
  467.  22702  HOME : VTAB 10: HTAB 9: INVERSE : PRINT "SUBMARINE SELECTION PHASE": NORMAL : PRINT : PRINT "CHOSE SUB S";B;" FROM BELOW"
  468.  22704  IF NU$ = "A" THEN 22750
  469.  22710  IF NU$ = "B" THEN 22900
  470.  22720  IF NU$ = "G" THEN 23000
  471.  22730  IF NU$ = "J" THEN 23300
  472.  22735  STOP
  473.  22750  PRINT : PRINT "  1. SARGO": PRINT "  2. GATO": PRINT "  3. TENCH"
  474.  22760  PRINT : PRINT "WHICH ";: INPUT A$
  475.  22770 A =  VAL (A$): IF A > 0 AND A < 4 THEN 22790
  476.  22780  PRINT "ONLY 1 THRU 3 ALLOWED": GOSUB 52000: HOME : GOTO 22702
  477.  22790 U$ = S$(A - 1 + 9):I =  VAL ( MID$ (U$,SC,1)):J =  VAL (TP$): IF J >  = I THEN 22798
  478.  22792  GOSUB 52100: HOME : GOTO 22702
  479.  22798  GOSUB 53200
  480.  22800 U$(U) = U$:U = U + 1:B = B + 1: IF B <  = S THEN 22702
  481.  22810  RETURN
  482.  22900  VTAB 12: PRINT "BRITISH SUBS ARE ALL CLASS = S-CLASS"
  483.  22910  PRINT "THE COMPUTER WILL FILL THEM IN FOR YOU": FOR I = 0 TO 1000: NEXT
  484.  22920 U$ = S$(20): GOSUB 53200
  485.  22930 U$(U) = U$:U = U + 1:B = B + 1: IF B <  = S THEN 22920
  486.  22940  PRINT : PRINT "HIT 'RETURN' WHEN READY ";: INPUT A$: RETURN
  487.  23000  PRINT : PRINT "  1. VII C": PRINT "  2. IX C": PRINT "  3. XXI"
  488.  23010  PRINT : PRINT "WHICH ";: INPUT A$
  489.  23020 A =  VAL (A$): IF A > 0 AND A < 4 THEN 23040
  490.  23030  PRINT "ONLY 1 THRU 3 ALLOWED": GOSUB 52000: GOTO 22702
  491.  23040 U$ = S$(A - 1 + 24):I =  VAL ( MID$ (U$,SC,1)):J =  VAL (TP$): IF J >  = I THEN 23048
  492.  23042  GOSUB 52100: HOME : GOTO 22702
  493.  23048  GOSUB 53200
  494.  2573 ZU$(U) = U$:U = U + 1:B = B + 1: IF B <  = S THEN 22702
  495.  23060  RETURN
  496.  23300  PRINT : PRINT "  1. RO 35": PRINT "  2. RO 100": PRINT "  3. I 15": PRINT "  4. I 16": PRINT "  5. I 176"
  497.  23310  PRINT : PRINT "WHICH ";: INPUT A$
  498.  23320 A =  VAL (A$): IF A > 0 AND A < 6 THEN 23340
  499.  23330  PRINT "ONLY 1 THRU 5 ALLOWED": GOSUB 52000: GOTO 22702
  500.  23340 U$ = S$(A - 1 + 33):I =  VAL ( MID$ (U$,SC,1)):J =  VAL (TP$): IF J >  = I THEN 23348
  501.  23342  GOSUB 52100: HOME : GOTO 22702
  502.  23348  GOSUB 53200
  503.  23350 U$(U) = U$:U = U + 1:B = B + 1: IF B <  = S THEN 22702
  504.  23360  RETURN
  505.  30000  TEXT : HOME :U$ = U$(U): REM MAIN MENU **
  506.  30020 N$ =  MID$ (U$,SD,1)
  507.  30100  HTAB 15: INVERSE : PRINT "SHIPYARD MENU": NORMAL
  508.  30110  PRINT "NATION IS ";: IF N$ = "A" THEN  PRINT "AMERICAN";: GOTO 30200
  509.  30120  IF N$ = "B" THEN  PRINT "BRITISH";: GOTO 30200
  510.  30130  IF N$ = "G" THEN  PRINT "GERMANY";: GOTO 30200
  511.  30140  IF N$ = "J" THEN  PRINT "JAPAN";: GOTO 30200
  512.  30150  IF N$ = "N" THEN  PRINT "NONE";: GOTO 30200
  513.  30160  FLASH : PRINT "DANGER - NATION FIELD (5) BAD": NORMAL
  514.  30200  VTAB 3: HTAB 1: PRINT "TIME PERIOD IS ";: IF TP$ = "1" THEN  PRINT "1939 - 1941": GOTO 30300
  515.  30210  IF TP$ = "2" THEN  PRINT "1942 - 1943 ": GOTO 30300
  516.  30220  IF TP$ = "3" THEN  PRINT "1944 - 1945 ": GOTO 30300
  517.  30230  IF TP$ = "0" THEN  PRINT "NONE": GOTO 30300
  518.  30240  STOP  REM OVE THIS IF OK !!!!!!!!!
  519.  30300  VTAB 4: HTAB 1: PRINT "         1         2         3         4"
  520.  30310  VTAB 5: HTAB 1: PRINT "1234567890123456789012345678901234567890"
  521.  30320  VTAB 6: HTAB 1: PRINT  LEFT$ (U$,40)
  522.  30330  VTAB 8: HTAB 1: PRINT "         5         6"
  523.  30340  VTAB 9: HTAB 1: PRINT "12345678901234567890"
  524.  30350  VTAB 10: HTAB 1: PRINT  RIGHT$ (U$,S9 - 40)
  525.  30360  RETURN
  526.  40000  HOME : REM  READ OLD SCENARIO **
  527.  40020  VTAB 2: PRINT "PLEASE INSERT THE DISC THAT HAS YOUR OLD SCENARIO"
  528.  40030  PRINT : PRINT "HIT 'RETURN' WHEN READY ";: INPUT A$
  529.  40040  PRINT : PRINT "ENTER SCENARIO NAME ";: INPUT A$
  530.  40100  PRINT : &  READ A$
  531.  47143  NOTRACE  INPUT SA: INPUT SB: INPUT SC: INPUT SD: INPUT SE: INPUT SF: INPUT SG
  532.  40130  INPUT SH: INPUT SI: INPUT SJ: INPUT SK: INPUT SL: INPUT SM: INPUT SN: INPUT SO
  533.  40140  INPUT SP: INPUT SQ: INPUT SR: INPUT SS: INPUT ST: INPUT SU: INPUT SV: INPUT SW
  534.  40150  INPUT SX: INPUT SY: INPUT SZ: INPUT SA%: INPUT SB%: INPUT SC%: INPUT SD%: INPUT SE%: INPUT SF%: INPUT S9
  535.  40160  INPUT UT: INPUT E: INPUT T: INPUT F: INPUT S
  536.  40170  FOR I = 0 TO UT: INPUT U$(I): NEXT
  537.  40180  FOR I = 0 TO UT: INPUT UX(I): NEXT
  538.  40190  FOR I = 0 TO UT: INPUT UY(I): NEXT
  539.  40200  INPUT B$:NS$ =  LEFT$ (B$,1):NU$ =  MID$ (B$,2,1):TP$ =  RIGHT$ (B$,1)
  540.  40300  &  END
  541.  40310  PRINT : PRINT "PLEASE REMOVE YOUR DISC AND INSERT THE  GAME DISC."
  542.  40320  PRINT : PRINT "HIT 'RETURN' WHEN READY. ";: INPUT A$
  543.  40500  GOTO 10200
  544.  50000  TEXT : HOME : REM  WRITE SCENARIO **
  545.  50005  &  RECALL "SSI INIT"
  546.  50007  GOSUB 61000
  547.  50008  IF B$ = "Y" THEN 50040
  548.  50010  PRINT : PRINT "PLEASE REMOVE THE GAME DISC AND INSERT  AN SSI-SAVE-GAME DISC"
  549.  50020  PRINT : PRINT "HIT 'RETURN' WHEN READY ";: INPUT A$
  550.  50040  INVERSE : PRINT : HTAB 11: PRINT " DON'T FORGET! "
  551.  50050  PRINT " DISC MUST NOT BE WRITE PROTECTED! "
  552.  50060  PRINT " THERE MUST BE 10 SECTORS AVAILABLE! ": NORMAL
  553.  50062  PRINT : & C AT
  554.  50070  PRINT : PRINT "PLEASE ENTER THE NAME FOR THIS SCENARIO."
  555.  38954  SPC(  VTAB 24: PRINT : HTAB 15: INVERSE : PRINT "          ";
  556.  50080  HTAB 15: INPUT A$: NORMAL
  557.  50090  ONERR  GOTO 50200
  558.  50100  &  DEL A$
  559.  50200  POKE 216,0: &  DEF A$,10
  560.  50210  &  PRINT A$
  561.  50212  PRINT SA: PRINT SB: PRINT SC: PRINT SD: PRINT SE: PRINT SF: PRINT SG
  562.  50214  PRINT SH: PRINT SI: PRINT SJ: PRINT SK: PRINT SL: PRINT SM: PRINT SN: PRINT SO
  563.  50216  PRINT SP: PRINT SQ: PRINT SR: PRINT SS: PRINT ST: PRINT SU: PRINT SV: PRINT SW
  564.  50218  PRINT SX: PRINT SY: PRINT SZ: PRINT SA%: PRINT SB%: PRINT SC%: PRINT SD%: PRINT SE%: PRINT SF%: PRINT S9
  565.  50220  PRINT UT: PRINT E: PRINT T: PRINT F: PRINT S
  566.  50230  FOR I = 0 TO UT: PRINT U$(I): NEXT
  567.  50240  FOR I = 0 TO UT: PRINT UX(I): NEXT
  568.  50250  FOR I = 0 TO UT: PRINT UY(I): NEXT
  569.  50260 B$ = NS$ + NU$ + TP$: PRINT B$
  570.  50300  &  END
  571.  50302  PRINT : & C AT
  572.  50310  PRINT : PRINT "PLEASE REMOVE THE SSI-SAVE-GAME DISC AND INSERT THE GAME DISC."
  573.  50320  PRINT : PRINT "HIT 'RETURN' WHEN READY. ";: INPUT A$
  574.  50400  GOTO 10400
  575.  51000 A$ = "TF-SHIPS": REM  READ INIT DATA **
  576.  45100  STEP  PRINT : &  READ A$
  577.  51200  INPUT SA: INPUT SB: INPUT SC: INPUT SD: INPUT SE: INPUT SF: INPUT SG
  578.  51202  INPUT SH: INPUT SI: INPUT SJ: INPUT SK: INPUT SL: INPUT SM: INPUT SN: INPUT SO
  579.  51204  INPUT SP: INPUT SQ: INPUT SR: INPUT SS: INPUT ST: INPUT SU: INPUT SV: INPUT SW
  580.  51206  INPUT SX: INPUT SY: INPUT SZ: INPUT SA%: INPUT SB%: INPUT SC%: INPUT SD%: INPUT SE%: INPUT SF%: INPUT S9
  581.  2573  +  INPUT TS
  582.  51220  DIM S$(TS)
  583.  51230  FOR I = 0 TO TS: INPUT S$(I): NEXT
  584.  51300  &  END
  585.  51310  RETURN
  586.  52000  INVERSE : FLASH : PRINT : PRINT "ILLEGAL ENTRY"
  587.  52010  FOR I = 1 TO 3000: NEXT
  588.  13357  /  NORMAL : RETURN
  589.  52100  PRINT "NOT AVAILABLE YET": GOSUB 52000: RETURN
  590.  53000  REM  FIX STRING USING U$,I,J **
  591.  53010 U$ =  LEFT$ (U$,I - 1) + A$ +  RIGHT$ (U$,S9 - I - J + 1)
  592.  53020  RETURN
  593.  53100  REM  FIX ESCORT STRINGS **
  594.  53110 A$ =  STR$ (B):I = SB + 1:J = 1: GOSUB 53000
  595.  53120 A$ = CS$:I = SI:J = 2: GOSUB 53000
  596.  53130  RETURN
  597.  53200  REM  FIX STRINGS FOR SUBS **
  598.  53210 A$ =  STR$ (B):I = SB + 1:J = 1: GOSUB 53000
  599.  53220 A$ = "05":I = SK:J = 2: GOSUB 53000
  600.  53230  RETURN
  601.  60000  GOSUB 30000: REM  PRINT MODIFY DATA/MENU **
  602.  60020 U$ = U$(U)
  603.  60030  VTAB 13: HTAB 1: PRINT "ID="; MID$ (U$,SB,2);
  604.  60120  VTAB 14: HTAB 10: PRINT "1. X=";UX(U);: HTAB 25: PRINT "2. Y=";UY(U)
  605.  60160  VTAB 16: HTAB 10: PRINT "3. OTHER"
  606.  60500  VTAB 22: HTAB 1: PRINT "ENTER # OF FIELD TO CHANGE (Q=EXIT) ";
  607.  60510  RETURN
  608.  61000  REM  RDOS-STUFF
  609.  61002  PRINT
  610.  61010  PRINT "DO YOU WISH TO INITIALIZE A BLANK DISC  FOR SAVING SSI GAMES? ENTER (Y) IF 'YES'";: INPUT B$
  611.  61020  IF B$ <  > "Y" THEN 61100
  612.  61022  PRINT : PRINT "PLEASE INSERT A SCRATCH DISC.": PRINT "HIT 'RETURN' WHEN READY TO INITIALIZE ";: INPUT AA$
  613.  61030  FLASH : PRINT "INITIALIZING...": NORMAL : CALL 20480: IF  NOT  PEEK (0) GOTO 61100
  614.  61040  PRINT : PRINT "ERROR !!!": PRINT : GOTO 61000
  615.  61100  RETURN
  616.  63000  REM AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  617.  63001 PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  618.  
  619.  REM PROG = P2
  620.  4 I =  FRE (0):BL$ = "                                       "
  621.  5  IF F0 = 1 THEN  POKE  - 16301,0:F0 = 0: GOTO 10000
  622.  6  IF QP% <  > 0 THEN 30
  623.  2573
  624.  17487 E%(15),X%(15),Y%(15),SCALE%(15),XROT%(15),YROT%(15),ZROT%(15),SX%(15),SY%(15)
  625.  20 RESET% = 7932:CLR% = 7951:HIRES% = 7983:CRNCH% = 7737
  626.  30  &  RECALL "MODULE.TWO.D"
  627.  50  CALL RESET%
  628.  69 PI = 3.14159
  629.  70  GOTO 92
  630.  71 UU = NE% - 1: REM  RESET FSG FLAG **
  631.  72  FOR U = 0 TO UU
  632.  74 U$(U) =  LEFT$ (U$(U),SJ - 1) + "N" +  RIGHT$ (U$(U),S9 - SJ)
  633.  76  NEXT
  634.  78  RETURN
  635.  92 BL$ = "                                       "
  636.  100  IF QP% <  > 0 THEN  TEXT : GOTO 9000
  637.  680  TEXT : HOME : PRINT "READING DATA"
  638.  700 A$ = "INTRO-GAME"
  639.  710  &  READ A$
  640.  730  INPUT SA: INPUT SB: INPUT SC: INPUT SD: INPUT SE: INPUT SF: INPUT SG
  641.  740  INPUT SH: INPUT SI: INPUT SJ: INPUT SK: INPUT SL: INPUT SM: INPUT SN: INPUT SO
  642.  750  INPUT SP: INPUT SQ: INPUT SR: INPUT SS: INPUT ST: INPUT SU: INPUT SV: INPUT SW
  643.  760  INPUT SX: INPUT SY: INPUT SZ: INPUT SA%: INPUT SB%: INPUT SC%: INPUT SD%: INPUT SE%: INPUT SF%: INPUT S9
  644.  770  INPUT UT: INPUT NE%: INPUT NT%: INPUT NF%: INPUT NS%
  645.  780  FOR I = 0 TO UT: INPUT U$(I): NEXT
  646.  790  FOR I = 0 TO UT: INPUT UX(I): NEXT
  647.  800  FOR I = 0 TO UT: INPUT UY(I): NEXT
  648.  810  INPUT B$
  649.  890  &  END
  650.  900 UE% = 0:UT% = 2:UF% = 3:US% = 5:CO% = NE% + NS%
  651.  910  FOR I = 0 TO UT
  652.  920 U$ = U$(I):U$ =  LEFT$ (U$,SQ - 1) + "D" +  RIGHT$ (U$,S9 - SQ):U$(I) = U$
  653.  922 A =  LEN (U$): IF A <  > S9 THEN  STOP
  654.  930  NEXT
  655.  940 U$(5) =  LEFT$ (U$(5),SQ - 1) + "S" +  RIGHT$ (U$(5),S9 - SQ)
  656.  960  GOSUB 71
  657.  999  GOTO 9000
  658.  1000  TEXT : HOME : PRINT "X = ";: INPUT A$: IF A$ = "" THEN 1050: REM  MAP **
  659.  1002  IF A$ = "Q" THEN  RETURN
  660.  1010 AX =  VAL (A$): PRINT "Y = ";: INPUT A$:AY =  VAL (A$): IF A$ = "Q" THEN 1000
  661.  1020  IF AX <  - 20000 OR AX > 20000 OR AY <  - 20000 OR AY > 20000 THEN 1040
  662.  1030  GOTO 1050
  663.  1040  PRINT "X & Y MUST BE FROM -20000 TO 20000": GOSUB 52000: GOTO 1000
  664.  1050  PRINT "SCALE = ";: INPUT A$: IF A$ = "Q" THEN 1000
  665.  1060  IF A$ = "A" THEN AS = 100:AC = 0: GOTO 1110
  666.  1070  IF A$ = "B" THEN AS = 50:AC = 2: GOTO 1110
  667.  1080  IF A$ = "C" THEN AS = 25:AC = 2: GOTO 1110
  668.  1090  IF A$ = "D" THEN AS = 10:AC = 2: GOTO 1110
  669.  1092  IF A$ = "E" THEN AS = 5:AC = 3: GOTO 1110
  670.  1094  IF A$ = "F" THEN AS = 10:AC = 6: GOTO 1110
  671.  1100  PRINT "SCALES ARE 'A B C D E F'": GOSUB 52000: GOTO 1050
  672.  1110 CX = AX / AS:CY = AY / AS
  673.  1112  PRINT "(O)RIGINAL OR (N)EW POSITIONS";: INPUT B$: IF B$ = "Q" THEN 1000
  674.  1114  IF B$ = "O" OR B$ = "N" THEN 1120
  675.  1116  PRINT "ONLY 'O N' ALLOWED": GOSUB 52000: GOTO 1112
  676.  1120 FM% = 1: CALL CLR%: HGR : HCOLOR= 2: HPLOT 0,0 TO 0,0: CALL 62454: HCOLOR= 3: HPLOT 10,11 TO 261,11 TO 261,159 TO 11,159 TO 11,11
  677.  1126  HCOLOR= 0: FOR I = 10 TO 170 STEP 20: HPLOT 12,I TO 260,I: NEXT
  678.  1128  FOR I = 16 TO 260 STEP 20: HPLOT I,10 TO I,170: NEXT
  679.  1130  HPLOT 131,85 TO 141,95: HPLOT 141,85 TO 131,95
  680.  1140  FOR I = 160 TO 191: HPLOT 0,I TO 279,I: NEXT
  681.  1142  POKE 512,216: POKE 513,160: POKE 514,0: POKE 515,76: POKE 516,44: POKE 517,254: POKE 60,0: POKE 61,32: POKE 62,255: POKE 63,63: POKE 66,0: POKE 67,64: CALL 512
  682.  1144  POKE  - 16302,0
  683.  1150  CALL CRNCH%: CALL CRNCH%
  684.  1152  GOSUB 2000
  685.  1160  FOR U = 0 TO UT
  686.  1170 X0 = UX(U):Y0 = UY(U):Z =  VAL ( MID$ (U$(U),SN,3)): IF B$ = "O" THEN 1180
  687.  1174 X0 = XN(U):Y0 = YN(U):Z =  VAL ( MID$ (UN$(U),4,3))
  688.  1180  GOSUB 8000
  689.  1190  NEXT
  690.  1192  IF  LEFT$ (FU$,1) = "S" THEN X0 = FX%:Y0 = FY%:Z = FZ%:S = 3: GOSUB 8010
  691.  1200  POKE  - 16301,0: RETURN
  692.  1252  VTAB 24: PRINT : PRINT "ENTER 'V' FOR VICTORY POINTS ";: INPUT A$: IF A$ <  > "V" THEN  RETURN
  693.  2000 AB = TI% - 1: IF TI% = 0 THEN  RETURN : REM DISPLAY TORPS
  694.  2010  FOR I = 0 TO AB
  695.  2020 X = TX(I) / AS:X = X + 136 - CX: IF X < 10 OR X > 245 THEN 2050
  696.  2030 Y = TY(I) / AS:Y = 90 - Y + CY: IF Y < 11 OR Y > 170 THEN 2050
  697.  2040  HCOLOR= 5: HPLOT X + 3,Y TO X - 3,Y: HPLOT X,Y TO X,Y + 5
  698.  2042  HPLOT X + 3,Y + 1 TO X - 3,Y + 1: HPLOT X + 1,Y TO X + 1,Y + 5
  699.  2050  NEXT
  700.  2060  RETURN
  701.  8000 S =  VAL ( LEFT$ (U$(U),1)): IF  MID$ (U$(U),SQ,1) = "X" AND U >  = US% THEN  RETURN
  702.  8010 X = X0 / AS:X = X + 136 - CX: IF X < 10 OR X > 245 THEN 8080
  703.  8030 Y = Y0 / AS:Y = 90 - Y + CY: IF Y < 11 OR Y > 170 THEN 8080
  704.  8050 X%(S) = X:Y%(S) = Y:CODE%(S) = 1:SCALE%(S) = AC:ZROT%(S) =  ABS ((Z / 13.3333) - 28): POKE  - 16302,0: CALL CRNCH%: CALL CRNCH%
  705.  8080 X%(S) = 0:Y%(S) = 0:CODE%(S) = 0:SCALE%(S) = 0:ZROT%(S) = 0
  706.  8090  POKE  - 16301,0: RETURN
  707.  9000  FOR U = 0 TO UT: REM  INIT UN$ **
  708.  9010 U$ = U$(U):UN$(U) =  LEFT$ (U$,1) +  MID$ (U$,SI,2) +  MID$ (U$,SN,3)
  709.  9011  IF U < US% THEN 9020
  710.  9012  IF  MID$ (U$,SM,3) <  > "000" THEN UN$(U) =  LEFT$ (U$,1) +  MID$ (U$,SK,2) +  MID$ (U$,SN,3)
  711.  9020 XN(U) = UX(U):YN(U) = UY(U)
  712.  9030  NEXT
  713.  9040  GOSUB 53000
  714.  9050  FOR I = 0 TO 9:SX(I) = 0:SY(I) = 0: NEXT :UU = US%
  715.  9052  FOR U = UU TO UT
  716.  9054 L0 = 200 * ( RND (1) + .5): IF  RND (1) > .5 THEN L0 =  - L0
  717.  9056 J = U - US%:SX(J) =  INT ((UX(U) + L0) / 100) * 100:SY(J) =  INT ((UY(U) + L0) / 100) * 100
  718.  9058  NEXT
  719.  9060 J = NE% - 1
  720.  9070  FOR I = 0 TO J:U$(I) =  LEFT$ (U$(I),SJ - 1) + "N" +  RIGHT$ (U$(I),S9 - SJ): NEXT
  721.  10000  HOME : VTAB 24:I =  FRE (0)
  722.  10110  PRINT "(M)AP (S)TATUS (O)RDERS (GA)ME OVER": PRINT "(E)ND THIS TURN ";: INPUT A$
  723.  10150  IF A$ = "S" THEN FM% = 0: GOSUB 12000: GOSUB 12510: VTAB 22: GOTO 10110
  724.  10200  IF A$ = "M" THEN  GOSUB 1000: GOTO 10000
  725.  10300  IF A$ = "O" THEN  GOSUB 20000: GOTO 10000
  726.  10400  IF A$ = "E" THEN FM% = 0: GOTO 19000
  727.  10410  IF A$ = "GA" THEN 19500
  728.  10500  PRINT : PRINT "ONLY 'M S O GA' ARE ALLOWED": GOSUB 52000: GOTO 10000
  729.  12000  VTAB 24: PRINT "ENTER SHIP ID FOR STATUS ";: INPUT A$:U = 0: IF A$ = "Q" THEN  RETURN
  730.  12130  IF  MID$ (U$(U),SB,2) = A$ AND UX(U) <  > 69000 THEN 12190
  731.  12140 U = U + 1: IF U < US% THEN 12130
  732.  12150  PRINT : PRINT "NO SUCH SHIP": GOSUB 52000: GOTO 12000
  733.  12190 U$ = U$(U): TEXT
  734.  12200  HOME : HTAB 15: INVERSE : PRINT " STATUS REPORT ": NORMAL
  735.  12210  VTAB 3: HTAB 1: PRINT "SHIP MAP-POSITION        DAMAGE PTS"
  736.  12220  VTAB 4: HTAB 2: PRINT "ID";: HTAB 6: PRINT "X";:: HTAB 13: PRINT "Y";: HTAB 19: PRINT "KN DIR  START NOW TURN"
  737.  12230  VTAB 5: PRINT " "; MID$ (U$,SB,2);: HTAB 6: PRINT  INT (UX(U));: HTAB 13: PRINT  INT (UY(U));: HTAB 19: PRINT  MID$ (U$,SI,2);: HTAB 22: PRINT  MID$ (U$,SN,3);
  738.  12232  HTAB 29: PRINT  MID$ (U$,SU,2);: HTAB 33: PRINT  MID$ (U$,SV,2);: HTAB 38: PRINT QP%
  739.  12240  PRINT : PRINT "SHIP   MAX"
  740.  12242  PRINT "CLASS  KN"
  741.  12244  HTAB 2: PRINT  MID$ (U$,SE,2);"    "; MID$ (U$,SH,2)
  742.  12300  VTAB 10: HTAB 10: INVERSE : PRINT " SUB(S) SPOTTED ": NORMAL
  743.  12310  PRINT "X        Y         DEPTH     BY"
  744.  12320 UU = US%:J = 0
  745.  12330  FOR I = UU TO UT
  746.  12332  IF UX(I) = 69000 THEN 12410
  747.  12340  IF  MID$ (U$(I),SQ,1) = "X" THEN 12410
  748.  12342 X = SX(I - US%):Y = SY(I - US%)
  749.  12350  PRINT X;: HTAB 10: PRINT Y;
  750.  12360  HTAB 20:P =  VAL ( MID$ (U$(I),SM,3)): IF P = 0 THEN  PRINT "SURFACE";:J = 1: GOTO 12390
  751.  12370  IF P > 30 THEN  PRINT "U/W";:J = 1: GOTO 12390
  752.  12372  IF  MID$ (U$(I),SQ,1) = "S" THEN  PRINT "U/W";:J = 1: GOTO 12390
  753.  12380  PRINT "PERISCOPE";:J = 1
  754.  12390  HTAB 30:C$ =  MID$ (U$(I),SQ,1): IF C$ = "D" OR C$ = "N" THEN  PRINT "VISUAL": GOTO 12410
  755.  12392  IF C$ = "R" THEN  PRINT "RADAR": GOTO 12410
  756.  12394  IF C$ = "S" THEN  PRINT "SONAR"
  757.  12399  IF C$ <  > "S" THEN  STOP
  758.  12410  NEXT
  759.  12420  IF  LEFT$ (FU$,1) <  > "S" THEN 12490
  760.  12430  PRINT FX%;: HTAB 10: PRINT FY%;:J = 1
  761.  12440  HTAB 20: IF FU$ = "SR" THEN  PRINT "SURFACE";: HTAB 30: PRINT "RADAR"
  762.  12450  IF FU$ = "SS" THEN  PRINT "U/W";: HTAB 30: PRINT "SONAR"
  763.  12490  IF J = 0 THEN  PRINT "NO SUBS SPOTTED"
  764.  12500  PRINT :: PRINT : IF U < NE% THEN  GOSUB 23120: GOTO 12504
  765.  12502 AB = U:U = CO%: GOSUB 23120:U = AB
  766.  12504  RETURN
  767.  12510  IF QS% <  > 69 THEN  RETURN
  768.  12520  PRINT : PRINT "ENTER 'V' FOR VICTORY POINTS ";: INPUT A$: IF A$ <  > "V" THEN  RETURN
  769.  12530  PRINT "SURFACE = ";VS%;" SUB = ";VU%
  770.  12540  PRINT : PRINT "HIT 'RETURN' TO CONTINUE ";: INPUT A$: RETURN
  771.  12900  FOR I = 20 TO 24: VTAB I: HTAB 1: PRINT BL$;: NEXT
  772.  12910  VTAB 21: HTAB 1: RETURN
  773.  19000  REM  CHAIN **
  774.  19010  TEXT : HOME :I =  FRE (0)
  775.  19100  VTAB 12: HTAB 4: INVERSE : PRINT " LOADING COMPUTER ACTIVITY PHASE ": NORMAL
  776.  19200  &  GOTO "P4"
  777.  19500  TEXT : HOME
  778.  19510  VTAB 12: HTAB 10: INVERSE : PRINT " LOADING FINAL PHASE ": NORMAL
  779.  19520  &  GOTO "PGA"
  780.  20000  HOME : VTAB 24: PRINT "ENTER ID OF SHIP TO BE GIVEN ORDERS ": PRINT "('Q' = QUIT)  ";: INPUT A$: IF A$ = "Q" THEN  RETURN
  781.  20020  IF A$ = "C" THEN  GOTO 20100
  782.  20030 U = 0
  783.  20040  IF  MID$ (U$(U),SB,2) = A$ AND UX(U) <  > 69000 THEN U$ = U$(U): GOTO 21000
  784.  20050 U = U + 1: IF U < UT% THEN 20040
  785.  20060  PRINT : PRINT "YOU CAN'T GIVE ORDERS TO THAT SHIP!": GOSUB 52000: GOTO 20000
  786.  20100  IF QP% < CT% THEN  PRINT "NO CONVOY ORDER UNTILL TURN ";CT%: GOSUB 52000: GOTO 20000
  787.  20110  PRINT : PRINT : PRINT : PRINT "MOVE ORDERS =";MO$(CO%): PRINT "ENTER MOVEMENT ORDER (SEC. 4.1) ";: INPUT A$: IF A$ = "Q" THEN 20000
  788.  20122 A =  LEN (A$):B$ =  LEFT$ (A$,3): IF A <  > 5 THEN  PRINT : PRINT "BAD FORMAT": GOSUB 52000: GOTO 20100
  789.  20124 MO$(CO%) = ""
  790.  20130  IF B$ = "MDP" OR B$ = "MDS" THEN 20400
  791.  20140  IF B$ = "MDC" THEN MO$(CO%) = "MDC60": GOTO 20500
  792.  20150  IF  LEFT$ (A$,2) = "MC" THEN 20300
  793.  20160 A$ = A$ + A$: GOTO 20122
  794.  20300 C$ = A$:M$ = A$:B$ = "":D$ = "":U$ = U$(UT%):UN$ =  LEFT$ (UN$(UT%),3) +  MID$ (U$(UT%),SN,3): GOSUB 28000
  795.  20310 MO$(CO%) =  LEFT$ (M$,5):A =  LEN (M$): IF A = 5 THEN 20500
  796.  20320  IF  MID$ (M$,6,2) = "MX" THEN MO$(CO%) =  LEFT$ (M$,10)
  797.  20330  GOTO 20500
  798.  20400  GOSUB 29000
  799.  20410 I =  INT (I / 10):B$ = "00" +  STR$ (I):MO$(CO%) =  LEFT$ (A$,3) +  RIGHT$ (B$,2)
  800.  20500  PRINT : PRINT : PRINT : PRINT "TO (E)XECUTE CONVOY ORDER ENTER 'E' ";: INPUT A$: IF A$ <  > "E" THEN 20000
  801.  20540  IF MO$(CO%) = "" THEN MO$(CO%) = "MDC60"
  802.  20542  IF  MID$ (MO$(CO%),3,1) = "C" THEN NO$ = "MDC10": GOTO 20560
  803.  20550 NO$ =  LEFT$ (MO$(CO%),3) + "01"
  804.  20560 UU = US% - 1:CU = UT%
  805.  20562  FOR U = CU TO UU:XN(U) = UX(U):YN(U) = UY(U): NEXT
  806.  20570  FOR U = CU TO UU
  807.  20580 TL = 60:UN$ =  LEFT$ (UN$(U),3) +  MID$ (U$(U),SN,3):UN$(U) = UN$
  808.  20590  IF  MID$ (UN$(U),2,2) <  > "00" THEN  GOSUB 40000
  809.  20600 TL = TL - I: IF TL > 0 THEN 20590
  810.  20610  NEXT
  811.  20620  GOTO 20000
  812.  21000  GOSUB 23000: PRINT "DO YOU WISH TO ENTER A (M)OVE OR (F)IRE ORDER, (E)XECUTE THESE ORDERS OR (Q)UIT": INPUT A$: IF A$ = "Q" THEN 20000
  813.  21030  IF A$ = "M" THEN 21100
  814.  21040  IF A$ = "F" THEN 22000
  815.  21050  IF A$ = "E" THEN 30000
  816.  21070  PRINT "ONLY 'M F E Q' ALLOWED": GOSUB 52000: GOTO 21000
  817.  21100  GOSUB 23100: PRINT "(N)EW, (A)DD OR (Q)UIT ";: INPUT A$: IF A$ = "Q" THEN 21000
  818.  21140  IF A$ = "N" THEN MO$(U) = "": GOTO 21200
  819.  21150  IF A$ = "A" THEN 21200
  820.  21160  PRINT "ONLY 'N A Q' ALLOWED": GOSUB 52000: GOTO 21100
  821.  21200  GOSUB 23100: PRINT "ENTER MOVEMENT ORDER (SEC. 4.1)";: INPUT A$: IF A$ = "Q" THEN 21000
  822.  21222 I =  LEN (A$): IF I <  > 5 THEN 21250
  823.  21230  IF  LEFT$ (A$,3) = "MSS" THEN 21260
  824.  21240  IF  LEFT$ (A$,2) = "MD" THEN 21400
  825.  21242  IF  LEFT$ (A$,2) = "MC" THEN 21500
  826.  21250  PRINT "BAD FORMAT": GOSUB 52000: GOTO 21200
  827.  21260 I =  VAL ( RIGHT$ (A$,2)): IF I < 0 THEN  PRINT "CAN'T GO BACKWARDS": GOSUB 52000: GOTO 21200
  828.  21270 J =  VAL ( MID$ (U$,SH,2)):K = J / 3: IF I <  = J THEN 21280
  829.  21274  PRINT : PRINT "CAN'T EXCEED MAX SPEED": GOSUB 52000: GOTO 21200
  830.  21280 A =  LEN (MO$(U)):B = 1:X = 0
  831.  21282  IF  MID$ (MO$(U),B,3) = "MSS" THEN X = 1
  832.  21284 B = B + 5: IF B <  = (A) THEN 21282
  833.  21286  IF X <  > 0 THEN  PRINT "ONLY 1 SPEED CHANGE PER TURN": GOSUB 52000: GOTO 21200
  834.  21300 J =  VAL ( MID$ (U$,SI,2)): IF  ABS (J - I) <  = K THEN 21320
  835.  21310  PRINT "CAN'T CHANGE SPEED THAT MUCH": GOSUB 52000: GOTO 21200
  836.  21320 MO$(U) = MO$(U) + A$: GOTO 21100
  837.  21400  IF  MID$ (A$,3,1) = "C" THEN 21430
  838.  21410  IF  MID$ (A$,3,1) = "P" OR  MID$ (A$,3,1) = "S" THEN 21450
  839.  21420  GOTO 21250
  840.  21430 I =  VAL ( MID$ (A$,4,2)): IF I > 9 AND I < 61 THEN 21320
  841.  21440  PRINT "YOU MUST ENTER 10-60 TIME POINTS": GOSUB 52000: GOTO 21200
  842.  21450 I =  VAL ( MID$ (A$,4,2)): IF I > 0 AND I < 19 THEN 21320
  843.  21460  PRINT "RANGE SHOULD BE 01-18": GOSUB 52000: GOTO 21200
  844.  21500 A =  VAL ( RIGHT$ (A$,3)): IF A >  = 0 AND A < 360 THEN 21320
  845.  21530  PRINT "COURSE MUST BE 000 TO 359": GOSUB 52000: GOTO 21200
  846.  22000  GOSUB 23100: PRINT "(N)EW, (A)DD OR (Q)UIT ";: INPUT A$: IF A$ = "Q" THEN 21000
  847.  22030  IF A$ = "N" THEN FO$(U) = "":FS$(U) = "": GOTO 22100
  848.  22040  IF A$ = "A" THEN 22100
  849.  22050  PRINT "ONLY 'N A Q' ALLOWED": GOSUB 52000: GOTO 22000
  850.  22100  GOSUB 23100: PRINT "ENTER FIRE ORDER (SEC. 4.2) ";: INPUT A$: IF A$ = "Q" THEN 21000
  851.  22110 B$ =  LEFT$ (A$,3): IF B$ = "FSG" OR B$ = "FSS" THEN 22600
  852.  22130 A =  LEN (A$): IF A <  > 7 THEN 22190
  853.  22140 I =  VAL ( MID$ (A$,4,1)): IF I < 7 THEN 22160
  854.  22150  PRINT "TIME MUST BE 0-6": GOSUB 52000: GOTO 22100
  855.  22160  IF B$ = "FDC" THEN 22200
  856.  22170  IF B$ = "FKG" THEN 22300
  857.  22180  IF B$ = "FAT" THEN 22400
  858.  22190  PRINT "BAD FORMAT": GOSUB 52000: GOTO 22100
  859.  22200 I =  VAL ( RIGHT$ (A$,3)): IF I > 25 THEN 22220
  860.  22210  PRINT "ILLEGAL DEPTH SETTING": GOSUB 52000: GOTO 22100
  861.  22220  GOTO 22800
  862.  22300 I =  VAL ( RIGHT$ (A$,3)): IF I > 25 THEN 22800
  863.  22310  PRINT "ILLEGAL DEPTH SETTING": GOSUB 52000: GOTO 22100
  864.  22400 I =  VAL ( RIGHT$ (A$,3)): IF I > 99 AND I < 201 THEN 22800
  865.  22410  PRINT "ILLEGAL DISTANCE": GOSUB 52000: GOTO 22100
  866.  22600 A =  LEN (A$): IF A <  > 10 THEN 22190
  867.  22610 I =  VAL ( MID$ (A$,4,3)): IF I >  = 0 AND I < 360 THEN 22630
  868.  22620  PRINT "COURSE MUST BE 000 TO 359": GOSUB 52000: GOTO 22100
  869.  22630 J =  VAL ( RIGHT$ (A$,4)): IF J > 0 THEN 22650
  870.  22640  PRINT "DISTANCE MUST BE POSITIVE": GOSUB 52000: GOTO 22100
  871.  22650 X = 0:Y = 0:K = NE% + NS%:A = 1:B$ = FS$(U):B =  LEN (B$)
  872.  22660  IF  MID$ (U$,SJ,1) = "Y" THEN X = X + 1
  873.  22670  IF  MID$ (B$,A,3) = "FSS" THEN Y = Y + 1
  874.  22680 A = A + 10: IF A < B THEN 22660
  875.  22690  IF  LEFT$ (A$,3) = "FSG" AND X > 0 THEN  PRINT "ONLY 1 'FSG' ALLOWED (SEE ERRATA)": GOSUB 52000: GOTO 22100
  876.  22700  IF  LEFT$ (A$,3) = "FSS" AND Y > 1 THEN  PRINT "ONLY 2 'FSS'S ALLOWED": GOSUB 52000: GOTO 22100
  877.  22710 I =  VAL ( MID$ (U$,SW,2)): IF I < 1 THEN  PRINT "SHIP DOESN'T HAVE GUNS": GOSUB 52000: GOTO 22100
  878.  22712  IF  LEFT$ (A$,3) = "FSG" THEN U$ =  LEFT$ (U$,SJ - 1) + "Y" +  RIGHT$ (U$,S9 - SJ):U$(U) = U$
  879.  22720 FS$(U) = FS$(U) + A$: GOTO 22000
  880.  22800 X = 0:Y = 0:Z = 0:F$ = FO$(U) + A$:A =  LEN (F$):B = 1: REM CHECKDC'S VS FDC'S,ETC **
  881.  22810  IF  MID$ (F$,B,3) = "FDC" THEN X = X + 1
  882.  22820  IF  MID$ (F$,B,3) = "FKG" THEN Y = Y + 1
  883.  22830  IF  MID$ (F$,B,3) = "FAT" THEN Z = Z + 1
  884.  22840 B = B + 7: IF B <  = (A) THEN 22810
  885.  22850 I =  VAL ( MID$ (U$,SZ,1)): IF X > I THEN 22900
  886.  22860 I =  VAL ( MID$ (U$,SY,1)): IF Y > I THEN 22900
  887.  22870 I =  VAL ( MID$ (U$,SA%,1)): IF Z > I THEN 22900
  888.  22880 FO$(U) = F$: GOTO 22000
  889.  22900  PRINT  LEFT$ (A$,3);" LIMIT = ";I: GOSUB 52000: GOTO 22100
  890.  23000  GOSUB 12200: GOSUB 12900: REM DATA LINE **
  891.  23010  PRINT  MID$ (U$,SB,2);" X="; INT (XN(U));" Y="; INT (YN(U));" KN="; MID$ (UN$(U),2,2);" DIR="; MID$ (UN$(U),4,3)
  892.  23020  RETURN
  893.  23100  GOSUB 12900: IF U > NE% - 1 THEN  RETURN
  894.  23110  PRINT  MID$ (U$,SB,2);" X="; INT (XN(U));" Y="; INT (YN(U));" KN="; MID$ (UN$(U),2,2);" DIR="; MID$ (UN$(U),4,3)
  895.  23120  PRINT "MOVE ORDERS = ";MO$(U): PRINT "FIRE ORDERS = ";FO$(U): IF FS$(U) <  > "" THEN  PRINT "     AND    = ";FS$(U)
  896.  23130  RETURN
  897.  28000  IF  LEFT$ (M$,2) <  > "MC" THEN  RETURN : REM MCNNN **
  898.  28012 A =  LEN (M$): IF A = 5 THEN M$ = "": GOTO 28020
  899.  28014 M$ =  RIGHT$ (M$,A - 5)
  900.  28020 D0 =  VAL ( RIGHT$ (UN$,3)):D =  VAL ( MID$ (C$,3,3))
  901.  28022  GOTO 28500
  902.  28030  GOSUB 29000
  903.  28090 K = 0:D$ = ""
  904.  28100 K = K + 10: IF K >  = I THEN 28130
  905.  28110  IF K >  = J THEN 28200
  906.  28120  GOTO 28100
  907.  28130 A =  INT (K / 10):B$ = "00" +  STR$ (A)
  908.  28140 D$ = D$ + "MD" + A$ +  RIGHT$ (B$,2):K = 0:J = J - I: IF J = 0 THEN 28252
  909.  28142  IF J < 10 THEN A =  ABS (J): GOTO 28230
  910.  28150  GOTO 28100
  911.  28200 A =  INT (K / 10):B$ = "00" +  STR$ (A)
  912.  28210 D$ = D$ + "MD" + A$ +  RIGHT$ (B$,2)
  913.  28220 A =  ABS (K - J): IF A = 0 THEN 28252
  914.  28230 B$ = "0" +  STR$ (A)
  915.  28240 A$ =  MID$ (D$,3,1)
  916.  28250 D$ = D$ + "MXX" + A$ +  RIGHT$ (B$,1)
  917.  28252 A =  LEN (C$): IF A = 5 THEN C$ = "": GOTO 28260
  918.  28254 C$ =  RIGHT$ (C$,A - 5)
  919.  28260 M$ = D$ + M$: RETURN
  920.  28500  IF D0 > D THEN A$ = "P"
  921.  28510  IF D0 < D THEN A$ = "S"
  922.  28520 J =  ABS (D0 - D): IF J < 180 THEN 28030
  923.  28530 J = D0 + 360 - D: IF J <  = 180 THEN A$ = "P": GOTO 28030
  924.  28540 J = D + 360 - D0: IF J < 180 THEN A$ = "S": GOTO 28030
  925.  28550  STOP
  926.  29000 A =  VAL ( MID$ (U$,SG,1)): IF A < 1 OR A > 9 THEN  STOP
  927.  29010  ON A GOTO 29011,29012,29013,29014,29015,29016,29017,29018,29019
  928.  29011 I = 6: GOTO 29020
  929.  29012 I = 18: GOTO 29020
  930.  29013 I = 30: GOTO 29020
  931.  29014 I = 60: GOTO 29020
  932.  29015 I = 90: GOTO 29020
  933.  29016 I = 120: GOTO 29020
  934.  29017 I = 180: GOTO 29020
  935.  29018 I = 360: GOTO 29020
  936.  29019 I = 720
  937.  29020  RETURN
  938.  30000  IF FM% = 1 THEN 30020
  939.  30010 UU = U: GOSUB 1000:U = UU: GOTO 30000
  940.  30020 I =  FRE (0): VTAB 24: &  GOTO "P2E"
  941.  34000 D0 =  VAL ( RIGHT$ (UN$,3)):D =  VAL ( MID$ (M$,5,1)): REM MXXJN **
  942.  34012  IF  MID$ (M$,4,1) = "P" THEN 34020
  943.  34014 D0 = D0 - D:A$ = "000" +  STR$ (D0): GOTO 34030
  944.  34020 D0 = D0 + D:A$ = "000" +  STR$ (D0)
  945.  34030 UN$ =  LEFT$ (UN$,3) +  RIGHT$ (A$,3)
  946.  34040 A =  LEN (M$):M$ =  RIGHT$ (M$,A - 5)
  947.  34050 UN$(U) = UN$: RETURN
  948.  40000 UN$ = UN$(U):U$ = U$(U): REM EXECUTE MDXTT **
  949.  40010 Z =  VAL ( MID$ (UN$,4,3)):K0 =  VAL ( MID$ (UN$,2,2))
  950.  40020  IF  MID$ (NO$,3,1) <  > "C" THEN 40100
  951.  40030 I =  VAL ( MID$ (NO$,4,2)): IF I > 10 THEN  STOP
  952.  40040  GOTO 40200
  953.  40100  IF  MID$ (NO$,3,1) <  > "P" AND  MID$ (NO$,3,1) <  > "S" THEN  STOP
  954.  40110  GOSUB 29000:A = I
  955.  40120 J = A / 60:I = 10 / J
  956.  40130 Z = Z + 10: IF  MID$ (NO$,3,1) = "P" THEN Z = Z - 20
  957.  40140  IF Z > 360 THEN Z = Z - 360
  958.  54922  NOTRACE  IF Z < 0 THEN Z = Z + 360
  959.  40200 L0 = K0 * .5555 * I:Z2 = 450 - Z: IF Z2 >  = 360 THEN Z2 = Z2 - 360
  960.  40210 X0 = XN(U) + L0 *  COS (Z2 * PI / 180)
  961.  40220 Y0 = YN(U) + L0 *  SIN (Z2 * PI / 180)
  962.  40230  GOSUB 8000
  963.  40300 XN(U) = X0:YN(U) = Y0
  964.  40310 A$ = "000" +  STR$ (Z)
  965.  40330 UN$ =  LEFT$ (UN$,3) +  RIGHT$ (A$,3)
  966.  40340 UN$(U) = UN$: RETURN
  967.  52000  INVERSE : FLASH : PRINT : PRINT "ILLEGAL ENTRY"
  968.  52010  FOR I = 1 TO 1500: NEXT
  969.  52020  NORMAL : RETURN
  970.  53000  CALL CLR%: HGR : HCOLOR= 2: HPLOT 0,0 TO 0,0: CALL 62454
  971.  53010  FOR I = 0 TO 3:CODE%(I) = 1: NEXT
  972.  53012  FOR I = 0 TO 3:SCALE%(I) = 8: NEXT
  973.  53020 X%(0) = 90:Y%(0) = 40
  974.  53030 X%(1) = 180:Y%(1) = 40
  975.  53040 X%(2) = 90:Y%(2) = 110
  976.  53050 X%(3) = 180:Y%(3) = 110
  977.  53058 J = 7: IF  RND (1) > .5 THEN J = 21
  978.  53060  FOR I = 0 TO 3:ZROT%(I) = J: NEXT
  979.  53100  CALL CRNCH%: CALL CRNCH%
  980.  53102  FOR I = 0 TO 3:X%(I) = X%(I) + 1: NEXT : CALL CRNCH%: CALL CRNCH%
  981.  53110  POKE  - 16301,0
  982.  53112  FOR I = 0 TO 3:CODE%(I) = 0: NEXT
  983.  53114  IF QS% = 69 THEN  RETURN
  984.  53120  VTAB 23: HTAB 1: PRINT "ENTER PASSWORD ";: INPUT A$
  985.  53130  IF A$ = PS$ THEN  RETURN
  986.  53140  GOSUB 52000: PRINT : PRINT : PRINT : GOTO 53000
  987.  62000  REM AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  988.  62001  REM AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  989.  62002  REM AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  990.  62003  REM AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  991.  
  992.  
  993.  
  994.  REM PROG = P2E
  995.  4 I =  FRE (0)
  996.  30  &  RECALL "MODULE.TWO.D"
  997.  69 PI = 3.14159
  998.  92 BL$ = "                                       "
  999.  100  GOTO 30000
  1000.  1000  TEXT : HOME : PRINT "X = ";: INPUT A$: IF A$ = "" THEN 1050: REM  MAP **
  1001.  1002  IF A$ = "Q" THEN  RETURN
  1002.  1010 AX =  VAL (A$): PRINT "Y = ";: INPUT A$:AY =  VAL (A$): IF A$ = "Q" THEN 1000
  1003.  1020  IF AX <  - 20000 OR AX > 20000 OR AY <  - 20000 OR AY > 20000 THEN 1040
  1004.  1030  GOTO 1050
  1005.  1040  PRINT "X & Y MUST BE FROM -20000 TO 20000": GOSUB 52000: GOTO 1000
  1006.  1050  PRINT "SCALE = ";: INPUT A$: IF A$ = "Q" THEN 1000
  1007.  1060  IF A$ = "A" THEN AS = 100:AC = 0: GOTO 1110
  1008.  1070  IF A$ = "B" THEN AS = 50:AC = 2: GOTO 1110
  1009.  1080  IF A$ = "C" THEN AS = 25:AC = 2: GOTO 1110
  1010.  1090  IF A$ = "D" THEN AS = 10:AC = 2: GOTO 1110
  1011.  1092  IF A$ = "E" THEN AS = 5:AC = 3: GOTO 1110
  1012.  1094  IF A$ = "F" THEN AS = 10:AC = 6: GOTO 1110
  1013.  1100  PRINT "SCALES ARE 'A B C D E F'": GOSUB 52000: GOTO 1050
  1014.  1110 CX = AX / AS:CY = AY / AS
  1015.  1112  PRINT "(O)RIGINAL OR (N)EW POSITIONS";: INPUT B$: IF B$ = "Q" THEN 1000
  1016.  1114  IF B$ = "O" OR B$ = "N" THEN 1120
  1017.  1116  PRINT "ONLY 'O N' ALLOWED": GOSUB 52000: GOTO 1112
  1018.  1120  CALL CLR%: HGR : HCOLOR= 2: HPLOT 0,0 TO 0,0: CALL 62454: HCOLOR= 3: HPLOT 10,11 TO 261,11 TO 261,159 TO 11,159 TO 11,11
  1019.  1126  HCOLOR= 0: FOR I = 10 TO 170 STEP 20: HPLOT 12,I TO 260,I: NEXT
  1020.  1128  FOR I = 16 TO 260 STEP 20: HPLOT I,10 TO I,170: NEXT
  1021.  1130  HPLOT 131,85 TO 141,95: HPLOT 141,85 TO 131,95
  1022.  1140  FOR I = 160 TO 191: HPLOT 0,I TO 279,I: NEXT
  1023.  1142  POKE 512,216: POKE 513,160: POKE 514,0: POKE 515,76: POKE 516,44: POKE 517,254: POKE 60,0: POKE 61,32: POKE 62,255: POKE 63,63: POKE 66,0: POKE 67,64: CALL 512
  1024.  1144  POKE  - 16302,0
  1025.  1150  CALL CRNCH%: CALL CRNCH%
  1026.  1160  FOR U = 0 TO UT
  1027.  1170 X0 = UX(U):Y0 = UY(U):Z =  VAL ( MID$ (U$(U),SN,3)): IF B$ = "O" THEN 1180
  1028.  1174 X0 = XN(U):Y0 = YN(U):Z =  VAL ( MID$ (UN$(U),4,3))
  1029.  1180  GOSUB 8000
  1030.  1190  NEXT
  1031.  1192  IF  LEFT$ (FU$,1) = "S" THEN X0 = FX%:Y0 = FY%:Z = FZ%:S = 3: GOSUB 8010
  1032.  1200  POKE  - 16301,0: RETURN
  1033.  8000 S =  VAL ( LEFT$ (U$(U),1)): IF  MID$ (U$(U),SQ,1) = "X" AND U >  = US% THEN  RETURN
  1034.  8010 X = X0 / AS:X = X + 136 - CX: IF X < 10 OR X > 245 THEN 8080
  1035.  8030 Y = Y0 / AS:Y = 90 - Y + CY: IF Y < 11 OR Y > 170 THEN 8080
  1036.  8050 X%(S) = X:Y%(S) = Y:CODE%(S) = 1:SCALE%(S) = AC:ZROT%(S) =  ABS ((Z / 13.3333) - 28): POKE  - 16302,0: CALL CRNCH%: CALL CRNCH%
  1037.  8080 X%(S) = 0:Y%(S) = 0:CODE%(S) = 0:SCALE%(S) = 0:ZROT%(S) = 0
  1038.  39526  POKE  - 16301,0: RETURN
  1039.  19000 F0 = 1: PRINT : &  GOTO "P2"
  1040.  20000  PRINT "FOR A NEW MAP TYPE 'M' ";: INPUT A$
  1041.  20010  IF A$ <  > "M" THEN 19000
  1042.  20020 D0 = U: GOSUB 1000: VTAB 24: HTAB 1
  1043.  20030  PRINT "TO EXECUTE THE SAME ORDER(S) ENTER 'E'";: INPUT A$
  1044.  20040  IF A$ <  > "E" THEN 19000
  1045.  20050 U = D0: GOTO 30000
  1046.  28000  IF  LEFT$ (M$,2) <  > "MC" THEN  RETURN : REM MCNNN **
  1047.  28012 C$ = M$:A =  LEN (M$): IF A = 5 THEN M$ = "": GOTO 28020
  1048.  28014 M$ =  RIGHT$ (M$,A - 5)
  1049.  28020 D0 =  VAL ( RIGHT$ (UN$,3)):D =  VAL ( MID$ (C$,3,3))
  1050.  28022  GOTO 28500
  1051.  28030  GOSUB 29000
  1052.  28090 K = 0:D$ = ""
  1053.  28100 K = K + 10: IF K >  = I THEN 28130
  1054.  28110  IF K >  = J THEN 28200
  1055.  28120  GOTO 28100
  1056.  28130 A =  INT (K / 10):B$ = "00" +  STR$ (A)
  1057.  28140 D$ = D$ + "MD" + A$ +  RIGHT$ (B$,2):K = 0:J = J - I: IF J = 0 THEN 28252
  1058.  28142  IF J < 10 THEN A =  ABS (J): GOTO 28230
  1059.  28150  GOTO 28100
  1060.  28200 A =  INT (K / 10):B$ = "00" +  STR$ (A)
  1061.  28210 D$ = D$ + "MD" + A$ +  RIGHT$ (B$,2)
  1062.  28220 A =  ABS (K - J): IF A = 0 THEN 28252
  1063.  28230 B$ = "0" +  STR$ (A)
  1064.  28240 A$ =  MID$ (D$,3,1)
  1065.  28250 D$ = D$ + "MXX" + A$ +  RIGHT$ (B$,1)
  1066.  28252 A =  LEN (C$): IF A = 5 THEN C$ = "": GOTO 28260
  1067.  28254 C$ =  RIGHT$ (C$,A - 5)
  1068.  28260 M$ = D$ + M$: RETURN
  1069.  28500  IF D0 > D THEN A$ = "P"
  1070.  28510  IF D0 < D THEN A$ = "S"
  1071.  28512  IF D0 = D THEN  RETURN
  1072.  28520 J =  ABS (D0 - D): IF J <  = 180 THEN 28030
  1073.  28530 J = D0 + 360 - D: IF J < 180 THEN A$ = "P": GOTO 28030
  1074.  28540 J = D + 360 - D0: IF J < 180 THEN A$ = "S": GOTO 28030
  1075.  28550  STOP
  1076.  29000 A =  VAL ( MID$ (U$,SG,1)): IF A < 1 OR A > 9 THEN  STOP
  1077.  29010  ON A GOTO 29011,29012,29013,29014,29015,29016,29017,29018,29019
  1078.  29011 I = 6: GOTO 29020
  1079.  29012 I = 18: GOTO 29020
  1080.  29013 I = 30: GOTO 29020
  1081.  29014 I = 60: GOTO 29020
  1082.  29015 I = 90: GOTO 29020
  1083.  29016 I = 120: GOTO 29020
  1084.  29017 I = 180: GOTO 29020
  1085.  29018 I = 360: GOTO 29020
  1086.  29019 I = 720
  1087.  29020  RETURN
  1088.  30000  GOSUB 35000: REM EXECUTE **
  1089.  30010 XN(U) = UX(U):YN(U) = UY(U):C$ = MO$(U) + "MDC01":M$ = C$:F$ = FO$(U)
  1090.  30012 U$ = U$(U):UN$(U) =  LEFT$ (U$,1) +  MID$ (U$,SI,2) +  MID$ (U$,SN,3):UN$ = UN$(U)
  1091.  30020 TL = 60:T = 0
  1092.  30030 DC$ = "0000000": FOR I = 0 TO 20:DC$ = DC$ + "000000": NEXT
  1093.  30040 DC = 2: GOSUB 28000
  1094.  30100  IF F$ = "" THEN 31000
  1095.  30102  GOSUB 33000
  1096.  30110 IB =  INT ((60 - TL) / 10):J =  LEN (F$):AB = 1
  1097.  30120 K =  VAL ( MID$ (F$,AB + 3,1)): IF IB = K THEN 30200
  1098.  30130 J =  LEN (F$):AB = AB + 7: IF AB < J THEN 30120
  1099.  30140  GOTO 31000
  1100.  30200 Z =  VAL ( MID$ (UN$,4,3)):NO$ =  MID$ (F$,AB,7)
  1101.  30210  IF  LEFT$ (NO$,2) <  > "FD" THEN 30300
  1102.  30220 Z1 = Z + 180
  1103.  5740 v IF Z1 > 360 THEN Z1 = Z1 - 360
  1104.  30238 Z2 = 450 - Z1: IF Z2 = 360 THEN Z2 = 0
  1105.  30240 X = XN(U) + 60 *  COS (Z2 * PI / 180)
  1106.  30250 Y = YN(U) + 60 *  SIN (Z2 * PI / 180)
  1107.  30260  GOSUB 30700
  1108.  30270  GOTO 30900
  1109.  30300  IF  LEFT$ (NO$,2) <  > "FA" THEN 30400
  1110.  30310 J =  VAL ( MID$ (NO$,5,3)) + 50:Z2 = 450 - Z: IF Z2 = 360 OR Z2 = 180 THEN Z2 = 0
  1111.  30320 X = XN(U) + J *  COS (Z2 * PI / 180)
  1112.  30330 Y = YN(U) + J *  SIN (Z2 * PI / 180)
  1113.  30340  GOSUB 30700: GOTO 30900
  1114.  30400  IF  LEFT$ (NO$,2) <  > "FK" THEN  STOP
  1115.  30402 J = Z + 90: IF J > 360 THEN J = J - 360
  1116.  30404 Z2 = 450 - J: IF Z2 = 360 THEN Z2 = 0
  1117.  30410 X = XN(U) + 100 *  COS (Z2 * PI / 180)
  1118.  30420 Y = YN(U) + 100 *  SIN (Z2 * PI / 180)
  1119.  30430  GOSUB 30700: GOSUB 30908
  1120.  30440 J = Z - 90: IF J < 0 THEN J = J + 360
  1121.  30450 X = XN(U) + 100 *  COS ((450 - J) * PI / 180)
  1122.  30460 Y = YN(U) + 100 *  SIN ((450 - J) * PI / 180)
  1123.  30470  GOSUB 30700: GOTO 30900
  1124.  30700 X0 = X / AS:X0 = X0 + 136 - CX: REM  PLOT + AT X,Y
  1125.  30710  IF X0 < 10 OR X0 > 250 THEN  RETURN
  1126.  30720 Y0 = Y / AS:Y0 = 90 - Y0 + CY
  1127.  2573 x IF Y0 < 10 OR Y0 > 170 THEN  RETURN
  1128.  30740  HCOLOR= 0: HPLOT X0 - 5,Y0 - 5 TO X0 + 5,Y0 + 5
  1129.  30742  HPLOT X0,Y0 + 5 TO X0,Y0 - 5
  1130.  30750  HPLOT X0 - 5,Y0 + 5 TO X0 + 5,Y0 - 5
  1131.  30752  HPLOT X0 - 5,Y0 TO X0 + 5,Y0
  1132.  30760  RETURN
  1133.  30900 I =  LEN (F$):F$ =  LEFT$ (F$,AB + 2) + "9" +  RIGHT$ (F$,I - AB - 3): REM  SET T=9 IN ORDER
  1134.  30902  GOTO 30940
  1135.  30908 X0 = X / AS:X0 = X0 + 136 - CX: REM   UPDATE DC$ **
  1136.  30910  IF X0 < 10 OR X0 > 250 THEN  RETURN
  1137.  30912 Y0 = Y / AS:Y0 = 90 - Y0 + CY
  1138.  30914  IF Y0 < 10 OR Y0 > 170 THEN  RETURN
  1139.  30916 I =  LEN (DC$):X0 =  INT (X0):Y0 =  INT (Y0)
  1140.  30918 A$ =  STR$ (X0):B$ =  STR$ (Y0)
  1141.  30920  IF X0 < 100 THEN A$ = "0" + A$
  1142.  30922  IF Y0 < 100 THEN B$ = "0" + B$
  1143.  30924 DC$ =  LEFT$ (DC$,DC - 1) + A$ + B$ +  RIGHT$ (DC$,I - DC - 6)
  1144.  30930 DC = DC + 6: RETURN
  1145.  30940  GOSUB 30908
  1146.  30990  GOTO 30130
  1147.  31000  IF  LEFT$ (M$,3) = "MSS" THEN  GOSUB 32000: GOTO 31500
  1148.  31002  IF  LEFT$ (M$,2) = "MX" THEN  GOSUB 34000: GOTO 30100
  1149.  31004  IF  LEFT$ (M$,2) = "MC" THEN  GOSUB 28000: GOTO 30100
  1150.  31010  IF  LEFT$ (M$,3) <  > "MDC" THEN 31300
  1151.  31020 TI =  VAL ( MID$ (M$,4,2))
  1152.  31030  IF TI < 11 THEN 31150
  1153.  31040 NO$ = "MDC10": GOSUB 40000
  1154.  31050 TI = TI - 10:J =  LEN (M$): IF TI <  = 0 THEN 31200
  1155.  31060 A$ =  STR$ (TI)
  1156.  31062  IF TI < 10 THEN A$ = "0" + A$
  1157.  31064  IF J = 5 THEN 31090
  1158.  31070 M$ =  LEFT$ (M$,3) +  RIGHT$ (A$,2) +  RIGHT$ (M$,J - 5)
  1159.  31080  GOTO 31100
  1160.  31090 M$ =  LEFT$ (M$,3) +  RIGHT$ (A$,2)
  1161.  31100 TL = TL - 10: GOTO 31500
  1162.  31110  IF J = 5 THEN M$ = "": GOTO 31500
  1163.  31150  IF TI = 10 THEN 31040
  1164.  31160 A$ =  STR$ (TI)
  1165.  31170 NO$ = "MDC" + "0" +  RIGHT$ (A$,1)
  1166.  31172  GOSUB 40000
  1167.  31180 TL = TL - TI: REM TL=TL-TI
  1168.  31182 A =  LEN (M$): IF A = 5 THEN M$ = "": GOTO 31500
  1169.  31184 M$ =  RIGHT$ (M$,A - 5): GOTO 31500
  1170.  31200  IF J = 5 THEN M$ = "": GOTO 31100
  1171.  31210 M$ =  RIGHT$ (M$,J - 5): GOTO 31100
  1172.  31300 NO$ =  LEFT$ (M$,3) + "01": GOSUB 40000
  1173.  31310 TL = TL - I
  1174.  31340 J =  VAL ( MID$ (M$,4,2)):J = J - 1:A =  LEN (M$)
  1175.  31350  IF J <  > 0 THEN 31370
  1176.  31360  IF A = 5 THEN M$ = "": GOTO 31500
  1177.  31362 M$ =  RIGHT$ (M$,A - 5): GOTO 31500
  1178.  31370 A$ =  STR$ (J): IF J < 10 THEN 31400
  1179.  31380  IF A = 5 THEN M$ =  LEFT$ (M$,3) +  RIGHT$ (A$,2): GOTO 31500
  1180.  31390 M$ =  LEFT$ (M$,3) +  RIGHT$ (A$,2) +  RIGHT$ (M$,A - 5): GOTO 31500
  1181.  31400  IF A = 5 THEN M$ =  LEFT$ (M$,3) + "0" +  RIGHT$ (A$,1): GOTO 31500
  1182.  31410 M$ =  LEFT$ (M$,3) + "0" +  RIGHT$ (A$,1) +  RIGHT$ (M$,A - 5): GOTO 31500
  1183.  31500  PRINT "ORDER=";M$;" TL=";TL
  1184.  31510  IF M$ = "" THEN 31600
  1185.  31520  GOTO 30100
  1186.  31600  PRINT : PRINT : PRINT "TIME LEFT = "; INT (TL): PRINT " HIT 'RETURN' TO CONTINUE";: INPUT A$
  1187.  31610  GOSUB 33000:DC$ = "": GOTO 20000
  1188.  32000 K =  VAL ( MID$ (M$,4,2))
  1189.  32070 B$ = "00" +  STR$ (K)
  1190.  32080 UN$(U) =  LEFT$ (UN$(U),1) +  RIGHT$ (B$,2) +  RIGHT$ (UN$(U),3):UN$ = UN$(U)
  1191.  32100 I =  LEN (M$): IF I <  > 5 THEN M$ =  RIGHT$ (M$,I - 5):MN$(U) = M$: GOTO 32110
  1192.  32102 M$ = "":MN$(U) = ""
  1193.  32110  RETURN
  1194.  33000 I = 2: REM  PLOT OLD DC'S **
  1195.  33010 X0 =  VAL ( MID$ (DC$,I,3)): IF X0 = 0 THEN  RETURN
  1196.  33020 Y0 =  VAL ( MID$ (DC$,I + 3,3))
  1197.  33030  GOSUB 30740
  1198.  33040 I = I + 6: GOTO 33010
  1199.  34000 D0 =  VAL ( RIGHT$ (UN$,3)):D =  VAL ( MID$ (M$,5,1)): REM MXXJN **
  1200.  34012  IF  MID$ (M$,4,1) = "P" THEN 34020
  1201.  34014 D0 = D0 - D:A$ = "000" +  STR$ (D0): GOTO 34030
  1202.  34020 D0 = D0 + D:A$ = "000" +  STR$ (D0)
  1203.  34030 UN$ =  LEFT$ (UN$,3) +  RIGHT$ (A$,3)
  1204.  34040 A =  LEN (M$):M$ =  RIGHT$ (M$,A - 5)
  1205.  34050 UN$(U) = UN$: RETURN
  1206.  35000 A = NE% - 1: REM FSG/FSS **
  1207.  35010  FOR T = 0 TO A
  1208.  35020 F$ = FS$(T):F =  LEN (F$):B = 1: IF F = 0 THEN 35310
  1209.  35030 Z =  VAL ( MID$ (F$,B + 3,3)):D =  VAL ( MID$ (F$,B + 6,4))
  1210.  35040 X = UX(T) + D *  COS ((450 - Z) * PI / 180):Y = UY(T) + D *  SIN ((450 - Z) * PI / 180)
  1211.  35060 X0 = X / AS:X0 = X0 + 136 - CX: IF X0 < 10 OR X0 > 250 THEN 35300
  1212.  35080 Y0 = Y / AS:Y0 = 90 - Y0 + CY: IF Y0 < 10 OR Y0 > 170 THEN 35300
  1213.  35100  IF  MID$ (F$,B + 2,1) = "S" THEN 35250
  1214.  35110 Y0 = Y0 - 3: HCOLOR= 5: FOR I = 0 TO 5: HPLOT X0 - 3,Y0 + I TO X0 + 3,Y0 + I: NEXT
  1215.  35120  GOTO 35300
  1216.  35250  HCOLOR= 1: HPLOT X0,Y0 - 5 TO X0 + 15,Y0 TO X0,Y0 + 5 TO X0 - 15,Y0 TO X0,Y0 - 5
  1217.  35252  HPLOT X0 + 6,Y0 TO X0,Y0 - 20 TO X0 - 6,Y0 TO X0,Y0 + 20 TO X0 + 6,Y0
  1218.  35254  HCOLOR= 3: HPLOT X0 - 10,Y0 - 10 TO X0 + 10,Y0 + 10: HPLOT X0 - 10,Y0 + 10 TO X0 + 10,Y0 - 10
  1219.  35300 B = B + 10: IF B < F THEN 35030
  1220.  35310  NEXT
  1221.  35320  RETURN
  1222.  40000 UN$ = UN$(U):U$ = U$(U): REM EXECUTE MDXTT **
  1223.  40010 Z =  VAL ( MID$ (UN$,4,3)):K0 =  VAL ( MID$ (UN$,2,2))
  1224.  40020  IF  MID$ (NO$,3,1) <  > "C" THEN 40100
  1225.  40030 I =  VAL ( MID$ (NO$,4,2)): IF I > 10 THEN  STOP
  1226.  40040  GOTO 40200
  1227.  40100  IF  MID$ (NO$,3,1) <  > "P" AND  MID$ (NO$,3,1) <  > "S" THEN  STOP
  1228.  40110  GOSUB 29000:A = I
  1229.  40120 J = A / 60:I = 10 / J
  1230.  40130 Z = Z + 10: IF  MID$ (NO$,3,1) = "P" THEN Z = Z - 20
  1231.  40140  IF Z > 360 THEN Z = Z - 360
  1232.  40150  IF Z < 0 THEN Z = Z + 360
  1233.  40200 L0 = K0 * .5555 * I:Z2 = 450 - Z: IF Z2 >  = 360 THEN Z2 = Z2 - 360
  1234.  40210 X0 = XN(U) + L0 *  COS (Z2 * PI / 180)
  1235.  40220 Y0 = YN(U) + L0 *  SIN (Z2 * PI / 180)
  1236.  40230  GOSUB 8000
  1237.  40300 XN(U) = X0:YN(U) = Y0
  1238.  40310 A$ = "000" +  STR$ (Z)
  1239.  40330 UN$ =  LEFT$ (UN$,3) +  RIGHT$ (A$,3)
  1240.  40340 UN$(U) = UN$: RETURN
  1241.  52000  INVERSE : FLASH : PRINT : PRINT "ILLEGAL ENTRY"
  1242.  52010  FOR I = 1 TO 1500: NEXT
  1243.  52020  NORMAL : RETURN
  1244.  60000  REM AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  1245.  60001  REM AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
  1246.  
  1247.  
  1248.  REM PROG = P3
  1249.  4 I =  FRE (0)
  1250.  30  &  RECALL "MODULE.THREE.D"
  1251.  40  CALL RESET%
  1252.  60  CALL CRNCH%: CALL CRNCH%
  1253.  69 PI = 355 / 113
  1254.  100  GOSUB 53000: GOTO 10000
  1255.  1000  TEXT : HOME : POKE 520,216: POKE 521,160: POKE 522,0: POKE 523,76: POKE 524,44: POKE 525,254
  1256.  1010  IF NS% = 1 AND UX(US%) <  > 69000 THEN AX = UX(US%):AY = UY(US%):U = US%: GOTO 1032
  1257.  1020  GOSUB 11000: IF A$ = "Q" THEN  RETURN
  1258.  1030 AX = UX(U):AY = UY(U)
  1259.  1032 P =  VAL ( MID$ (U$(U),SM,3)): IF P < 31 THEN 1040
  1260.  2573  GOTO 5040
  1261.  1040 AS = 100:AC = 0
  1262.  1090 CX = AX / AS:CY = AY / AS
  1263.  1099  HGR
  1264.  1100  CALL CLR%:UU = US% - 1
  1265.  1101 X%(4) = 125:Y%(4) = 80:CODE%(4) = 1:SCALE%(4) = 9:XROT%(4) = 0: CALL CRNCH%: CALL CRNCH%
  1266.  1102  IF FU$ <  > "UR" THEN 1110
  1267.  1104 S = 2:U = 0:SX(0) = UX(0):SY(0) = UY(0):UX(0) = FX%:UY(0) = FY%:Z = FZ%
  1268.  1106 F2% = 1: GOSUB 1140:F2% = 0:UX(0) = SX(0):UY(0) = SY(0)
  1269.  1110  FOR U = 0 TO UU
  1270.  1120 U$ = U$(U)
  1271.  1122  IF  MID$ (U$,SQ,1) = "S" OR  MID$ (U$,SQ,1) = "X" THEN 1132
  1272.  1130 S =  VAL ( LEFT$ (U$,1)): GOSUB 1140
  1273.  1132  NEXT : GOTO 1260
  1274.  1140 X = UX(U) / AS: IF CX >  = 0 THEN X = X + 125 - CX: GOTO 1160
  1275.  1150 X = X - CX + 125
  1276.  1160  IF X < 15 OR X > 240 THEN 1250
  1277.  1170 Y = UY(U) / AS: IF CY >  = 0 THEN Y = 80 - Y + CY: GOTO 1190
  1278.  1180 Y = 80 + CY - Y
  1279.  1190  IF Y < 10 OR Y > 182 THEN 1250
  1280.  1200 X%(S) = X:Y%(S) = Y:CODE%(S) = 1:SCALE%(S) = AC
  1281.  1210  IF F2% = 0 THEN Z =  VAL ( MID$ (U$,SN,3))
  1282.  1220 ZROT%(S) =  ABS ((Z / 13.3333) - 28)
  1283.  1230  CALL CRNCH%: CALL CRNCH%
  1284.  1240 X%(S) = 0:Y%(S) = 0:CODE%(S) = 0:ZROT%(S) = 0
  1285.  1250  RETURN
  1286.  1260  POKE  - 16301,0
  1287.  2000 Y0 = 0:X0 = 125
  1288.  2100 D = 180
  1289.  2110 J = D
  1290.  2120 X = 76 *  COS ((450 - J) * PI / 180)
  1291.  2130 J = J + 180: IF J > 360 THEN J = J - 360
  1292.  2140 Y = 76 *  SIN ((450 - J) * PI / 180)
  1293.  2150 X = X + 125
  1294.  2160 Y = 80 - Y
  1295.  2180  POKE  - 16300,0
  1296.  2200  HCOLOR= 3
  1297.  2210  HPLOT 125,80 TO X,Y
  1298.  2230  POKE 60,0: POKE 61,64: POKE 62,255: POKE 63,95: POKE 66,0: POKE 67,32: CALL 520
  1299.  2270 K =  PEEK ( - 16384)
  1300.  2280  IF K > 127 THEN  RETURN
  1301.  2300  VTAB 21: HTAB 1
  1302.  2340  PRINT "(R)ADAR (P)ERISCOPE (O)RDERS (TDC)      (S)TATUS (E)ND TURN (GA)ME OVER";
  1303.  2550 D = D - 10: IF D >  =  - 180 THEN 2110
  1304.  3328
  1305.  GOTO 2100
  1306.  5000  TEXT : HOME
  1307.  5010  IF NS% = 1 AND UX(US%) <  > 69000 THEN XC = UX(US%):YC = UY(US%): GOTO 5040
  1308.  5020  GOSUB 11000: IF A$ = "Q" THEN  RETURN
  1309.  5030 XC = UX(U):YC = UY(U)
  1310.  5040 P =  VAL ( MID$ (U$(U),SM,3)): IF P < 31 THEN 5050
  1311.  5042  PRINT "SUB TOO DEEP": PRINT "HIT 'RETURN' TO CONTINUE ";: INPUT A$: RETURN
  1312.  5050  PRINT "ENTER DEGREE OF CENTRAL SCAN-";: INPUT A$:CD =  VAL (A$):CC = 360 - CD: IF CD >  - 1 AND CD < 361 THEN 5070
  1313.  5060  PRINT : PRINT "ENTER DEGREE FROM 0 TO 359": PRINT : GOSUB 52000: GOTO 5050
  1314.  5070  CALL CLR%
  1315.  5080 X%(4) = 130:Y%(4) = 80:CODE%(4) = 1:SCALE%(4) = 15:XROT%(4) = 4
  1316.  5082 X%(5) = 130:Y%(5) = 78:CODE%(5) = 1:SCALE%(5) = 15:XROT%(5) = 4
  1317.  5083  GOSUB 7000
  1318.  5084  CALL CRNCH%: CALL CRNCH%
  1319.  5086 CODE%(4) = 0:CODE%(5) = 0
  1320.  5090  HCOLOR= 0: HPLOT 130,22 TO 130,180: HPLOT 2,79 TO 260,79: HPLOT 2,80 TO 260,80
  1321.  5092 UU = US% - 1
  1322.  5100  FOR U = 0 TO UU
  1323.  5104 U$ = U$(U):A$ =  MID$ (U$,SQ,1): IF A$ = "X" OR A$ = "R" OR A$ = "S" THEN 5122
  1324.  5110 S =  VAL ( LEFT$ (U$,1)): IF S > 2 THEN 5122
  1325.  5120 F0 = 0: GOSUB 5140
  1326.  5122  NEXT
  1327.  5124  GOTO 5600
  1328.  5140 J = 360 - CD: IF J < 000 THEN J = J + 360
  1329.  5142 K = J + 90: IF K > 360 THEN K = K - 360
  1330.  5144  IF J = 180 OR J = 360 THEN J = 0
  1331.  5146  IF K = 360 OR K = 180 THEN K = 0
  1332.  5150 X1 = UY(U) *  SIN ((J) * PI / 180) + UX(U) *  SIN ((K) * PI / 180)
  1333.  5160 CX = YC *  SIN ((J) * PI / 180) + XC *  SIN ((K) * PI / 180)
  1334.  5170 J = J + 180: IF J > 360 THEN J = J - 360
  1335.  5172  IF J = 180 OR J = 360 THEN J = 0
  1336.  5180 Y1 = UX(U) *  SIN ((J) * PI / 180) + UY(U) *  SIN ((K) * PI / 180)
  1337.  5190 CY = XC *  SIN ((J) * PI / 180) + YC *  SIN ((K) * PI / 180)
  1338.  5192 X1 =  INT (X1):CX =  INT (CX):Y1 =  INT (Y1):CY =  INT (CY)
  1339.  5200 CY = CY:A = (X1 - CX) * (X1 - CX):B = (Y1 - CY) * (Y1 - CY)
  1340.  5210 D =  SQR (A + B): IF D = 0 THEN F2% = 1: GOTO 5550
  1341.  5220 D =  INT (D / 10):D = D * 10
  1342.  28266  IF Y1 - CY <  = 0 THEN F2% = 1: GOTO 5550
  1343.  5240  IF X1 - CX <  = 0 THEN 5280
  1344.  5250 D0 = (X1 - CX) / (Y1 - CY): IF D0 <  = 1 THEN 5280
  1345.  5260  IF D0 >  =  - 1 THEN 5280
  1346.  5270 F2% = 1: GOTO 5550
  1347.  5280 Y = 200
  1348.  5290  IF D < 10 THEN F2% = 1: GOTO 5550
  1349.  5300 D1 = D:D =  ABS (CY) + Y1: IF CY > 0 AND Y1 > 0 THEN D = Y1 - CY
  1350.  5310  IF D > 3400 THEN Y = 22:X2 = 30: GOTO 5420
  1351.  5320 K = D / 500: IF K < 1 THEN 5350
  1352.  5330  ON K GOTO 5360,5370,5380,5390,5400,5410
  1353.  5340  STOP : REM  REMOVE
  1354.  5350 Y = 160 - (D * .088):X2 = 5: GOTO 5420
  1355.  5360 J = D - 500:Y = 116 - (J * .064):X2 = 7.5: GOTO 5420
  1356.  5370 J = D - 1000:Y = 84 - (J * .05):K = J * .007:X2 = 9.5 + K: GOTO 5420
  1357.  5380 J = D - 1500:Y = 59 - (J * .036):K = J * .008:X2 = 13 + K: GOTO 5420
  1358.  5390 J = D - 2000:Y = 41 - (J * .026):K = J * .012:X2 = 17 + K: GOTO 5420
  1359.  5400 J = D - 2500:Y = 28 - (J * .012):K = J * .004:X2 = 23 + K: GOTO 5420
  1360.  5410 J = D - 3000:Y = 22 - (J * .002):X2 = 25
  1361.  5420  IF Y < 22 THEN Y = 22
  1362.  5422  IF Y > 170 THEN F2% = 1: GOTO 5540
  1363.  5430 X = 130 + (X1 / X2) - (CX / X2):D = D1
  1364.  5432  IF X < 10 OR X > 245 THEN F2% = 1: GOTO 5540
  1365.  5434  IF Y = 22 AND (X < 50 OR X > 200) THEN 5540
  1366.  5436  IF Y < 30 AND (X < 30 OR X > 220) THEN 5540
  1367.  5438  IF Y < 45 AND (X < 30 OR X > 220) THEN 5540
  1368.  5450  IF Y < 10 OR Y > 182 THEN 5540
  1369.  5460 Z =  VAL ( MID$ (U$,SN,3))
  1370.  5470 Z = Z - CD: IF Z > 360 THEN Z = Z - 360
  1371.  5480  IF Z > 360 THEN Z = Z - 360
  1372.  5490  IF Z < 0 THEN Z = Z + 360
  1373.  5492  IF F0 = 1 THEN  RETURN
  1374.  5500 ZROT%(S) =  ABS ((Z / 13.3333) - 28)
  1375.  5510 SCALE%(S) = (1000 / D) * 4 + 1
  1376.  5520 X%(S) = X:Y%(S) = Y:CODE%(S) = 1:XROT%(S) = 7
  1377.  5522  CALL CRNCH%: CALL CRNCH%
  1378.  5524 X%(S) = X + 1: CALL CRNCH%: CALL CRNCH%
  1379.  5530  CALL CRNCH%: CALL CRNCH%
  1380.  5540 X%(S) = 0:Y%(S) = 0:CODE%(S) = 0:SCALE%(S) = 0:XROT%(S) = 0:ZROT%(S) = 0
  1381.  5550  RETURN
  1382.  5600  GOSUB 8000: POKE  - 16301,0
  1383.  5610  HOME : VTAB 23
  1384.  5620  PRINT "X="; INT (XC);" Y="; INT (YC);" DIR=";CD
  1385.  5630  PRINT : PRINT "HIT 'RETURN' TO CONTINUE";: INPUT A$: RETURN
  1386.  7000  HCOLOR= 2: HGR :J = 83:X = 130
  1387.  7002  CALL CRNCH%: CALL CRNCH%
  1388.  7010  FOR I = 22 TO 40
  1389.  7020  HPLOT X - J,I TO X + J + 2,I
  1390.  7030 J = J + 1.34
  1391.  7040  NEXT
  1392.  7050  FOR I = 41 TO 65
  1393.  7060  HPLOT X - J,I TO X + J,I
  1394.  7070 J = J + .67
  1395.  7080  NEXT
  1396.  7090  FOR I = 66 TO 80
  1397.  7100  HPLOT X - J,I TO X + J,I
  1398.  7110 J = J + .25
  1399.  7120  NEXT
  1400.  7130  FOR I = 81 TO 95
  1401.  7140  HPLOT X - J,I TO X + J,I
  1402.  7150 J = J - .25
  1403.  7160  NEXT
  1404.  7180  FOR I = 96 TO 110: HPLOT X - J,I TO X + J,I:J = J - .67: NEXT
  1405.  7190  FOR I = 111 TO 125: HPLOT X - J,I TO X + J,I:J = J - 1: NEXT
  1406.  7200  FOR I = 126 TO 145: HPLOT X - J,I TO X + J,I:J = J - 1.5: NEXT
  1407.  7210  FOR I = 146 TO 160: HPLOT X - J,I TO X + J,I:J = J - 3.5: NEXT
  1408.  7220  POKE 512,216: POKE 513,160: POKE 514,0: POKE 515,76: POKE 516,44: POKE 517,254: POKE 60,0: POKE 61,32: POKE 62,255: POKE 63,63: POKE 66,0: POKE 67,64: CALL 512
  1409.  7230  POKE  - 16302,0
  1410.  7299  RETURN
  1411.  8000  IF TI% = 0 THEN  RETURN
  1412.  8010 UU = TI% - 1:SX(0) = UX(0):SY(0) = UY(0):U = 0:F0 = 1
  1413.  8100  FOR AB = 0 TO UU
  1414.  8110 UX(0) = TX(AB):UY(0) = TY(AB):F2% = 0: GOSUB 5140: IF F2% = 1 THEN 8130
  1415.  8120  HCOLOR= 5: FOR I = 0 TO 5: HPLOT X - 2,Y + I TO X + 2,Y + I: NEXT
  1416.  8122  HPLOT X - 4,Y - 0 TO X + 4,Y - 0
  1417.  8130  NEXT
  1418.  8140 UX(0) = SX(0):UY(0) = SY(0):F2% = 0:F0 = 0: RETURN
  1419.  10000  HOME : PRINT : VTAB 24
  1420.  10020 I =  FRE (0)
  1421.  10100  PRINT "(R)ADAR (P)ERISCOPE (O)RDERS (TDC)      (S)TATUS (E)ND TURN (GA)ME OVER";
  1422.  10110  INPUT A$
  1423.  10120  IF A$ = "E" THEN  GOTO 19000
  1424.  10130  IF A$ = "O" THEN  GOSUB 20000: GOTO 10000
  1425.  10140  IF A$ = "R" THEN  GOSUB 1000: GOTO 10000
  1426.  10150  IF A$ = "P" THEN  GOSUB 5000: GOTO 10000
  1427.  10160  IF A$ = "TDC" THEN  GOSUB 30000: GOTO 10000
  1428.  10170  IF A$ = "S" THEN  GOSUB 12000: VTAB 22: GOTO 10100
  1429.  10180  IF A$ = "GA" THEN 19500
  1430.  10200  PRINT : PRINT : PRINT "ONLY 'R P O TDC S E GA' ARE LEGAL"
  1431.  10210  GOSUB 52000: GOTO 10000
  1432.  11000  PRINT "ENTER ID OF SUB AT CENTER ";
  1433.  11010  INPUT A$: IF A$ = "Q" THEN  RETURN
  1434.  11020 U = US%
  1435.  11030  IF A$ <  >  MID$ (U$(U),SB,2) THEN 11040
  1436.  11032  IF UX(U) = 69000 THEN A$ = "Q": RETURN
  1437.  11034 U$ = U$(U): RETURN
  1438.  11040 U = U + 1: IF U <  = UT THEN 11030
  1439.  11050  PRINT : PRINT "NO SUCH SHIP": GOSUB 52000: GOTO 11000
  1440.  12000  IF US% = UT THEN U = UT:O = NE%: GOTO 12090
  1441.  12010  PRINT "ENTER ID FOR STATUS ";: INPUT A$: IF A$ = "Q" THEN  RETURN
  1442.  12020 U = US%:O = NE%
  1443.  12030  IF A$ =  MID$ (U$(U),SB,2) THEN 12090
  1444.  12040 O = O + 1:U = U + 1: IF U <  = UT THEN 12030
  1445.  12050  PRINT "NO SUCH SHIP": GOSUB 52000: GOTO 12000
  1446.  12090 U$ = U$(U): TEXT
  1447.  12100  TEXT : HOME : HTAB 15: INVERSE : PRINT " STATUS REPORT ": NORMAL
  1448.  12110  VTAB 3: HTAB 1: PRINT "SHIP MAP POSITION"
  1449.  12120  VTAB 4: PRINT " ID";: HTAB 6: PRINT "X";: HTAB 13: PRINT "Y";: HTAB 20: PRINT "SPEED DIR DEPTH  TURN"
  1450.  12130  VTAB 5: HTAB 2: PRINT  MID$ (U$,SB,2);: HTAB 6: PRINT  INT (UX(U));: HTAB 13: PRINT  INT (UY(U));
  1451.  12132  HTAB 21: PRINT  MID$ (U$,SI,2);: IF  MID$ (U$,SM,3) <  > "000" THEN  VTAB 5: HTAB 21: PRINT  MID$ (U$,SK,2);
  1452.  12134  HTAB 26: PRINT  MID$ (U$,SN,3);: HTAB 31: PRINT  MID$ (U$,SM,3);: HTAB 38: PRINT QP%
  1453.  12140  VTAB 7: PRINT "  DP'S    VP'S";: HTAB 24: PRINT "TORPEDO STATUS"
  1454.  12150  VTAB 8: PRINT "BEG NOW ESC SUB      ...BOW... ..STERN.."
  1455.  12160  VTAB 9: PRINT  MID$ (U$,SU,2);: HTAB 6: PRINT  MID$ (U$,SV,2);"  ";VS%;"  ";VU%;
  1456.  12170  HTAB 22: PRINT  MID$ (TB$(U - US%),2,9);: HTAB 32: PRINT  MID$ (TS$(U - US%),2,9)
  1457.  12180  PRINT " SHIP DISTURBED"
  1458.  12182  PRINT "CLASS   WATER"
  1459.  12184  HTAB 2: PRINT  MID$ (U$,SE,2);: HTAB 10: IF  MID$ (U$,SB%,1) = "Y" THEN  INVERSE : PRINT "YES": NORMAL : GOTO 12200
  1460.  12186  PRINT "NO"
  1461.  43127 / VTAB 15: INVERSE : PRINT "SONAR REPORTS OF ENEMY SHIPS": NORMAL
  1462.  12210 UU = US% - 1:X0 = UX(U):Y0 = UY(U):J = 0
  1463.  12220  FOR I = 0 TO UU
  1464.  12222  IF UX(U) = 69000 THEN 12250
  1465.  12230  IF  MID$ (U$(I),SQ,1) <  > "S" THEN 12250
  1466.  12240 X2 = UX(I):Y2 = UY(I): GOSUB 30900: PRINT " "; INT (A);:J = 1
  1467.  12250  NEXT
  1468.  12260  IF FU$ <  > "US" THEN 12280
  1469.  12270 X2 = FX%:Y2 = FY%: GOSUB 30900: PRINT " "; INT (A);:J = 1
  1470.  12280  IF J = 0 THEN  PRINT "NONE";
  1471.  12290  PRINT : PRINT
  1472.  12400  GOSUB 23120
  1473.  12410  PRINT : PRINT "ENTER 'T' FOR TORPEDO STATUS";: INPUT A$: IF A$ <  > "T" THEN 12500
  1474.  12420  HOME : HTAB 10: INVERSE : PRINT " LIVE TORPEDOES AT ": NORMAL : PRINT
  1475.  12430  PRINT " X       Y        DIR TURNS LEFT": PRINT
  1476.  12440 A = TI% - 1: IF TI% = 0 THEN 12500
  1477.  12450  FOR I = 0 TO A: HTAB 2: PRINT  INT (TX(I));: HTAB 10: PRINT  INT (TY(I));: HTAB 19: PRINT TZ%(I);
  1478.  12460  HTAB 28: PRINT  MID$ (TA$,I + 2,1)
  1479.  12470  NEXT
  1480.  12500  RETURN
  1481.  19000  TEXT : HOME :I =  FRE (0)
  1482.  19100  VTAB 12: HTAB 10: INVERSE : PRINT " LOADING ORDERS PHASE ": HTAB 14: PRINT " SURFACE SIDE ": NORMAL
  1483.  19200  &  GOTO "P2"
  1484.  19500  TEXT : HOME
  1485.  19510  VTAB 12: HTAB 10: INVERSE : PRINT " LOADING FINAL PHASE ": NORMAL
  1486.  19520  &  GOTO "PGA"
  1487.  20000  HOME : VTAB 24: IF US% = (UT) AND UX(US%) <  > 69000 THEN U = US%:O = NE%: GOTO 20200
  1488.  20010  HOME : VTAB 24: PRINT "ENTER ID OF SHIP TO BE GIVEN ORDERS ": PRINT "('Q' = QUIT) ";
  1489.  20020  INPUT A$: IF A$ = "Q" THEN  RETURN
  1490.  20030 U = US%:O = NE%
  1491.  20040  IF  MID$ (U$(U),SB,2) = A$ AND UX(U) <  > 69000 THEN U$ = U$(U): GOTO 20200
  1492.  20050 O = O + 1:U = U + 1: IF U <  = UT THEN 20040
  1493.  20060  PRINT "YOU CAN'T ORDER THAT SHIP!": GOSUB 52000: GOTO 20000
  1494.  20200 U$ = U$(U): PRINT : PRINT : PRINT "DO YOU WISH TO ENTER (M)OVE OR (F)IRE   ORDERS OR (Q)UIT ";
  1495.  20210  INPUT A$: IF A$ = "Q" THEN  RETURN
  1496.  20220  IF A$ = "M" THEN 20300
  1497.  20230  IF A$ = "F" THEN 22000
  1498.  20250  PRINT : PRINT "ONLY 'M F Q' ALLOWED": GOSUB 52000: GOTO 20200
  1499.  20300  GOSUB 23100
  1500.  20310  PRINT "(N)EW, (A)DD OR (Q)UIT ";: INPUT A$: IF A$ = "Q" THEN 20200
  1501.  20320  IF A$ = "N" THEN MO$(O) = "": GOTO 20400
  1502.  20330  IF A$ = "A" THEN 20400
  1503.  20340  PRINT "ONLY 'N A Q' ALLOWED": GOSUB 52000: GOTO 20300
  1504.  20400  GOSUB 23100
  1505.  20410  PRINT "ENTER MOVEMENT ORDER (SEC. 4.1) ";:
  1506.  20420  INPUT A$: IF A$ = "Q" THEN 20200
  1507.  20430 I =  LEN (A$): IF I <  > 5 THEN 20470
  1508.  20440  IF  LEFT$ (A$,3) = "MSS" THEN 20500
  1509.  20450  IF  LEFT$ (A$,2) = "MD" THEN 21000
  1510.  20460  IF  LEFT$ (A$,2) = "MU" THEN 21500
  1511.  20462  IF  LEFT$ (A$,2) = "MC" THEN 21300
  1512.  20470  PRINT "BAD FORMAT": GOSUB 52000: GOTO 20400
  1513.  20500 A =  LEN (MO$(O)):B = 1:X = 0
  1514.  20502  IF  MID$ (MO$(O),B,3) = "MSS" THEN X = 1
  1515.  20504 B = B + 5: IF B <  = (A) THEN 20502
  1516.  20506  IF X = 1 THEN  PRINT : PRINT "ONLY 1 SPEED CHANGE PER TURN": GOSUB 52000: GOTO 20400
  1517.  20507 I =  VAL ( RIGHT$ (A$,2)): IF I < 0 THEN  PRINT : PRINT "CAN'T GO BACKWARDS": GOSUB 52000: GOTO 20400
  1518.  20508 D =  VAL ( MID$ (U$,SM,3)): IF D <  > 0 THEN 20600
  1519.  20510 I =  VAL ( RIGHT$ (A$,2)):J =  VAL ( MID$ (U$,SH,2)):K = J / 3
  1520.  20520  IF I <  = J THEN 20540
  1521.  20530  PRINT : PRINT "CAN'T EXCEED MAX SPEED": GOSUB 52000: GOTO 20400
  1522.  20540 J =  VAL ( MID$ (U$,SI,2)): IF  ABS (J - I) <  = K THEN 20560
  1523.  20550  PRINT : PRINT "CAN'T CHANGE SPEED THAT MUCH": GOSUB 52000: GOTO 20400
  1524.  20560 MO$(O) = MO$(O) + A$: GOTO 20300
  1525.  20600 I =  VAL ( RIGHT$ (A$,2)):J =  VAL ( MID$ (U$,SJ,2)):K = J / 3
  1526.  20620  IF I <  = J THEN 20640
  1527.  20630  GOTO 20530
  1528.  20640 J =  VAL ( MID$ (U$,SK,2)): IF  ABS (J - I) <  = K THEN 20560
  1529.  20650  GOTO 20550
  1530.  21000  IF  MID$ (A$,3,1) = "C" THEN 21030
  1531.  21010  IF  MID$ (A$,3,1) = "P" OR  MID$ (A$,3,1) = "S" THEN 21050
  1532.  21020  GOTO 20470
  1533.  21030 I =  VAL ( MID$ (A$,4,2)): IF I > 9 AND I < 61 THEN 20560
  1534.  21040  PRINT "YOU MUST ENTER 10-60 TIME POINTS": GOSUB 52000: GOTO 20400
  1535.  21050 I =  VAL ( MID$ (A$,4,2)): IF I > 0 AND I < 19 THEN 20560
  1536.  21060  PRINT "TURN MUST BE 01-18": GOSUB 52000: GOTO 20400
  1537.  21300 A =  VAL ( RIGHT$ (A$,3)): IF A >  = 0 AND A < 360 THEN 20560
  1538.  21310  PRINT "COURSE MUST BE 000 TO 359": GOSUB 52000: GOTO 20400
  1539.  21500 D =  VAL ( RIGHT$ (A$,3)):D0 =  VAL ( MID$ (U$,SM,3)): IF D0 < D THEN 21530
  1540.  21510 K =  VAL ( MID$ (U$,SP,3)): IF D0 - D <  = K THEN 21550
  1541.  21520  PRINT "CAN'T RISE THAT FAST": GOSUB 52000: GOTO 20400
  1542.  21530 K =  VAL ( MID$ (U$,SO,3)): IF D - D0 <  = K THEN 21550
  1543.  21540  PRINT "CAN'T DIVE THAT FAST": GOSUB 52000: GOTO 20400
  1544.  21550 I =  VAL ( MID$ (U$,SL,3)): IF D <  = I THEN 20560
  1545.  21560  FLASH : PRINT : PRINT "WARNING! MAX DEPTH EXCEEDED": NORMAL
  1546.  21570  FOR I = 0 TO 3000: NEXT : GOTO 20560
  1547.  22000  GOSUB 23100
  1548.  22010  PRINT "(N)EW, (A)DD OR (Q)UIT";
  1549.  22020  INPUT A$: IF A$ = "Q" THEN 20200
  1550.  22030  IF A$ = "N" THEN FO$(O) = "":FS$(O) = "": GOTO 22100
  1551.  22040  IF A$ = "A" THEN 22100
  1552.  22050  PRINT "ONLY 'N A Q' ALLOWED": GOSUB 52000: GOTO 22000
  1553.  22100  GOSUB 23100
  1554.  22110  PRINT "ENTER FIRE ORDER (SEC. 4.2) ";
  1555.  22120  INPUT A$: IF A$ = "Q" THEN 20200
  1556.  22122  IF  LEFT$ (A$,3) = "FSG" THEN 22600
  1557.  22130 A =  LEN (A$): IF A <  > 8 THEN 22134
  1558.  22132  GOTO 22140
  1559.  22134  PRINT "BAD FORMAT": GOSUB 52000: GOTO 22100
  1560.  22140  IF  MID$ (A$,3,1) = "B" OR  MID$ (A$,3,1) = "S" THEN 22160
  1561.  22150  GOTO 22134
  1562.  22160 D =  VAL ( MID$ (A$,4,3)): IF D >  - 1 AND D < 361 THEN 22180
  1563.  22170  PRINT "YOU CAN FIRE 0-360 DEGREES ONLY": GOSUB 52000: GOTO 22100
  1564.  22180 A =  VAL ( MID$ (A$,7,2)): IF A >  - 1 AND A < 51 THEN 22200
  1565.  22190  PRINT "TIME POINTS MUST BE 00-50": GOSUB 52000: GOTO 22100
  1566.  22200 A = U - US%:F$ = FO$(O) + A$:B = 1:C =  LEN (F$):X = 0:X0 = 0:Y = 0:Y0 = 0
  1567.  22210  IF  MID$ (F$,B + 2,1) = "B" THEN X = X + 1
  1568.  22220  IF  MID$ (F$,B + 2,1) = "S" THEN Y = Y + 1
  1569.  22230 B = B + 8: IF B < C THEN 22210
  1570.  22250  FOR I = 2 TO 10
  1571.  22260  IF  MID$ (TB$(A),I,1) = "L" THEN X0 = X0 + 1
  1572.  22270  IF  MID$ (TS$(A),I,1) = "L" THEN Y0 = Y0 + 1
  1573.  22280  NEXT
  1574.  22290  IF X <  = X0 THEN 22310
  1575.  22300  PRINT "NOT ENOUGH 'L'OADED TUBES": GOSUB 52000: GOTO 22100
  1576.  22310  IF Y <  = Y0 THEN 22330
  1577.  22320  GOTO 22300
  1578.  22330 D0 =  VAL ( MID$ (U$,SN,3)): IF  MID$ (A$,3,1) = "S" THEN D0 = D0 + 180
  1579.  22340  IF D0 > 360 THEN D0 = D0 - 360
  1580.  22350 I =  ABS (D - D0): IF I > 180 THEN I = 360 - I
  1581.  22360  IF I <  = 120 THEN 22380
  1582.  22370  FLASH : PRINT "WARNING !": NORMAL : PRINT "IF ANGLE NOT +/- 120 DEGREES THEN": PRINT "TORPEDO WILL SINK (SEC. 4.22)": PRINT "HIT' RETURN ' TO CONTINUE ";: INPUT B$
  1583.  22380 FO$(O) = FO$(O) + A$: GOTO 22000
  1584.  22600 A =  LEN (A$): IF A <  > 10 THEN 22134
  1585.  22610 I =  VAL ( MID$ (A$,4,3)): IF I >  = 0 AND I < 360 THEN 22630
  1586.  22620  PRINT "ANGLE MUST BE 000-359 DEGREES": GOSUB 52000: GOTO 22100
  1587.  22630 J =  VAL ( RIGHT$ (A$,4)): IF J > 0 THEN 22650
  1588.  22640  PRINT "DISTANCE MUST BE POSITIVE": GOSUB 52000: GOTO 22100
  1589.  22650  IF FS$(O) <  > "" THEN  PRINT "ONLY ONE 'FSG' ALLOWED": GOSUB 52000: GOTO 22100
  1590.  22660 I =  VAL ( MID$ (U$,SW,2)): IF I < 1 THEN  PRINT "SUB HAS NO GUNS": GOSUB 52000: GOTO 22100
  1591.  22700 FS$(O) = A$: GOTO 22000
  1592.  23100  PRINT : PRINT
  1593.  23110  PRINT  MID$ (U$,SB,2);" X="; INT (UX(U));" Y="; INT (UY(U));
  1594.  23112  IF  MID$ (U$,SM,3) <  > "000" THEN  PRINT " KU="; MID$ (U$,SK,2);" D="; MID$ (U$,SM,3);
  1595.  23114  IF  MID$ (U$,SM,3) = "000" THEN  PRINT " KS="; MID$ (U$,SI,2);
  1596.  23116  PRINT " DIR="; MID$ (U$,SN,3)
  1597.  23120  PRINT "MOVE ORDERS = ";MO$(O): PRINT "FIRE ORDERS = ";FO$(O);FS$(O)
  1598.  23130  RETURN
  1599.  30000  TEXT : HOME : HTAB 10: INVERSE : PRINT "TARGET DATA COMPUTER": NORMAL
  1600.  30001 PI = 3.14159
  1601.  30010  VTAB 4: PRINT "PLEASE ENTER THE FOLLOWING DATA"
  1602.  30012  PRINT : PRINT "SUB'S X = ";: INPUT A$:X0 =  VAL (A$): IF A$ = "Q" THEN  RETURN
  1603.  30020  PRINT "SUBS'S Y = ";: INPUT A$:Y0 =  VAL (A$)
  1604.  30030  PRINT "SUB'S DIRECTION = ";: INPUT A$:Z0 =  VAL (A$): IF Z0 >  = 0 AND Z0 < 360 THEN 30050
  1605.  30040  PRINT "0-359 DEGREES ONLY": GOSUB 52000: GOTO 30030
  1606.  30050  PRINT "SUB'S SPEED = ";: INPUT A$:K0 =  VAL (A$)
  1607.  30060  PRINT "(B)OW OR (S)TERN TUBE ";: INPUT B$: IF B$ = "B" OR B$ = "S" THEN 30080
  1608.  30070  PRINT "ONLY 'B S' ALLOWED": GOSUB 52000: GOTO 30060
  1609.  30080  PRINT : PRINT "TARGET'S X = ";: INPUT A$:XT =  VAL (A$): IF A$ = "Q" THEN 30000
  1610.  30090  PRINT "TARGET'S Y = ";: INPUT A$:YT =  VAL (A$)
  1611.  30100  PRINT "TARGET'S DIRECTION = ";: INPUT A$:Z1 =  VAL (A$): IF Z1 >  = 0 AND Z1 < 360 THEN 30120
  1612.  30110  PRINT "0-359 DEGREES ONLY": GOSUB 52000: GOTO 30100
  1613.  30120  PRINT "TARGET'S SPEED = ";: INPUT A$:K1 =  VAL (A$): IF A$ = "Q" THEN 30000
  1614.  30150  IF B$ = "S" THEN Z0 = Z0 + 180: IF Z0 >  = 360 THEN Z0 = Z0 - 360
  1615.  30152 I = 450 - Z0
  1616.  30160 X2 = X0 + (100 + 10 * K0 * .5555) *  COS (I * PI / 180):X0 = X2
  1617.  30170 Y2 = Y0 + (100 + 10 * K0 * .5555) *  SIN (I * PI / 180):Y0 = Y2
  1618.  30200 X1 = XT:Y1 = YT:T = 0:L1 = 3 * K1 * .5555:L0 = 30 * .5555:Z2 = 450 - Z1
  1619.  30210  VTAB 17: HTAB 1: PRINT "WORKING ";: INVERSE : PRINT " *";:I = I + 1: IF I > 1 THEN I = 0: GOTO 30230
  1620.  30220  HTAB 9: PRINT "* ";
  1621.  30230  NORMAL
  1622.  30240 X2 = X1 + L1 *  COS (Z2 * PI / 180):Y2 = Y1 + L1 *  SIN (Z2 * PI / 180):T = T + 3
  1623.  30250 D =  SQR ((X0 - X2) ^ 2 + (Y0 - Y2) ^ 2):X1 = X2:Y1 = Y2
  1624.  30260 T0 = D / L0: IF T0 > (T) AND D < 10000 THEN 30210
  1625.  30270  GOSUB 30900
  1626.  30280 Z2 =  ABS (A - Z1): IF Z2 > 180 THEN Z2 = Z2 - 180
  1627.  30300  PRINT : PRINT : PRINT "ANGLE TO FIRE TORPEDO = "; INT (A)
  1628.  30310  PRINT "PROJECTED HIT ANGLE (SEC. 6.8) = "; INT (Z2)
  1629.  30320  PRINT "PROJECTED TIME TILL DETONATION = "; INT (T0)
  1630.  30400  PRINT : PRINT "HIT 'RETURN' TO CONTINUE ";: INPUT A$: RETURN
  1631.  30900  IF Y0 = Y2 THEN Y0 = Y0 + 1
  1632.  30902 AA =  ATN ((X0 - X2) / (Y0 - Y2)) * 180 / PI
  1633.  30904 X =  INT (X2 - X0 + .5):Y =  INT (Y2 - Y0 + .5)
  1634.  30910  IF AA > 0 THEN 30940
  1635.  30920  IF X > 0 THEN A = 180 + AA: GOTO 30960
  1636.  30922 A = 360 + AA: GOTO 30960
  1637.  30940  IF X >  = 0 AND Y >  = 0 THEN A = AA: GOTO 30960
  1638.  30942  IF X <  = 0 AND Y <  = 0 THEN A = AA: GOTO 30960
  1639.  30950 A = 180 + AA
  1640.  30960  RETURN
  1641.  52000  INVERSE : FLASH : PRINT : PRINT "ILLEGAL ENTRY"
  1642.  52010  FOR I = 0 TO 1500: NEXT : NORMAL : RETURN
  1643.  53000  CALL CLR%: HGR : HCOLOR= 2: HPLOT 0,0 TO 0,0: CALL 62454
  1644.  53010  FOR I = 0 TO 2:CODE%(I) = 1:SCALE%(I) = 8:XROT%(I) = 7: NEXT
  1645.  53020 X%(0) = 90:Y%(0) = 40
  1646.  53030 X%(1) = 180:Y%(1) = 40
  1647.  53040 X%(2) = 135:Y%(2) = 110
  1648.  53050 J = 7: IF  RND (1) > .5 THEN J = 21
  1649.  53060  FOR I = 0 TO 2:ZROT%(I) = J: NEXT
  1650.  53100  CALL CRNCH%: CALL CRNCH%
  1651.  53102  FOR I = 0 TO 2:X%(I) = X%(I) + 1: NEXT : CALL CRNCH%: CALL CRNCH%
  1652.  53110  POKE  - 16301,0
  1653.  53112  FOR I = 0 TO 2:CODE%(I) = 0:XROT%(I) = 0: NEXT
  1654.  53120  VTAB 23: HTAB 1: PRINT "ENTER PASSWORD ";: INPUT A$: IF A$ = PU$ THEN  RETURN
  1655.  53130  GOSUB 52000: PRINT : PRINT : PRINT : GOTO 53000
  1656.  63000  REM PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  1657.  63001  REM PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  1658.  63002  REM PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  1659.  63003  REM PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  1660.  63004  REM PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  1661.  
  1662.  
  1663.  REM PROG = P4
  1664.  4 I =  FRE (0): HOME : GOSUB 57000
  1665.  2573
  1666.  21968 S%
  1667.  20  FOR U = 0 TO UT:U$(U) =  LEFT$ (U$(U),SB% - 1) + "N" +  RIGHT$ (U$(U),S9 - SB%): NEXT
  1668.  100  GOTO 10000
  1669.  1000 UN$ = UN$(U):U$ = U$(U)
  1670.  1010 Z =  VAL ( MID$ (UN$,4,3)):K0 =  VAL ( MID$ (UN$,2,2))
  1671.  1020  IF  MID$ (NO$,3,1) <  > "C" THEN 1100
  1672.  1030 T =  VAL ( MID$ (NO$,4,2)): IF T > 10 THEN  STOP
  1673.  1040  GOTO 1200
  1674.  1100  IF  MID$ (NO$,3,1) <  > "P" AND  MID$ (NO$,3,1) <  > "S" THEN  STOP
  1675.  1110  GOSUB 29000:A = I
  1676.  1120 J = A / 60:T = 10 / J
  1677.  1130 Z = Z + 10: IF  MID$ (NO$,3,1) = "P" THEN Z = Z - 20
  1678.  1140  IF Z > 360 THEN Z = Z - 360
  1679.  1150  IF Z < 0 THEN Z = Z + 360
  1680.  1200 L0 = K0 * .5555 * T:Z2 = 450 - Z: IF Z2 >  = 360 THEN Z2 = Z2 - 360
  1681.  1210 X0 = XN(U) + L0 *  COS (Z2 * PI / 180)
  1682.  1220 Y0 = YN(U) + L0 *  SIN (Z2 * PI / 180)
  1683.  1300 XN(U) = X0:YN(U) = Y0
  1684.  7778 A$ = "000" +  STR$ (Z)
  1685.  1330 UN$ =  LEFT$ (UN$,3) +  RIGHT$ (A$,3)
  1686.  1340 UN$(U) = UN$: RETURN
  1687.  10000  IF MO$(CO%) = "" THEN MO$(CO%) = "MDC60"
  1688.  10002  IF  LEFT$ (MO$(CO%),3) <  > "MDC" THEN CT% = QP% + 5:MO$(CO%) = MO$(CO%) + "MDC60"
  1689.  10004  IF  LEFT$ (MO$(CO%),3) = "MDC" THEN MO$(CO%) = "MDC60MDC60"
  1690.  10010  FOR U = 0 TO UT
  1691.  10012 U$ = U$(U):UN$(U) =  LEFT$ (U$,1) +  MID$ (U$,SI,2) +  MID$ (U$,SN,3):XN(U) = UX(U):YN(U) = UY(U)
  1692.  10013  IF U < US% THEN 10016
  1693.  10014  IF  MID$ (U$,SM,3) <  > "000" THEN UN$(U) =  LEFT$ (U$,1) +  MID$ (U$,SK,2) +  MID$ (U$,SN,3)
  1694.  10016  NEXT
  1695.  10020 J = CO% - 1
  1696.  10030  FOR I = 0 TO J:MO$(I) = MO$(I) + "MDC60MDC60":TU%(I) = 0: NEXT
  1697.  10032 TU%(CO%) = 0
  1698.  10040  GOSUB 36500: GOSUB 36000: GOSUB 24000
  1699.  10100 TU% = 3:TT% = 2
  1700.  10110  GOSUB 11000
  1701.  32868 ' GOSUB 11800: REM MOVE TORPEDOES
  1702.  10120  GOSUB 12000
  1703.  10130  GOSUB 15000
  1704.  10132  GOSUB 16000: REM TORPEDO FIRE CHAEK
  1705.  10140  GOSUB 20000: REM  DEPTH CHARGE COMBAT
  1706.  10150  GOSUB 21000: REM  TORPEDO COMBAT
  1707.  10200 TU% = TU% + 3: IF TU% < 61 THEN 10110
  1708.  10202  HGR : POKE  - 16302,0
  1709.  10204  FOR I = 5 TO 7
  1710.  10205  HCOLOR= I: HPLOT 0,0 TO 0,0: CALL 62454
  1711.  10206  FOR J = 0 TO 100:X =  PEEK ( - 16336): NEXT
  1712.  10207  NEXT : TEXT
  1713.  10220  PRINT : PRINT : PRINT "HIT 'RETURN' FOR SEARCH PHASE ";: INPUT A$
  1714.  10999  GOTO 19000
  1715.  11000 O = 0
  1716.  11100 T = 0: IF TU%(O) < TU% THEN 11130
  1717.  11110 O = O + 1: IF O > CO% THEN  RETURN
  1718.  11120  GOTO 11100
  1719.  11130  IF O = CO% THEN 11200
  1720.  11140  IF O < NE% THEN U = O: GOTO 11160
  1721.  11150 I = O - NE%:U = US% + I
  1722.  11160 U$ = U$(U):UN$ = UN$(U)
  1723.  11170  IF XN(U) = 69000 THEN 11110
  1724.  11180  GOSUB 11300
  1725.  11199 TU%(O) = TU%(O) + T: GOTO 11100
  1726.  11200  IF  MID$ (MO$(O),3,1) = "C" THEN NO$ = "MDC10": GOTO 11220
  1727.  11202  IF  LEFT$ (MO$(O),2) = "MX" THEN  GOSUB 35000: GOTO 11200
  1728.  11210 NO$ =  LEFT$ (MO$(O),3) + "01"
  1729.  11220 UU = UT% + NT% + NF% - 1:CC = UT%
  1730.  11230  FOR U = CC TO UU
  1731.  11240  IF XN(U) = 69000 THEN 11250
  1732.  11242  IF  MID$ (UN$(U),2,2) <  > "00" THEN UN$ = UN$(U): GOSUB 1000
  1733.  11250  NEXT
  1734.  11252  IF T = 0 THEN T = 2
  1735.  11260  IF  LEFT$ (MO$(O),3) = "MDC" THEN 11290
  1736.  11270 M$ = MO$(O):J =  LEN (M$):I =  VAL ( MID$ (M$,4,2)):I = I - 1: IF I = 0 THEN M$ =  RIGHT$ (M$,J - 5): GOTO 11288
  1737.  11272 A$ = "00" +  STR$ (I):M$ =  LEFT$ (M$,3) +  RIGHT$ (A$,2) +  RIGHT$ (M$,J - 5)
  1738.  11288 MO$(O) = M$: IF  LEFT$ (M$,2) = "MX" THEN 11202
  1739.  11290  GOTO 11199
  1740.  11300 M$ = MO$(O)
  1741.  11310  IF  LEFT$ (M$,3) = "MSS" THEN  GOSUB 14000: GOTO 11300
  1742.  11312  IF  LEFT$ (M$,3) = "MXX" THEN  GOSUB 34000: GOTO 11300
  1743.  11314  IF  LEFT$ (M$,2) = "MC" THEN  GOSUB 28000: GOTO 11300
  1744.  11320  IF  LEFT$ (M$,2) = "MU" THEN  GOSUB 14200: GOTO 11300
  1745.  11330  IF  LEFT$ (M$,3) <  > "MDC" THEN 11500
  1746.  11340 TL =  VAL ( MID$ (M$,4,2))
  1747.  11350  IF TL = 1 THEN NO$ = "MDC01": GOTO 11370
  1748.  11360 NO$ = "MDC02"
  1749.  11370  GOSUB 1000
  1750.  11380 I =  VAL ( MID$ (NO$,4,2)):TL = TL - I
  1751.  11390 J =  LEN (M$): IF TL = 0 THEN M$ =  RIGHT$ (M$,J - 5): GOTO 11420
  1752.  11400 A$ =  STR$ (TL): IF TL < 10 THEN A$ = "0" + A$
  1753.  11410 M$ = "MDC" + A$ +  RIGHT$ (M$,J - 5)
  1754.  11420 MO$(O) = M$: RETURN
  1755.  11500 NO$ =  LEFT$ (M$,3) + "01"
  1756.  11510  GOSUB 1000:T =  INT (T + .5)
  1757.  11520 J =  LEN (M$):I =  VAL ( MID$ (M$,4,2)):I = I - 1
  1758.  2573 - IF I = 0 THEN M$ =  RIGHT$ (M$,J - 5): GOTO 11560
  1759.  11540 A$ =  STR$ (I): IF I < 10 THEN A$ = "0" + A$
  1760.  11550 M$ =  LEFT$ (M$,3) + A$ +  RIGHT$ (M$,J - 5)
  1761.  11560 MO$(O) = M$: RETURN
  1762.  11800  IF TT% > TU% THEN  RETURN
  1763.  11810 UU = TI% - 1: IF TI% = 0 THEN 11910
  1764.  11820  FOR U = 0 TO UU
  1765.  11822  IF TX(U) = 69000 THEN 11900
  1766.  11830 Z = TZ%(U)
  1767.  11840 Z2 = 450 - Z
  1768.  11850 L0 = 30 * .5555 * 6
  1769.  11860 X = TX(U) + L0 *  COS (Z2 * PI / 180)
  1770.  11870 Y = TY(U) + L0 *  SIN (Z2 * PI / 180)
  1771.  11880 TX(U) = X:TY(U) = Y
  1772.  11900  NEXT
  1773.  11910 TT% = TT% + 6: GOTO 11800
  1774.  12000  PRINT "COLLISION CHECK TIME=";TU% - 3
  1775.  12010 UU = NE% - 1
  1776.  12100  FOR U = 0 TO UU
  1777.  12110  IF XN(U) = 69000 THEN 12130
  1778.  12120 CC = 0: GOSUB 12700
  1779.  25195 / NEXT
  1780.  12200 UU = US%
  1781.  12210  FOR U = UU TO UT
  1782.  12220  IF XN(U) = 69000 THEN 12240
  1783.  12230 CC = NE%: GOSUB 12700
  1784.  12240  NEXT
  1785.  12299  RETURN
  1786.  12700  FOR C = CC TO UT: REM  CHECK SHIPS **
  1787.  12710  IF C = U THEN 12900
  1788.  12720  IF XN(C) = 69000 THEN 12900
  1789.  12730  IF  ABS (XN(U) - XN(C)) > 150 THEN 12900
  1790.  12740  IF  ABS (YN(U) - YN(C)) > 150 THEN 12900
  1791.  12748 J =  VAL ( MID$ (U$(C),SM,3))
  1792.  12750 I =  VAL ( MID$ (U$(U),SM,3)): IF I = 0 THEN 12800
  1793.  12760  IF J = 0 THEN 12900
  1794.  12770  IF  ABS (I - J) > 100 THEN 12900
  1795.  12780 U$ = U$(U): GOSUB 50510:VS% = VS% + V
  1796.  12781  FLASH : PRINT "SUBS COLLIDED U/W": NORMAL
  1797.  12782 A = U:U = C
  1798.  12784 U$ = U$(U): GOSUB 50510:VS% = VS% + V:U = A: GOTO 12900
  1799.  12800  IF J <  > 0 THEN 12900
  1800.  12802  FLASH : PRINT "SHIPS COLLIDED ON SURFACE": NORMAL :UP$ = "U": IF U >  = US% THEN UP$ = "S"
  1801.  2573 2 GOSUB 50500: GOSUB 50600
  1802.  12812 A = U:U = C:UP$ = "U": IF U >  = US% THEN UP$ = "S"
  1803.  12814  GOSUB 50500: GOSUB 50600:U = A
  1804.  12900  NEXT
  1805.  12910  RETURN
  1806.  14000 UN$(U) =  LEFT$ (UN$(U),1) +  MID$ (M$,4,2) +  RIGHT$ (UN$(U),3)
  1807.  14010 I =  LEN (M$):MO$(O) =  RIGHT$ (MO$(O),I - 5): RETURN
  1808.  14200 D =  VAL ( MID$ (U$,SM,3)): IF D <  > 0 THEN 14300
  1809.  14210 I =  VAL ( MID$ (U$,SI,2)):J =  VAL ( MID$ (U$,SJ,2)):K = I: IF I > J THEN K = J
  1810.  14230 A$ = "00" +  STR$ (K):UN$(U) = "3" +  RIGHT$ (A$,2) +  RIGHT$ (UN$(U),3)
  1811.  14300 U$(U) =  LEFT$ (U$(U),SM - 1) +  MID$ (M$,3,3) +  RIGHT$ (U$(U),S9 - SM - 2)
  1812.  14310 I =  LEN (M$):MO$(O) =  RIGHT$ (MO$(O),I - 5): RETURN
  1813.  15000 UU = NE% - 1
  1814.  15100  FOR O = 0 TO UU
  1815.  15102  IF UX(O) = 69000 THEN 15900
  1816.  15110  IF FO$(O) = "" THEN 15900
  1817.  15120 F$ = FO$(O):AB = 1
  1818.  15130 K =  VAL ( MID$ (F$,AB + 3,1)) * 10
  1819.  15140  IF K > TU% THEN 15160
  1820.  15150  GOTO 15200
  1821.  15160 J =  LEN (F$):AB = AB + 7: IF AB < J THEN 15130
  1822.  15170  GOTO 15900
  1823.  15200 Z =  VAL ( MID$ (UN$(O),4,3)):NO$ =  MID$ (F$,AB,7)
  1824.  15210  IF  LEFT$ (NO$,2) <  > "FD" THEN 15300
  1825.  15220 Z1 = Z + 180: IF Z1 > 360 THEN Z1 = Z1 - 360
  1826.  15230 Z2 = 450 - Z1
  1827.  15240 J = 60: GOSUB 15700
  1828.  15250  GOTO 15800
  1829.  15300  IF  LEFT$ (NO$,2) <  > "FA" THEN 15400
  1830.  15310 J =  VAL ( MID$ (NO$,5,3)) + 50
  1831.  15320 Z2 = 450 - Z
  1832.  15330  GOSUB 15700
  1833.  15340  GOTO 15800
  1834.  15400  IF  LEFT$ (NO$,2) <  > "FK" THEN  STOP
  1835.  15410 J = Z + 90: IF J > 360 THEN J = J - 360
  1836.  15420 Z2 = 450 - J
  1837.  15430 J = 100: GOSUB 15700
  1838.  15440 J = Z - 90: IF J < 0 THEN J = J + 360
  1839.  15450 Z2 = 450 - J
  1840.  15460 J = 100: GOSUB 15700
  1841.  15470  GOTO 15800
  1842.  15700 X = XN(O) + J *  COS (Z2 * PI / 180): REM EXPLODE & UPDATE ******
  1843.  15710 Y = YN(O) + J *  SIN (Z2 * PI / 180)
  1844.  15720 WX(WI%) = X:WY(WI%) = Y
  1845.  15730 D =  VAL ( MID$ (NO$,5,3)):WZ(WI%) = D
  1846.  15740  IF  LEFT$ (NO$,2) = "FA" THEN WZ(WI%) =  - 69:WT%(WI%) = TU% + 7: GOTO 15760
  1847.  15750 I =  INT (D / 10):WT%(WI%) = I + TU% + 7
  1848.  15760 WI% = WI% + 1: IF WI% > 19 THEN WI% = 19
  1849.  15770  RETURN
  1850.  15800 I =  LEN (F$):F$ =  LEFT$ (F$,AB + 2) + "9" +  RIGHT$ (F$,I - AB - 3): REM UPDATE ORDER
  1851.  15810 FO$(O) = F$: GOTO 15160
  1852.  15900  NEXT
  1853.  15910  RETURN
  1854.  16000 CC = NE%:UU = CO% - 1
  1855.  16100  FOR O = CC TO UU
  1856.  16110  IF FO$(O) = "" THEN 16400
  1857.  16120 F$ = FO$(O):AB = 1
  1858.  16130 K =  VAL ( MID$ (F$,AB + 6,2))
  1859.  16140  IF K + 10 > TU% THEN 16160
  1860.  16150  GOTO 16200
  1861.  16160 J =  LEN (F$):AB = AB + 8: IF AB < J THEN 16130
  1862.  16170  GOTO 16400
  1863.  16200 J = O + NF% + NT%:Z =  VAL ( RIGHT$ (UN$(J),3))
  1864.  16210 D = 150: IF  MID$ (F$,AB + 2,1) = "B" THEN 16230
  1865.  16220 D =  - 150:Z = Z + 180: IF Z > 360 THEN Z = Z - 360
  1866.  16230 Z2 = 450 - Z: IF Z2 = 360 OR Z2 = 180 THEN Z2 = 0
  1867.  16232  IF XN(J) = 69000 THEN 16400
  1868.  16234 VS% = VS% + 1: FLASH : PRINT "TORPEDO AWAY": NORMAL : GOSUB 16800: IF TI% >  = 19 THEN 16300
  1869.  16236 Z0 =  VAL ( RIGHT$ (UN$(J),3)): IF  MID$ (F$,AB + 2,1) = "S" THEN Z0 = Z0 + 180
  1870.  16237 I =  ABS (Z0 - Z): IF I > 180 THEN I = 360 - I
  1871.  16238  IF I > 120 THEN 16300
  1872.  16240 X = XN(J) + D *  COS (Z2 * PI / 180)
  1873.  16250 Y = YN(J) + D *  SIN (Z2 * PI / 180)
  1874.  16260 TX(TI%) = X:TY(TI%) = Y:TZ%(TI%) =  VAL ( MID$ (F$,AB + 3,3))
  1875.  16270 TI% = TI% + 1: IF TI% >  = 19 THEN TI% = 19
  1876.  16272 A$ =  LEFT$ (TA$,TI%) + "8000000000000000000000":TA$ =  LEFT$ (A$,22)
  1877.  16300 I =  LEN (F$): IF I = AB + 7 THEN 16304
  1878.  16302 F$ =  LEFT$ (F$,AB + 5) + "99" +  RIGHT$ (F$,I - AB - 7): GOTO 16310
  1879.  16304 F$ =  LEFT$ (F$,AB + 5) + "99"
  1880.  16310 FO$(O) = F$: GOTO 16160
  1881.  16400  NEXT
  1882.  16410  RETURN
  1883.  16800 A$ = TB$(J - US%): IF  MID$ (F$,AB + 2,1) = "S" THEN A$ = TS$(J - US%)
  1884.  16810 X = 2
  1885.  16820  IF  MID$ (A$,X,1) = "L" THEN 16840
  1886.  16830 X = X + 1: IF X < 11 THEN 16820
  1887.  16832  STOP
  1888.  16840 A$ =  LEFT$ (A$,X - 1) + "F" +  RIGHT$ (A$,11 - X)
  1889.  16850  IF  MID$ (F$,AB + 2,1) = "B" THEN TB$(J - US%) = A$: GOTO 16870
  1890.  16860  IF  MID$ (F$,AB + 2,1) = "S" THEN TS$(J - US%) = A$: GOTO 16870
  1891.  16865  STOP
  1892.  16870  RETURN
  1893.  19000  REM  CHAIN **
  1894.  19010  TEXT : HOME :I =  FRE (0)
  1895.  19100  VTAB 12: HTAB 10: INVERSE : PRINT " LOADING SEARCH PHASE "
  1896.  19110  NORMAL
  1897.  19200  &  GOTO "P5"
  1898.  20000 AB = WI% - 1: IF AB =  - 1 THEN  RETURN
  1899.  20110  FOR U = 0 TO UT
  1900.  20112 U$ = U$(U): IF XN(U) = 69000 THEN 20310
  1901.  20120  FOR DC = 0 TO AB
  1902.  20122  IF TU% < WT%(DC) THEN 20300
  1903.  20124  IF WT%(DC) = 6969 THEN  STOP 20300
  1904.  20126  IF WZ(DC) =  - 69 THEN WZ(DC) = 0:WT%(DC) =  - 69
  1905.  20130 X0 = XN(U):Y0 = YN(U):X1 = WX(DC):Y1 = WY(DC)
  1906.  20132 D =  SQR ((X0 - X1) ^ 2 + (Y0 - Y1) ^ 2)
  1907.  20140  IF D > 75 THEN 20300
  1908.  20142  IF QB% = 69 THEN 20200
  1909.  20144  IF D > 50 THEN 20300
  1910.  20200 I =  VAL ( MID$ (U$(U),SM,3))
  1911.  20210 D0 =  ABS (I - WZ(DC)): IF D0 > 75 THEN 20300
  1912.  20212  IF QB% = 69 THEN 20220
  1913.  20214  IF D0 > 50 THEN 20300
  1914.  20220  GOSUB 20500
  1915.  20230 WT%(DC) = 6969: GOSUB 60000: GOSUB 58000
  1916.  20300  NEXT DC
  1917.  20310  NEXT U
  1918.  24696 O FOR DC = 0 TO AB
  1919.  20330  IF WT%(DC) = 6969 THEN 20360
  1920.  20332  IF WT%(DC) <  >  - 69 THEN 20340
  1921.  20334 WZ(DC) = WZ(DC) + 30: IF WZ(DC) > 999 THEN 20350
  1922.  20336  GOTO 20360
  1923.  20340  IF TU% < WT%(DC) THEN 20360
  1924.  20350 WT%(DC) = 6969: GOSUB 60000: GOSUB 58000
  1925.  20360  NEXT : RETURN
  1926.  20500  IF D > 50 THEN D = 45: REM U/W CRT
  1927.  20502  IF D0 > 50 THEN D0 = 45
  1928.  20503  IF WT%(DC) =  - 69 THEN D0 = 11
  1929.  20504 I = 100 - D - D0:J = I / 100:K =  VAL ( MID$ (U$,SX,1)) / 10:Q =  RND (1) + .5
  1930.  20510 X0 = J * 20 * K * Q:X1 =  INT (X0 + .5)
  1931.  20520 Y0 =  VAL ( MID$ (U$,SV,2)):Y1 = Y0 - X1: IF Y1 < 1 THEN 20600
  1932.  20530 A$ = "00" +  STR$ (Y1):U$ =  LEFT$ (U$,SV - 1) +  RIGHT$ (A$,2) +  RIGHT$ (U$,S9 - SV - 1)
  1933.  20540 U$(U) = U$: RETURN
  1934.  20600  FLASH : PRINT "SHIP SUNK BY DC":UP$ = "S": NORMAL
  1935.  20610  GOSUB 50500: GOSUB 50600: GOTO 20540
  1936.  21000  IF TI% = 0 THEN  RETURN
  1937.  21100 CC = TI% - 1:UU = US% - 1
  1938.  21110  FOR AB = 0 TO CC
  1939.  21112  IF TX(AB) = 69000 THEN 21410
  1940.  21120  FOR U = 0 TO UU
  1941.  21122 U$ = U$(U):UN$ = UN$(U): IF XN(U) = 69000 THEN 21400
  1942.  21130 X0 = XN(U):Y0 = YN(U):X1 = TX(AB):Y1 = TY(AB)
  1943.  21140 D =  SQR ((X0 - X1) ^ 2 + (Y0 - Y1) ^ 2)
  1944.  21150  IF D > 150 THEN 21400
  1945.  21160 D0 =  VAL ( RIGHT$ (UN$,3)):J =  VAL ( MID$ (U$,SX,1)) / 10:I =  ABS (D0 - TZ%(AB))
  1946.  43643 R IF I > 90 THEN I = I - 90: GOTO 21162
  1947.  21170 I = I + 10:K = I * J:Q =  RND (1) * 100
  1948.  21172  IF NU$ = "A" AND TP$ <  > "3" THEN K = K / 2
  1949.  21180  IF Q <  = K THEN 21190
  1950.  21182 I = Q - K: FLASH : IF I < 11 THEN  PRINT "TORPEDO NARROWLY MISSED ";: GOTO 21185
  1951.  21183  IF I < 34 THEN  PRINT "TORPEDO CAME CLOSE TO ";: GOTO 21185
  1952.  21184  PRINT "TORPEDO WENT WIDE OF ";
  1953.  21185  PRINT  MID$ (U$,SB,2): NORMAL
  1954.  21186 Z = 450 - TZ%(AB):TX(AB) = TX(AB) + 400 *  COS (Z * PI / 180):TY(AB) = TY(AB) + 400 *  SIN (Z * PI / 180)
  1955.  21188  GOTO 21400
  1956.  21190 X0 = 30 * ( RND (1) + .5):X1 =  INT (X0 + .5): GOSUB 60500
  1957.  21200 Y0 =  VAL ( MID$ (U$,SV,2)):Y1 = Y0 - X1: IF Y1 < 1 THEN 21300
  1958.  21210 A$ = "00" +  STR$ (Y1):U$ =  LEFT$ (U$,SV - 1) +  RIGHT$ (A$,2) +  RIGHT$ (U$,S9 - SV - 1)
  1959.  21212 TX(AB) = 69000: GOSUB 21800
  1960.  21215  FLASH : PRINT "TORPEDO HIT "; MID$ (U$,SB,2): NORMAL
  1961.  21220 U$(U) = U$: GOTO 21400
  1962.  21300  FLASH : PRINT  MID$ (U$,SB,2);" SUNK BY TORPEDO":UP$ = "U": NORMAL
  1963.  21302 TX(AB) = 69000
  1964.  21310  GOSUB 50500: GOSUB 50600: GOTO 21400
  1965.  21400  NEXT U
  1966.  21410  NEXT AB
  1967.  21420  RETURN
  1968.  21800  IF U >  = NE% THEN  RETURN
  1969.  21810 I =  INT ((X1 *  RND (1)) + .5):J =  VAL ( MID$ (U$,SH,2)):K = J - I: IF K < 1 THEN K = 0
  1970.  21820 A$ = "00" +  STR$ (K):U$ =  LEFT$ (U$,SH - 1) +  RIGHT$ (A$,2) +  RIGHT$ (U$,S9 - SH - 1)
  1971.  21830 J =  VAL ( MID$ (UN$,2,2)): IF J <  = K THEN  RETURN
  1972.  21840 U$ =  LEFT$ (U$,SI - 1) +  RIGHT$ (A$,2) +  RIGHT$ (U$,S9 - SI - 1)
  1973.  21850 UN$ =  LEFT$ (UN$,1) +  RIGHT$ (A$,2) +  RIGHT$ (UN$,3):UN$(U) = UN$: RETURN
  1974.  24000 CC = CO% - 1: IF  RND (1) > .5 THEN 24010: REM FSS CRT **
  1975.  24002  FOR O = CC TO 0 STEP  - 1
  1976.  24004  GOTO 24020
  1977.  24010  FOR O = 0 TO CC
  1978.  24020 F$ = FS$(O): IF F$ = "" THEN 24060
  1979.  24030 A =  LEN (F$):B = 1
  1980.  24040  IF  MID$ (F$,B,3) = "FSG" THEN 24100
  1981.  24050 B = B + 10: IF B <  = (A) THEN 24040
  1982.  24060  NEXT O
  1983.  24070  RETURN
  1984.  24100 Z =  VAL ( MID$ (F$,B + 3,3)):D =  VAL ( MID$ (F$,B + 6,4))
  1985.  24110  IF O < NE% THEN U = O: GOTO 24130
  1986.  24120 I = O - NE%:U = US% + I
  1987.  24130 U$ = U$(U):UN$ = UN$(U):X = UX(U):Y = UY(U): IF X = 69000 THEN 24060
  1988.  24131  PRINT  MID$ (U$,SB,2);" FIRING SURFACE GUNS": GOSUB 60500
  1989.  24132 J =  VAL ( MID$ (U$,SM,3)): IF J <  > 0 THEN 24060
  1990.  24140 Z2 = 450 - Z: IF Z2 >  = 360 THEN Z2 = Z2 - 360
  1991.  24150 X0 = X + D *  COS (Z2 * PI / 180):Y0 = Y + D *  SIN (Z2 * PI / 180)
  1992.  24200  FOR I = 0 TO UT
  1993.  24202  IF UX(I) = 69000 THEN 24310
  1994.  24204 J =  VAL ( MID$ (U$(I),SM,3)): IF J <  > 0 THEN 24310
  1995.  24210  IF  ABS (UX(I) - X0) > 150 THEN 24310
  1996.  24220  IF  ABS (UY(I) - Y0) > 150 THEN 24310
  1997.  24230 D0 =  SQR ((UX(I) - X0) ^ 2 + (UY(I) - Y0) ^ 2)
  1998.  24240 J = (150 - D0) / 500:Q =  RND (1) + .5
  1999.  24250 K =  VAL ( MID$ (U$(U),SW,2)):C = J * K * Q
  2000.  24260 L1 =  INT (C + .5): IF L1 < 1 THEN 24310
  2001.  24270 U$ = U$(I):K1 =  VAL ( MID$ (U$,SV,2)):DC = K1 - L1: IF DC < 1 THEN 24400
  2002.  24280 A$ = "00" +  STR$ (DC):U$ =  LEFT$ (U$,SV - 1) +  RIGHT$ (A$,2) +  RIGHT$ (U$,S9 - SV - 1)
  2003.  24300 U$(I) = U$
  2004.  24305  FLASH : PRINT "SURFACE GUN HIT "; MID$ (U$,SB,2): NORMAL
  2005.  24310  NEXT I
  2006.  24320  GOTO 24060
  2007.  24400  PRINT  MID$ (U$,SB,2);" SUNK BY SURFACE GUNS":UP$ = "U": IF I >  = US% THEN UP$ = "S"
  2008.  24405  REM
  2009.  24410 J = U:U = I: GOSUB 50500:I = U:U = J: GOSUB 50600: GOTO 24310
  2010.  28000  IF  LEFT$ (M$,2) <  > "MC" THEN  RETURN
  2011.  28010 C$ =  LEFT$ (M$,5):A =  LEN (M$): IF A = 5 THEN M$ = "": GOTO 28030
  2012.  28020 M$ =  RIGHT$ (M$,A - 5)
  2013.  28030 D0 =  VAL ( RIGHT$ (UN$,3)):D =  VAL ( MID$ (C$,3,3))
  2014.  28040  IF D0 > D THEN A$ = "P"
  2015.  28050  IF D0 < D THEN A$ = "S"
  2016.  28060  IF D0 = D THEN MO$(O) = M$: RETURN
  2017.  28070 J =  ABS (D0 - D): IF J <  = 180 THEN 28100
  2018.  28080 J = D0 + 360 - D: IF J < 180 THEN A$ = "P": GOTO 28100
  2019.  28090 J = D + 360 - D0: IF J < 180 THEN A$ = "S": GOTO 28100
  2020.  28095  STOP
  2021.  28100  GOSUB 29000:K = 0:D$ = ""
  2022.  28110 K = K + 10: IF K >  = I THEN 28140
  2023.  28120  IF K >  = J THEN 28200
  2024.  28130  GOTO 28110
  2025.  28140 A =  INT (K / 10):B$ = "00" +  STR$ (A)
  2026.  28150 D$ = D$ + "MD" + A$ +  RIGHT$ (B$,2):K = 0:J = J - I: IF J = 0 THEN 28260
  2027.  28160 K = 0: GOTO 28110
  2028.  28200 A =  INT (K / 10):B$ = "00" +  STR$ (A)
  2029.  28210 D$ = D$ + "MD" + A$ +  RIGHT$ (B$,2)
  2030.  28220 A =  ABS (K - J): IF A = 0 THEN 28260
  2031.  28230 B$ = "0" +  STR$ (A)
  2032.  28240 A$ =  MID$ (D$,3,1)
  2033.  28250 D$ = D$ + "MXX" + A$ +  RIGHT$ (B$,1)
  2034.  28260 M$ = D$ + M$:MO$(O) = M$: RETURN
  2035.  29000 A =  VAL ( MID$ (U$,SG,1)): IF A < 1 OR A > 9 THEN  STOP
  2036.  21125 q ON A GOTO 29011,29012,29013,29014,29015,29016,29017,29018,29019
  2037.  29011 I = 6: GOTO 29020
  2038.  29012 I = 18: GOTO 29020
  2039.  29013 I = 30: GOTO 29020
  2040.  29014 I = 60: GOTO 29020
  2041.  29015 I = 90: GOTO 29020
  2042.  29016 I = 120: GOTO 29020
  2043.  29017 I = 180: GOTO 29020
  2044.  29018 I = 360: GOTO 29020
  2045.  29019 I = 720
  2046.  29020  RETURN
  2047.  32000 K0 =  VAL ( MID$ (UN$(O),2,2)): REM  CHANGE SPEED ORDER **
  2048.  2573 }K1 =  VAL ( MID$ (M$,4,2))
  2049.  32020  IF  MID$ (M$,3,1) = "P" THEN K = K0 + K1
  2050.  32030  IF  MID$ (M$,3,1) = "M" THEN K = K0 - K1
  2051.  32040  IF K < 1 THEN K = 0
  2052.  32050 K1 =  VAL ( MID$ (U$(O),SH,2))
  2053.  32060  IF K > K1 THEN K = K1
  2054.  32070 B$ =  STR$ (K): IF K < 1 THEN B$ = "000"
  2055.  32080 UN$(O) =  LEFT$ (UN$(O),1) +  RIGHT$ (B$,2) +  RIGHT$ (UN$(O),3)
  2056.  32100 I =  LEN (M$):MN$(O) =  RIGHT$ (M$,I - 5)
  2057.  32110  RETURN
  2058.  34000 D0 =  VAL ( RIGHT$ (UN$,3)):D =  VAL ( MID$ (M$,5,1))
  2059.  34010  IF  MID$ (M$,4,1) = "P" THEN D0 = D0 + D
  2060.  58503  INPUT  IF  MID$ (M$,4,1) = "S" THEN D0 = D0 - D
  2061.  34030 A$ = "00" +  STR$ (D0):UN$ =  LEFT$ (UN$,3) +  RIGHT$ (A$,3)
  2062.  34040 A =  LEN (M$):M$ =  RIGHT$ (M$,A - 5)
  2063.  34050 UN$(U) = UN$:MO$(O) = M$: RETURN
  2064.  35000 UU = UT% + NT% + NF% - 1:CC = UT%
  2065.  35070  FOR U = CC TO UU
  2066.  35080  IF XN(U) = 69000 THEN 35100
  2067.  2573  TEXT D0 =  VAL ( RIGHT$ (UN$(U),3)):D =  VAL ( MID$ (MO$(O),5,1)): IF  MID$ (MO$(O),4,1) = "P" THEN K = D0 + D: GOTO 35086
  2068.  35084  IF  MID$ (MO$(O),4,1) = "S" THEN K = D0 - D: GOTO 35086
  2069.  2573  TEXT  STOP
  2070.  35086 A$ = "00" +  STR$ (K):UN$(U) =  LEFT$ (UN$(U),3) +  RIGHT$ (A$,3)
  2071.  35100  NEXT
  2072.  35110 MO$(O) = "MDC60MDC60": RETURN
  2073.  36000 U = US%: REM FORCE SUB TO SURFACE **
  2074.  36002 U$ = U$(U): IF UX(U) = 69000 THEN 36110
  2075.  36010 J =  VAL ( MID$ (U$,SU,2)):K = 2 *  VAL ( MID$ (U$,SV,2)): IF K > J THEN 36110
  2076.  36020 O = NE% + U - US%:M$ = "12345" + MO$(O) + "67890":M =  LEN (M$):B = 1
  2077.  36030  IF  MID$ (M$,B,2) <  > "MU" THEN 36050
  2078.  36040 M$ =  LEFT$ (M$,B - 1) +  RIGHT$ (M$,M - B - 4):M = M - 5:B = B - 5
  2079.  36050 B = B + 5: IF B <  = M THEN 36030
  2080.  36070 D0 =  VAL ( MID$ (U$,SM,3)):D =  VAL ( MID$ (U$,SP,3)):P = D0 - D: IF P < 0 THEN P = 0
  2081.  36090 A$ = "000" +  STR$ (P): IF M = 10 THEN MO$(O) = "MU" +  RIGHT$ (A$,3) + "MDC60MDC60": GOTO 36110
  2082.  36100 MO$(O) = "MU" +  RIGHT$ (A$,3) +  MID$ (M$,6,M - 10)
  2083.  36110 U = U + 1: IF U <  = UT THEN 36002
  2084.  36120 M$ = "": RETURN
  2085.  36500  FOR I = 0 TO UT: REM DEAD IN WATER **
  2086.  36510  IF UX(I) = 69000 THEN 36550
  2087.  36520 J =  VAL ( MID$ (U$(I),SV,2)): IF J > 4 THEN 36550
  2088.  36530 U$(I) =  LEFT$ (U$(I),SH - 1) + "0000" +  RIGHT$ (U$(I),S9 - SH - 3)
  2089.  36532 UN$(I) =  LEFT$ (UN$(I),1) + "00" +  RIGHT$ (UN$(I),3)
  2090.  36534  IF I < NE% THEN MO$(I) = "MDC60MDC60"
  2091.  36536  IF I >  = US% THEN MO$(I - US% + NE%) = "MDC60MDC60"
  2092.  36540  IF I >  = US% THEN U$(I) =  LEFT$ (U$(I),SK - 1) + "00" +  RIGHT$ (U$(I),S9 - SK - 1)
  2093.  36550  NEXT
  2094.  36560  RETURN
  2095.  50500  PRINT  MID$ (U$(U),2,2);" SUNK"
  2096.  50510 UX(U) = 69000:UY(U) = 69000:XN(U) = 69000:YN(U) = 69000:U$ = U$(U)
  2097.  50520 U$ =  LEFT$ (U$,SV - 1) + "00" +  RIGHT$ (U$,S9 - SV - 1): REM DP'S = 0
  2098.  50530 V =  VAL ( MID$ (U$,SF,2))
  2099.  50540 U$(U) = U$: RETURN
  2100.  50600  IF UP$ = "U" THEN 50620: REM ADD VP'S **
  2101.  50610 VS% = VS% + V: GOTO 50630
  2102.  50620 VU% = VU% + V
  2103.  50630  PRINT V;" VP'S AWARDED TO ";
  2104.  50640  IF UP$ = "U" THEN  PRINT "UNDERWATER";: GOTO 50660
  2105.  50650  PRINT "SURFACE";
  2106.  50660  PRINT " SIDE"
  2107.  50690  RETURN
  2108.  57000  VTAB 24: PRINT "THIS WILL TAKE 1-5 MINUTES."
  2109.  57002 I =  FRE (0)
  2110.  57010  PRINT : PRINT : RETURN
  2111.  58000  FOR X1 = 0 TO UT
  2112.  58010  IF UX(X1) = 69000 THEN 58100
  2113.  58020 J =  VAL ( MID$ (U$(X1),SM,3)): IF J <  > 0 THEN 58100
  2114.  58030 J =  SQR ((XN(X1) - WX(DC)) ^ 2 + (YN(X1) - WY(DC)) ^ 2): IF J > 75 THEN 58100
  2115.  58050  IF QB% = 69 THEN 58070
  2116.  58060  IF J > 50 THEN 58100
  2117.  58070  FLASH : PRINT  MID$ (U$(X1),SB,2);" SUNK BY D.C. BACK-WASH!": NORMAL : PRINT "DIS=";J:UP$ = "U": IF X1 >  = US% THEN UP$ = "S"
  2118.  58080 X0 = U:U = X1:A$ = U$:U$ = U$(X1): GOSUB 50500: GOSUB 50600:U = X0:U$ = A$
  2119.  58100  NEXT : RETURN
  2120.  60000  GOSUB 60500
  2121.  60020  PRINT "DC DETONATED AT "; INT (WX(DC));","; INT (WY(DC));" DEPTH="; INT (WZ(DC))
  2122.  60030 J = US%
  2123.  60040  FOR I = J TO UT
  2124.  60042 K =  SQR ((XN(I) - WX(DC)) ^ 2 + (YN(I) - WY(DC)) ^ 2)
  2125.  60044  IF K > 251 THEN 60060
  2126.  60046 U$(I) =  LEFT$ (U$(I),SB% - 1) + "Y" +  RIGHT$ (U$(I),S9 - SB%)
  2127.  60048  IF QB% <  > 69 THEN 60060
  2128.  60052 K =  SQR ((XN(I) - WX(DC)) ^ 2 + (YN(I) - WY(DC)) ^ 2)
  2129.  60054  PRINT " DIS="; INT (K)
  2130.  60060  NEXT
  2131.  60099  POKE  - 16301,0: RETURN
  2132.  60500  CALL CLR%: HGR : POKE  - 16302,0
  2133.  60510  HCOLOR= 5: HPLOT 0,0 TO 0,0: CALL 62454
  2134.  60520  FOR I = 0 TO 2: HCOLOR= 3: HPLOT 0,0 TO 0,0: CALL 62454: HCOLOR= 5: HPLOT 0,0 TO 0,0: CALL 62454: NEXT
  2135.  60530  TEXT : RETURN
  2136.  
  2137.  18255  = P4
  2138.  4 I =  FRE (0): HOME : GOSUB 57000
  2139.  2573
  2140.  21968 S%
  2141.  20  FOR U = 0 TO UT:U$(U) =  LEFT$ (U$(U),SB% - 1) + "N" +  RIGHT$ (U$(U),S9 - SB%): NEXT
  2142.  100  GOTO 10000
  2143.  1000 UN$ = UN$(U):U$ = U$(U)
  2144.  1010 Z =  VAL ( MID$ (UN$,4,3)):K0 =  VAL ( MID$ (UN$,2,2))
  2145.  1020  IF  MID$ (NO$,3,1) <  > "C" THEN 1100
  2146.  1030 T =  VAL ( MID$ (NO$,4,2)): IF T > 10 THEN  STOP
  2147.  1040  GOTO 1200
  2148.  1100  IF  MID$ (NO$,3,1) <  > "P" AND  MID$ (NO$,3,1) <  > "S" THEN  STOP
  2149.  1110  GOSUB 29000:A = I
  2150.  1120 J = A / 60:T = 10 / J
  2151.  1130 Z = Z + 10: IF  MID$ (NO$,3,1) = "P" THEN Z = Z - 20
  2152.  1140  IF Z > 360 THEN Z = Z - 360
  2153.  1150  IF Z < 0 THEN Z = Z + 360
  2154.  1200 L0 = K0 * .5555 * T:Z2 = 450 - Z: IF Z2 >  = 360 THEN Z2 = Z2 - 360
  2155.  1210 X0 = XN(U) + L0 *  COS (Z2 * PI / 180)
  2156.  1220 Y0 = YN(U) + L0 *  SIN (Z2 * PI / 180)
  2157.  1300 XN(U) = X0:YN(U) = Y0
  2158.  7778 A$ = "000" +  STR$ (Z)
  2159.  1330 UN$ =  LEFT$ (UN$,3) +  RIGHT$ (A$,3)
  2160.  1340 UN$(U) = UN$: RETURN
  2161.  10000  IF MO$(CO%) = "" THEN MO$(CO%) = "MDC60"
  2162.  10002  IF  LEFT$ (MO$(CO%),3) <  > "MDC" THEN CT% = QP% + 5:MO$(CO%) = MO$(CO%) + "MDC60"
  2163.  10004  IF  LEFT$ (MO$(CO%),3) = "MDC" THEN MO$(CO%) = "MDC60MDC60"
  2164.  10010  FOR U = 0 TO UT
  2165.  10012 U$ = U$(U):UN$(U) =  LEFT$ (U$,1) +  MID$ (U$,SI,2) +  MID$ (U$,SN,3):XN(U) = UX(U):YN(U) = UY(U)
  2166.  10013  IF U < US% THEN 10016
  2167.  10014  IF  MID$ (U$,SM,3) <  > "000" THEN UN$(U) =  LEFT$ (U$,1) +  MID$ (U$,SK,2) +  MID$ (U$,SN,3)
  2168.  10016  NEXT
  2169.  10020 J = CO% - 1
  2170.  10030  FOR I = 0 TO J:MO$(I) = MO$(I) + "MDC60MDC60":TU%(I) = 0: NEXT
  2171.  10032 TU%(CO%) = 0
  2172.  10040  GOSUB 36500: GOSUB 36000: GOSUB 24000
  2173.  10100 TU% = 3:TT% = 2
  2174.  10110  GOSUB 11000
  2175.  32868 ' GOSUB 11800: REM MOVE TORPEDOES
  2176.  10120  GOSUB 12000
  2177.  10130  GOSUB 15000
  2178.  10132  GOSUB 16000: REM TORPEDO FIRE CHAEK
  2179.  10140  GOSUB 20000: REM  DEPTH CHARGE COMBAT
  2180.  10150  GOSUB 21000: REM  TORPEDO COMBAT
  2181.  10200 TU% = TU% + 3: IF TU% < 61 THEN 10110
  2182.  10202  HGR : POKE  - 16302,0
  2183.  10204  FOR I = 5 TO 7
  2184.  10205  HCOLOR= I: HPLOT 0,0 TO 0,0: CALL 62454
  2185.  10206  FOR J = 0 TO 100:X =  PEEK ( - 16336): NEXT
  2186.  10207  NEXT : TEXT
  2187.  10220  PRINT : PRINT : PRINT "HIT 'RETURN' FOR SEARCH PHASE ";: INPUT A$
  2188.  10999  GOTO 19000
  2189.  11000 O = 0
  2190.  11100 T = 0: IF TU%(O) < TU% THEN 11130
  2191.  11110 O = O + 1: IF O > CO% THEN  RETURN
  2192.  11120  GOTO 11100
  2193.  11130  IF O = CO% THEN 11200
  2194.  11140  IF O < NE% THEN U = O: GOTO 11160
  2195.  11150 I = O - NE%:U = US% + I
  2196.  11160 U$ = U$(U):UN$ = UN$(U)
  2197.  11170  IF XN(U) = 69000 THEN 11110
  2198.  11180  GOSUB 11300
  2199.  11199 TU%(O) = TU%(O) + T: GOTO 11100
  2200.  11200  IF  MID$ (MO$(O),3,1) = "C" THEN NO$ = "MDC10": GOTO 11220
  2201.  11202  IF  LEFT$ (MO$(O),2) = "MX" THEN  GOSUB 35000: GOTO 11200
  2202.  11210 NO$ =  LEFT$ (MO$(O),3) + "01"
  2203.  11220 UU = UT% + NT% + NF% - 1:CC = UT%
  2204.  11230  FOR U = CC TO UU
  2205.  11240  IF XN(U) = 69000 THEN 11250
  2206.  11242  IF  MID$ (UN$(U),2,2) <  > "00" THEN UN$ = UN$(U): GOSUB 1000
  2207.  11250  NEXT
  2208.  11252  IF T = 0 THEN T = 2
  2209.  11260  IF  LEFT$ (MO$(O),3) = "MDC" THEN 11290
  2210.  11270 M$ = MO$(O):J =  LEN (M$):I =  VAL ( MID$ (M$,4,2)):I = I - 1: IF I = 0 THEN M$ =  RIGHT$ (M$,J - 5): GOTO 11288
  2211.  11272 A$ = "00" +  STR$ (I):M$ =  LEFT$ (M$,3) +  RIGHT$ (A$,2) +  RIGHT$ (M$,J - 5)
  2212.  11288 MO$(O) = M$: IF  LEFT$ (M$,2) = "MX" THEN 11202
  2213.  11290  GOTO 11199
  2214.  11300 M$ = MO$(O)
  2215.  11310  IF  LEFT$ (M$,3) = "MSS" THEN  GOSUB 14000: GOTO 11300
  2216.  11312  IF  LEFT$ (M$,3) = "MXX" THEN  GOSUB 34000: GOTO 11300
  2217.  11314  IF  LEFT$ (M$,2) = "MC" THEN  GOSUB 28000: GOTO 11300
  2218.  11320  IF  LEFT$ (M$,2) = "MU" THEN  GOSUB 14200: GOTO 11300
  2219.  11330  IF  LEFT$ (M$,3) <  > "MDC" THEN 11500
  2220.  11340 TL =  VAL ( MID$ (M$,4,2))
  2221.  11350  IF TL = 1 THEN NO$ = "MDC01": GOTO 11370
  2222.  11360 NO$ = "MDC02"
  2223.  11370  GOSUB 1000
  2224.  11380 I =  VAL ( MID$ (NO$,4,2)):TL = TL - I
  2225.  11390 J =  LEN (M$): IF TL = 0 THEN M$ =  RIGHT$ (M$,J - 5): GOTO 11420
  2226.  11400 A$ =  STR$ (TL): IF TL < 10 THEN A$ = "0" + A$
  2227.  11410 M$ = "MDC" + A$ +  RIGHT$ (M$,J - 5)
  2228.  11420 MO$(O) = M$: RETURN
  2229.  11500 NO$ =  LEFT$ (M$,3) + "01"
  2230.  11510  GOSUB 1000:T =  INT (T + .5)
  2231.  11520 J =  LEN (M$):I =  VAL ( MID$ (M$,4,2)):I = I - 1
  2232.  2573 - IF I = 0 THEN M$ =  RIGHT$ (M$,J - 5): GOTO 11560
  2233.  11540 A$ =  STR$ (I): IF I < 10 THEN A$ = "0" + A$
  2234.  11550 M$ =  LEFT$ (M$,3) + A$ +  RIGHT$ (M$,J - 5)
  2235.  11560 MO$(O) = M$: RETURN
  2236.  11800  IF TT% > TU% THEN  RETURN
  2237.  11810 UU = TI% - 1: IF TI% = 0 THEN 11910
  2238.  11820  FOR U = 0 TO UU
  2239.  11822  IF TX(U) = 69000 THEN 11900
  2240.  11830 Z = TZ%(U)
  2241.  11840 Z2 = 450 - Z
  2242.  11850 L0 = 30 * .5555 * 6
  2243.  11860 X = TX(U) + L0 *  COS (Z2 * PI / 180)
  2244.  11870 Y = TY(U) + L0 *  SIN (Z2 * PI / 180)
  2245.  11880 TX(U) = X:TY(U) = Y
  2246.  11900  NEXT
  2247.  11910 TT% = TT% + 6: GOTO 11800
  2248.  12000  PRINT "COLLISION CHECK TIME=";TU% - 3
  2249.  12010 UU = NE% - 1
  2250.  12100  FOR U = 0 TO UU
  2251.  12110  IF XN(U) = 69000 THEN 12130
  2252.  12120 CC = 0: GOSUB 12700
  2253.  25195 / NEXT
  2254.  12200 UU = US%
  2255.  12210  FOR U = UU TO UT
  2256.  12220  IF XN(U) = 69000 THEN 12240
  2257.  12230 CC = NE%: GOSUB 12700
  2258.  12240  NEXT
  2259.  12299  RETURN
  2260.  12700  FOR C = CC TO UT: REM  CHECK SHIPS **
  2261.  12710  IF C = U THEN 12900
  2262.  12720  IF XN(C) = 69000 THEN 12900
  2263.  12730  IF  ABS (XN(U) - XN(C)) > 150 THEN 12900
  2264.  12740  IF  ABS (YN(U) - YN(C)) > 150 THEN 12900
  2265.  12748 J =  VAL ( MID$ (U$(C),SM,3))
  2266.  12750 I =  VAL ( MID$ (U$(U),SM,3)): IF I = 0 THEN 12800
  2267.  12760  IF J = 0 THEN 12900
  2268.  12770  IF  ABS (I - J) > 100 THEN 12900
  2269.  12780 U$ = U$(U): GOSUB 50510:VS% = VS% + V
  2270.  12781  FLASH : PRINT "SUBS COLLIDED U/W": NORMAL
  2271.  12782 A = U:U = C
  2272.  12784 U$ = U$(U): GOSUB 50510:VS% = VS% + V:U = A: GOTO 12900
  2273.  12800  IF J <  > 0 THEN 12900
  2274.  12802  FLASH : PRINT "SHIPS COLLIDED ON SURFACE": NORMAL :UP$ = "U": IF U >  = US% THEN UP$ = "S"
  2275.  2573 2 GOSUB 50500: GOSUB 50600
  2276.  12812 A = U:U = C:UP$ = "U": IF U >  = US% THEN UP$ = "S"
  2277.  12814  GOSUB 50500: GOSUB 50600:U = A
  2278.  12900  NEXT
  2279.  12910  RETURN
  2280.  14000 UN$(U) =  LEFT$ (UN$(U),1) +  MID$ (M$,4,2) +  RIGHT$ (UN$(U),3)
  2281.  14010 I =  LEN (M$):MO$(O) =  RIGHT$ (MO$(O),I - 5): RETURN
  2282.  14200 D =  VAL ( MID$ (U$,SM,3)): IF D <  > 0 THEN 14300
  2283.  14210 I =  VAL ( MID$ (U$,SI,2)):J =  VAL ( MID$ (U$,SJ,2)):K = I: IF I > J THEN K = J
  2284.  14230 A$ = "00" +  STR$ (K):UN$(U) = "3" +  RIGHT$ (A$,2) +  RIGHT$ (UN$(U),3)
  2285.  14300 U$(U) =  LEFT$ (U$(U),SM - 1) +  MID$ (M$,3,3) +  RIGHT$ (U$(U),S9 - SM - 2)
  2286.  14310 I =  LEN (M$):MO$(O) =  RIGHT$ (MO$(O),I - 5): RETURN
  2287.  15000 UU = NE% - 1
  2288.  15100  FOR O = 0 TO UU
  2289.  15102  IF UX(O) = 69000 THEN 15900
  2290.  15110  IF FO$(O) = "" THEN 15900
  2291.  15120 F$ = FO$(O):AB = 1
  2292.  15130 K =  VAL ( MID$ (F$,AB + 3,1)) * 10
  2293.  15140  IF K > TU% THEN 15160
  2294.  15150  GOTO 15200
  2295.  15160 J =  LEN (F$):AB = AB + 7: IF AB < J THEN 15130
  2296.  15170  GOTO 15900
  2297.  15200 Z =  VAL ( MID$ (UN$(O),4,3)):NO$ =  MID$ (F$,AB,7)
  2298.  15210  IF  LEFT$ (NO$,2) <  > "FD" THEN 15300
  2299.  15220 Z1 = Z + 180: IF Z1 > 360 THEN Z1 = Z1 - 360
  2300.  15230 Z2 = 450 - Z1
  2301.  15240 J = 60: GOSUB 15700
  2302.  15250  GOTO 15800
  2303.  15300  IF  LEFT$ (NO$,2) <  > "FA" THEN 15400
  2304.  15310 J =  VAL ( MID$ (NO$,5,3)) + 50
  2305.  15320 Z2 = 450 - Z
  2306.  15330  GOSUB 15700
  2307.  15340  GOTO 15800
  2308.  15400  IF  LEFT$ (NO$,2) <  > "FK" THEN  STOP
  2309.  15410 J = Z + 90: IF J > 360 THEN J = J - 360
  2310.  15420 Z2 = 450 - J
  2311.  15430 J = 100: GOSUB 15700
  2312.  15440 J = Z - 90: IF J < 0 THEN J = J + 360
  2313.  15450 Z2 = 450 - J
  2314.  15460 J = 100: GOSUB 15700
  2315.  15470  GOTO 15800
  2316.  15700 X = XN(O) + J *  COS (Z2 * PI / 180): REM EXPLODE & UPDATE ******
  2317.  15710 Y = YN(O) + J *  SIN (Z2 * PI / 180)
  2318.  15720 WX(WI%) = X:WY(WI%) = Y
  2319.  15730 D =  VAL ( MID$ (NO$,5,3)):WZ(WI%) = D
  2320.  15740  IF  LEFT$ (NO$,2) = "FA" THEN WZ(WI%) =  - 69:WT%(WI%) = TU% + 7: GOTO 15760
  2321.  15750 I =  INT (D / 10):WT%(WI%) = I + TU% + 7
  2322.  15760 WI% = WI% + 1: IF WI% > 19 THEN WI% = 19
  2323.  15770  RETURN
  2324.  15800 I =  LEN (F$):F$ =  LEFT$ (F$,AB + 2) + "9" +  RIGHT$ (F$,I - AB - 3): REM UPDATE ORDER
  2325.  15810 FO$(O) = F$: GOTO 15160
  2326.  15900  NEXT
  2327.  15910  RETURN
  2328.  16000 CC = NE%:UU = CO% - 1
  2329.  16100  FOR O = CC TO UU
  2330.  16110  IF FO$(O) = "" THEN 16400
  2331.  16120 F$ = FO$(O):AB = 1
  2332.  16130 K =  VAL ( MID$ (F$,AB + 6,2))
  2333.  16140  IF K + 10 > TU% THEN 16160
  2334.  16150  GOTO 16200
  2335.  16160 J =  LEN (F$):AB = AB + 8: IF AB < J THEN 16130
  2336.  16170  GOTO 16400
  2337.  16200 J = O + NF% + NT%:Z =  VAL ( RIGHT$ (UN$(J),3))
  2338.  16210 D = 150: IF  MID$ (F$,AB + 2,1) = "B" THEN 16230
  2339.  16220 D =  - 150:Z = Z + 180: IF Z > 360 THEN Z = Z - 360
  2340.  16230 Z2 = 450 - Z: IF Z2 = 360 OR Z2 = 180 THEN Z2 = 0
  2341.  16232  IF XN(J) = 69000 THEN 16400
  2342.  16234 VS% = VS% + 1: FLASH : PRINT "TORPEDO AWAY": NORMAL : GOSUB 16800: IF TI% >  = 19 THEN 16300
  2343.  16236 Z0 =  VAL ( RIGHT$ (UN$(J),3)): IF  MID$ (F$,AB + 2,1) = "S" THEN Z0 = Z0 + 180
  2344.  16237 I =  ABS (Z0 - Z): IF I > 180 THEN I = 360 - I
  2345.  16238  IF I > 120 THEN 16300
  2346.  16240 X = XN(J) + D *  COS (Z2 * PI / 180)
  2347.  16250 Y = YN(J) + D *  SIN (Z2 * PI / 180)
  2348.  16260 TX(TI%) = X:TY(TI%) = Y:TZ%(TI%) =  VAL ( MID$ (F$,AB + 3,3))
  2349.  16270 TI% = TI% + 1: IF TI% >  = 19 THEN TI% = 19
  2350.  16272 A$ =  LEFT$ (TA$,TI%) + "8000000000000000000000":TA$ =  LEFT$ (A$,22)
  2351.  16300 I =  LEN (F$): IF I = AB + 7 THEN 16304
  2352.  16302 F$ =  LEFT$ (F$,AB + 5) + "99" +  RIGHT$ (F$,I - AB - 7): GOTO 16310
  2353.  16304 F$ =  LEFT$ (F$,AB + 5) + "99"
  2354.  16310 FO$(O) = F$: GOTO 16160
  2355.  16400  NEXT
  2356.  16410  RETURN
  2357.  16800 A$ = TB$(J - US%): IF  MID$ (F$,AB + 2,1) = "S" THEN A$ = TS$(J - US%)
  2358.  16810 X = 2
  2359.  16820  IF  MID$ (A$,X,1) = "L" THEN 16840
  2360.  16830 X = X + 1: IF X < 11 THEN 16820
  2361.  16832  STOP
  2362.  16840 A$ =  LEFT$ (A$,X - 1) + "F" +  RIGHT$ (A$,11 - X)
  2363.  16850  IF  MID$ (F$,AB + 2,1) = "B" THEN TB$(J - US%) = A$: GOTO 16870
  2364.  16860  IF  MID$ (F$,AB + 2,1) = "S" THEN TS$(J - US%) = A$: GOTO 16870
  2365.  16865  STOP
  2366.  16870  RETURN
  2367.  19000  REM  CHAIN **
  2368.  19010  TEXT : HOME :I =  FRE (0)
  2369.  19100  VTAB 12: HTAB 10: INVERSE : PRINT " LOADING SEARCH PHASE "
  2370.  19110  NORMAL
  2371.  19200  &  GOTO "P5"
  2372.  20000 AB = WI% - 1: IF AB =  - 1 THEN  RETURN
  2373.  20110  FOR U = 0 TO UT
  2374.  20112 U$ = U$(U): IF XN(U) = 69000 THEN 20310
  2375.  20120  FOR DC = 0 TO AB
  2376.  20122  IF TU% < WT%(DC) THEN 20300
  2377.  20124  IF WT%(DC) = 6969 THEN  STOP 20300
  2378.  20126  IF WZ(DC) =  - 69 THEN WZ(DC) = 0:WT%(DC) =  - 69
  2379.  20130 X0 = XN(U):Y0 = YN(U):X1 = WX(DC):Y1 = WY(DC)
  2380.  20132 D =  SQR ((X0 - X1) ^ 2 + (Y0 - Y1) ^ 2)
  2381.  20140  IF D > 75 THEN 20300
  2382.  20142  IF QB% = 69 THEN 20200
  2383.  20144  IF D > 50 THEN 20300
  2384.  20200 I =  VAL ( MID$ (U$(U),SM,3))
  2385.  20210 D0 =  ABS (I - WZ(DC)): IF D0 > 75 THEN 20300
  2386.  20212  IF QB% = 69 THEN 20220
  2387.  20214  IF D0 > 50 THEN 20300
  2388.  20220  GOSUB 20500
  2389.  20230 WT%(DC) = 6969: GOSUB 60000: GOSUB 58000
  2390.  20300  NEXT DC
  2391.  20310  NEXT U
  2392.  24696 O FOR DC = 0 TO AB
  2393.  20330  IF WT%(DC) = 6969 THEN 20360
  2394.  20332  IF WT%(DC) <  >  - 69 THEN 20340
  2395.  20334 WZ(DC) = WZ(DC) + 30: IF WZ(DC) > 999 THEN 20350
  2396.  20336  GOTO 20360
  2397.  20340  IF TU% < WT%(DC) THEN 20360
  2398.  20350 WT%(DC) = 6969: GOSUB 60000: GOSUB 58000
  2399.  20360  NEXT : RETURN
  2400.  20500  IF D > 50 THEN D = 45: REM U/W CRT
  2401.  20502  IF D0 > 50 THEN D0 = 45
  2402.  20503  IF WT%(DC) =  - 69 THEN D0 = 11
  2403.  20504 I = 100 - D - D0:J = I / 100:K =  VAL ( MID$ (U$,SX,1)) / 10:Q =  RND (1) + .5
  2404.  20510 X0 = J * 20 * K * Q:X1 =  INT (X0 + .5)
  2405.  20520 Y0 =  VAL ( MID$ (U$,SV,2)):Y1 = Y0 - X1: IF Y1 < 1 THEN 20600
  2406.  20530 A$ = "00" +  STR$ (Y1):U$ =  LEFT$ (U$,SV - 1) +  RIGHT$ (A$,2) +  RIGHT$ (U$,S9 - SV - 1)
  2407.  20540 U$(U) = U$: RETURN
  2408.  20600  FLASH : PRINT "SHIP SUNK BY DC":UP$ = "S": NORMAL
  2409.  20610  GOSUB 50500: GOSUB 50600: GOTO 20540
  2410.  21000  IF TI% = 0 THEN  RETURN
  2411.  21100 CC = TI% - 1:UU = US% - 1
  2412.  21110  FOR AB = 0 TO CC
  2413.  21112  IF TX(AB) = 69000 THEN 21410
  2414.  21120  FOR U = 0 TO UU
  2415.  21122 U$ = U$(U):UN$ = UN$(U): IF XN(U) = 69000 THEN 21400
  2416.  21130 X0 = XN(U):Y0 = YN(U):X1 = TX(AB):Y1 = TY(AB)
  2417.  21140 D =  SQR ((X0 - X1) ^ 2 + (Y0 - Y1) ^ 2)
  2418.  21150  IF D > 150 THEN 21400
  2419.  21160 D0 =  VAL ( RIGHT$ (UN$,3)):J =  VAL ( MID$ (U$,SX,1)) / 10:I =  ABS (D0 - TZ%(AB))
  2420.  43643 R IF I > 90 THEN I = I - 90: GOTO 21162
  2421.  21170 I = I + 10:K = I * J:Q =  RND (1) * 100
  2422.  21172  IF NU$ = "A" AND TP$ <  > "3" THEN K = K / 2
  2423.  21180  IF Q <  = K THEN 21190
  2424.  21182 I = Q - K: FLASH : IF I < 11 THEN  PRINT "TORPEDO NARROWLY MISSED ";: GOTO 21185
  2425.  21183  IF I < 34 THEN  PRINT "TORPEDO CAME CLOSE TO ";: GOTO 21185
  2426.  21184  PRINT "TORPEDO WENT WIDE OF ";
  2427.  21185  PRINT  MID$ (U$,SB,2): NORMAL
  2428.  21186 Z = 450 - TZ%(AB):TX(AB) = TX(AB) + 400 *  COS (Z * PI / 180):TY(AB) = TY(AB) + 400 *  SIN (Z * PI / 180)
  2429.  21188  GOTO 21400
  2430.  21190 X0 = 30 * ( RND (1) + .5):X1 =  INT (X0 + .5): GOSUB 60500
  2431.  21200 Y0 =  VAL ( MID$ (U$,SV,2)):Y1 = Y0 - X1: IF Y1 < 1 THEN 21300
  2432.  21210 A$ = "00" +  STR$ (Y1):U$ =  LEFT$ (U$,SV - 1) +  RIGHT$ (A$,2) +  RIGHT$ (U$,S9 - SV - 1)
  2433.  21212 TX(AB) = 69000: GOSUB 21800
  2434.  21215  FLASH : PRINT "TORPEDO HIT "; MID$ (U$,SB,2): NORMAL
  2435.  21220 U$(U) = U$: GOTO 21400
  2436.  21300  FLASH : PRINT  MID$ (U$,SB,2);" SUNK BY TORPEDO":UP$ = "U": NORMAL
  2437.  21302 TX(AB) = 69000
  2438.  21310  GOSUB 50500: GOSUB 50600: GOTO 21400
  2439.  21400  NEXT U
  2440.  21410  NEXT AB
  2441.  21420  RETURN
  2442.  21800  IF U >  = NE% THEN  RETURN
  2443.  21810 I =  INT ((X1 *  RND (1)) + .5):J =  VAL ( MID$ (U$,SH,2)):K = J - I: IF K < 1 THEN K = 0
  2444.  21820 A$ = "00" +  STR$ (K):U$ =  LEFT$ (U$,SH - 1) +  RIGHT$ (A$,2) +  RIGHT$ (U$,S9 - SH - 1)
  2445.  21830 J =  VAL ( MID$ (UN$,2,2)): IF J <  = K THEN  RETURN
  2446.  21840 U$ =  LEFT$ (U$,SI - 1) +  RIGHT$ (A$,2) +  RIGHT$ (U$,S9 - SI - 1)
  2447.  21850 UN$ =  LEFT$ (UN$,1) +  RIGHT$ (A$,2) +  RIGHT$ (UN$,3):UN$(U) = UN$: RETURN
  2448.  24000 CC = CO% - 1: IF  RND (1) > .5 THEN 24010: REM FSS CRT **
  2449.  24002  FOR O = CC TO 0 STEP  - 1
  2450.  24004  GOTO 24020
  2451.  24010  FOR O = 0 TO CC
  2452.  24020 F$ = FS$(O): IF F$ = "" THEN 24060
  2453.  24030 A =  LEN (F$):B = 1
  2454.  24040  IF  MID$ (F$,B,3) = "FSG" THEN 24100
  2455.  24050 B = B + 10: IF B <  = (A) THEN 24040
  2456.  24060  NEXT O
  2457.  24070  RETURN
  2458.  24100 Z =  VAL ( MID$ (F$,B + 3,3)):D =  VAL ( MID$ (F$,B + 6,4))
  2459.  24110  IF O < NE% THEN U = O: GOTO 24130
  2460.  24120 I = O - NE%:U = US% + I
  2461.  24130 U$ = U$(U):UN$ = UN$(U):X = UX(U):Y = UY(U): IF X = 69000 THEN 24060
  2462.  24131  PRINT  MID$ (U$,SB,2);" FIRING SURFACE GUNS": GOSUB 60500
  2463.  24132 J =  VAL ( MID$ (U$,SM,3)): IF J <  > 0 THEN 24060
  2464.  24140 Z2 = 450 - Z: IF Z2 >  = 360 THEN Z2 = Z2 - 360
  2465.  24150 X0 = X + D *  COS (Z2 * PI / 180):Y0 = Y + D *  SIN (Z2 * PI / 180)
  2466.  24200  FOR I = 0 TO UT
  2467.  24202  IF UX(I) = 69000 THEN 24310
  2468.  24204 J =  VAL ( MID$ (U$(I),SM,3)): IF J <  > 0 THEN 24310
  2469.  24210  IF  ABS (UX(I) - X0) > 150 THEN 24310
  2470.  24220  IF  ABS (UY(I) - Y0) > 150 THEN 24310
  2471.  24230 D0 =  SQR ((UX(I) - X0) ^ 2 + (UY(I) - Y0) ^ 2)
  2472.  24240 J = (150 - D0) / 500:Q =  RND (1) + .5
  2473.  24250 K =  VAL ( MID$ (U$(U),SW,2)):C = J * K * Q
  2474.  24260 L1 =  INT (C + .5): IF L1 < 1 THEN 24310
  2475.  24270 U$ = U$(I):K1 =  VAL ( MID$ (U$,SV,2)):DC = K1 - L1: IF DC < 1 THEN 24400
  2476.  24280 A$ = "00" +  STR$ (DC):U$ =  LEFT$ (U$,SV - 1) +  RIGHT$ (A$,2) +  RIGHT$ (U$,S9 - SV - 1)
  2477.  24300 U$(I) = U$
  2478.  24305  FLASH : PRINT "SURFACE GUN HIT "; MID$ (U$,SB,2): NORMAL
  2479.  24310  NEXT I
  2480.  24320  GOTO 24060
  2481.  24400  PRINT  MID$ (U$,SB,2);" SUNK BY SURFACE GUNS":UP$ = "U": IF I >  = US% THEN UP$ = "S"
  2482.  24405  REM
  2483.  24410 J = U:U = I: GOSUB 50500:I = U:U = J: GOSUB 50600: GOTO 24310
  2484.  28000  IF  LEFT$ (M$,2) <  > "MC" THEN  RETURN
  2485.  28010 C$ =  LEFT$ (M$,5):A =  LEN (M$): IF A = 5 THEN M$ = "": GOTO 28030
  2486.  28020 M$ =  RIGHT$ (M$,A - 5)
  2487.  28030 D0 =  VAL ( RIGHT$ (UN$,3)):D =  VAL ( MID$ (C$,3,3))
  2488.  28040  IF D0 > D THEN A$ = "P"
  2489.  28050  IF D0 < D THEN A$ = "S"
  2490.  28060  IF D0 = D THEN MO$(O) = M$: RETURN
  2491.  28070 J =  ABS (D0 - D): IF J <  = 180 THEN 28100
  2492.  28080 J = D0 + 360 - D: IF J < 180 THEN A$ = "P": GOTO 28100
  2493.  28090 J = D + 360 - D0: IF J < 180 THEN A$ = "S": GOTO 28100
  2494.  28095  STOP
  2495.  28100  GOSUB 29000:K = 0:D$ = ""
  2496.  28110 K = K + 10: IF K >  = I THEN 28140
  2497.  28120  IF K >  = J THEN 28200
  2498.  28130  GOTO 28110
  2499.  28140 A =  INT (K / 10):B$ = "00" +  STR$ (A)
  2500.  28150 D$ = D$ + "MD" + A$ +  RIGHT$ (B$,2):K = 0:J = J - I: IF J = 0 THEN 28260
  2501.  28160 K = 0: GOTO 28110
  2502.  28200 A =  INT (K / 10):B$ = "00" +  STR$ (A)
  2503.  28210 D$ = D$ + "MD" + A$ +  RIGHT$ (B$,2)
  2504.  28220 A =  ABS (K - J): IF A = 0 THEN 28260
  2505.  28230 B$ = "0" +  STR$ (A)
  2506.  28240 A$ =  MID$ (D$,3,1)
  2507.  28250 D$ = D$ + "MXX" + A$ +  RIGHT$ (B$,1)
  2508.  28260 M$ = D$ + M$:MO$(O) = M$: RETURN
  2509.  29000 A =  VAL ( MID$ (U$,SG,1)): IF A < 1 OR A > 9 THEN  STOP
  2510.  21125 q ON A GOTO 29011,29012,29013,29014,29015,29016,29017,29018,29019
  2511.  29011 I = 6: GOTO 29020
  2512.  29012 I = 18: GOTO 29020
  2513.  29013 I = 30: GOTO 29020
  2514.  29014 I = 60: GOTO 29020
  2515.  29015 I = 90: GOTO 29020
  2516.  29016 I = 120: GOTO 29020
  2517.  29017 I = 180: GOTO 29020
  2518.  29018 I = 360: GOTO 29020
  2519.  29019 I = 720
  2520.  29020  RETURN
  2521.  32000 K0 =  VAL ( MID$ (UN$(O),2,2)): REM  CHANGE SPEED ORDER **
  2522.  2573 }K1 =  VAL ( MID$ (M$,4,2))
  2523.  32020  IF  MID$ (M$,3,1) = "P" THEN K = K0 + K1
  2524.  32030  IF  MID$ (M$,3,1) = "M" THEN K = K0 - K1
  2525.  32040  IF K < 1 THEN K = 0
  2526.  32050 K1 =  VAL ( MID$ (U$(O),SH,2))
  2527.  32060  IF K > K1 THEN K = K1
  2528.  32070 B$ =  STR$ (K): IF K < 1 THEN B$ = "000"
  2529.  32080 UN$(O) =  LEFT$ (UN$(O),1) +  RIGHT$ (B$,2) +  RIGHT$ (UN$(O),3)
  2530.  32100 I =  LEN (M$):MN$(O) =  RIGHT$ (M$,I - 5)
  2531.  32110  RETURN
  2532.  34000 D0 =  VAL ( RIGHT$ (UN$,3)):D =  VAL ( MID$ (M$,5,1))
  2533.  34010  IF  MID$ (M$,4,1) = "P" THEN D0 = D0 + D
  2534.  58503  INPUT  IF  MID$ (M$,4,1) = "S" THEN D0 = D0 - D
  2535.  34030 A$ = "00" +  STR$ (D0):UN$ =  LEFT$ (UN$,3) +  RIGHT$ (A$,3)
  2536.  34040 A =  LEN (M$):M$ =  RIGHT$ (M$,A - 5)
  2537.  34050 UN$(U) = UN$:MO$(O) = M$: RETURN
  2538.  35000 UU = UT% + NT% + NF% - 1:CC = UT%
  2539.  35070  FOR U = CC TO UU
  2540.  35080  IF XN(U) = 69000 THEN 35100
  2541.  2573  TEXT D0 =  VAL ( RIGHT$ (UN$(U),3)):D =  VAL ( MID$ (MO$(O),5,1)): IF  MID$ (MO$(O),4,1) = "P" THEN K = D0 + D: GOTO 35086
  2542.  35084  IF  MID$ (MO$(O),4,1) = "S" THEN K = D0 - D: GOTO 35086
  2543.  2573  TEXT  STOP
  2544.  35086 A$ = "00" +  STR$ (K):UN$(U) =  LEFT$ (UN$(U),3) +  RIGHT$ (A$,3)
  2545.  35100  NEXT
  2546.  35110 MO$(O) = "MDC60MDC60": RETURN
  2547.  36000 U = US%: REM FORCE SUB TO SURFACE **
  2548.  36002 U$ = U$(U): IF UX(U) = 69000 THEN 36110
  2549.  36010 J =  VAL ( MID$ (U$,SU,2)):K = 2 *  VAL ( MID$ (U$,SV,2)): IF K > J THEN 36110
  2550.  36020 O = NE% + U - US%:M$ = "12345" + MO$(O) + "67890":M =  LEN (M$):B = 1
  2551.  36030  IF  MID$ (M$,B,2) <  > "MU" THEN 36050
  2552.  36040 M$ =  LEFT$ (M$,B - 1) +  RIGHT$ (M$,M - B - 4):M = M - 5:B = B - 5
  2553.  36050 B = B + 5: IF B <  = M THEN 36030
  2554.  36070 D0 =  VAL ( MID$ (U$,SM,3)):D =  VAL ( MID$ (U$,SP,3)):P = D0 - D: IF P < 0 THEN P = 0
  2555.  36090 A$ = "000" +  STR$ (P): IF M = 10 THEN MO$(O) = "MU" +  RIGHT$ (A$,3) + "MDC60MDC60": GOTO 36110
  2556.  36100 MO$(O) = "MU" +  RIGHT$ (A$,3) +  MID$ (M$,6,M - 10)
  2557.  36110 U = U + 1: IF U <  = UT THEN 36002
  2558.  36120 M$ = "": RETURN
  2559.  36500  FOR I = 0 TO UT: REM DEAD IN WATER **
  2560.  36510  IF UX(I) = 69000 THEN 36550
  2561.  36520 J =  VAL ( MID$ (U$(I),SV,2)): IF J > 4 THEN 36550
  2562.  36530 U$(I) =  LEFT$ (U$(I),SH - 1) + "0000" +  RIGHT$ (U$(I),S9 - SH - 3)
  2563.  36532 UN$(I) =  LEFT$ (UN$(I),1) + "00" +  RIGHT$ (UN$(I),3)
  2564.  36534  IF I < NE% THEN MO$(I) = "MDC60MDC60"
  2565.  36536  IF I >  = US% THEN MO$(I - US% + NE%) = "MDC60MDC60"
  2566.  36540  IF I >  = US% THEN U$(I) =  LEFT$ (U$(I),SK - 1) + "00" +  RIGHT$ (U$(I),S9 - SK - 1)
  2567.  36550  NEXT
  2568.  36560  RETURN
  2569.  50500  PRINT  MID$ (U$(U),2,2);" SUNK"
  2570.  50510 UX(U) = 69000:UY(U) = 69000:XN(U) = 69000:YN(U) = 69000:U$ = U$(U)
  2571.  50520 U$ =  LEFT$ (U$,SV - 1) + "00" +  RIGHT$ (U$,S9 - SV - 1): REM DP'S = 0
  2572.  50530 V =  VAL ( MID$ (U$,SF,2))
  2573.  50540 U$(U) = U$: RETURN
  2574.  50600  IF UP$ = "U" THEN 50620: REM ADD VP'S **
  2575.  50610 VS% = VS% + V: GOTO 50630
  2576.  50620 VU% = VU% + V
  2577.  50630  PRINT V;" VP'S AWARDED TO ";
  2578.  50640  IF UP$ = "U" THEN  PRINT "UNDERWATER";: GOTO 50660
  2579.  50650  PRINT "SURFACE";
  2580.  50660  PRINT " SIDE"
  2581.  50690  RETURN
  2582.  57000  VTAB 24: PRINT "THIS WILL TAKE 1-5 MINUTES."
  2583.  57002 I =  FRE (0)
  2584.  57010  PRINT : PRINT : RETURN
  2585.  58000  FOR X1 = 0 TO UT
  2586.  58010  IF UX(X1) = 69000 THEN 58100
  2587.  58020 J =  VAL ( MID$ (U$(X1),SM,3)): IF J <  > 0 THEN 58100
  2588.  58030 J =  SQR ((XN(X1) - WX(DC)) ^ 2 + (YN(X1) - WY(DC)) ^ 2): IF J > 75 THEN 58100
  2589.  58050  IF QB% = 69 THEN 58070
  2590.  58060  IF J > 50 THEN 58100
  2591.  58070  FLASH : PRINT  MID$ (U$(X1),SB,2);" SUNK BY D.C. BACK-WASH!": NORMAL : PRINT "DIS=";J:UP$ = "U": IF X1 >  = US% THEN UP$ = "S"
  2592.  58080 X0 = U:U = X1:A$ = U$:U$ = U$(X1): GOSUB 50500: GOSUB 50600:U = X0:U$ = A$
  2593.  58100  NEXT : RETURN
  2594.  60000  GOSUB 60500
  2595.  60020  PRINT "DC DETONATED AT "; INT (WX(DC));","; INT (WY(DC));" DEPTH="; INT (WZ(DC))
  2596.  60030 J = US%
  2597.  60040  FOR I = J TO UT
  2598.  60042 K =  SQR ((XN(I) - WX(DC)) ^ 2 + (YN(I) - WY(DC)) ^ 2)
  2599.  60044  IF K > 251 THEN 60060
  2600.  60046 U$(I) =  LEFT$ (U$(I),SB% - 1) + "Y" +  RIGHT$ (U$(I),S9 - SB%)
  2601.  60048  IF QB% <  > 69 THEN 60060
  2602.  60052 K =  SQR ((XN(I) - WX(DC)) ^ 2 + (YN(I) - WY(DC)) ^ 2)
  2603.  60054  PRINT " DIS="; INT (K)
  2604.  60060  NEXT
  2605.  60099  POKE  - 16301,0: RETURN
  2606.  60500  CALL CLR%: HGR : POKE  - 16302,0
  2607.  60510  HCOLOR= 5: HPLOT 0,0 TO 0,0: CALL 62454
  2608.  60520  FOR I = 0 TO 2: HCOLOR= 3: HPLOT 0,0 TO 0,0: CALL 62454: HCOLOR= 5: HPLOT 0,0 TO 0,0: CALL 62454: NEXT
  2609.  60530  TEXT : RETURN
  2610.  
  2611.  45568 PROG = PGA
  2612.  50 I =  FRE (0)
  2613.  60  &  RECALL "HT": CALL 3072
  2614.  1000  PRINT  CHR$ (3);"0": PRINT  CHR$ (2);"0": PRINT  CHR$ (12)
  2615.  1010  PRINT  CHR$ (3);"2": PRINT  CHR$ (5): VTAB 4
  2616.  1020  FOR I = 0 TO 3: PRINT  CHR$ (9);: NEXT
  2617.  1030  PRINT "TORPEDO FIRE"
  2618.  1040  PRINT  CHR$ (20): VTAB 10: HTAB 11
  2619.  1050  PRINT "FINAL VICTORY POINTS"
  2620.  1060  PRINT  CHR$ (18)
  2621.  1070  GOSUB 2000
  2622.  1080  INVERSE : VTAB 14: HTAB 12: PRINT "SUBMARINE";: HTAB 23: PRINT "SURFACE"
  2623.  1090  HTAB 14: PRINT "SIDE";: HTAB 24: PRINT "SIDE": NORMAL
  2624.  1100  HTAB 15: PRINT VU%;: HTAB 25: PRINT VS%
  2625.  1200  VTAB 22: PRINT "HIT 'RETURN' FOR A NEW GAME ";: INPUT A$
  2626.  1210  GOTO 19000
  2627.  2000  FOR U = 0 TO UT
  2628.  2010 U$ = U$(U): IF UX(U) = 69000 THEN 2100
  2629.  2020 I =  VAL ( MID$ (U$,SU,2)):J =  VAL ( MID$ (U$,SV,2)): IF I = J THEN 2100
  2630.  2030 K =  VAL ( MID$ (U$,SF,2)):V =  INT (K * .5 * ((I - J) / I) + .5)
  2631.  2040  IF U >  = US% THEN VS% = VS% + V
  2632.  2050  IF U < US% THEN VU% = VU% + V
  2633.  2100  NEXT
  2634.  2110  RETURN
  2635.  19000  PRINT : PR# 0: IN# 0
  2636.  19100  TEXT : HOME :I =  FRE (0): PRINT "MEM=";I
  2637.  19200  VTAB 12: HTAB 11: INVERSE : PRINT " NEW GAME COMING UP ": NORMAL
  2638.  19300  POKE 2048,0: &  RUN "P0",2049
  2639.  
  2640.  45568 PROG = SOL
  2641.  4 I =  FRE (0)
  2642.  100  GOSUB 60000
  2643.  110  IF QP% <  > 0 THEN  GOSUB 51000: GOTO 10000
  2644.  200 PI = 3.14159
  2645.  680  TEXT : HOME : PRINT "READING DATA"
  2646.  700 A$ = "SOL-TEST"
  2647.  710  PRINT : PRINT  CHR$ (4);"OPEN";A$
  2648.  720  PRINT  CHR$ (4);"READ";A$
  2649.  730  INPUT SA: INPUT SB: INPUT SC: INPUT SD: INPUT SE: INPUT SF: INPUT SG
  2650.  740  INPUT SH: INPUT SI: INPUT SJ: INPUT SK: INPUT SL: INPUT SM: INPUT SN: INPUT SO
  2651.  750  INPUT SP: INPUT SQ: INPUT SR: INPUT SS: INPUT ST: INPUT SU: INPUT SV: INPUT SW
  2652.  760  INPUT SX: INPUT SY: INPUT SZ: INPUT SA%: INPUT SB%: INPUT SC%: INPUT SD%: INPUT SE%: INPUT SF%: INPUT S9
  2653.  770  INPUT UT: INPUT NE%: INPUT NT%: INPUT NF%: INPUT NS%
  2654.  780  FOR I = 0 TO UT: INPUT U$(I): NEXT
  2655.  790  FOR I = 0 TO UT: INPUT UX(I): NEXT
  2656.  800  FOR I = 0 TO UT: INPUT UY(I): NEXT
  2657.  810  INPUT B$
  2658.  890  PRINT  CHR$ (4);"CLOSE";A$
  2659.  900 UE% = 0:UT% = NE%:UF% = UT% + NT%:US% = NE% + NT% + NF%:CO% = NE% + NS%
  2660.  910  FOR I = 0 TO UT
  2661.  920 U$(I) =  LEFT$ (U$(I),SQ - 1) + "D" +  RIGHT$ (U$(I),S9 - SQ)
  2662.  930  NEXT
  2663.  940 TB$(0) = "XL23456789X":TS$(0) = "X123456789X"
  2664.  942 UX(5) = 0:UY(2) = 1000
  2665.  949  GOTO 960
  2666.  950 UX(5) = 500:UY(5) =  - 1522:U$(5) =  LEFT$ (U$(5),SB% - 1) + "Y" +  RIGHT$ (U$(5),S9 - SB%)
  2667.  960 U$(0) =  LEFT$ (U$(0),SI - 1) + "60" +  RIGHT$ (U$(5),S9 - SI - 1)
  2668.  999  GOTO 10000
  2669.  10000 UU = US%: REM  MAIN LOOP **
  2670.  10010  FOR U = UU TO UT
  2671.  10020 U$ = U$(U): IF UX(U) = 69000 THEN 10500
  2672.  10030  GOSUB 40000: REM INIT
  2673.  10040 P =  VAL ( MID$ (U$,SM,3)): REM ON SURFACE ?
  2674.  10042  IF TD$ = "D" THEN 10050
  2675.  10044  IF P >  VAL ( MID$ (U$,SP,3)) THEN 10050
  2676.  10046  IF  RND (1) > .25 THEN 10050
  2677.  10048 MO$(O) = "MU000"
  2678.  10050  IF P <  > 0 THEN 10100: REM NO
  2679.  10060  GOSUB 43000: REM FSG
  2680.  10080  GOSUB 45000: REM MC(RND)
  2681.  10090 MO$(O) = "MU031" + MO$(O): GOTO 10500:DUCK -  IF  POS SIBLE
  2682.  10100 I =  VAL ( MID$ (U$,SV,2)):J =  VAL ( MID$ (U$,SU,2)): REM FORCED UP ?
  2683.  10110  IF 2 * I > J THEN 10200: REM NO
  2684.  10120  GOSUB 44000: REM FIRE ALL TUBES
  2685.  10130  GOSUB 45000: REM MC(RND)
  2686.  10140  GOTO 10500
  2687.  10200  IF  MID$ (U$,SY,1) <  > "D" THEN 10240: REM MODE=D ?
  2688.  10210  GOSUB 20000: REM  YES-DEFENSE
  2689.  10220  GOTO 10400: REM JMP TO FIRE DRILL
  2690.  10240  IF  MID$ (U$,SB%,1) <  > "Y" THEN 10260: REM WATER DISTURBED ?
  2691.  2573 ( GOTO 10210: REM  YES-DEFEND
  2692.  10260  IF  MID$ (U$,SY,1) <  > "I" THEN 10290: REM MODE=I ?
  2693.  10270  GOSUB 50000: REM  COUNT DOWN I MODE
  2694.  10280  GOTO 10500
  2695.  10290  IF P < 31 THEN 10400: REM PERISCOPE DEPTH?
  2696.  10300  GOSUB 46000: REM  MU(PER)
  2697.  10310  GOTO 10500: REM (?10410?)
  2698.  10400  GOSUB 42000: REM FIRE DRILL
  2699.  10410  IF B = 0 AND S = 0 THEN  GOSUB 48000: GOTO 10500: REM  MC(INT)
  2700.  10412  IF F0% = 1 THEN 10500
  2701.  10420  GOSUB 47000: REM  MC(VP+)
  2702.  10500  NEXT U
  2703.  10501  GOTO 19000
  2704.  10510  PRINT "ORDERS ARE":J = NE% + NS%
  2705.  10512  FOR I = 0 TO J
  2706.  10520  PRINT I;" MO$=";MO$(I);" FO$=";FO$(I);" FS$=";FS$(I)
  2707.  10530  NEXT
  2708.  10540  PRINT U$
  2709.  10999  PRINT "'RETURN' TO CHAIN ";: INPUT AA$
  2710.  19000  REM  CHAIN **
  2711.  19010  TEXT : HOME :I =  FRE (0)
  2712.  19100  VTAB 12: HTAB 10: INVERSE : PRINT " LOADING ORDERS PHASE ": HTAB 14: PRINT " SURFACE SIDE ": NORMAL
  2713.  19200  &  GOTO "P2"
  2714.  20000 C =  VAL ( MID$ (U$,SZ,1)): REM PRINT "** DEFENSE !!": REM
  2715.  20002  IF  MID$ (U$,SY,1) <  > "D" THEN C = 0
  2716.  20010  IF C = 0 THEN 20100: REM JIF COUNT = 0
  2717.  20020  GOSUB 49000: REM MU(RND)
  2718.  20030  GOSUB 45000: REM MC(RND)
  2719.  20040 C = C - 1:A$ =  STR$ (C): REM DECREMENT COUNT
  2720.  20050 U$ =  LEFT$ (U$,SZ - 1) + A$ +  RIGHT$ (U$,S9 - SZ):U$(U) = U$
  2721.  20060  GOTO 20500
  2722.  20100  IF  MID$ (U$,SB%,1) = "Y" THEN 20200: REM JIF DC'S FALLING
  2723.  20102  REM INT "THEY'VE GONE ** RISE !!"
  2724.  20110  GOSUB 46000: REM MU(PER)
  2725.  20120 U$ =  LEFT$ (U$,SY - 1) + "A" +  RIGHT$ (U$,S9 - SY):U$(U) = U$
  2726.  20130  GOTO 20500
  2727.  20200  IF  MID$ (U$,SY,1) <  > "D" THEN 20300
  2728.  60009 N REM RINT "DANGER! STAY U/W"
  2729.  20210 C = 2: GOTO 20020
  2730.  20300 U$ =  LEFT$ (U$,SY - 1) + "D2" +  RIGHT$ (U$,S9 - SY - 1):U$(U) = U$
  2731.  20302  REM RINT "PREPARE TO DIVE"
  2732.  20500  RETURN
  2733.  30000  REM TDC *********************************
  2734.  30002  REM RINT "*** TDC ***"
  2735.  30010 X0 = UX(U):Y0 = UY(U):K0 =  VAL ( MID$ (U$,SK,2)):Z0 =  VAL ( MID$ (U$,SN,3))
  2736.  30020 XT = UX(T):YT = UY(T):Z1 =  VAL ( MID$ (U$(T),SN,3)):K1 =  VAL ( MID$ (U$(T),SI,2))
  2737.  30028  REM RINT "BOW/STERN CHECK"
  2738.  30030 X2 = XT:Y2 = YT: GOSUB 30900
  2739.  30040 B$ = "B": IF B = 0 THEN 30100
  2740.  30050 I =  ABS (Z0 - A): IF I > 180 THEN I = 360 - I
  2741.  30060  IF I < 120 THEN 30160
  2742.  30100 B$ = "S": IF S = 0 THEN A = 0:Z2 = 0: RETURN : REM  ?NO SHOT POSSIBLE
  2743.  30110 Z0 = Z0 + 180: IF Z0 > 360 THEN Z0 = Z0 - 360
  2744.  30120 J =  ABS (Z0 - A): IF J > 180 THEN J = 360 - J
  2745.  30130  IF J < 120 THEN 30160
  2746.  30140 A = 0:Z2 = 0: RETURN
  2747.  30141 A = 0:Z2 = 0: PRINT "STERN SHOT IMPOSSIBLE": RETURN
  2748.  30160 I = 450 - Z0: REM INT "SHOT=";B$: PRINT : PRINT
  2749.  30162 X2 = X0 + (100 + 10 * K0 * .5555) *  COS (I * PI / 180):X0 = X2
  2750.  30170 Y2 = Y0 + (100 + 10 * K0 * .5555) *  SIN (I * PI / 180):Y0 = Y2
  2751.  30200 X1 = XT:Y1 = YT:TT = 0:L1 = 3 * K1 * .5555:L0 = 30 * .5555:Z2 = 450 - Z1
  2752.  30210  GOTO 30240
  2753.  30211  VTAB 23: HTAB 1: PRINT "WORKING ";: INVERSE : PRINT " *";:I = I + 1: IF I > 1 THEN I = 0: GOTO 30230
  2754.  30220  HTAB 9: PRINT "* ";
  2755.  30230  NORMAL
  2756.  30240 X2 = X1 + L1 *  COS (Z2 * PI / 180):Y2 = Y1 + L1 *  SIN (Z2 * PI / 180):TT = TT + 3
  2757.  30250 D =  SQR ((X0 - X2) ^ 2 + (Y0 - Y2) ^ 2):X1 = X2:Y1 = Y2
  2758.  30255  REM RINT "30255 DIS="; INT (D)
  2759.  30260 T0 = D / L0: IF T0 > (TT) AND D < 10000 THEN 30210
  2760.  30270  GOSUB 30900
  2761.  30280 Z2 =  ABS (A - Z1): IF Z2 > 180 THEN Z2 = Z2 - 180
  2762.  30300  RETURN
  2763.  30900  IF Y0 = Y2 THEN Y0 = Y0 + 1: REM GET ANGLE $$WHEEL $$
  2764.  30902 AA =  ATN ((X0 - X2) / (Y0 - Y2)) * 180 / PI
  2765.  30904 X =  INT (X2 - X0 + .5):Y =  INT (Y2 - Y0 + .5)
  2766.  30910 AA =  INT (AA): IF AA > 0 THEN 30940
  2767.  30912  IF AA = 0 AND X = 0 THEN A = 0: GOTO 30960
  2768.  30920  IF X >  = 0 THEN A = 180 + AA: GOTO 30960
  2769.  30922 A = 360 + AA: GOTO 30960
  2770.  30940  IF X >  = 0 AND Y >  = 0 THEN A = AA: GOTO 30960
  2771.  30942  REM F X <  = 0 AND Y <  = 0 THEN         A = AA: GOTO 30960
  2772.  30943  REM CHECK WITH P3 #####!!!!!!!!3333
  2773.  30950 A = 180 + AA
  2774.  30960  GOTO 30962
  2775.  30961  PRINT "ANGLE FROM "; INT (X0);","; INT (Y0);" TO "; INT (X2);","; INT (Y2): PRINT " = ";A
  2776.  30962 A =  INT (A + .5)
  2777.  30970 A =  INT (A + .5): RETURN
  2778.  40000 AB = US% - 1: REM  INIT **
  2779.  40010  FOR D = 0 TO AB
  2780.  40020  IF UX(D) = 69000 THEN XN(D) = 69000:YN(D) = 0: GOTO 40050
  2781.  40022 A$ =  MID$ (U$(D),SQ,1): IF A$ = "X" OR A$ = "S" THEN XN(D) = 69000:YN(D) = 0: GOTO 40050
  2782.  40030 XN(D) =  SQR ((UX(U) - UX(D)) ^ 2 + (UY(U) - UY(D)) ^ 2): REM CALC DIS
  2783.  40040 YN(D) =  VAL ( MID$ (U$(D),SF,2)): REM VP'S
  2784.  40050  NEXT D
  2785.  40100 A = 1:B = 0: REM BOW TUBES LOADED
  2786.  40110  IF  MID$ (TB$(U - US%),A,1) = "L" THEN B = B + 1
  2787.  40120 A = A + 1: IF A <  = 10 THEN 40110
  2788.  40130 A = 1:S = 0: REM S=STERN TUBES LOADED
  2789.  40140  IF  MID$ (TS$(U - US%),A,1) = "L" THEN S = S + 1
  2790.  40150 A = A + 1: IF A <  = 10 THEN 40140
  2791.  40160 F0% = 0
  2792.  40200 O = NE% + U - US%: REM BLANK OLD ORDERS
  2793.  40210 MO$(O) = "":FO$(O) = "":FS$(O) = ""
  2794.  40250  IF  MID$ (U$,SJ,2) =  MID$ (U$,SK,2) THEN 40299: REM SET SPEED TO MAX
  2795.  40260  IF  VAL ( MID$ (U$,SV,2)) < 5 THEN 40299: REM JIF STOPPED
  2796.  40270 A$ =  MID$ (U$,SJ,2):U$ =  LEFT$ (U$,SK - 1) + A$ +  RIGHT$ (U$,S9 - SK - 1):U$(U) = U$: REM SPEED=MAX U/W
  2797.  40299  RETURN
  2798.  40300  FOR I = 0 TO UT - 1: PRINT XN(I),YN(I): NEXT
  2799.  40310 J = NE%:K = J + NS% - 1: FOR I = J TO K: PRINT MO$(I),FO$(I),FS$(I): NEXT
  2800.  40320  PRINT U$
  2801.  40322  PRINT "X="; INT (UX(U));" Y="; INT (UY(U))
  2802.  40330  PRINT "B=";B;" S=";S
  2803.  40400  PRINT "INIT DONE";: INPUT AA$: RETURN
  2804.  41000 Z =  VAL ( MID$ (U$(T),SN,3)): REM MOVE TO INTERCEPT **
  2805.  41010 Z0 = Z + 90: IF Z0 > 360 THEN Z0 = Z0 - 360
  2806.  41020 X0 = UX(T) + 1200 *  COS ((450 - Z0) * PI / 180): REM CALC 1ST PT
  2807.  41030 Y0 = UY(T) + 1200 *  SIN ((450 - Z0) * PI / 180)
  2808.  41040 D0 =  SQR ((UX(U) - X0) ^ 2 + (UY(U) - Y0) ^ 2)
  2809.  41050 Z1 = Z - 90: IF Z1 < 0 THEN Z1 = 360 + Z1: REM CALC 2ND PT
  2810.  41060 X1 = UX(T) + 1200 *  COS ((450 - Z1) * PI / 180)
  2811.  41070 Y1 = UY(T) + 1200 *  SIN ((450 - Z1) * PI / 180)
  2812.  41080 D1 =  SQR ((UX(U) - X1) ^ 2 + (UY(U) - Y1) ^ 2)
  2813.  41100 X2 = X0:Y2 = Y0: IF D1 < D0 THEN X2 = X1:Y2 = Y1
  2814.  41110 X0 = UX(U):Y0 = UY(U): GOSUB 30900
  2815.  41112 A =  INT (A)
  2816.  41120 A$ = "000" +  STR$ (A):MO$(O) = MO$(O) + "MC" +  RIGHT$ (A$,3): REM MC(INT)
  2817.  41200  RETURN
  2818.  42000 AB = US% - 1:T = 0: IF B = 0 AND S = 0 THEN 42080: REM              FIRE DRILL **
  2819.  42010 D = 600: IF  MID$ (U$(T),SB,1) <  > "E" THEN D = 1500
  2820.  42020  IF XN(T) > D THEN 42070: REM JIF O.O.R.
  2821.  42030  GOSUB 30000: REM TDC
  2822.  42040  IF Z2 < 45 OR Z2 > 135 THEN 42070: REM ??BAD ANGLE
  2823.  42050 A =  INT (A):A$ = "000" +  STR$ (A):FO$(O) = FO$(O) + "FT" + B$ +  RIGHT$ (A$,3) + "00"
  2824.  42052  REM RINT "TORPEDO FIRE=";FO$(O)
  2825.  42054  IF B$ = "B" THEN B = B - 1
  2826.  42056  IF B$ = "S" THEN S = S - 1
  2827.  42060  IF B = 0 AND S = 0 THEN 42080
  2828.  42070 T = T + 1: IF T <  = AB THEN 42010
  2829.  42080  RETURN : REM PRINT "FIRE DRILL OVER": RETURN
  2830.  43000 T = 0: REM FIRE SURFACE GUN **********
  2831.  43010  IF UX(T) = 69000 THEN T = T + 1: GOTO 43010
  2832.  43020 X0 = UX(U):Y0 = UY(U):X2 = UX(T):Y2 = UY(T)
  2833.  43030 D =  INT (XN(T))
  2834.  43040  GOSUB 30900: REM GET ANGLE
  2835.  43050 A$ = "000" +  STR$ (A):B$ = "0000" +  STR$ (D)
  2836.  43060 FS$(O) = "FSG" +  RIGHT$ (A$,3) +  RIGHT$ (B$,4)
  2837.  43070  RETURN
  2838.  44000  IF B = 0 AND S = 0 THEN 44060: REM FIRE ALL TUBES *******
  2839.  44010 T = US% - 1:AB =  - 69
  2840.  44020  IF UX(T) = 69000 THEN 44050
  2841.  44030  GOSUB 42030:T = T - 1: REM FIRE TORP
  2842.  44040  IF B = 0 AND S = 0 THEN 44060
  2843.  44050 T = T - 1: IF T >  = 0 THEN 44020
  2844.  44060  RETURN : REM PRINT "ALL SHIPS FIRED AT": RETURN
  2845.  45000 Z =  VAL ( MID$ (U$,SN,3)): REM MC(RND) *****
  2846.  45010 I =  INT (120 *  RND (1)): IF  RND (1) > .5 THEN I =  - I
  2847.  45020 Z1 = Z + I: IF Z1 > 360 THEN Z1 = Z1 - 360
  2848.  45030  IF Z1 < 0 THEN Z1 = 360 + Z1
  2849.  45040 A$ = "000" +  STR$ (Z1):MO$(O) = MO$(O) + "MC" +  RIGHT$ (A$,3)
  2850.  45042  REM RINT "MC(RND)=";Z1;" FROM ";Z
  2851.  45050 F0% = 1: RETURN
  2852.  46000 I =  VAL ( MID$ (U$,SP,3)): REM I=MRR ** MU(PER) ******
  2853.  46010 J = P - I: IF J < 0 THEN J = 28
  2854.  46020 A$ = "000" +  STR$ (J):MO$(O) = "MU" +  RIGHT$ (A$,3) + MO$(O)
  2855.  46022  REM RINT "MU(PER) NEW DEPTH="            ;J
  2856.  46030  RETURN
  2857.  47000 AB = US% - 1:T = 0:I = 0:V = YN(0): REM MC(VP+) ********
  2858.  47010  IF UX(T) = 69000 THEN 47030
  2859.  47020  IF YN(T) > V THEN I = T:V = YN(T): REM T=MOST VP'S
  2860.  47030 T = T + 1: IF T <  = AB THEN 47010
  2861.  47032  REM RINT  MID$ (U$,SB,2);" MC(VP+) TO "; MID$ (U$(I),SB,2)
  2862.  47034  IF V = 0 THEN  RETURN
  2863.  47039  REM SET XT&YT TO SHIPS POSITION 1 TURN FROM NOW ??????
  2864.  47040 T = I: GOSUB 41000: REM  MOVE TO INTERCEPT
  2865.  47050  RETURN
  2866.  48000 U$ =  LEFT$ (U$,SY - 1) + "I" +  RIGHT$ (U$,S9 - SY):U$(U) = U$: REM MODE=INTERCEPT
  2867.  48010 T = 0:AB = US% - 1: REM ANYBODY STOPPED ?
  2868.  48020  IF UX(T) = 69000 THEN 48040
  2869.  48030 I =  VAL ( MID$ (U$(T),SV,2)): IF I < 5 THEN 48060: REM YES !
  2870.  48040 T = T + 1: IF T <  = AB THEN 48020
  2871.  48050  GOTO 48200: REM  NOBODY STOPPED
  2872.  48060 XT = UX(T):YT = UY(T): GOSUB 41000: REM MOVE TO INTERCEPT
  2873.  48062  REM RINT  MID$ (U$,SB,2);" INTERCEPTING STOPPED "; MID$ (U$(T),SB,2)
  2874.  48070  IF XN(T) > 1500 THEN A$ = "3": GOTO 48100
  2875.  48080  IF XN(T) > 1000 THEN A$ = "2": GOTO 48100
  2876.  48090 A$ = "1"
  2877.  48100 U$ =  LEFT$ (U$,SZ - 1) + A$ +  RIGHT$ (U$,S9 - SZ):U$(U) = U$: REM MODE COUNT=1 TO 3
  2878.  48110 MO$(O) = "MU033" + MO$(O)
  2879.  48120  GOTO 48299
  2880.  48200  GOSUB 47000: REM MC(VP+)
  2881.  48202  REM RINT  MID$ (U$,SB,2);" MODE=INTERCEPTING VP+ "; MID$(U$(T),SB,2)
  2882.  48210  GOTO 48070
  2883.  48299  RETURN
  2884.  49000 I =  VAL ( MID$ (U$,SP,3)): REM I=MRR ** MU(RND) **
  2885.  49010 J =  INT (I * ( RND (1) + .2)): REM EXPECTED DIVE=70% OF MRR
  2886.  49020 K = P + J:A$ = "000" +  STR$ (K): IF K < 31 THEN K = 32:A$ = "0032"
  2887.  49030 MO$(O) = "MU" +  RIGHT$ (A$,3) + MO$(O)
  2888.  49032  REM RINT "MU(RND) OLD=";P;" NEW=";K;" MRR=";I;" MDR="; MID$(U$,SO,3)
  2889.  49040  RETURN
  2890.  50000 C =  VAL ( MID$ (U$,SZ,1)): REM COUNT DOWN I MODE ****
  2891.  50010 C = C - 1: IF C < 1 THEN 50100
  2892.  50020 A$ = "0" +  STR$ (C):U$ =  LEFT$ (U$,SZ - 1) +  RIGHT$ (A$,1) +  RIGHT$ (U$,S9 - SZ):U$(U) = U$
  2893.  50022  REM RINT "INTERCEPT MODE CONTINUING"
  2894.  50030  RETURN
  2895.  50100  GOSUB 46000: REM MU(PER)
  2896.  50110 U$ =  LEFT$ (U$,SY - 1) + "A0" +  RIGHT$ (U$,S9 - SY - 1):U$(U) = U$
  2897.  50112  REM RINT "INTERCEPT MODE OVER"
  2898.  50120  RETURN
  2899.  51000 J = NE%:K = CO% - 1: REM BLANK ORDERS **
  2900.  51010  FOR I = J TO K:MO$(I) = "":FO$(I) = "": NEXT : RETURN
  2901.  60000  TEXT : REM SOLITAIRE **
  2902.  60002  HOME : VTAB 12: HTAB 12: PRINT "OTTO VON COMPUTER": PRINT
  2903.  60004  HTAB 6: PRINT "SIMULATED SUBMARINE COMMANDER": PRINT
  2904.  60006  HTAB 6: PRINT "IS CRAFTILY MOVING HIS FLEET"
  2905.  27263  MID$  RETURN
  2906.  63001  REM PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
  2907.  63002  REM PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP
Advertisement
RAW Paste Data Copied