Source Code

These source-code files are part of a reconstructed copy of Luminary 98, a development version of the Apollo 11 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with source code of Luminary 99 revision 1 previously transcribed from a digitized copy of that program. The code was then updated by undoing changes described in original Luminary memo 85, using asterisks indicating changed lines in the listing as a guide. While no listing of this version is known to exist, nor are the memory-bank checksums available, the reconstruction is believed to be correct because it was an an intermediate step in reconstructing Luminary 97 whose reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152G. Note that page numbers in the reconstructed code match those on the Luminary 099 revision 001 printout, although the added code would likely have changed page numbers for a real Luminary 98 listing.

Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository.

052257,000002:                                                                                                  ## Copyright:   Public domain.
052258,000003:                                                                                                  ## Filename:    INFLIGHT_ALIGNMENT_ROUTINES.agc
052259,000004:                                                                                                  ## Purpose:     A section of Luminary revision 98.
052260,000005:                                                                                                  ##              It is part of the reconstructed source code for the a
052261,000006:                                                                                                  ##              development version of the flight software for the Lunar 
052262,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 11.
052263,000008:                                                                                                  ##              The code has been recreated from a copy of Luminary 99
052264,000009:                                                                                                  ##              revision 001, using asterisks indicating changed lines in
052265,000010:                                                                                                  ##              the listing and Luminary Memo #85, which lists changes between
052266,000011:                                                                                                  ##              Luminary 98 and 99.
052267,000012:                                                                                                  ## Reference:   pp. 1249-1258
052268,000013:                                                                                                  ## Assembler:   yaYUL
052269,000014:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
052270,000015:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
052271,000016:                                                                                                  ## Mod history: 2019-07-28 MAS  Created from Luminary 99.
052272,000017: 

Page 1249

052274,000019: 22,3773                                           BANK     22                                    
052275,000020: 23,2000                                           SETLOC   INFLIGHT                              
052276,000021: 23,2000                                           BANK                                           
052277,000022: 
052278,000023: 23,3247  E5,1642                                  EBANK=   XSM                                   
052279,000024: 
052280,000025:                                                                                                  #  CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
052281,000026: 
052282,000027:                                                                                                  #  THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES.  THE THREE
052283,000028:                                                                                                  #  HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
052284,000029: 
052285,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,
052286,000031:                                                                                                  #  MGC, AND OGC RESPECTIVELY.
052287,000032: 
052288,000033: 23,3247                                           COUNT*   $$/INFLT                              
052289,000034: 23,3247           71220        CALCGTA            ITA      DLOAD                                 #  PUSHDOWN 00-03, 16D-27D, 34D-37D
052290,000035: 23,3250           00051                                    S2                                    #  XDC = (XD1 XD2 XD3)
052291,000036: 23,3251           02665                                    XDC                                   #  YDC = (YD1 YD2 YD3)
052292,000037: 23,3252           65325                           PDDL     PDDL                                  #  ZDC = (ZD1 ZD2 ZD3)
052293,000038: 23,3253           06522                                    HI6ZEROS                              
052294,000039: 23,3254           02671                                    XDC        +4                         
052295,000040: 23,3255           55476                           DCOMP    VDEF                                  
052296,000041: 23,3256           77656                           UNIT                                           
052297,000042: 23,3257           14027                           STODL    ZPRIME                                #  ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
052298,000043: 23,3260           00027                                    ZPRIME                                
052299,000044: 
052300,000045: 23,3261           77742                           SR1                                            
052301,000046: 23,3262           14023                           STODL    SINTH                                 #  SIN(IGC) = ZP1
052302,000047: 23,3263           00033                                    ZPRIME     +4                         
052303,000048: 23,3264           77742                           SR1                                            
052304,000049: 23,3265           34021                           STCALL   COSTH                                 #  COS(IGC) = ZP3
052305,000050: 23,3266           47320                                    ARCTRIG                               
052306,000051: 
052307,000052: 23,3267           16742                           STODL    IGC                                   #  Y GYRO TORQUING ANGLE   FRACTION OF REV.
052308,000053: 23,3270           02667                                    XDC        +2                         
052309,000054: 23,3271           77742                           SR1                                            
052310,000055: 23,3272           14023                           STODL    SINTH                                 #  SIN(MGC) = XD2
052311,000056: 23,3273           00027                                    ZPRIME                                
052312,000057: 
052313,000058: 23,3274           65205                           DMP      PDDL                                  
052314,000059: 23,3275           02671                                    XDC        +4                         #  PD00 = (ZP1)(XD3)
052315,000060: 23,3276           00033                                    ZPRIME     +4                         
052316,000061: 
052317,000062: 23,3277           45205                           DMP      DSU                                   
052318,000063: 23,3300           02665                                    XDC                                   #  MPAC = (ZP3)(XD1)
052319,000064: 23,3301           77626                           STADR                                          
052320,000065: 23,3302           43756                           STCALL   COSTH                                 #  COS(MGC) = MPAC - PD00
052321,000066: 23,3303           47320                                    ARCTRIG                               

