Source Code

These source code files are a reconstruction of Sundance, 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
This means that source code does not represent a specific historical revision of Sundance, but rather a mixture of the three released versions. Nonetheless, it is capable of flying the whole Apollo 9 mission. This source code matches the binary dumps, as closely as feasible, but 100% match is not possible, due mostly to changes in memory addresses at which code and variables were allocated in different revisions of Sundance. Refer to this list of explanations for each binary mismatch.

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.

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

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