Source Code

This is a reconstructed version of Luminary 130, the initial AGC program released in November 1969 for the Apollo 13 LM. Three more releases followed before the flown revision was finally manufactured in February 1970.

This reconstruction was created from a previous transcription of the original listing of Luminary 131, combined with Luminary memo #129 which describes the small difference between the Luminary 130 and 131. The reconstructed source code was verified by matching memory-bank checksums to those listed for Luminary 130 in drawing 2021152G.

In this source code, program comments from the original (Luminary 131) code are prefixed with '#', while those added later by the Virtual AGC project are prefixed with '##'.

052583,000002:                                                                                                  ## Copyright:   Public domain.
052584,000003:                                                                                                  ## Filename:    INFLIGHT_ALIGNMENT_ROUTINES.agc
052585,000004:                                                                                                  ## Purpose:     A section of the reconstructed source code for Luminary 130.
052586,000005:                                                                                                  ##              This was the original program released for the Apollo 13 LM,
052587,000006:                                                                                                  ##              although several more revisions would follow. It has been
052588,000007:                                                                                                  ##              reconstructed from a listing of Luminary 131, from which it
052589,000008:                                                                                                  ##              differs on only two lines in P70-P71. The difference is
052590,000009:                                                                                                  ##              described in detail in Luminary memo #129, which was used
052591,000010:                                                                                                  ##              to perform the reconstruction. This file is intended to be a
052592,000011:                                                                                                  ##              faithful reconstruction, except that the code format has been
052593,000012:                                                                                                  ##              changed to conform to the requirements of the yaYUL assembler
052594,000013:                                                                                                  ##              rather than the original YUL assembler.
052595,000014:                                                                                                  ## Reference:   pp. 1241-1250
052596,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
052597,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
052598,000017:                                                                                                  ## Mod history: 06/03/03 RSB.   Began transcribing.
052599,000018:                                                                                                  ##              05/14/05 RSB.   Corrected website reference above.
052600,000019:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
052601,000020:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
052602,000021:                                                                                                  ##                              numbers in 1701.pdf.
052603,000022:                                                                                                  ##              2017-02-27 RSB  Proofed comment text using octopus/ProoferComments.
052604,000023:                                                                                                  ##              2017-03-17 RSB  Comment-text fixes identified in diff'ing
052605,000024:                                                                                                  ##                              Luminary 99 vs Comanche 55.
052606,000025:                                                                                                  ##              2018-09-04 MAS  Copied from Luminary 131 for Luminary 130.
052607,000026: 

Page 1241