Page 1250

052323,000068: 23,3304           26744                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.
052324,000069: 23,3305           00027                                    ZPRIME                                
052325,000070: 23,3306           77641                           DOT                                            
052326,000071: 23,3307           02701                                    ZDC                                   
052327,000072: 23,3310           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
052328,000073: 23,3311           00027                                    ZPRIME                                
052329,000074: 23,3312           77641                           DOT                                            
052330,000075: 23,3313           02673                                    YDC                                   
052331,000076: 23,3314           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
052332,000077: 23,3315           47320                                    ARCTRIG                               
052333,000078: 
052334,000079: 23,3316           36740                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
052335,000080: 23,3317           00051                                    S2                                    
052336,000081: 

Page 1251

052338,000083:                                                                                                  #  ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
052339,000084: 
052340,000085:                                                                                                  #  THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
052341,000086: 
052342,000087:                                                                                                  #  THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA.  THE OUTPUT IS ALSO
052343,000088:                                                                                                  #  AVAILABLE AT MPAC.
052344,000089: 
052345,000090: 23,3320           51545        ARCTRIG            DLOAD    ABS                                   #  PUSHDOWN  16D-21D
052346,000091: 23,3321           00023                                    SINTH                                 
052347,000092: 23,3322           50025                           DSU      BMN                                   
052348,000093: 23,3323           07534                                    QTSN45                                #  ABS(SIN/4) - SIN(45)/4
052349,000094: 23,3324           47333                                    TRIG1                                 #  IF (-45,45) OR (135,-135)
052350,000095: 
052351,000096: 23,3325           72545                           DLOAD    SL1                                   #  (45,135) OR (-135,-45)
052352,000097: 23,3326           00021                                    COSTH                                 
052353,000098: 23,3327           75326                           ACOS     SIGN                                  
052354,000099: 23,3330           00023                                    SINTH                                 
052355,000100: 23,3331           00025                           STORE    THETA                                 #  X = ARCCOS(COS) WITH SIGN(SIN)
052356,000101: 23,3332           77616                           RVQ                                            
052357,000102: 
052358,000103: 23,3333           72545        TRIG1              DLOAD    SL1                                   #  (-45,45) OR (135,-135)
052359,000104: 23,3334           00023                                    SINTH                                 
052360,000105: 23,3335           77736                           ASIN                                           
052361,000106: 23,3336           14025                           STODL    THETA                                 #  X = ARCSIN(SIN) WITH SIGN(SIN)
052362,000107: 23,3337           00021                                    COSTH                                 
052363,000108: 23,3340           77640                           BMN                                            
052364,000109: 23,3341           47344                                    TRIG2                                 #  IF (135,-135)
052365,000110: 
052366,000111: 23,3342           43545                           DLOAD    RVQ                                   
052367,000112: 23,3343           00025                                    THETA                                 #  X = ARCSIN(SIN)   (-45,45)
052368,000113: 
052369,000114: 23,3344           75345        TRIG2              DLOAD    SIGN                                  #  (135,-135)
052370,000115: 23,3345           06520                                    HIDPHALF                              
052371,000116: 23,3346           00023                                    SINTH                                 
052372,000117: 23,3347           77625                           DSU                                            
052373,000118: 23,3350           00025                                    THETA                                 
052374,000119: 23,3351           00025                           STORE    THETA                                 #  X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
052375,000120: 23,3352           77616                           RVQ                                            #        (+) - (+) OR (-) - (-)
052376,000121: 

