Source Code

These source-code files are part of a reconstructed copy of Comanche 72, the first release of the Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 13.

They have been adapted from sources files created from a listing of Comanche 55. These source files were updated to match binary dumps of a set of Comanche 67 rope modules. They were then further modified by applying known changes between Comanche 67 and Comanche 72. A binary dump of module B2 of Comanche 72, part number 2010802-021, was also used to validate changes made to banks 05-13. The resulting code assembles to have identical memory-bank checksums as those specified in NASA drawing 2021153G; this gives reasonably high confidence that the changes that have been made are correct. In places where ambiguity exists, this ambiguity is discussed in "## Reconstruction:" comments.

Since no contemporary listings of Comanche 72 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.

056708,000002:                                                                                                  ## Copyright:   Public domain.
056709,000003:                                                                                                  ## Filename:    INFLIGHT_ALIGNMENT_ROUTINES.agc
056710,000004:                                                                                                  ## Purpose:     A section of Comanche revision 072.
056711,000005:                                                                                                  ##              It is part of the reconstructed source code for the first
056712,000006:                                                                                                  ##              release of the software for the Command Module's (CM) Apollo
056713,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 13. No original listings
056714,000008:                                                                                                  ##              of this program are available; instead, this file was recreated
056715,000009:                                                                                                  ##              from a printout of Comanche 055, binary dumps of a set of
056716,000010:                                                                                                  ##              Comanche 067 rope modules, and changelogs between Comanche 067
056717,000011:                                                                                                  ##              and 072. It has been adapted such that the resulting bugger words
056718,000012:                                                                                                  ##              exactly match those specified for Comanche 072 in NASA drawing
056719,000013:                                                                                                  ##              2021153G, which gives relatively high confidence that the
056720,000014:                                                                                                  ##              reconstruction is correct.
056721,000015:                                                                                                  ## Assembler:   yaYUL
056722,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
056723,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
056724,000018:                                                                                                  ## Mod history: 2024-05-13 MAS  Created from Comanche 067.
056725,000019: 
056726,000020: 22,3510                                           BANK     22                                    
056727,000021: 23,2000                                           SETLOC   INFLIGHT                              
056728,000022: 23,2000                                           BANK                                           
056729,000023: 
056730,000024: 23,3207  E5,1671                                  EBANK=   XSM                                   
056731,000025: 
056732,000026:                                                                                                  #  CALCGTA COMPUTES THE GYRO TORQUE ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
056733,000027: 
056734,000028:                                                                                                  #  THE INPUT IS THE DESIRED STABLE MEMBER COORDINATES REFERRED TO PRESENT STABLE MEMBER COORDINATES.  THE THREE
056735,000029:                                                                                                  #  HALF-UNIT VECTORS ARE STORED AT XDC, YDC, AND ZDC.
056736,000030: 
056737,000031:                                                                                                  #  THE OUTPUTS ARE THE THREE GYRO TORQUING ANGLES TO BE APPLIED TO THE Y, Z, AND X GYROS AND ARE STORED DP AT IGC,
056738,000032:                                                                                                  #  MGC, AND OGC RESPECTIVELY.
056739,000033: 
056740,000034: 23,3207                                           COUNT    23/INFLT                              
056741,000035: 
056742,000036: 23,3207           71220        CALCGTA            ITA      DLOAD                                 #  PUSHDOWN 00-03, 16D-27D, 34D-37D
056743,000037: 23,3210           00051                                    S2                                    #  XDC = (XD1 XD2 XD3)
056744,000038: 23,3211           02714                                    XDC                                   #  YDC = (YD1 YD2 YD3)
056745,000039: 23,3212           65325                           PDDL     PDDL                                  #  ZDC = (ZD1 ZD2 ZD3)
056746,000040: 23,3213           15334                                    HI6ZEROS                              
056747,000041: 23,3214           02720                                    XDC        +4                         
056748,000042: 23,3215           55476                           DCOMP    VDEF                                  
056749,000043: 23,3216           77656                           UNIT                                           
056750,000044: 23,3217           14027                           STODL    ZPRIME                                #  ZP = UNIT(-XD3 0 XD1) = (ZP1 ZP2 ZP3)
056751,000045: 23,3220           00027                                    ZPRIME                                
056752,000046: 
056753,000047: 23,3221           77742                           SR1                                            
056754,000048: 23,3222           14023                           STODL    SINTH                                 #  SIN(IGC) = ZP1
056755,000049: 23,3223           00033                                    ZPRIME     +4                         
056756,000050: 23,3224           77742                           SR1                                            
056757,000051: 23,3225           34021                           STCALL   COSTH                                 #  COS(IGC) = ZP3
056758,000052: 23,3226           47260                                    ARCTRIG                               
056759,000053: 
056760,000054: 23,3227           16762                           STODL    IGC                                   #  Y GYRO TORQUING ANGLE   FRACTION OF REV.
056761,000055: 23,3230           02716                                    XDC        +2                         
056762,000056: 23,3231           77742                           SR1                                            
056763,000057: 23,3232           14023                           STODL    SINTH                                 #  SIN(MGC) = XD2
056764,000058: 23,3233           00027                                    ZPRIME                                
056765,000059: 
056766,000060: 23,3234           65205                           DMP      PDDL                                  
056767,000061: 23,3235           02720                                    XDC        +4                         #  PD00 = (ZP1)(XD3)
056768,000062: 23,3236           00033                                    ZPRIME     +4                         
056769,000063: 
056770,000064: 23,3237           45205                           DMP      DSU                                   
056771,000065: 23,3240           02714                                    XDC                                   #  MPAC = (ZP3)(XD1)
056772,000066: 23,3241           77626                           STADR                                          
056773,000067: 23,3242           43756                           STCALL   COSTH                                 #  COS(MGC) = MPAC - PD00
056774,000068: 23,3243           47260                                    ARCTRIG                               
056775,000069: 23,3244           26764                           STOVL    MGC                                   #  Z GYRO TORQUING ANGLE   FRACTION OF REV.
056776,000070: 23,3245           00027                                    ZPRIME                                
056777,000071: 23,3246           77641                           DOT                                            
056778,000072: 23,3247           02730                                    ZDC                                   
056779,000073: 23,3250           24021                           STOVL    COSTH                                 #  COS(OGC) = ZP . ZDC
056780,000074: 23,3251           00027                                    ZPRIME                                
056781,000075: 23,3252           77641                           DOT                                            
056782,000076: 23,3253           02722                                    YDC                                   
056783,000077: 23,3254           34023                           STCALL   SINTH                                 #  SIN(OGC) = ZP . YDC
056784,000078: 23,3255           47260                                    ARCTRIG                               
056785,000079: 
056786,000080: 23,3256           36760                           STCALL   OGC                                   #  X GYRO TORQUING ANGLE   FRACTION OF REV.
056787,000081: 23,3257           00051                                    S2                                    
056788,000082: 
056789,000083:                                                                                                  #  ARCTRIG COMPUTES AN ANGLE GIVEN THE SINE AND COSINE OF THIS ANGLE.
056790,000084: 
056791,000085:                                                                                                  #  THE INPUTS ARE SIN/4 AND COS/4 STORED DP AT SINTH AND COSTH.
056792,000086: 
056793,000087:                                                                                                  #  THE OUTPUT IS THE CALCULATED ANGLE BETWEEN +.5 AND -.5 REVOLUTIONS AND STORED AT THETA.  THE OUTPUT IS ALSO
056794,000088:                                                                                                  #  AVAILABLE AT MPAC.
056795,000089: 
056796,000090: 23,3260           51545        ARCTRIG            DLOAD    ABS                                   #  PUSHDOWN  16D-21D
056797,000091: 23,3261           00023                                    SINTH                                 
056798,000092: 23,3262           50025                           DSU      BMN                                   
056799,000093: 23,3263           07476                                    QTSN45                                #  ABS(SIN/4) - SIN(45)/4
056800,000094: 23,3264           47273                                    TRIG1                                 #  IF (-45,45) OR (135,-135)
056801,000095: 
056802,000096: 23,3265           72545                           DLOAD    SL1                                   #  (45,135) OR (-135,-45)
056803,000097: 23,3266           00021                                    COSTH                                 
056804,000098: 23,3267           75326                           ACOS     SIGN                                  
056805,000099: 23,3270           00023                                    SINTH                                 
056806,000100: 23,3271           00025                           STORE    THETA                                 #  X = ARCCOS(COS) WITH SIGN(SIN)
056807,000101: 23,3272           77616                           RVQ                                            
056808,000102: 
056809,000103: 23,3273           72545        TRIG1              DLOAD    SL1                                   #  (-45,45) OR (135,-135)
056810,000104: 23,3274           00023                                    SINTH                                 
056811,000105: 23,3275           77736                           ASIN                                           
056812,000106: 23,3276           14025                           STODL    THETA                                 #  X = ARCSIN(SIN) WITH SIGN(SIN)
056813,000107: 23,3277           00021                                    COSTH                                 
056814,000108: 23,3300           77640                           BMN                                            
056815,000109: 23,3301           47304                                    TRIG2                                 #  IF (135,-135)
056816,000110: 
056817,000111: 23,3302           43545                           DLOAD    RVQ                                   
056818,000112: 23,3303           00025                                    THETA                                 #  X = ARCSIN(SIN)   (-45,45)
056819,000113: 
056820,000114: 23,3304           75345        TRIG2              DLOAD    SIGN                                  #  (135,-135)
056821,000115: 23,3305           15332                                    HIDPHALF                              
056822,000116: 23,3306           00023                                    SINTH                                 
056823,000117: 23,3307           77625                           DSU                                            
056824,000118: 23,3310           00025                                    THETA                                 
056825,000119: 23,3311           00025                           STORE    THETA                                 #  X = .5 WITH SIGN(SIN) - ARCSIN(SIN)
056826,000120: 23,3312           77616                           RVQ                                            #        (+) - (+) OR (-) - (-)
056827,000121: 
056828,000122:                                                                                                  #  SMNB, NBSM, AND AXISROT, WHICH USED TO APPEAR HERE, HAVE BEEN
056829,000123:                                                                                                  #  COMBINED IN A ROUTINE CALLED AX*SR*T, WHICH APPEARS AMONG THE POWERED
056830,000124:                                                                                                  #  FLIGHT SUBROUTINES.
056831,000125: 
056832,000126:                                                                                                  #  CALCGA COMPUTES THE CDU DRIVING ANGLES REQUIRED TO BRING THE STABLE MEMBER INTO THE DESIRED ORIENTATION.
056833,000127: 
056834,000128:                                                                                                  #  THE INPUTS ARE  1) THE NAVIGATION BASE COORDINATES REFERRED TO ANY COORDINATE SYSTEM.  THE THREE HALF-UNIT
056835,000129:                                                                                                  #  VECTORS ARE STORED AT XNB, YNB, AND ZNB.  2) THE DESIRED STABLE MEMBER COORDINATES REFERRED TO THE SAME
056836,000130:                                                                                                  #  COORDINATE SYSTEM ARE STORED AT XSM, YSM, AND ZSM.
056837,000131: 
056838,000132:                                                                                                  #  THE OUTPUTS ARE THE THREE CDU DRIVING ANGLES AND ARE STORED SP AT THETAD, THETAD +1, AND THETAD +2.
056839,000133: 
056840,000134: 23,3313           77601        CALCGA             SETPD                                          #  PUSHDOWN 00-05, 16D-21D, 34D-37D
056841,000135: 23,3314           00001                                    0                                     
056842,000136: 23,3315           47375                           VLOAD    VXV                                   
056843,000137: 23,3316           02714                                    XNB                                   #  XNB = OGA (OUTER GIMBAL AXIS)
056844,000138: 23,3317           02700                                    YSM                                   #  YSM = IGA (INNER GIMBAL AXIS)
056845,000139: 23,3320           41456                           UNIT     PUSH                                  #  PD0 = UNIT(OGA X IGA) = MGA
056846,000140: 
056847,000141: 23,3321           44041                           DOT      ITA                                   
056848,000142: 23,3322           02730                                    ZNB                                   
056849,000143: 23,3323           00051                                    S2                                    
056850,000144: 23,3324           24021                           STOVL    COSTH                                 #  COS(OG) = MGA . ZNB
056851,000145: 23,3325           00001                                    0                                     
056852,000146: 23,3326           77641                           DOT                                            
056853,000147: 23,3327           02722                                    YNB                                   
056854,000148: 23,3330           34023                           STCALL   SINTH                                 #  SIN(OG) = MGA . YNB
056855,000149: 23,3331           47260                                    ARCTRIG                               
056856,000150: 23,3332           26760                           STOVL    OGC                                   
056857,000151: 23,3333           00001                                    0                                     
056858,000152: 
056859,000153: 23,3334           50235                           VXV      DOT                                   #  PROVISION FOR MG ANGLE OF 90 DEGREES
056860,000154: 23,3335           02714                                    XNB                                   
056861,000155: 23,3336           02700                                    YSM                                   
056862,000156: 23,3337           77752                           SL1                                            
056863,000157: 23,3340           24021                           STOVL    COSTH                                 #  COS(MG) = IGA . (MGA X OGA)
056864,000158: 23,3341           02700                                    YSM                                   
056865,000159: 23,3342           77641                           DOT                                            
056866,000160: 23,3343           02714                                    XNB                                   
056867,000161: 23,3344           34023                           STCALL   SINTH                                 #  SIN(MG) = IGA . OGA
056868,000162: 23,3345           47260                                    ARCTRIG                               
056869,000163: 23,3346           02764                           STORE    MGC                                   
056870,000164: 
056871,000165: 23,3347           45246                           ABS      DSU                                   
056872,000166: 23,3350           07500                                    .166...                               
056873,000167: 23,3351           77644                           BPL                                            
056874,000168: 23,3352           47373                                    GIMLOCK1                              #  IF ANGLE GREATER THAN 60 DEGREES
056875,000169: 
056876,000170: 23,3353           50375        CALCGA1            VLOAD    DOT                                   
056877,000171: 23,3354           02706                                    ZSM                                   
056878,000172: 23,3355           00001                                    0                                     
056879,000173: 23,3356           24021                           STOVL    COSTH                                 #  COS(IG) = ZSM . MGA
056880,000174: 23,3357           02672                                    XSM                                   
056881,000175: 23,3360           45441                           DOT      STADR                                 
056882,000176: 23,3361           43754                           STCALL   SINTH                                 #  SIN(IG) = XSM . MGA
056883,000177: 23,3362           47260                                    ARCTRIG                               
056884,000178: 
056885,000179: 23,3363           26762                           STOVL    IGC                                   
056886,000180: 23,3364           02760                                    OGC                                   
056887,000181: 23,3365           43034                           RTB      BONCLR                                
056888,000182: 23,3366           45552                                    V1STO2S                               
056889,000183: 23,3367           00200                                    CPHIFLAG                              
056890,000184: 23,3370           00051                                    S2                                    
056891,000185: 23,3371           35156                           STCALL   THETAD                                
056892,000186: 23,3372           00051                                    S2                                    
056893,000187: 
056894,000188: 23,3373           77776        GIMLOCK1           EXIT                                           
056895,000189: 23,3374           05664                           TC       ALARM                                 
056896,000190: 23,3375           00401                           OCT      00401                                 
056897,000191: 23,3376           05562                           TC       UPFLAG                                #  GIMBAL LOCK HAS OCCURED
056898,000192: 23,3377           00056                           ADRES    GLOKFAIL                              
056899,000193: 
056900,000194: 23,3400           06006                           TC       INTPRET                               
056901,000195: 23,3401           77650                           GOTO                                           
056902,000196: 23,3402           47353                                    CALCGA1                               
056903,000197: 
056904,000198:                                                                                                  #  AXISGEN COMPUTES THE COORDINATES OF ONE COORDINATE SYSTEM REFERRED TO ANOTHER COORDINATE SYSTEM.
056905,000199: 
056906,000200:                                                                                                  #  THE INPUTS ARE  1) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM A STORED AT STARAD.  2) THE STAR2 VECTOR
056907,000201:                                                                                                  #  REFERRED TO COORDINATE SYSTEM A STORED AT STARAD +6.  3) THE STAR1 VECTOR REFERRED TO COORDINATE SYSTEM B STORED
056908,000202:                                                                                                  #  AT LOCATION 6 OF THE VAC AREA.  4) THE STAR2 VECTOR REFERRED TO COORDINATE SYSTEM B STORED AT LOCATION 12D OF
056909,000203:                                                                                                  #  THE VAC AREA.
056910,000204: 
056911,000205:                                                                                                  #  THE OUTPUT DEFINES COORDINATE SYSTEM A REFERRED TO COORDINATE SYSTEM B.  THE THREE HALF-UNIT VECTORS ARE STORED
056912,000206:                                                                                                  #  AT LOCATIONS XDC, XDC +6, XDC +12D, AND STARAD, STARAD +6, STARAD +12D.
056913,000207: 
056914,000208: 23,3403           66370        AXISGEN            AXT,1    SSP                                   #  PUSHDOWN 00-30D, 34D-37D
056915,000209: 23,3404           02743                                    STARAD     +6                         
056916,000210: 23,3405           00051                                    S1                                    
056917,000211: 23,3406           02727                                    STARAD     -6                         
056918,000212: 
056919,000213: 23,3407           77601                           SETPD                                          
056920,000214: 23,3410           00001                                    0                                     
056921,000215: 23,3411           46773        AXISGEN1           VLOAD*   VXV*                                  #  06D   UA = S1
056922,000216: 23,3412           02752                                    STARAD     +12D,1                     #        STARAD +00D     UB = S1
056923,000217: 23,3413           02760                                    STARAD     +18D,1                     
056924,000218: 23,3414           77656                           UNIT                                           #  12D   VA = UNIT(S1 X S2)
056925,000219: 23,3415           06760                           STORE    STARAD     +18D,1                     #        STARAD +06D     VB = UNIT(S1 X S2)
056926,000220: 23,3416           77773                           VLOAD*                                         
056927,000221: 23,3417           02752                                    STARAD     +12D,1                     
056928,000222: 
056929,000223: 23,3420           76433                           VXV*     VSL1                                  
056930,000224: 23,3421           02760                                    STARAD     +18D,1                     #  18D   WA = UA X VA
056931,000225: 23,3422           06766                           STORE    STARAD     +24D,1                     #        STARAD +12D     WB = UB X VB
056932,000226: 
056933,000227: 23,3423           77700                           TIX,1                                          
056934,000228: 23,3424           47411                                    AXISGEN1                              
056935,000229: 
056936,000230: 23,3425           66160                           AXC,1    SXA,1                                 
056937,000231: 23,3426           00006                                    6                                     
056938,000232: 23,3427           00036                                    30D                                   
056939,000233: 
056940,000234: 23,3430           66370                           AXT,1    SSP                                   
056941,000235: 23,3431           00022                                    18D                                   
056942,000236: 23,3432           00051                                    S1                                    
056943,000237: 23,3433           00006                                    6                                     
056944,000238: 
056945,000239: 23,3434           66374                           AXT,2    SSP                                   
056946,000240: 23,3435           00006                                    6                                     
056947,000241: 23,3436           00052                                    S2                                    
056948,000242: 23,3437           00002                                    2                                     
056949,000243: 
056950,000244: 23,3440           76720        AXISGEN2           XCHX,1   VLOAD*                                
056951,000245: 23,3441           00036                                    30D                                   #  X1=-6 X2=+6   X1=-6 X2=+4     X1=-6 X2=+2
056952,000246: 23,3442           00001                                    0,1                                   
056953,000247: 
056954,000248: 23,3443           62757                           VXSC*    PDVL*                                 #  J=(UA)(UB1)   J=(UA)(UB2)     J=(UA)(UB3)
056955,000249: 23,3444           75033                                    STARAD     +6,2                       
056956,000250: 23,3445           00007                                    6,1                                   
056957,000251: 23,3446           77757                           VXSC*                                          
056958,000252: 23,3447           75025                                    STARAD     +12D,2                     
056959,000253: 23,3450           30031                           STOVL*   24D                                   #  K=(VA)(VB1)   J=(VA)(VB2)     J=(VA)(VB3)
056960,000254: 23,3451           00015                                    12D,1                                 
056961,000255: 
056962,000256: 23,3452           53357                           VXSC*    VAD                                   
056963,000257: 23,3453           75017                                    STARAD     +18D,2                     #  L=(WA)(WB1)   J=(WA)(WB2)     J=(WA)(WB3)
056964,000258: 23,3454           76455                           VAD      VSL1                                  
056965,000259: 23,3455           00031                                    24D                                   
056966,000260: 23,3456           53520                           XCHX,1   UNIT                                  
056967,000261: 23,3457           00036                                    30D                                   
056968,000262: 23,3460           06736                           STORE    XDC        +18D,1                     #  XDC = L+J+K   YDC = L+J+K     ZDC = L+J+K
056969,000263: 
056970,000264: 23,3461           77700                           TIX,1                                          
056971,000265: 23,3462           47463                                    AXISGEN3                              
056972,000266: 
056973,000267: 23,3463           77704        AXISGEN3           TIX,2                                          
056974,000268: 23,3464           47440                                    AXISGEN2                              
056975,000269: 
056976,000270: 23,3465           77775                           VLOAD                                          
056977,000271: 23,3466           02714                                    XDC                                   
056978,000272: 23,3467           26736                           STOVL    STARAD                                
056979,000273: 23,3470           02722                                    YDC                                   
056980,000274: 23,3471           26744                           STOVL    STARAD     +6                         
056981,000275: 23,3472           02730                                    ZDC                                   
056982,000276: 23,3473           02752                           STORE    STARAD     +12D                       
056983,000277: 
056984,000278: 23,3474           77616                           RVQ                                            
056985,000279: 
056986,000280: 23,3475           05520 26075  QTSN45             2DEC     .1768                                 
056987,000281: 23,3477           05252 25253  .166...            2DEC     .1666666667                            

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