052609,000028: 22,3773                                           BANK     22                                    
052610,000029: 23,2000                                           SETLOC   INFLIGHT                              
052611,000030: 23,2000                                           BANK                                           
052612,000031: 
052613,000032: 23,3251  E5,1642                                  EBANK=   XSM                                   
052614,000033: 
052615,000034:                                                                                                  #  CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
052616,000035: 
052617,000036:                                                                                                  #  THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES.  THE THREE
052618,000037:                                                                                                  #  HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
052619,000038: 
052620,000039:                                                                                                  #  THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
052621,000040:                                                                                                  #  MGC, AND OGC RESPECTIVELY.
052622,000041: 
052623,000042: 23,3251                                           COUNT*   $$/INFLT                              
052624,000043: 23,3251           71220        CALCGTA            ITA      DLOAD                                 #  PUSHDOWN 00-03, 16D-27D, 34D-37D
052625,000044: 23,3252           00051                                    S2                                    #  XDC = (XD1 XD2 XD3)
052626,000045: 23,3253           02665                                    XDC                                   #  YDC = (YD1 YD2 YD3)
052627,000046: 23,3254           65325                           PDDL     PDDL                                  #  ZDC = (ZD1 ZD2 ZD3)
052628,000047: 23,3255           06524                                    HI6ZEROS                              
052629,000048: 23,3256           02671                                    XDC        +4                         
052630,000049: 23,3257           55476                           DCOMP    VDEF                                  
052631,000050: 23,3260           77656                           UNIT                                           
052632,000051: 23,3261           14027                           STODL    ZPRIME                                #  ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
052633,000052: 23,3262           00027                                    ZPRIME                                
052634,000053: 
052635,000054: 23,3263           77742                           SR1                                            
052636,000055: 23,3264           14023                           STODL    SINTH                                 #  SIN(IGC) = ZP1
052637,000056: 23,3265           00033                                    ZPRIME     +4                         
052638,000057: 23,3266           77742                           SR1                                            
052639,000058: 23,3267           34021                           STCALL   COSTH                                 #  COS(IGC) = ZP3
052640,000059: 23,3270           47322                                    ARCTRIG                               
052641,000060: 
052642,000061: 23,3271           16742                           STODL    IGC                                   #  Y GYRO TORQUING ANGLE   FRACTION OF REV.
052643,000062: 23,3272           02667                                    XDC        +2                         
052644,000063: 23,3273           77742                           SR1                                            
052645,000064: 23,3274           14023                           STODL    SINTH                                 #  SIN(MGC) = XD2
052646,000065: 23,3275           00027                                    ZPRIME                                
052647,000066: 
052648,000067: 23,3276           65205                           DMP      PDDL                                  
052649,000068: 23,3277           02671                                    XDC        +4                         #  PD00 = (ZP1)(XD3)
052650,000069: 23,3300           00033                                    ZPRIME     +4                         
052651,000070: 
052652,000071: 23,3301           45205                           DMP      DSU                                   
052653,000072: 23,3302           02665                                    XDC                                   #  MPAC = (ZP3)(XD1)
052654,000073: 23,3303           77626                           STADR                                          
052655,000074: 23,3304           43756                           STCALL   COSTH                                 #  COS(MGC) = MPAC - PD00
052656,000075: 23,3305           47322                                    ARCTRIG                               

Page 1242

052658,000077: 23,3306           26744                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.
052659,000078: 23,3307           00027                                    ZPRIME                                
052660,000079: 23,3310           77641                           DOT                                            
052661,000080: 23,3311           02701                                    ZDC                                   
052662,000081: 23,3312           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
052663,000082: 23,3313           00027                                    ZPRIME                                
052664,000083: 23,3314           77641                           DOT                                            
052665,000084: 23,3315           02673                                    YDC                                   
052666,000085: 23,3316           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
052667,000086: 23,3317           47322                                    ARCTRIG                               
052668,000087: 
052669,000088: 23,3320           36740                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
052670,000089: 23,3321           00051                                    S2                                    
052671,000090: 

Page 1243

052673,000092:                                                                                                  #  ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
052674,000093: 
052675,000094:                                                                                                  #  THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
052676,000095: 
052677,000096:                                                                                                  #  THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA.  THE OUTPUT IS ALSO
052678,000097:                                                                                                  #  AVAILABLE AT MPAC.
052679,000098: 
052680,000099: 23,3322           51545        ARCTRIG            DLOAD    ABS                                   #  PUSHDOWN  16D-21D
052681,000100: 23,3323           00023                                    SINTH                                 
052682,000101: 23,3324           50025                           DSU      BMN                                   
052683,000102: 23,3325           07536                                    QTSN45                                #  ABS(SIN/4) - SIN(45)/4
052684,000103: 23,3326           47335                                    TRIG1                                 #  IF (-45,45) OR (135,-135)
052685,000104: 
052686,000105: 23,3327           72545                           DLOAD    SL1                                   #  (45,135) OR (-135,-45)
052687,000106: 23,3330           00021                                    COSTH                                 
052688,000107: 23,3331           75326                           ACOS     SIGN                                  
052689,000108: 23,3332           00023                                    SINTH                                 
052690,000109: 23,3333           00025                           STORE    THETA                                 #  X = ARCCOS(COS) WITH SIGN(SIN)
052691,000110: 23,3334           77616                           RVQ                                            
052692,000111: 
052693,000112: 23,3335           72545        TRIG1              DLOAD    SL1                                   #  (-45,45) OR (135,-135)
052694,000113: 23,3336           00023                                    SINTH                                 
052695,000114: 23,3337           77736                           ASIN                                           
052696,000115: 23,3340           14025                           STODL    THETA                                 #  X = ARCSIN(SIN) WITH SIGN(SIN)
052697,000116: 23,3341           00021                                    COSTH                                 
052698,000117: 23,3342           77640                           BMN                                            
052699,000118: 23,3343           47346                                    TRIG2                                 #  IF (135,-135)
052700,000119: 
052701,000120: 23,3344           43545                           DLOAD    RVQ                                   
052702,000121: 23,3345           00025                                    THETA                                 #  X = ARCSIN(SIN)   (-45,45)
052703,000122: 
052704,000123: 23,3346           75345        TRIG2              DLOAD    SIGN                                  #  (135,-135)
052705,000124: 23,3347           06522                                    HIDPHALF                              
052706,000125: 23,3350           00023                                    SINTH                                 
052707,000126: 23,3351           77625                           DSU                                            
052708,000127: 23,3352           00025                                    THETA                                 
052709,000128: 23,3353           00025                           STORE    THETA                                 #  X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
052710,000129: 23,3354           77616                           RVQ                                            #        (+) - (+) OR (-) - (-)
052711,000130: 