Page 1252

052378,000123:                                                                                                  #  SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
052379,000124:                                                                                                  #  COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
052380,000125:                                                                                                  #  FLIGHT SUBROUTINES.
052381,000126: 

Page 1253

052383,000128:                                                                                                  #  CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
052384,000129: 
052385,000130:                                                                                                  #  THE INPUTS ARE  1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM.  THE THREE HALF-UNIT
052386,000131:                                                                                                  #  VECTORS ARE STORED AT XNB, YNB, AND ZNB.  2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
052387,000132:                                                                                                  #  COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
052388,000133: 
052389,000134:                                                                                                  #  THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
052390,000135: 
052391,000136: 23,3353           77601        CALCGA             SETPD                                          #  PUSHDOWN 00-05, 16D-21D, 34D-37D
052392,000137: 23,3354           00001                                    0                                     
052393,000138: 23,3355           47375                           VLOAD    VXV                                   
052394,000139: 23,3356           02665                                    XNB                                   #  XNB = OGA (OUTER GIMBAL AXIS)
052395,000140: 23,3357           02651                                    YSM                                   #  YSM = IGA (INNER GIMBAL AXIS)
052396,000141: 23,3360           41456                           UNIT     PUSH                                  #  PD0 = UNIT(OGA X IGA) = MGA
052397,000142: 
052398,000143: 23,3361           44041                           DOT      ITA                                   
052399,000144: 23,3362           02701                                    ZNB                                   
052400,000145: 23,3363           00051                                    S2                                    
052401,000146: 23,3364           24021                           STOVL    COSTH                                 #  COS(OG) = MGA . ZNB
052402,000147: 23,3365           00001                                    0                                     
052403,000148: 23,3366           77641                           DOT                                            
052404,000149: 23,3367           02673                                    YNB                                   
052405,000150: 23,3370           34023                           STCALL   SINTH                                 #  SIN(OG) = MGA . YNB
052406,000151: 23,3371           47320                                    ARCTRIG                               
052407,000152: 23,3372           26740                           STOVL    OGC                                   
052408,000153: 23,3373           00001                                    0                                     
052409,000154: 
052410,000155: 23,3374           50235                           VXV      DOT                                   #  PROVISION FOR MG ANGLE OF 90 DEGREES
052411,000156: 23,3375           02665                                    XNB                                   
052412,000157: 23,3376           02651                                    YSM                                   
052413,000158: 23,3377           77752                           SL1                                            
052414,000159: 23,3400           24021                           STOVL    COSTH                                 #  COS(MG) = IGA . (MGA X OGA)
052415,000160: 23,3401           02651                                    YSM                                   
052416,000161: 23,3402           77641                           DOT                                            
052417,000162: 23,3403           02665                                    XNB                                   
052418,000163: 23,3404           34023                           STCALL   SINTH                                 #  SIN(MG) = IGA . OGA
052419,000164: 23,3405           47320                                    ARCTRIG                               
052420,000165: 23,3406           02744                           STORE    MGC                                   
052421,000166: 
052422,000167: 23,3407           45246                           ABS      DSU                                   
052423,000168: 23,3410           07536                                    .166...                               
052424,000169: 23,3411           77644                           BPL                                            
052425,000170: 23,3412           47431                                    GIMLOCK1                              #  IF ANGLE GREATER THAN 60 DEGREES
052426,000171: 
052427,000172: 23,3413           50375        CALCGA1            VLOAD    DOT                                   
052428,000173: 23,3414           02657                                    ZSM                                   
052429,000174: 23,3415           00001                                    0                                     
052430,000175: 23,3416           24021                           STOVL    COSTH                                 #  COS(IG) = ZSM . MGA
052431,000176: 23,3417           02643                                    XSM                                   

