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.

048803,000002:                                                                                                  ## Copyright:   Public domain.
048804,000003:                                                                                                  ## Filename:    INFLIGHT_ALIGNMENT_ROUTINES.agc
048805,000004:                                                                                                  ## Purpose:     A section of an attempt to reconstruct Sundance revision 306
048806,000005:                                                                                                  ##              as closely as possible with available information. Sundance
048807,000006:                                                                                                  ##              306 is the source code for the Lunar Module's (LM) Apollo
048808,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 9. This program was created
048809,000008:                                                                                                  ##              using the mixed-revision SundanceXXX as a starting point, and
048810,000009:                                                                                                  ##              pulling back features from Luminary 69 believed to have been
048811,000010:                                                                                                  ##              added based on memos, checklists, observed address changes,
048812,000011:                                                                                                  ##              or the Sundance GSOPs.
048813,000012:                                                                                                  ## Assembler:   yaYUL
048814,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
048815,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
048816,000015:                                                                                                  ## Mod history: 2020-07-24 MAS  Created from SundanceXXX.
048817,000016: 
048818,000017: 
048819,000018: 
048820,000019: 22,3644                                           BANK     22                                    
048821,000020: 23,2000                                           SETLOC   INFLIGHT                              
048822,000021: 23,2000                                           BANK                                           
048823,000022: 
048824,000023: 23,3043  E5,1642                                  EBANK=   XSM                                   
048825,000024: 
048826,000025:                                                                                                  #  CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
048827,000026: 
048828,000027:                                                                                                  #  THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES. THE THREE
048829,000028:                                                                                                  #  HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
048830,000029: 
048831,000030:                                                                                                  #  THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
048832,000031:                                                                                                  #  MGC, AND OGC RESPECTIVELY.
048833,000032: 
048834,000033: 23,3043                                           COUNT*   $$/INFLT                              
048835,000034: 23,3043           71220        CALCGTA            ITA      DLOAD                                 #  PUSHDOWN  00-03,16D-27D,34D-37D
048836,000035: 23,3044           00051                                    S2                                    #  XDC = (XD1 XD2 XD3)
048837,000036: 23,3045           02665                                    XDC                                   #  YDC = (YD1 YD2 YD3)
048838,000037: 23,3046           65325                           PDDL     PDDL                                  #  ZDC = (ZD1 ZD2 ZD3)
048839,000038: 23,3047           06233                                    HI6ZEROS                              
048840,000039: 23,3050           02671                                    XDC        +4                         
048841,000040: 23,3051           55476                           DCOMP    VDEF                                  
048842,000041: 23,3052           77656                           UNIT                                           
048843,000042: 23,3053           14027                           STODL    ZPRIME                                #  ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
048844,000043: 23,3054           00027                                    ZPRIME                                
048845,000044: 
048846,000045: 23,3055           77742                           SR1                                            
048847,000046: 23,3056           14023                           STODL    SINTH                                 #  SIN(IGC) = ZP1
048848,000047: 23,3057           00033                                    ZPRIME     +4                         
048849,000048: 23,3060           77742                           SR1                                            
048850,000049: 23,3061           34021                           STCALL   COSTH                                 #  COS(IGC) = ZP3
048851,000050: 23,3062           47114                                    ARCTRIG                               
048852,000051: 
048853,000052: 23,3063           16742                           STODL    IGC                                   #  Y GYRO TORQUING ANGLE   FRACTION OF REV.
048854,000053: 23,3064           02667                                    XDC        +2                         
048855,000054: 23,3065           77742                           SR1                                            
048856,000055: 23,3066           14023                           STODL    SINTH                                 #  SIN(MGC) = XD2
048857,000056: 23,3067           00027                                    ZPRIME                                
048858,000057: 
048859,000058: 23,3070           65205                           DMP      PDDL                                  
048860,000059: 23,3071           02671                                    XDC        +4                         #  PD00 = (ZP1)(XD3)
048861,000060: 23,3072           00033                                    ZPRIME     +4                         
048862,000061: 
048863,000062: 23,3073           45205                           DMP      DSU                                   
048864,000063: 23,3074           02665                                    XDC                                   #  MPAC = (ZP3)(XD1)
048865,000064: 23,3075           77626                           STADR                                          
048866,000065: 23,3076           43756                           STCALL   COSTH                                 #  COS(MGC) = MPAC - PD00
048867,000066: 23,3077           47114                                    ARCTRIG                               
048868,000067: 23,3100           26744                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.
048869,000068: 23,3101           00027                                    ZPRIME                                
048870,000069: 23,3102           77641                           DOT                                            
048871,000070: 23,3103           02701                                    ZDC                                   
048872,000071: 23,3104           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
048873,000072: 23,3105           00027                                    ZPRIME                                
048874,000073: 23,3106           77641                           DOT                                            
048875,000074: 23,3107           02673                                    YDC                                   
048876,000075: 23,3110           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
048877,000076: 23,3111           47114                                    ARCTRIG                               
048878,000077: 
048879,000078: 23,3112           36740                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
048880,000079: 23,3113           00051                                    S2                                    
048881,000080: 
048882,000081:                                                                                                  #  ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
048883,000082: 
048884,000083:                                                                                                  #  THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
048885,000084: 
048886,000085:                                                                                                  #  THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA. THE OUTPUT IS ALSO
048887,000086:                                                                                                  #  AVAILABLE AT MPAC.
048888,000087: 
048889,000088: 23,3114           51545        ARCTRIG            DLOAD    ABS                                   #  PUSHDOWN  16D-21D
048890,000089: 23,3115           00023                                    SINTH                                 
048891,000090: 23,3116           50025                           DSU      BMN                                   
048892,000091: 23,3117           07332                                    QTSN45                                #  ABS(SIN/4) - SIN(45)/4
048893,000092: 23,3120           47127                                    TRIG1                                 #  IF (-45,45) OR (135,-135)
048894,000093: 
048895,000094: 23,3121           72545                           DLOAD    SL1                                   #  (45,135) OR (-135,-45)
048896,000095: 23,3122           00021                                    COSTH                                 
048897,000096: 23,3123           75326                           ACOS     SIGN                                  
048898,000097: 23,3124           00023                                    SINTH                                 
048899,000098: 23,3125           00025                           STORE    THETA                                 #  X = ARCCOS(COS) WITH SIGN(SIN)
048900,000099: 23,3126           77616                           RVQ                                            
048901,000100: 
048902,000101: 23,3127           72545        TRIG1              DLOAD    SL1                                   #  (-45,45) OR (135,-135)
048903,000102: 23,3130           00023                                    SINTH                                 
048904,000103: 23,3131           77736                           ASIN                                           
048905,000104: 23,3132           14025                           STODL    THETA                                 #  X = ARCSIN(SIN) WITH SIGN(SIN)
048906,000105: 23,3133           00021                                    COSTH                                 
048907,000106: 23,3134           77640                           BMN                                            
048908,000107: 23,3135           47140                                    TRIG2                                 #  IF (135,-135)
048909,000108: 
048910,000109: 23,3136           43545                           DLOAD    RVQ                                   
048911,000110: 23,3137           00025                                    THETA                                 #  X = ARCSIN(SIN)   (-45,45)
048912,000111: 
048913,000112: 23,3140           75345        TRIG2              DLOAD    SIGN                                  #  (135,-135)
048914,000113: 23,3141           06231                                    HIDPHALF                              
048915,000114: 23,3142           00023                                    SINTH                                 
048916,000115: 23,3143           77625                           DSU                                            
048917,000116: 23,3144           00025                                    THETA                                 
048918,000117: 23,3145           00025                           STORE    THETA                                 #  X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
048919,000118: 23,3146           77616                           RVQ                                            #        (+) - (+) OR (-) - (-)
048920,000119: 
048921,000120:                                                                                                  #      SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
048922,000121:                                                                                                  #  COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
048923,000122:                                                                                                  #  FLIGHT SUBROUTINES.
048924,000123: 
048925,000124:                                                                                                  #  CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
048926,000125: 
048927,000126:                                                                                                  #  THE INPUTS ARE  1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM. THE THREE HALF-UNIT
048928,000127:                                                                                                  #  VECTORS ARE STORED AT XNB, YNB, AND ZNB. 2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
048929,000128:                                                                                                  #  COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
048930,000129: 
048931,000130:                                                                                                  #  THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
048932,000131: 
048933,000132: 23,3147           77601        CALCGA             SETPD                                          #  PUSHDOWN  00-05, 16D-21D, 34D-37D
048934,000133: 23,3150           00001                                    0                                     
048935,000134: 23,3151           47375                           VLOAD    VXV                                   
048936,000135: 23,3152           02665                                    XNB                                   #  XNB = OGA (OUTER GIMBAL AXIS)
048937,000136: 23,3153           02651                                    YSM                                   #  YSM = IGA (INNER GIMBAL AXIS)
048938,000137: 23,3154           41456                           UNIT     PUSH                                  #  PD0 = UNIT(OGA X IGA) = MGA
048939,000138: 
048940,000139: 23,3155           44041                           DOT      ITA                                   
048941,000140: 23,3156           02701                                    ZNB                                   
048942,000141: 23,3157           00051                                    S2                                    
048943,000142: 23,3160           24021                           STOVL    COSTH                                 #  COS(OG) = MGA . ZNB
048944,000143: 23,3161           00001                                    0                                     
048945,000144: 23,3162           77641                           DOT                                            
048946,000145: 23,3163           02673                                    YNB                                   
048947,000146: 23,3164           34023                           STCALL   SINTH                                 #  SIN(OG) = MGA . YNB
048948,000147: 23,3165           47114                                    ARCTRIG                               
048949,000148: 23,3166           26740                           STOVL    OGC                                   
048950,000149: 23,3167           00001                                    0                                     
048951,000150: 
048952,000151: 23,3170           50235                           VXV      DOT                                   #  PROVISION FOR MG ANGLE OF 90 DEGREES
048953,000152: 23,3171           02665                                    XNB                                   
048954,000153: 23,3172           02651                                    YSM                                   
048955,000154: 23,3173           77752                           SL1                                            
048956,000155: 23,3174           24021                           STOVL    COSTH                                 #  COS(MG) = IGA . (MGA X OGA)
048957,000156: 23,3175           02651                                    YSM                                   
048958,000157: 23,3176           77641                           DOT                                            
048959,000158: 23,3177           02665                                    XNB                                   
048960,000159: 23,3200           34023                           STCALL   SINTH                                 #  SIN(MG) = IGA . OGA
048961,000160: 23,3201           47114                                    ARCTRIG                               
048962,000161: 23,3202           02744                           STORE    MGC                                   
048963,000162: 
048964,000163: 23,3203           45246                           ABS      DSU                                   
048965,000164: 23,3204           07334                                    .166...                               
048966,000165: 23,3205           77644                           BPL                                            
048967,000166: 23,3206           47227                                    GIMLOCK1                              #  IF ANGLE GREATER THAN 60 DEGREES
048968,000167: 
048969,000168: 23,3207           50375        CALCGA1            VLOAD    DOT                                   
048970,000169: 23,3210           02657                                    ZSM                                   
048971,000170: 23,3211           00001                                    0                                     
048972,000171: 23,3212           24021                           STOVL    COSTH                                 #  COS(IG) = ZSM . MGA
048973,000172: 23,3213           02643                                    XSM                                   
048974,000173: 23,3214           45441                           DOT      STADR                                 
048975,000174: 23,3215           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
048976,000175: 23,3216           47114                                    ARCTRIG                               
048977,000176: 
048978,000177: 23,3217           26742                           STOVL    IGC                                   
048979,000178: 23,3220           02740                                    OGC                                   
048980,000179: 23,3221           43034                           RTB      BONCLR                                
048981,000180: 23,3222           21516                                    V1STO2S                               
048982,000181: 23,3223           00200                                    CPHIFLAG                              
048983,000182: 23,3224           00051                                    S2                                    
048984,000183: 23,3225           35207                           STCALL   THETAD                                
048985,000184: 23,3226           00051                                    S2                                    
048986,000185: 
048987,000186: 23,3227           77776        GIMLOCK1           EXIT                                           
048988,000187: 23,3230           05651                           TC       ALARM                                 
048989,000188: 23,3231           00401                           OCT      00401                                 
048990,000189: 23,3232           05566                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
048991,000190: 23,3233           00056                           ADRES    GLOKFAIL                              
048992,000191: 
048993,000192: 23,3234           06014                           TC       INTPRET                               
048994,000193: 23,3235           77650                           GOTO                                           
048995,000194: 23,3236           47207                                    CALCGA1                               
048996,000195: 
048997,000196:                                                                                                  #  AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
048998,000197: 
048999,000198:                                                                                                  #  THE INPUTS ARE  1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD.  2) THE STAR2 VECTOR
049000,000199:                                                                                                  #  REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6.  3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
049001,000200:                                                                                                  #  AT LOCATION 6 OF THE VAC AREA.  4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
049002,000201:                                                                                                  #  THE VAC AREA.
049003,000202: 
049004,000203:                                                                                                  #  THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B. THE THREE HALF-UNIT VECTORS ARE STORED
049005,000204:                                                                                                  #  AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
049006,000205: 
049007,000206: 23,3237           66370        AXISGEN            AXT,1    SSP                                   #  PUSHDOWN 00-30D,34D-37D
049008,000207: 23,3240           02714                                    STARAD     +6                         
049009,000208: 23,3241           00051                                    S1                                    
049010,000209: 23,3242           02700                                    STARAD     -6                         
049011,000210: 
049012,000211: 23,3243           77601                           SETPD                                          
049013,000212: 23,3244           00001                                    0                                     
049014,000213: 23,3245           46773        AXISGEN1           VLOAD*   VXV*                                  #  06D   UA = S1
049015,000214: 23,3246           02723                                    STARAD     +12D,1                     #         STARAD +00D   UB = S1
049016,000215: 23,3247           02731                                    STARAD     +18D,1                     
049017,000216: 23,3250           77656                           UNIT                                           #  12D   VA = UNIT(S1 X S2)
049018,000217: 23,3251           06731                           STORE    STARAD     +18D,1                     #         STARAD +06D   VB = UNIT(S1 X S2)
049019,000218: 23,3252           77773                           VLOAD*                                         
049020,000219: 23,3253           02723                                    STARAD     +12D,1                     
049021,000220: 
049022,000221: 23,3254           76433                           VXV*     VSL1                                  
049023,000222: 23,3255           02731                                    STARAD     +18D,1                     #  18D   WA = UA X VA
049024,000223: 23,3256           06737                           STORE    STARAD     +24D,1                     #         STARAD +12D   WB = UB X VB
049025,000224: 
049026,000225: 23,3257           77700                           TIX,1                                          
049027,000226: 23,3260           47245                                    AXISGEN1                              
049028,000227: 
049029,000228: 23,3261           66160                           AXC,1    SXA,1                                 
049030,000229: 23,3262           00006                                    6                                     
049031,000230: 23,3263           00036                                    30D                                   
049032,000231: 
049033,000232: 23,3264           66370                           AXT,1    SSP                                   
049034,000233: 23,3265           00022                                    18D                                   
049035,000234: 23,3266           00051                                    S1                                    
049036,000235: 23,3267           00006                                    6                                     
049037,000236: 
049038,000237: 23,3270           66374                           AXT,2    SSP                                   
049039,000238: 23,3271           00006                                    6                                     
049040,000239: 23,3272           00052                                    S2                                    
049041,000240: 23,3273           00002                                    2                                     
049042,000241: 
049043,000242: 23,3274           76720        AXISGEN2           XCHX,1   VLOAD*                                
049044,000243: 23,3275           00036                                    30D                                   #  X1=-6 X2=+6   X1=-6 X2=+4     X1=-6 X2=+2
049045,000244: 23,3276           00001                                    0,1                                   
049046,000245: 
049047,000246: 23,3277           62757                           VXSC*    PDVL*                                 #  J=(UA)(UB1)   J=(UA)(UB2)     J=(UA)(UB3)
049048,000247: 23,3300           75062                                    STARAD     +6,2                       
049049,000248: 23,3301           00007                                    6,1                                   
049050,000249: 23,3302           77757                           VXSC*                                          
049051,000250: 23,3303           75054                                    STARAD     +12D,2                     
049052,000251: 23,3304           30031                           STOVL*   24D                                   #  K=(VA)(VB1)   J=(VA)(VB2)     J=(VA)(VB3)
049053,000252: 23,3305           00015                                    12D,1                                 
049054,000253: 
049055,000254: 23,3306           53357                           VXSC*    VAD                                   
049056,000255: 23,3307           75046                                    STARAD     +18D,2                     #  L=(WA)(WB1)   J=(WA)(WB2)     J=(WA)(WB3)
049057,000256: 23,3310           76455                           VAD      VSL1                                  
049058,000257: 23,3311           00031                                    24D                                   
049059,000258: 23,3312           53520                           XCHX,1   UNIT                                  
049060,000259: 23,3313           00036                                    30D                                   
049061,000260: 23,3314           06707                           STORE    XDC        +18D,1                     #  XDC = L+J+K   YDC = L+J+K     ZDC = L+J+K
049062,000261: 
049063,000262: 23,3315           77700                           TIX,1                                          
049064,000263: 23,3316           47317                                    AXISGEN3                              
049065,000264: 
049066,000265: 23,3317           77704        AXISGEN3           TIX,2                                          
049067,000266: 23,3320           47274                                    AXISGEN2                              
049068,000267: 
049069,000268: 23,3321           77775                           VLOAD                                          
049070,000269: 23,3322           02665                                    XDC                                   
049071,000270: 23,3323           26707                           STOVL    STARAD                                
049072,000271: 23,3324           02673                                    YDC                                   
049073,000272: 23,3325           26715                           STOVL    STARAD     +6                         
049074,000273: 23,3326           02701                                    ZDC                                   
049075,000274: 23,3327           02723                           STORE    STARAD     +12D                       
049076,000275: 
049077,000276: 23,3330           77616                           RVQ                                            
049078,000277: 
049079,000278: 23,3331           05520 26075  QTSN45             2DEC     .1768                                 
049080,000279: 
049081,000280: 23,3333           05252 25253  .166...            2DEC     .1666666667                            
049082,000281: 

Empty page

049084,000283: 

End of include-file INFLIGHT_ALIGNMENT_ROUTINES.agc.  Parent file is MAIN.agc