Page 1244

052713,000132:                                                                                                  #  SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
052714,000133:                                                                                                  #  COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
052715,000134:                                                                                                  #  FLIGHT SUBROUTINES.
052716,000135: 

Page 1245

052718,000137:                                                                                                  #  CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
052719,000138: 
052720,000139:                                                                                                  #  THE INPUTS ARE  1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM.  THE THREE HALF-UNIT
052721,000140:                                                                                                  #  VECTORS ARE STORED AT XNB, YNB, AND ZNB.  2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
052722,000141:                                                                                                  #  COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
052723,000142: 
052724,000143:                                                                                                  #  THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
052725,000144: 
052726,000145: 23,3355           77601        CALCGA             SETPD                                          #  PUSHDOWN 00-05, 16D-21D, 34D-37D
052727,000146: 23,3356           00001                                    0                                     
052728,000147: 23,3357           47375                           VLOAD    VXV                                   
052729,000148: 23,3360           02665                                    XNB                                   #  XNB = OGA (OUTER GIMBAL AXIS)
052730,000149: 23,3361           02651                                    YSM                                   #  YSM = IGA (INNER GIMBAL AXIS)
052731,000150: 23,3362           41456                           UNIT     PUSH                                  #  PD0 = UNIT(OGA X IGA) = MGA
052732,000151: 
052733,000152: 23,3363           44041                           DOT      ITA                                   
052734,000153: 23,3364           02701                                    ZNB                                   
052735,000154: 23,3365           00051                                    S2                                    
052736,000155: 23,3366           24021                           STOVL    COSTH                                 #  COS(OG) = MGA . ZNB
052737,000156: 23,3367           00001                                    0                                     
052738,000157: 23,3370           77641                           DOT                                            
052739,000158: 23,3371           02673                                    YNB                                   
052740,000159: 23,3372           34023                           STCALL   SINTH                                 #  SIN(OG) = MGA . YNB
052741,000160: 23,3373           47322                                    ARCTRIG                               
052742,000161: 23,3374           26740                           STOVL    OGC                                   
052743,000162: 23,3375           00001                                    0                                     
052744,000163: 
052745,000164: 23,3376           50235                           VXV      DOT                                   #  PROVISION FOR MG ANGLE OF 90 DEGREES
052746,000165: 23,3377           02665                                    XNB                                   
052747,000166: 23,3400           02651                                    YSM                                   
052748,000167: 23,3401           77752                           SL1                                            
052749,000168: 23,3402           24021                           STOVL    COSTH                                 #  COS(MG) = IGA . (MGA X OGA)
052750,000169: 23,3403           02651                                    YSM                                   
052751,000170: 23,3404           77641                           DOT                                            
052752,000171: 23,3405           02665                                    XNB                                   
052753,000172: 23,3406           34023                           STCALL   SINTH                                 #  SIN(MG) = IGA . OGA
052754,000173: 23,3407           47322                                    ARCTRIG                               
052755,000174: 23,3410           02744                           STORE    MGC                                   
052756,000175: 
052757,000176: 23,3411           45246                           ABS      DSU                                   
052758,000177: 23,3412           07540                                    .166...                               
052759,000178: 23,3413           77644                           BPL                                            
052760,000179: 23,3414           47433                                    GIMLOCK1                              #  IF ANGLE GREATER THAN 60 DEGREES
052761,000180: 
052762,000181: 23,3415           50375        CALCGA1            VLOAD    DOT                                   
052763,000182: 23,3416           02657                                    ZSM                                   
052764,000183: 23,3417           00001                                    0                                     
052765,000184: 23,3420           24021                           STOVL    COSTH                                 #  COS(IG) = ZSM . MGA
052766,000185: 23,3421           02643                                    XSM                                   