Page 1254

052433,000178: 23,3420           45441                           DOT      STADR                                 
052434,000179: 23,3421           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
052435,000180: 23,3422           47320                                    ARCTRIG                               
052436,000181: 
052437,000182: 23,3423           26742                           STOVL    IGC                                   
052438,000183: 23,3424           02740                                    OGC                                   
052439,000184: 23,3425           77634                           RTB                                            
052440,000185: 23,3426           21620                                    V1STO2S                               
052441,000186: 23,3427           34322                           STCALL   THETAD                                
052442,000187: 23,3430           00051                                    S2                                    
052443,000188: 
052444,000189: 23,3431           77776        GIMLOCK1           EXIT                                           
052445,000190: 23,3432           05567                           TC       ALARM                                 
052446,000191: 23,3433           00401                           OCT      00401                                 
052447,000192: 23,3434           05504                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
052448,000193: 23,3435           00056                           ADRES    GLOKFAIL                              
052449,000194: 
052450,000195: 23,3436           06037                           TC       INTPRET                               
052451,000196: 23,3437           77650                           GOTO                                           
052452,000197: 23,3440           47413                                    CALCGA1                               
052453,000198: 

Page 1255

052455,000200:                                                                                                  #  AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
052456,000201: 
052457,000202:                                                                                                  #  THE INPUTS ARE  1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD.  2) THE STAR2 VECTOR
052458,000203:                                                                                                  #  REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6.  3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
052459,000204:                                                                                                  #  AT LOCATION 6 OF THE VAC AREA.  4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
052460,000205:                                                                                                  #  THE VAC AREA.
052461,000206: 
052462,000207:                                                                                                  #  THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B.  THE THREE HALF-UNIT VECTORS ARE STORED
052463,000208:                                                                                                  #  AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
052464,000209: 
052465,000210: 23,3441           66370        AXISGEN            AXT,1    SSP                                   #  PUSHDOWN 00-30D, 34D-37D
052466,000211: 23,3442           02714                                    STARAD     +6                         
052467,000212: 23,3443           00051                                    S1                                    
052468,000213: 23,3444           02700                                    STARAD     -6                         
052469,000214: 
052470,000215: 23,3445           77601                           SETPD                                          
052471,000216: 23,3446           00001                                    0                                     
052472,000217: 23,3447           46773        AXISGEN1           VLOAD*   VXV*                                  #  06D   UA = S1
052473,000218: 23,3450           02723                                    STARAD     +12D,1                     #        STARAD +00D     UB = S1
052474,000219: 23,3451           02731                                    STARAD     +18D,1                     
052475,000220: 23,3452           77656                           UNIT                                           #  12D   VA = UNIT(S1 X S2)
052476,000221: 23,3453           06731                           STORE    STARAD     +18D,1                     #        STARAD +06D     VB = UNIT(S1 X S2)
052477,000222: 23,3454           77773                           VLOAD*                                         
052478,000223: 23,3455           02723                                    STARAD     +12D,1                     
052479,000224: 
052480,000225: 23,3456           76433                           VXV*     VSL1                                  
052481,000226: 23,3457           02731                                    STARAD     +18D,1                     #  18D   WA = UA X VA
052482,000227: 23,3460           06737                           STORE    STARAD     +24D,1                     #        STARAD +12D     WB = UB X VB
052483,000228: 
052484,000229: 23,3461           77700                           TIX,1                                          
052485,000230: 23,3462           47447                                    AXISGEN1                              
052486,000231: 
052487,000232: 23,3463           66160                           AXC,1    SXA,1                                 
052488,000233: 23,3464           00006                                    6                                     
052489,000234: 23,3465           00036                                    30D                                   
052490,000235: 
052491,000236: 23,3466           66370                           AXT,1    SSP                                   
052492,000237: 23,3467           00022                                    18D                                   
052493,000238: 23,3470           00051                                    S1                                    
052494,000239: 23,3471           00006                                    6                                     
052495,000240: 
052496,000241: 23,3472           66374                           AXT,2    SSP                                   
052497,000242: 23,3473           00006                                    6                                     
052498,000243: 23,3474           00052                                    S2                                    
052499,000244: 23,3475           00002                                    2                                     
052500,000245: 
052501,000246: 23,3476           76720        AXISGEN2           XCHX,1   VLOAD*                                
052502,000247: 23,3477           00036                                    30D                                   #  X1=-6 X2=+6   X1=-6 X2=+4     X1=-6 X2=+2
052503,000248: 23,3500           00001                                    0,1                                   
052504,000249: 

