Source Code

These source code files are an attempted reconstruction of Sundance revision 306, the Apollo 9 LM (Lunar Module) AGC (Apollo Guidance Computer) flight software, created from binary dumps of original core rope program modules, as follows:
  • B1 — Revision 292
  • B2 — Revision 302
  • B3 — Revision 302
  • B4 — Revision 302
  • B5 — Revision 292
  • B6 — Revision 306
These dumps were then modified using memos, checklists, observed address changes, and the Sundance GSOPs to get the entire program to match Sundance revision 306 as closely as possible. Without more information, it is not possible to say how close it actually is; however, this code should be quite close. It is capable of flying the whole Apollo 9 mission using the original checklists and padload. Since only binary dumps (rather than listings) of Sundance are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing.

018360,000002:                                                                                                  ## Copyright:   Public domain.
018361,000003:                                                                                                  ## Filename:    R60,R62.agc
018362,000004:                                                                                                  ## Purpose:     A section of an attempt to reconstruct Sundance revision 306
018363,000005:                                                                                                  ##              as closely as possible with available information. Sundance
018364,000006:                                                                                                  ##              306 is the source code for the Lunar Module's (LM) Apollo
018365,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 9. This program was created
018366,000008:                                                                                                  ##              using the mixed-revision SundanceXXX as a starting point, and
018367,000009:                                                                                                  ##              pulling back features from Luminary 69 believed to have been
018368,000010:                                                                                                  ##              added based on memos, checklists, observed address changes,
018369,000011:                                                                                                  ##              or the Sundance GSOPs.
018370,000012:                                                                                                  ## Assembler:   yaYUL
018371,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
018372,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
018373,000015:                                                                                                  ## Mod history: 2020-07-24 MAS  Created from SundanceXXX.
018374,000016: 
018375,000017: 
018376,000018: 
018377,000019:                                                                                                  #  MOD NO: 0                             DATE: 1 MAY 1968
018378,000020:                                                                                                  #  MOD BY: DIGITAL DEVEL GROUP           LOG SECTION R60,R62
018379,000021: 
018380,000022:                                                                                                  #  FUNCTIONAL DESCRIPTION:
018381,000023: 
018382,000024:                                                                                                  #  CALLED AS A GENERAL SUBROUTINE TO MANEUVER THE LM TO A SPECIFIED
018383,000025:                                                                                                  #  ATTITUDE.
018384,000026: 
018385,000027:                                                                                                  #  1. IF THE 3-AXIS FLAG IS NOT SET THE FINAL CDU ANGLES ARE
018386,000028:                                                                                                  #  CALCULATED (VECPOINT).
018387,000029: 
018388,000030:                                                                                                  #  2. THE FDAI BALL ANGLES (NOUN 18) ARE CALCULATED (BALLANGS).
018389,000031: 
018390,000032:                                                                                                  #  3. REQUEST FLASHING DISPLAY V50 N18 PLEASE PERFORM AUTO MANEUVER.
018391,000033: 
018392,000034:                                                                                                  #  4. IF PRIORITY DISPLAY FLAG IS SET DO A PHASECHANGE. THEN AWAIT
018393,000035:                                                                                                  #  ASTRONAUT RESPONSE.
018394,000036: 
018395,000037:                                                                                                  #  5. DISPLAY RESPONSE RETURNS:
018396,000038: 
018397,000039:                                                                                                  #        A.      ENTER - RESET 3-AXIS FLAG AND RETURN TO CLIENT.
018398,000040: 
018399,000041:                                                                                                  #        B.      TERMINATE - IF IN P00 GO TO STEP 5A. OTHERWISE CHECK IF R61 IS
018400,000042:                                                                                                  #                THE CALLING PROGRAM. IF IN R61 AN EXIT IS MADE TO GOTOV56.  IF
018401,000043:                                                                                                  #                NOT IN R61 AN EXIT IS DONE VIA GOTOP00H.
018402,000044: 
018403,000045:                                                                                                  #        C.      PROCEED - CONTINUE WITH PROGRAM AT STEP 6.
018404,000046: 
018405,000047:                                                                                                  #  6. IF THE 3-AXISFLAG IS NOT SET, THE FINAL CDU ANGLES ARE CALCULATED
018406,000048:                                                                                                  #  (VECPOINT).
018407,000049: 
018408,000050:                                                                                                  #  7. THE FDAI BALL ANGLES (NOUN 18) ARE CALCULATED (BALLANGS).
018409,000051: 
018410,000052:                                                                                                  #  8. IF THE G+N SWITCH IS NOT SET GO BACK TO STEP 3.
018411,000053:                                                                                                  #  
018412,000054:                                                                                                  #  9. IF THE AUTO SWITCH IS NOT SET GO BACK TO STEP 3.
018413,000055: 
018414,000056:                                                                                                  #  10. NONFLASHING DISPLAY V06N18 (FDAI ANGLES).
018415,000057: 
018416,000058:                                                                                                  #  11. DO A PHASECHANGE.
018417,000059: 
018418,000060:                                                                                                  #  12. DO A MANEUVER CALCULATION AND ICDU DRIVE ROUTINE TO ACHIEVE FINAL
018419,000061: 
018420,000062:                                                                                                  #  GIMBAL ANGLES (GOMANUR).
018421,000063:                                                                                                  #  13. AT END OF MANEUVER GO TO STEP 3.
018422,000064: 
018423,000065:                                                                                                  #        IF SATISFACTORY MANEUVER STEP 5A EXITS R60.
018424,000066:                                                                                                  #        FOR FURTHER ADJUSTMENT OF THE VEHICLE ATTITUDE ABOUT THE
018425,000067:                                                                                                  #        DESIRED VECTOR, THE ROUTINE MAY BE PERFORMED AGAIN STARTING AT
018426,000068:                                                                                                  #        STEP 5C.
018427,000069: 
018428,000070:                                                                                                  #  CALLING SEQUENCE:     TC      BANKCALL
018429,000071:                                                                                                  #                        CADR    R60LEM
018430,000072: 
018431,000073:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED:     SCAXIS, POINTVSM (FOR VECPOINT)
018432,000074:                                                                                                  #                                        3AXISFLG.
018433,000075: 
018434,000076:                                                                                                  #  SUBROUTINES CALLED:   VECPOINT, BALLANGS, GOPERF2R, LINUS, GODSPER,
018435,000077:                                                                                                  #                        GOMANUR, DOWNFLAG, PHASCHNG, UPFLAG
018436,000078: 
018437,000079:                                                                                                  #  NORMAL EXIT MODES:    CAE     TEMPR60         (CALLERS RETURN ADDRESS)
018438,000080:                                                                                                  #                        TC      BANKJUMP
018439,000081: 
018440,000082:                                                                                                  #  ALARMS: NONE
018441,000083: 
018442,000084:                                                                                                  #  OUTPUT: NONE
018443,000085: 
018444,000086:                                                                                                  #  DEBRIS: CPHI, CTHETA, CPSI, 3AXISFLG, TBASE2
018445,000087: 
018446,000088: 34,2000                                           BANK     34                                    
018447,000089: 26,2000                                           SETLOC   MANUVER                               
018448,000090: 26,2000                                           BANK                                           
018449,000091: 
018450,000092: 26,2103     1176                                  EBANK=   TEMPR60                               
018451,000093: 
018452,000094: 26,2103                                           COUNT*   $$/R06                                
018453,000095: 26,2103           04704        R60LEM             TC       MAKECADR                              
018454,000096: 26,2104           55176                           TS       TEMPR60                               
018455,000097: 
018456,000098: 26,2105           05600                           TC       DOWNFLAG                              
018457,000099: 26,2106           00055                           ADRES    AUTMANSW                              
018458,000100: 
018459,000101: 26,2107           35021        REDOMANN           CAF      3AXISBIT                              
018460,000102: 26,2110           70101                           MASK     FLAGWRD5                              #  IS 3-AXIS FLAG SET
018461,000103: 26,2111           10000                           CCS      A                                     
018462,000104: 26,2112           12120                           TCF      TOBALL                                #  YES
018463,000105: 26,2113           06014                           TC       INTPRET                               
018464,000106: 26,2114           77624                           CALL                                           
018465,000107: 26,2115           56000                                    VECPOINT                              #  TO COMPUTE FINAL ANGLES
018466,000108: 26,2116           01207                           STORE    CPHI                                  #  STORE FINAL ANGLES - CPHI, CTHETA, CPSI
018467,000109: 26,2117           77776                           EXIT                                           
018468,000110: 
018469,000111: 26,2120           02302        TOBALL             TC       BALLANGS                              #  TO CONVERT ANGLES TO FDAI
018470,000112: 26,2121           32267        TOBALLA            CAF      V06N18                                
018471,000113: 26,2122           04655                           TC       BANKCALL                              
018472,000114: 26,2123           20606                           CADR     GOPERF2R                              #  DISPLAY PLEASE PERFORM AUTO MANEUVER
018473,000115: 26,2124           02255                           TC       R61TEST                               
018474,000116: 26,2125           02133                           TC       REDOMANC                              #  PROCEED
018475,000117: 26,2126           02131                           TC       GOMANMNV                              #  ENTER I.E. FINISHED WITH R60
018476,000118: 26,2127           02214                           TC       CHKLINUS                              #  TO CHECK FOR PRIORITY DISPLAYS
018477,000119: 26,2130           05225                           TC       ENDOFJOB                              
018478,000120: 
018479,000121: 26,2131           05566        GOMANMNV           TC       UPFLAG                                
018480,000122: 26,2132           00055                           ADRES    AUTMANSW                              
018481,000123: 
018482,000124: 26,2133           35021        REDOMANC           CAF      3AXISBIT                              
018483,000125: 26,2134           70101                           MASK     FLAGWRD5                              #  IS 3-AXIS FLAG SET
018484,000126: 26,2135           10000                           CCS      A                                     
018485,000127: 26,2136           12144                           TCF      TOBALLC                               #  YES
018486,000128: 26,2137           06014                           TC       INTPRET                               
018487,000129: 26,2140           77624                           CALL                                           
018488,000130: 26,2141           56000                                    VECPOINT                              #  TO COMPUTE FINAL ANGLES
018489,000131: 26,2142           01207                           STORE    CPHI                                  #  STORE ANGLES
018490,000132: 26,2143           77776                           EXIT                                           
018491,000133: 
018492,000134: 26,2144           02302        TOBALLC            TC       BALLANGS                              #  TO CONVERT ANGLES TO FDAI
018493,000135: 26,2145           02271                           TC       G+N,AUTO                              #  CHECK AUTO MODE
018494,000136: 26,2146           10000                           CCS      A                                     
018495,000137: 26,2147           02175                           TC       MANMANUV                              #  NOT AUTO, GO PERFORM MANUAL MANEUVER.
018496,000138: 
018497,000139: 26,2150           30077                           CA       FLAGWRD3                              
018498,000140: 26,2151           75010                           MASK     AUTMNBIT                              
018499,000141: 26,2152           00006                           EXTEND                                         
018500,000142: 26,2153           12155                           BZF      AUTOMANV                              
018501,000143: 26,2154           02175                           TC       MANMANUV                              
018502,000144: 
018503,000145: 26,2155           32267        AUTOMANV           CAF      V06N18                                #  STATIC DISPLAY DURING AUTO MANEUVER
018504,000146: 26,2156           04655                           TC       BANKCALL                              #                                        -
018505,000147: 26,2157           20364                           CADR     GODSPR                                #                                        -
018506,000148: 26,2160           02214                           TC       CHKLINUS                              #  TO CHECK FOR PRIORITY DISPLAYS
018507,000149: 26,2161           00004                           INHINT                                         
018508,000150: 26,2162           41102                           CS       DAPBOOLS                              
018509,000151: 26,2163           75016                           MASK     XOVINHIB                              
018510,000152: 26,2164           27102                           ADS      DAPBOOLS                              
018511,000153: 26,2165           00003                           RELINT                                         
018512,000154: 
018513,000155: 26,2166           04655        STARTMNV           TC       BANKCALL                              #  PERFORM MANEUVER VIA KALCMANU
018514,000156: 26,2167           17656                           CADR     GOMANUR                               
018515,000157: 
018516,000158: 26,2170           00004                           INHINT                                         
018517,000159: 26,2171           45016                           CS       XOVINHIB                              
018518,000160: 26,2172           71102                           MASK     DAPBOOLS                              
018519,000161: 26,2173           55102                           TS       DAPBOOLS                              
018520,000162: 26,2174           00003                           RELINT                                         
018521,000163: 
018522,000164: 26,2175           32270        MANMANUV           CAF      V06N19                                
018523,000165: 26,2176           04655                           TC       BANKCALL                              
018524,000166: 26,2177           20606                           CADR     GOPERF2R                              
018525,000167: 26,2200           02255                           TC       R61TEST                               
018526,000168: 26,2201           12210                           TCF      ENDMANU1                              
018527,000169: 26,2202           02205                           TC       ENDMANUV                              
018528,000170: 26,2203           02214                           TC       CHKLINUS                              
018529,000171: 26,2204           05225                           TC       ENDOFJOB                              
018530,000172: 
018531,000173: 26,2205           05600        ENDMANUV           TC       DOWNFLAG                              #  FINISHED MANEUVER.
018532,000174: 26,2206           00055                           ADRES    AUTMANSW                              
018533,000175: 26,2207           12133                           TCF      REDOMANC                              
018534,000176: 
018535,000177: 26,2210           05600        ENDMANU1           TC       DOWNFLAG                              #  RESET 3-AXIS FLAG
018536,000178: 26,2211           00124                           ADRES    3AXISFLG                              
018537,000179: 26,2212           31176                           CAE      TEMPR60                               #                                        -
018538,000180: 26,2213           04677                           TC       BANKJUMP                              #                                        -
018539,000181: 
018540,000182: 26,2214           40100        CHKLINUS           CS       FLAGWRD4                              
018541,000183: 26,2215           75013                           MASK     PDSPFBIT                              #  IS PRIORITY DISPLAY FLAG SET?
018542,000184: 26,2216           10000                           CCS      A                                     #                                        -
018543,000185: 26,2217           00002                           TC       Q                                     #  NO - EXIT
018544,000186: 26,2220           30002                           CA       Q                                     
018545,000187: 26,2221           54156                           TS       MPAC       +2                         #  SAVE RETURN
018546,000188: 26,2222           46221                           CS       THREE                                 #  OBTAIN LOCATION FOR RESTART
018547,000189: 26,2223           60133                           AD       BUF2                                  #  HOLDS Q OF LAST DISPLAY
018548,000190: 26,2224           55056                           TS       TBASE2                                
018549,000191: 
018550,000192: 26,2225           05423                           TC       PHASCHNG                              
018551,000193: 26,2226           00132                           OCT      00132                                 
018552,000194: 
018553,000195: 26,2227           32265                           CAF      BIT14+7                               
018554,000196: 26,2230           05556                           TC       LINUS                                 #  GO SET BITS FOR PRIORITY DISPLAY      -
018555,000197: 26,2231           00156                           TC       MPAC       +2                         
018556,000198: 
018557,000199: 26,2232           37666        RELINUS            CAF      PRIO26                                #  RESTORE ORIGINAL PRIORITY
018558,000200: 26,2233           05216                           TC       PRIOCHNG                              
018559,000201: 
018560,000202: 26,2234           35022                           CAF      TRACKBIT                              #  DON'T CONTINUE R60 UNLESS TRACKFLAG ON.
018561,000203: 26,2235           70075                           MASK     FLAGWRD1                              
018562,000204: 26,2236           10000                           CCS      A                                     
018563,000205: 26,2237           12252                           TCF      RER60                                 
018564,000206: 
018565,000207: 26,2240           35020                           CAF      RNDVZBIT                              #  IS IT P20?
018566,000208: 26,2241           70074                           MASK     FLAGWRD0                              
018567,000209: 26,2242           10000                           CCS      A                                     
018568,000210: 26,2243           02247                           TC       +4                                    #  YES
018569,000211: 26,2244           05423                           TC       PHASCHNG                              #  NO, MUST BE P25, SET 2.11 SPOT
018570,000212: 26,2245           40112                           OCT      40112                                 
018571,000213: 
018572,000214: 26,2246           05225                           TC       ENDOFJOB                              
018573,000215: 
018574,000216: 26,2247           05423                           TC       PHASCHNG                              #  SET 2.7 SPOT FOR P20
018575,000217: 26,2250           40072                           OCT      40072                                 
018576,000218: 
018577,000219: 26,2251           05225                           TC       ENDOFJOB                              
018578,000220: 
018579,000221: 26,2252           05566        RER60              TC       UPFLAG                                #  SET PRIO DISPLAY FLAG AFTER RESTART
018580,000222: 26,2253           00077                           ADRES    PDSPFLAG                              
018581,000223: 
018582,000224: 26,2254           01056                           TC       TBASE2                                
018583,000225: 
018584,000226: 26,2255           31012        R61TEST            CA       MODREG                                #  IF WE ARE IN P00 IT MUST BE V49 OR V89
018585,000227: 26,2256           00006                           EXTEND                                         
018586,000228: 26,2257           12210                           BZF      ENDMANU1                              #  THUS WE GO TO ENDEXT VIA USER
018587,000229: 
018588,000230: 26,2260           30100                           CA       FLAGWRD4                              #  ARE WE IN R61 (P20 OR P25)
018589,000231: 26,2261           75013                           MASK     PDSPFBIT                              
018590,000232: 26,2262           00006                           EXTEND                                         
018591,000233: 26,2263           14106                           BZF      GOTOPOOH                              #  NO
018592,000234: 26,2264           06000                           TC       GOTOV56                               #  YES
018593,000235: 
018594,000236: 26,2265           20100        BIT14+7            OCT      20100                                 #                                        -
018595,000237: 26,2266           00203        OCT203             OCT      203                                   
018596,000238: 26,2267           01422        V06N18             VN       0618                                  
018597,000239: 26,2270           01423        V06N19             VN       0619                                  
018598,000240: 
018599,000241:                                                                                                  #  SUBROUTINE TO CHECK FOR G+N CONTROL, AUTO STABILIZATION
018600,000242: 
018601,000243:                                                                                                  #  RETURNS WITH C(A) = +         IF NOT SET FOR G+N, AUTO
018602,000244:                                                                                                  #  RETURNS WITH C(A) = +0        IF SWITCHES ARE SET
018603,000245: 
018604,000246: 26,2271           00006        G+N,AUTO           EXTEND                                         
018605,000247: 26,2272           00030                           READ     CHAN30                                
018606,000248: 26,2273           75015                           MASK     BIT10                                 
018607,000249: 26,2274           10000                           CCS      A                                     
018608,000250: 26,2275           00002                           TC       Q                                     #  NOT IN G+N    C(A) = +
018609,000251: 26,2276           00006        ISITAUTO           EXTEND                                         #  CHECK FOR AUTO MODE
018610,000252: 26,2277           00031                           READ     CHAN31                                
018611,000253: 26,2300           75011                           MASK     BIT14                                 
018612,000254: 26,2301           00002                           TC       Q                                     #  (+) = NOT IN AUTO, (+0) = AOK
018613,000255: 
018614,000256:                                                                                                  #  PROGRAM DESCRIPTION BALLANGS
018615,000257:                                                                                                  #  MOD NO.         LOG SECTION R60,R62
018616,000258: 
018617,000259:                                                                                                  #  WRITTEN BY RAMA M. AIYAWAR
018618,000260:                                                                                                  #  FUNCTIONAL DESCRIPTION
018619,000261: 
018620,000262:                                                                                                  #  COMPUTES LM FDAI BALL DISPLAY ANGLES
018621,000263:                                                                                                  #  CALLING SEQUENCE
018622,000264: 
018623,000265:                                                                                                  #           TC     BALLANGS
018624,000266:                                                                                                  #  NORMAL EXIT MODE
018625,000267: 
018626,000268:                                                                                                  #           TC     BALLEXIT        (SAVED Q)
018627,000269: 
018628,000270:                                                                                                  #  ALARM OR EXIT MODE  NIL
018629,000271:                                                                                                  #  SUBROUTINES CALLED
018630,000272:                                                                                                  #           CD*TR*G
018631,000273:                                                                                                  #           ARCTAN
018632,000274: 
018633,000275:                                                                                                  #  INPUT
018634,000276: 
018635,000277:                                                                                                  #  CPHI,CTHETA,CPSI  ARE  THE ANGLES CORRESPONDING TO AOG,AIG,AMG. THEY ARE
018636,000278:                                                                                                  #  SP,2S COMPLIMENT SCALED TO HALF REVOLUTION.
018637,000279:                                                                                                  #  OUTPUT
018638,000280: 
018639,000281:                                                                                                  #  FDAIX, FDAIY, FDAIZ ARE THE REQUIRED BALL ANGLES SCALED TO HALF REVOLUTION
018640,000282:                                                                                                  #  SP,2S COMPLIMENT.
018641,000283:                                                                                                  #  THESE ANGLES WILL BE DISPLAYED AS DEGREES AND HUNDREDTHS, IN THE ORDER ROLL, PITCH, YAW, USING NOUNS 18 & 19.
018642,000284: 
018643,000285:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED
018644,000286: 
018645,000287:                                                                                                  #  CPHI,CTHETA,CPSI EACH A SP REGISTER
018646,000288:                                                                                                  #  DEBRIS
018647,000289: 
018648,000290:                                                                                                  #  A,L,Q,MPAC,SINCDU,COSCDU,PUSHLIST,BALLEXIT
018649,000291: 
018650,000292:                                                                                                  #  NOMENCLATURE:  CPHI, CTHETA, & CPSI REPRESENT THE OUTER, INNER, & MIDDLE GIMBAL ANGLES, RESPECTIVELY; OR
018651,000293:                                                                                                  #  EQUIVALENTLY, CDUX, CDUY, & CDUZ.
018652,000294: 
018653,000295:                                                                                                  #  NOTE:  ARCTAN CHECKS FOR OVERFLOW AND SHOULD BE ABLE TO HANDLE ANY SINGULARITIES.
018654,000296: 
018655,000297: 26,2000                                           SETLOC   BAWLANGS                              
018656,000298: 26,2000                                           BANK                                           
018657,000299: 
018658,000300: 26,2302                                           COUNT*   $$/BALL                               
018659,000301: 26,2302           00006        BALLANGS           EXTEND                                         
018660,000302: 26,2303           23346                           QXCH     BALLEXIT                              
018661,000303: 26,2304           31206                           CA       CPHI                                  
018662,000304: 26,2305           54772                           TS       CDUSPOT    +4                         
018663,000305: 26,2306           31207                           CA       CTHETA                                
018664,000306: 26,2307           54766                           TS       CDUSPOT                               
018665,000307: 26,2310           31210                           CA       CPSI                                  
018666,000308: 26,2311           54770                           TS       CDUSPOT    +2                         
018667,000309: 
018668,000310: 26,2312           06014                           TC       INTPRET                               
018669,000311: 26,2313           45001                           SETPD    CALL                                  
018670,000312: 26,2314           00001                                    0D                                    
018671,000313: 26,2315           47341                                    CD*TR*G                               
018672,000314: 
018673,000315: 26,2316           41345                           DLOAD    DMP                                   
018674,000316: 26,2317           00743                                    SINCDUX                               #  SIN (OGA)
018675,000317: 26,2320           00747                                    COSCDUZ                               #  COS (MGA)
018676,000318: 
018677,000319: 26,2321           57552                           SL1      DCOMP                                 #  SCALE
018678,000320: 26,2322           65336                           ARCSIN   PDDL                                  #  YAW = ARCSIN(-SXCZ) INTO 0 PD
018679,000321: 26,2323           00741                                    SINCDUZ                               
018680,000322: 26,2324           14023                           STODL    SINTH                                 #  (SINTH = 18D IN PD)
018681,000323: 26,2325           00747                                    COSCDUZ                               
018682,000324: 26,2326           72405                           DMP      SL1                                   #  RESCALE
018683,000325: 26,2327           00751                                    COSCDUX                               
018684,000326: 26,2330           34021                           STCALL   COSTH                                 #  (COSTH= 16D IN PD)
018685,000327: 26,2331           26464                                    ARCTAN                                
018686,000328: 26,2332           41325                           PDDL     DMP                                   #  ROLL = ARCTAN(SZ/CZCX) INTO 2 PD
018687,000329: 26,2333           00741                                    SINCDUZ                               
018688,000330: 26,2334           00743                                    SINCDUX                               
018689,000331: 26,2335           41512                           SL2      PUSH                                  #  SXSZ INTO 4 PD
018690,000332: 26,2336           65205                           DMP      PDDL                                  #  SXSZCY INTO 4 PD
018691,000333: 26,2337           00745                                    COSCDUY                               
018692,000334: 26,2340           65205                           DMP      PDDL                                  #  SXSZSY INTO 6 PD
018693,000335: 26,2341           00737                                    SINCDUY                               
018694,000336: 26,2342           00751                                    COSCDUX                               
018695,000337: 26,2343           72405                           DMP      SL1                                   #  CXCY
018696,000338: 26,2344           00745                                    COSCDUY                               
018697,000339: 26,2345           45425                           DSU      STADR                                 #  PULL UP FROM 6 PD
018698,000340: 26,2346           63756                           STODL    COSTH                                 #  COSTH = CXCY - SXSZSY
018699,000341: 26,2347           00737                                    SINCDUY                               
018700,000342: 26,2350           72405                           DMP      SL1                                   
018701,000343: 26,2351           00751                                    COSCDUX                               #  CXSY
018702,000344: 26,2352           45415                           DAD      STADR                                 #  PULL UP FROM 4 PD
018703,000345: 26,2353           43754                           STCALL   SINTH                                 #  SINTH = CXSY + SXSZCY
018704,000346: 26,2354           26464                                    ARCTAN                                #  RETURNS WITH D(MPAC) = PITCH
018705,000347: 26,2355           55525                           PDDL     VDEF                                  #  PITCH INTO 2 PD, ROLL INTO MPAC FROM 2 PD
018706,000348: 26,2356           77634                           RTB                                            #  VDEF MAKES V(MPAC) = ROLL, PITCH, YAW
018707,000349: 26,2357           21516                                    V1STO2S                               
018708,000350: 26,2360           03776                           STORE    FDAIX                                 #  MODE IS TP
018709,000351: 26,2361           77776                           EXIT                                           
018710,000352: 
018711,000353: 26,2362           01346        ENDBALL            TC       BALLEXIT                              
018712,000354: 
018713,000355:                                                                                                  #  PROGRAM DESCRIPTION - VECPOINT
018714,000356: 
018715,000357:                                                                                                  #           THIS INTERPRETIVE SUBROUTINE MAY BE USED TO POINT A SPACECRAFT AXIS IN A DESIRED DIRECTION.  THE AXIS
018716,000358:                                                                                                  #  TO BE POINTED MUST APPEAR AS A HALF UNIT DOUBLE PRECISION VECTOR IN SUCCESSIVE LOCATIONS OF ERASABLE MEMORY
018717,000359:                                                                                                  #  BEGINNING WITH THE LOCATION CALLED SCAXIS.  THE COMPONENTS OF THIS VECTOR ARE GIVEN IN SPACECRAFT COORDINATES.
018718,000360:                                                                                                  #  THE DIRECTION IN WHICH THIS AXIS IS TO BE POINTED MUST APPEAR AS A HALF UNIT DOUBLE PRECISION VECTOR IN
018719,000361:                                                                                                  #  SUCCESSIVE LOCATIONS OF ERASABLE MEMORY BEGINNING WITH THE ADDRESS CALLED POINTVSM.  THE COMPONENTS OF THIS
018720,000362:                                                                                                  #  VECTOR ARE GIVEN IN STABLE MEMBER COORDINATES.  WITH THIS INFORMATION VECPOINT COMPUTES A SET OF THREE GIMBAL
018721,000363:                                                                                                  #  ANGLES (2S COMPLEMENT) CORESPONDING TO THE CROSS-PRODUCT ROTATION BETWEEN SCAXIS AND POINTVSM AND STORES THEM
018722,000364:                                                                                                  #  IN T(MPAC) BEFORE RETURNING TO THE CALLER.
018723,000365:                                                                                                  #           THIS ROTATION, HOWEVER, MAY BRING THE S/C INTO GIMBAL LOCK.  WHEN POINTING A VECTOR IN THE Y-Z PLANE,
018724,000366:                                                                                                  #  THE TRANSPONDER AXIS, OR THE AOT FOR THE LEM, THE PROGRAM WILL CORRECT THIS PROBLEM BY ROTATING THE CROSS-
018725,000367:                                                                                                  #  PRODUCT ATTITUDE ABOUT POINTVSM BY A FIXED AMOUNT SUFFICIENT TO ROTATE THE DESIRED S/C ATTITUDE OUT OF GIMBAL
018726,000368:                                                                                                  #  LOCK.  IF THE AXIS TO BE POINTED IS MORE THAN 40.6 DEGREES BUT LESS THAN 60.5 DEG FROM THE +X (OR -X) AXIS,
018727,000369:                                                                                                  #  THE ADDITIONAL ROTATION TO AVOID GIMAL LOCK IS 35 DEGREES.  IF THE AXIS IS MORE THAN 60.5 DEGEES FROM +X (OR -X)
018728,000370:                                                                                                  #  THE ADDITIONAL ROTATION IS 35 DEGREES.  THE GIMBAL ANGLES CORRESPONDING TO THIS ATTITUDE ARE THEN COMPUTED AND
018729,000371:                                                                                                  #  STORED AS 2S COMPLIMENT ANGLES IN T(MPAC) BEFORE RETURNING TO THE CALLER.
018730,000372:                                                                                                  #           WHEN POINTING THE X-AXIS, OR THE THRUST VECTOR, OR ANY VECTOR WITHIN 40.6 DEG OF THE X-AXIS, VECPOINT
018731,000373:                                                                                                  #  CANNOT CORRECT FOR A CROSS-PRODUCT ROTATION INTO GIMBAL LOCK.  IN THIS CASE A PLATFORM REALIGNMENT WOULD BE
018732,000374:                                                                                                  #  REQUIRED TO POINT THE VECTOR IN THE DESIRED DIRECTION.  AT PRESENT NO INDICATION IS GIVEN FOR THIS SITUATION
018733,000375:                                                                                                  #  EXCEPT THAT THE FINAL MIDDLE GIMBAL ANGLE IN MPAC +2 IS GREATER THAN 59 DEGREES.
018734,000376: 
018735,000377:                                                                                                  #           CALLING SEQUENCE -
018736,000378:                                                                                                  #               1) LOAD SCAXIS, POINTVSM
018737,000379:                                                                                                  #               2) CALL
018738,000380:                                                                                                  #                       VECPOINT
018739,000381: 
018740,000382:                                                                                                  #           RETURNS WITH
018741,000383: 
018742,000384:                                                                                                  #               1) DESIRED OUTER GIMBAL ANGLE IN MPAC
018743,000385:                                                                                                  #               2) DESIRED INNER GIMBAL ANGLE IN MPAC +1
018744,000386:                                                                                                  #               3) DESIRED MIDDLE GIMBAL ANGLE IN MPAC +2
018745,000387: 
018746,000388:                                                                                                  #  ERASABLES USED -
018747,000389: 
018748,000390:                                                                                                  #      1) SCAXIS           6
018749,000391:                                                                                                  #      2) POINTVSM         6
018750,000392:                                                                                                  #      3) MIS             18
018751,000393:                                                                                                  #      4) DEL             18
018752,000394:                                                                                                  #      5) COF              6
018753,000395:                                                                                                  #      6) VECQTEMP         1
018754,000396:                                                                                                  #      7) ALL OF VAC AREA 43
018755,000397: 
018756,000398:                                                                                                  #               TOTAL     99
018757,000399: 
018758,000400: 27,2000                                           SETLOC   VECPT                                 
018759,000401: 27,2000                                           BANK                                           
018760,000402: 27,2000                                           COUNT*   $$/VECPT                              
018761,000403: 
018762,000404: 27,2000  E6,1673                                  EBANK=   BCDU                                  
018763,000405: 
018764,000406: 27,2000           40020        VECPOINT           STQ      BOV                                   #  SAVE RETURN ADDRESS
018765,000407: 27,2001           03322                                    VECQTEMP                              
018766,000408: 27,2002           56003                                    VECLEAR                               #  AND CLEAR OVFIND
018767,000409: 27,2003           47164        VECLEAR            AXC,2    RTB                                   
018768,000410: 27,2004           03243                                    MIS                                   #  READ THE PRESENT CDU ANGLES AND
018769,000411: 27,2005           44377                                    READCDUK                              #  STORE THEM IN PD25, 26, 27
018770,000412: 27,2006           34032                           STCALL   25D                                   
018771,000413: 27,2007           44404                                    CDUTODCM                              #  S/C AXES TO STABLE MEMBER AXES (MIS)
018772,000414: 27,2010           61375                           VLOAD    VXM                                   
018773,000415: 27,2011           01256                                    POINTVSM                              #  RESOLVE THE POINTING DIRECTION VF INTO
018774,000416: 27,2012           03244                                    MIS                                   #  INITIAL S/C AXES (VF = POINTVSM)
018775,000417: 27,2013           77656                           UNIT                                           
018776,000418: 27,2014           00035                           STORE    28D                                   
018777,000419:                                                                                                  #  PD 28 29 30 31 32 33
018778,000420: 27,2015           53435                           VXV      UNIT                                  #  TAKE THE CROSS PRODUCT VF X VI
018779,000421: 27,2016           01250                                    SCAXIS                                #  WHERE VI = SCAXIS
018780,000422: 27,2017           57400                           BOV      VCOMP                                 
018781,000423: 27,2020           56130                                    PICKAXIS                              
018782,000424: 27,2021           17266                           STODL    COF                                   #  CHECK MAGNITUDE
018783,000425: 27,2022           00045                                    36D                                   #  OF CROSS PRODUCT
018784,000426: 27,2023           50025                           DSU      BMN                                   #  VECTOR, IF LESS
018785,000427: 27,2024           14424                                    DPB-14                                #  THAN B-14 ASSUME
018786,000428: 27,2025           56130                                    PICKAXIS                              #  UNIT OPERATION
018787,000429: 27,2026           50375                           VLOAD    DOT                                   #           INVALID.
018788,000430: 27,2027           01250                                    SCAXIS                                
018789,000431: 27,2030           00035                                    28D                                   
018790,000432: 27,2031           65552                           SL1      ARCCOS                                
018791,000433: 27,2032           77624        COMPMATX           CALL                                           #  NOW COMPUTE THE TRANSFORMATION FROM
018792,000434: 27,2033           44523                                    DELCOMP                               #  FINAL S/C AXES TO INITIAL S/C AXES  MFI
018793,000435: 27,2034           75160                           AXC,1    AXC,2                                 
018794,000436: 27,2035           03243                                    MIS                                   #  COMPUTE THE TRANSFORMATION FROM FINAL
018795,000437: 27,2036           02236                                    KEL                                   #  S/C AXES TO STABLE MEMBER AXES
018796,000438: 27,2037           77624                           CALL                                           #  MFS = MIS MFI
018797,000439: 27,2040           44306                                    MXM3                                  #  (IN PD LIST)
018798,000440: 
018799,000441: 27,2041           51545                           DLOAD    ABS                                   
018800,000442: 27,2042           00007                                    6                                     #  MFS6 = SIN(CPSI)                      $2
018801,000443: 27,2043           50025                           DSU      BMN                                   
018802,000444: 27,2044           14411                                    SINGIMLC                              #  = SIN(59 DEGS)                        $2
018803,000445: 27,2045           56120                                    FINDGIMB                              #  /CPSI/ LESS THAN 59 DEGS
018804,000446:                                                                                                  #  I.E. DESIRED ATTITUDE NOT IN GIMBAL LOCK
018805,000447: 
018806,000448: 27,2046           51545                           DLOAD    ABS                                   #  CHECK TO SEE IF WE ARE POINTING
018807,000449: 27,2047           01250                                    SCAXIS                                #  THE THRUST AXIS
018808,000450: 27,2050           51025                           DSU      BPL                                   
018809,000451: 27,2051           14413                                    SINVEC1                               #  SIN 49.4 DEGS                         $2
018810,000452: 27,2052           56120                                    FINDGIMB                              #  IF SO, WE ARE TRYING TO POINT IT INTO
018811,000453: 27,2053           77775                           VLOAD                                          #  GIMBAL LOCK, ABORT COULD GO HERE
018812,000454: 27,2054           77626                           STADR                                          
018813,000455: 27,2055           50517                           STOVL    MIS        +12D                       
018814,000456: 27,2056           77626                           STADR                                          #  STORE MFS (IN PD LIST) IN MIS
018815,000457: 27,2057           50525                           STOVL    MIS        +6                         
018816,000458: 27,2060           77626                           STADR                                          
018817,000459: 27,2061           50533                           STOVL    MIS                                   
018818,000460: 27,2062           03252                                    MIS        +6                         #  INNER GIMBAL AXIS IN FINAL S/C AXES
018819,000461: 27,2063           57444                           BPL      VCOMP                                 #  LOCATE THE IG AXIS DIRECTION CLOSEST TO
018820,000462: 27,2064           56065                                    IGSAMEX                               #  FINAL X S/C AXIS
018821,000463: 
018822,000464: 27,2065           50035        IGSAMEX            VXV      BMN                                   #  FIND THE SHORTEST WAY OF ROTATING THE 
018823,000465: 27,2066           01250                                    SCAXIS                                #  S/C OUT OF GIMBAL LOCK BY A ROTATION 
018824,000466: 27,2067           56074                                    U=SCAXIS                              #  ABOUT +- SCAXIS, I.E. IF  (IG (SGN MFS3)
018825,000467:                                                                                                  #  X SCAXIS . XF) LESS THAN 0, U = SCAXIS
018826,000468:                                                                                                  #  OTHERWISE U = -SCAXIS
018827,000469: 
018828,000470: 27,2070           57575                           VLOAD    VCOMP                                 
018829,000471: 27,2071           01250                                    SCAXIS                                
018830,000472: 27,2072           37266                           STCALL   COF                                   #  ROTATE ABOUT -SCAXIS
018831,000473: 27,2073           56077                                    CHEKAXIS                              
018832,000474: 27,2074           77775        U=SCAXIS           VLOAD                                          
018833,000475: 27,2075           01250                                    SCAXIS                                
018834,000476: 27,2076           03266                           STORE    COF                                   #  ROTATE ABOUT + SCAXIS
018835,000477: 27,2077           51545        CHEKAXIS           DLOAD    ABS                                   
018836,000478: 27,2100           01250                                    SCAXIS                                #  SEE IF WE ARE POINTING THE AOT
018837,000479: 27,2101           51025                           DSU      BPL                                   
018838,000480: 27,2102           14415                                    SINVEC2                               #  SIN 29.5 DEGS                         $2
018839,000481: 27,2103           56107                                    PICKANG1                              #  IF SO, ROTATE 50 DEGS ABOUT +- SCAXIS
018840,000482: 27,2104           52145                           DLOAD    GOTO                                  #  IF NOT, MUST BE POINTING THE TRANSPONDER
018841,000483: 27,2105           14421                                    VECANG2                               #  OR SOME VECTOR IN THE Y, OR Z PLANE
018842,000484: 27,2106           56111                                    COMPMFSN                              #  IN THIS CASE ROTATE 35 DEGS TO GET OUT
018843,000485:                                                                                                  #  OF GIMBAL LOCK (VECANG2  $360)
018844,000486: 27,2107           77745        PICKANG1           DLOAD                                          
018845,000487: 27,2110           14417                                    VECANG1                               #  = 50 DEGS                             $360
018846,000488: 27,2111           77624        COMPMFSN           CALL                                           
018847,000489: 27,2112           44523                                    DELCOMP                               #  COMPUTE THE ROTATION ABOUT SCAXIS TO
018848,000490: 27,2113           75160                           AXC,1    AXC,2                                 #  BRING MFS OUT OF GIMBAL LOCK
018849,000491: 27,2114           03243                                    MIS                                   
018850,000492: 27,2115           02236                                    KEL                                   
018851,000493: 27,2116           77624                           CALL                                           #  COMPUTE THE NEW TRANSFORMATION FROM
018852,000494: 27,2117           44306                                    MXM3                                  #  DESIRED S/C AXES TO STABLE MEMBER AXES
018853,000495:                                                                                                  #  WHICH WILL ALIGN VI WITH VF AND AVOID
018854,000496:                                                                                                  #  GIMBAL LOCK
018855,000497: 27,2120           45160        FINDGIMB           AXC,1    CALL                                  
018856,000498: 27,2121           00000                                    0                                     #  EXTRACT THE COMMANDED CDU ANGLES FROM
018857,000499: 27,2122           44650                                    DCMTOCDU                              #  THIS MATRIX
018858,000500: 27,2123           40234                           RTB      SETPD                                 
018859,000501: 27,2124           21516                                    V1STO2S                               #  CONVERT TO 2:S COMPLEMENT
018860,000502: 27,2125           00001                                    0                                     
018861,000503: 27,2126           77650                           GOTO                                           
018862,000504: 27,2127           03322                                    VECQTEMP                              #  RETURN TO CALLER
018863,000505: 
018864,000506: 27,2130           50375        PICKAXIS           VLOAD    DOT                                   #  IF VF X VI = 0, FIND VF . VI
018865,000507: 27,2131           00035                                    28D                                   
018866,000508: 27,2132           01250                                    SCAXIS                                
018867,000509: 27,2133           72240                           BMN      TLOAD                                 
018868,000510: 27,2134           54363                                    ROT180                                
018869,000511: 27,2135           00032                                    25D                                   
018870,000512: 27,2136           77650                           GOTO                                           #  IF VF = VI, CDU DESIRED = PRESENT CDU
018871,000513: 27,2137           03322                                    VECQTEMP                              #  PRESENT CDU ANGLES
018872,000514: 
018873,000515: 35,2000                                           BANK     35                                    
018874,000516: 26,2000                                           SETLOC   MANUVER1                              
018875,000517: 26,2000                                           BANK                                           
018876,000518: 26,2363           47375        ROT180             VLOAD    VXV                                   #  IF VF, VI ANTIPARALLEL, 108 DEG ROTATION
018877,000519: 26,2364           03252                                    MIS        +6                         #  IS REQUIRED. Y STABLE MEMBER AXIS IN
018878,000520: 26,2365           06231                                    HIDPHALF                              #  INITIAL S/C AXES.
018879,000521: 26,2366           47256                           UNIT     VXV                                   #  FIND Y(SM) X X(I)
018880,000522: 26,2367           01250                                    SCAXIS                                #  FIND UNIT(VI X UNIT(Y(SM) X X(I)))
018881,000523: 26,2370           40056                           UNIT     BOV                                   #  I.E. PICK A VECTOR IN THE PLANE OF X(I),
018882,000524: 26,2371           54405                                    PICKX                                 #  Y(SM) PERPENDICULAR TO VI
018883,000525: 26,2372           17266                           STODL    COF                                   
018884,000526: 26,2373           00045                                    36D                                   #  CHECK MAGNITUDE
018885,000527: 26,2374           50025                           DSU      BMN                                   #  OF THIS VECTOR.
018886,000528: 26,2375           14424                                    DPB-14                                #  IF LESS THAN B-14,
018887,000529: 26,2376           54405                                    PICKX                                 #  PICK X-AXIS.
018888,000530: 26,2377           77775                           VLOAD                                          
018889,000531: 26,2400           03266                                    COF                                   
018890,000532: 26,2401           17266        XROT               STODL    COF                                   
018891,000533: 26,2402           06231                                    HIDPHALF                              
018892,000534: 26,2403           77650                           GOTO                                           
018893,000535: 26,2404           56032                                    COMPMATX                              
018894,000536: 26,2405           52175        PICKX              VLOAD    GOTO                                  #  PICK THE XAXIS IN THIS CASE
018895,000537: 26,2406           06231                                    HIDPHALF                              
018896,000538: 26,2407           54401                                    XROT                                  
018897,000539: 26,2410           15555 35172  SINGIMLC           2DEC     .4285836003                            #  = SIN(59)                             $2
018898,000540: 
018899,000541: 26,2412           14113 36326  SINVEC1            2DEC     .3796356537                            #  = SIN(49.4)                           $2
018900,000542: 
018901,000543: 26,2414           07701 35703  SINVEC2            2DEC     .2462117800                            #  = SIN(29.5)                           $2
018902,000544: 
018903,000545: 26,2416           04343 21616  VECANG1            2DEC     .1388888889                            #  = 50 DEGREES                          $360
018904,000546: 
018905,000547: 26,2420           03070 34344  VECANG2            2DEC     .09722222222                            #  = 35 DEGREES                          $360
018906,000548: 
018907,000549: 26,2422           00000        1BITDP             OCT      0                                     #  KEEP THIS BEFORE DPB(-14)        *********
018908,000550: 26,2423           00001        DPB-14             OCT      00001                                 
018909,000551: 26,2424           00000                           OCT      00000                                 
018910,000552: 
018911,000553:                                                                                                  #  ROUTINE FOR INITIATING AUTOMATIC MANEUVER VIA KEYBOARD (V49)
018912,000554: 
018913,000555: 34,2000                                           BANK     34                                    
018914,000556: 23,2000                                           SETLOC   R62                                   
018915,000557: 23,2000                                           BANK                                           
018916,000558: 23,2024  E6,1673                                  EBANK=   BCDU                                  
018917,000559: 
018918,000560: 23,2024                                           COUNT*   $$/R62                                
018919,000561: 
018920,000562: 23,2024  23,2024               R62DISP            EQUALS   R62FLASH                              
018921,000563: 
018922,000564: 23,2024           35060        R62FLASH           CAF      V06N22                                #  FLASH V06N22 AND
018923,000565: 23,2025           04655                           TC       BANKCALL                              #  ICDU ANGLES
018924,000566: 23,2026           20406                           CADR     GOFLASH                               
018925,000567: 23,2027           15564                           TCF      ENDEXT                                #  TERMINATE
018926,000568: 23,2030           12032                           TCF      GOMOVE                                #  PROCEED
018927,000569: 23,2031           12024                           TCF      R62FLASH                              #  ENTER
018928,000570: 
018929,000571:                                                                                                  #  ASTRONAUT MAY LOAD NEW ICDUS AT THIS
018930,000572:                                                                                                  #  POINT
018931,000573: 23,2032           05566        GOMOVE             TC       UPFLAG                                #  SET FOR 3-AXIS MANEUVER
018932,000574: 23,2033           00124                           ADRES    3AXISFLG                              
018933,000575: 
018934,000576: 23,2034           04655                           TC       BANKCALL                              
018935,000577: 23,2035           54103                           CADR     R60LEM                                
018936,000578: 23,2036           15564                           TCF      ENDEXT                                #  END R62
018937,000579: 

End of include-file R60,R62.agc.  Parent file is MAIN.agc