Page 1246

052768,000187: 23,3422           45441                           DOT      STADR                                 
052769,000188: 23,3423           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
052770,000189: 23,3424           47322                                    ARCTRIG                               
052771,000190: 
052772,000191: 23,3425           26742                           STOVL    IGC                                   
052773,000192: 23,3426           02740                                    OGC                                   
052774,000193: 23,3427           77634                           RTB                                            
052775,000194: 23,3430           21621                                    V1STO2S                               
052776,000195: 23,3431           34322                           STCALL   THETAD                                
052777,000196: 23,3432           00051                                    S2                                    
052778,000197: 
052779,000198: 23,3433           77776        GIMLOCK1           EXIT                                           
052780,000199: 23,3434           05567                           TC       ALARM                                 
052781,000200: 23,3435           00401                           OCT      00401                                 
052782,000201: 23,3436           05504                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
052783,000202: 23,3437           00056                           ADRES    GLOKFAIL                              
052784,000203: 
052785,000204: 23,3440           06042                           TC       INTPRET                               
052786,000205: 23,3441           77650                           GOTO                                           
052787,000206: 23,3442           47415                                    CALCGA1                               
052788,000207: 

Page 1247

052790,000209:                                                                                                  #  AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
052791,000210: 
052792,000211:                                                                                                  #  THE INPUTS ARE  1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD.  2) THE STAR2 VECTOR
052793,000212:                                                                                                  #  REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6.  3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
052794,000213:                                                                                                  #  AT LOCATION 6 OF THE VAC AREA.  4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
052795,000214:                                                                                                  #  THE VAC AREA.
052796,000215: 
052797,000216:                                                                                                  #  THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B.  THE THREE HALF-UNIT VECTORS ARE STORED
052798,000217:                                                                                                  #  AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
052799,000218: 
052800,000219: 23,3443           66370        AXISGEN            AXT,1    SSP                                   #  PUSHDOWN 00-30D, 34D-37D
052801,000220: 23,3444           02714                                    STARAD     +6                         
052802,000221: 23,3445           00051                                    S1                                    
052803,000222: 23,3446           02700                                    STARAD     -6                         
052804,000223: 
052805,000224: 23,3447           77601                           SETPD                                          
052806,000225: 23,3450           00001                                    0                                     
052807,000226: 23,3451           46773        AXISGEN1           VLOAD*   VXV*                                  #  06D   UA = S1
052808,000227: 23,3452           02723                                    STARAD     +12D,1                     #        STARAD +00D     UB = S1
052809,000228: 23,3453           02731                                    STARAD     +18D,1                     
052810,000229: 23,3454           77656                           UNIT                                           #  12D   VA = UNIT(S1 X S2)
052811,000230: 23,3455           06731                           STORE    STARAD     +18D,1                     #        STARAD +06D     VB = UNIT(S1 X S2)
052812,000231: 23,3456           77773                           VLOAD*                                         
052813,000232: 23,3457           02723                                    STARAD     +12D,1                     
052814,000233: 
052815,000234: 23,3460           76433                           VXV*     VSL1                                  
052816,000235: 23,3461           02731                                    STARAD     +18D,1                     #  18D   WA = UA X VA
052817,000236: 23,3462           06737                           STORE    STARAD     +24D,1                     #        STARAD +12D     WB = UB X VB
052818,000237: 
052819,000238: 23,3463           77700                           TIX,1                                          
052820,000239: 23,3464           47451                                    AXISGEN1                              
052821,000240: 
052822,000241: 23,3465           66160                           AXC,1    SXA,1                                 
052823,000242: 23,3466           00006                                    6                                     
052824,000243: 23,3467           00036                                    30D                                   
052825,000244: 
052826,000245: 23,3470           66370                           AXT,1    SSP                                   
052827,000246: 23,3471           00022                                    18D                                   
052828,000247: 23,3472           00051                                    S1                                    
052829,000248: 23,3473           00006                                    6                                     
052830,000249: 
052831,000250: 23,3474           66374                           AXT,2    SSP                                   
052832,000251: 23,3475           00006                                    6                                     
052833,000252: 23,3476           00052                                    S2                                    
052834,000253: 23,3477           00002                                    2                                     
052835,000254: 
052836,000255: 23,3500           76720        AXISGEN2           XCHX,1   VLOAD*                                
052837,000256: 23,3501           00036                                    30D                                   #  X1=-6 X2=+6   X1=-6 X2=+4     X1=-6 X2=+2
052838,000257: 23,3502           00001                                    0,1                                   
052839,000258: 