Page 1256

052506,000251: 23,3501           62757                           VXSC*    PDVL*                                 #  J=(UA)(UB1)   J=(UA)(UB2)     J=(UA)(UB3)
052507,000252: 23,3502           75062                                    STARAD     +6,2                       
052508,000253: 23,3503           00007                                    6,1                                   
052509,000254: 23,3504           77757                           VXSC*                                          
052510,000255: 23,3505           75054                                    STARAD     +12D,2                     
052511,000256: 23,3506           30031                           STOVL*   24D                                   #  K=(VA)(VB1)   J=(VA)(VB2)     J=(VA)(VB3)
052512,000257: 23,3507           00015                                    12D,1                                 
052513,000258: 
052514,000259: 23,3510           53357                           VXSC*    VAD                                   
052515,000260: 23,3511           75046                                    STARAD     +18D,2                     #  L=(WA)(WB1)   J=(WA)(WB2)     J=(WA)(WB3)
052516,000261: 23,3512           76455                           VAD      VSL1                                  
052517,000262: 23,3513           00031                                    24D                                   
052518,000263: 23,3514           53520                           XCHX,1   UNIT                                  
052519,000264: 23,3515           00036                                    30D                                   
052520,000265: 23,3516           06707                           STORE    XDC        +18D,1                     #  XDC = L+J+K   YDC = L+J+K     ZDC = L+J+K
052521,000266: 
052522,000267: 23,3517           77700                           TIX,1                                          
052523,000268: 23,3520           47521                                    AXISGEN3                              
052524,000269: 
052525,000270: 23,3521           77704        AXISGEN3           TIX,2                                          
052526,000271: 23,3522           47476                                    AXISGEN2                              
052527,000272: 
052528,000273: 23,3523           77775                           VLOAD                                          
052529,000274: 23,3524           02665                                    XDC                                   
052530,000275: 23,3525           26707                           STOVL    STARAD                                
052531,000276: 23,3526           02673                                    YDC                                   
052532,000277: 23,3527           26715                           STOVL    STARAD     +6                         
052533,000278: 23,3530           02701                                    ZDC                                   
052534,000279: 23,3531           02723                           STORE    STARAD     +12D                       
052535,000280: 
052536,000281: 23,3532           77616                           RVQ                                            
052537,000282: 

Page 1257

052539,000284: 23,3533           05520 26075  QTSN45             2DEC     .1768                                 
052540,000285: 
052541,000286: 23,3535           05252 25253  .166...            2DEC     .1666666667                            
052542,000287: 

Page 1258 Empty page

052545,000290: 

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