Page 1248

052841,000260: 23,3503           62757                           VXSC*    PDVL*                                 #  J=(UA)(UB1)   J=(UA)(UB2)     J=(UA)(UB3)
052842,000261: 23,3504           75062                                    STARAD     +6,2                       
052843,000262: 23,3505           00007                                    6,1                                   
052844,000263: 23,3506           77757                           VXSC*                                          
052845,000264: 23,3507           75054                                    STARAD     +12D,2                     
052846,000265: 23,3510           30031                           STOVL*   24D                                   #  K=(VA)(VB1)   J=(VA)(VB2)     J=(VA)(VB3)
052847,000266: 23,3511           00015                                    12D,1                                 
052848,000267: 
052849,000268: 23,3512           53357                           VXSC*    VAD                                   
052850,000269: 23,3513           75046                                    STARAD     +18D,2                     #  L=(WA)(WB1)   J=(WA)(WB2)     J=(WA)(WB3)
052851,000270: 23,3514           76455                           VAD      VSL1                                  
052852,000271: 23,3515           00031                                    24D                                   
052853,000272: 23,3516           53520                           XCHX,1   UNIT                                  
052854,000273: 23,3517           00036                                    30D                                   
052855,000274: 23,3520           06707                           STORE    XDC        +18D,1                     #  XDC = L+J+K   YDC = L+J+K     ZDC = L+J+K
052856,000275: 
052857,000276: 23,3521           77700                           TIX,1                                          
052858,000277: 23,3522           47523                                    AXISGEN3                              
052859,000278: 
052860,000279: 23,3523           77704        AXISGEN3           TIX,2                                          
052861,000280: 23,3524           47500                                    AXISGEN2                              
052862,000281: 
052863,000282: 23,3525           77775                           VLOAD                                          
052864,000283: 23,3526           02665                                    XDC                                   
052865,000284: 23,3527           26707                           STOVL    STARAD                                
052866,000285: 23,3530           02673                                    YDC                                   
052867,000286: 23,3531           26715                           STOVL    STARAD     +6                         
052868,000287: 23,3532           02701                                    ZDC                                   
052869,000288: 23,3533           02723                           STORE    STARAD     +12D                       
052870,000289: 
052871,000290: 23,3534           77616                           RVQ                                            
052872,000291: 

Page 1249

052874,000293: 23,3535           05520 26075  QTSN45             2DEC     .1768                                 
052875,000294: 23,3537           05252 25253  .166...            2DEC     .1666666667                            
052876,000295: 

Page 1250 There is no source code on this page of the original assembly listing.


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