Source Code

These source-code files were from the printout at the MIT Museum, with many thanks to Deborah Douglas, the Museum's Curator of Science and Technology, for releasing it to us. The printout was digitally photographed by Paul Fjeld. A team of volunteers transcribed the source code manually from these images or, where appropriate, modified already-transcribed but similar source Colossus 249 (Apollo 9) source code to agree with the images from the printout. Note that the page images presented online are of reduced quality, and that higher-quality images are available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 055 OF AGC PROGRAM COMANCHE BY NASA 2021113-051
	10:28 APR.  1,1969
Note that the date is the date of the printout, not the date of the program revision.

039335,000002:                                                                                                  ## Copyright:   Public domain.
039336,000003:                                                                                                  ## Filename:    CM_BODY_ATTITUDE.agc
039337,000004:                                                                                                  ## Purpose:     Part of the source code for Comanche, build 055. It
039338,000005:                                                                                                  ##              is part of the source code for the Command Module's
039339,000006:                                                                                                  ##              (CM) Apollo Guidance Computer (AGC), Apollo 11.
039340,000007:                                                                                                  ## Assembler:   yaYUL
039341,000008:                                                                                                  ## Reference:   pp. 883-889
039342,000009:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>
039343,000010:                                                                                                  ## Website:     http://www.ibiblio.org/apollo.
039344,000011:                                                                                                  ## Mod history: 2009-05-12 RSB  Adapted from Colossus249 file of the same
039345,000012:                                                                                                  ##                              name and Comanche 055 page images.
039346,000013:                                                                                                  ##              2016-12-21 RSB  Proofed comment text using octopus/ProoferComments
039347,000014:                                                                                                  ##                              and corrected the errors found.
039348,000015:                                                                                                  ##
039349,000016:                                                                                                  ## The contents of the "Comanche055" files, in general, are transcribed 
039350,000017:                                                                                                  ## from scanned documents. 
039351,000018:                                                                                                  ##
039352,000019:                                                                                                  ##       Assemble revision 055 of AGC program Comanche by NASA
039353,000020:                                                                                                  ##       2021113-051.  April 1, 1969.  
039354,000021:                                                                                                  ##
039355,000022:                                                                                                  ##       This AGC program shall also be referred to as Colossus 2A
039356,000023:                                                                                                  ##
039357,000024:                                                                                                  ##       Prepared by
039358,000025:                                                                                                  ##                       Massachusetts Institute of Technology
039359,000026:                                                                                                  ##                       75 Cambridge Parkway
039360,000027:                                                                                                  ##                       Cambridge, Massachusetts
039361,000028:                                                                                                  ##
039362,000029:                                                                                                  ##       under NASA contract NAS 9-4065.
039363,000030:                                                                                                  ##
039364,000031:                                                                                                  ## Refer directly to the online document mentioned above for further
039365,000032:                                                                                                  ## information.  Please report any errors to info@sandroid.org.
039366,000033: 

Page 883

039368,000035: 35,3477                                           BANK     35                                    
039369,000036: 
039370,000037: 37,2000                                           SETLOC   BODYATT                               
039371,000038: 37,2000                                           BANK                                           
039372,000039: 
039373,000040: 37,3470                                           COUNT    37/CMBAT                              
039374,000041: 
039375,000042:                                                                                                  #  PDL 12D - 15D SAFE.
039376,000043: 
039377,000044:                                                                                                  #  VALUES OF GIMBAL AND BODY ANGLES VALID AT PIP TIME ARE SAVED DURING  READACCS.
039378,000045: 
039379,000046: 37,3470  E7,1451                                  EBANK=   RTINIT                                #  LET INTERPRETER SET EB
039380,000047: 
039381,000048: 37,3470           06006        CM/POSE            TC       INTPRET                               #  COME HERE VIA AVEGEXIT.
039382,000049: 
039383,000050: 37,3471           77201                           SETPD    VLOAD                                 
039384,000051: 37,3472           00001                                    0                                     
039385,000052: 37,3473           01177                                    VN                                    #  KVSCALE = (12800/ .3048) /2VS
039386,000053: 37,3474           63361                           VXSC     PDVL                                  
039387,000054: 37,3475           37767                                    -KVSCALE                              #  KVSCALE = .81491944
039388,000055: 37,3476           01714                                    UNITW                                 #  FULL UNIT VECTOR
039389,000056: 37,3477           74235                           VXV      VXSC                                  #  VREL = V - WE*R
039390,000057: 37,3500           01760                                    UNITR                                 
039391,000058: 37,3501           15245                                    KWE                                   
039392,000059: 37,3502           45455                           VAD      STADR                                 
039393,000060: 37,3503           74251                           STORE    -VREL                                 #  SAVE FOR ENTRY GUIDANCE.      REF COORDS
039394,000061: 
039395,000062: 37,3504           72056                           UNIT     LXA,1                                 
039396,000063: 37,3505           00044                                    36D                                   #  ABVAL( -VREL) TO X1
039397,000064: 37,3506           03542                           STORE    UXA/2                                 #  -UVREL                        REF COORDS
039398,000065: 
039399,000066: 37,3507           57435                           VXV      VCOMP                                 
039400,000067: 37,3510           01760                                    UNITR                                 #  .5 UNIT                       REF COORDS
039401,000068: 37,3511           66256                           UNIT     SSP                                   #  THE FOLLOWING IS TO PROVIDE A STABLE
039402,000069: 37,3512           00051                                    S1                                    #  UN FOR THE END OF THE TERMINAL PHASE.
039403,000070: 37,3513           00476        SPVQUIT            DEC      .019405                               #  1000/ 2 VS
039404,000071: 37,3514           77300                           TIX,1    VLOAD                                 #  IF V-VQUIT POS, BRANCH.
039405,000072: 37,3515           77517                                    CM/POSE2                              #  SAVE UYA IN OLDUYA
039406,000073: 37,3516           03534                                    OLDUYA                                #  OTHERWISE CONTINUE TO USE OLDUYA.
039407,000074: 37,3517           03550        CM/POSE2           STORE    UYA/2                                 #                                REF COORDS
039408,000075: 
039409,000076: 37,3520           03534                           STORE    OLDUYA                                #  RESTORE, OR SAVE AS CASE MAY BE.
039410,000077: 
039411,000078: 37,3521           57435                           VXV      VCOMP                                 
039412,000079: 37,3522           03542                                    UXA/2                                 #  FINISH OBTAINING TRAJECTORY TRIAD.
039413,000080: 37,3523           77772                           VSL1                                           
039414,000081: 37,3524           03556                           STORE    UZA/2                                 #                                REF COORDS

Page 884

039416,000083: 37,3525           77751                           TLOAD                                          #  PICK UP CDUX, CDUY, CDUZ CORRESPONDING
039417,000084: 37,3526           03270                                    AOG/PIP                               #  TO PIPUP TIME IN 2S,C AND SAVE.
039418,000085: 37,3527           14031        CM/TRIO            STODL    24D                                   
039419,000086: 37,3530           00032                                    25D                                   #  AIG/PIP
039420,000087: 
039421,000088: 37,3531           41434                           RTB      PUSH                                  #  TO PDL0
039422,000089: 37,3532           45513                                    CDULOGIC                              
039423,000090: 37,3533           77746                           COS                                            
039424,000091: 37,3534           17564                           STODL    UBX/2                                 #  CI /2
039425,000092:                                                                                                  #  AIG/PIP FROM PDL 0
039426,000093: 37,3535           57556                           SIN      DCOMP                                 
039427,000094: 37,3536           17570                           STODL    UBX/2      +4                         #  -SI /2
039428,000095: 37,3537           00033                                    26D                                   #  AMG/PIP
039429,000096: 37,3540           41434                           RTB      PUSH                                  #  TO PDL 0
039430,000097: 37,3541           45513                                    CDULOGIC                              
039431,000098: 37,3542           65356                           SIN      PDDL                                  #  XCH PDL 0.  SAVE SM /2
039432,000099: 37,3543           65346                           COS      PDDL                                  #  CM /2 TO PDL 2
039433,000100: 37,3544           00001                                    0                                     #  SM /2
039434,000101: 37,3545           74276                           DCOMP    VXSC                                  
039435,000102: 37,3546           03564                                    UBX/2                                 
039436,000103: 37,3547           77772                           VSL1                                           #  NOISE WONT OVFL.
039437,000104: 37,3550           17572                           STODL    UBY/2                                 #  =(-SMCI, NOISE, SMSI)/2
039438,000105: 37,3551           00003                                    2                                     #  CM /2 REPLACES NOISE
039439,000106: 37,3552           17574                           STODL    UBY/2      +2                         #  UBY/2=(-SMCI, CM, SMSI)/2
039440,000107: 37,3553           00031                                    24D                                   #  AOG/PIP
039441,000108: 37,3554           41434                           RTB      PUSH                                  #  TO PDL 4
039442,000109: 37,3555           45513                                    CDULOGIC                              
039443,000110: 37,3556           65356                           SIN      PDDL                                  #  XCH PDL 4.  SAVE SO /2
039444,000111: 37,3557           74346                           COS      VXSC                                  #  CO /2
039445,000112: 37,3560           03572                                    UBY/2                                 
039446,000113: 37,3561           17572                           STODL    UBY/2                                 #  UBY/2=(-COSMCI, COCM, COSMSI)/4
039447,000114: 37,3562           00005                                    4D                                    #  SO /2
039448,000115: 37,3563           57405                           DMP      DCOMP                                 
039449,000116: 37,3564           03570                                    UBX/2      +4                         #  -SI /2
039450,000117: 37,3565           77615                           DAD                                            
039451,000118: 37,3566           03572                                    UBY/2                                 #  INCREMENT BY (SOSI /4)
039452,000119: 37,3567           17572                           STODL    UBY/2                                 
039453,000120:                                                                                                  #  SO /2 FROM PDL 4
039454,000121: 37,3570           43205                           DMP      DAD                                   
039455,000122: 37,3571           03564                                    UBX/2                                 #  CI /2
039456,000123: 37,3572           03576                                    UBY/2      +4                         
039457,000124: 37,3573           27576                           STOVL    UBY/2      +4                         #  YB/4                          PLATFORM COORDS
039458,000125: 
039459,000126:                                                                                                  #  YB = (-COSMCI + SOSI , COCM , COSMSI + SOCI )
039460,000127: 
039461,000128: 37,3574           03572                                    UBY/2                                 
039462,000129: 37,3575           72505                           VXM      VSL2                                  
039463,000130: 37,3576           01736                                    REFSMMAT                              #  .5 UNIT
039464,000131: 37,3577           17572                           STODL    UBY/2                                 #  YB/2 DONE                     REF COORDS

Page 885

039466,000133:                                                                                                  #  CM /2 FROM PDL 2
039467,000134: 37,3600           76561                           VXSC     VSL1                                  
039468,000135: 37,3601           03564                                    UBX/2                                 
039469,000136: 37,3602           17564                           STODL    UBX/2                                 #  =( CMCI, NOISE, -CMSI)/2
039470,000137: 37,3603           77626                           STADR                                          #  SM /2 FROM PDL 0
039471,000138: 37,3604           50211                           STOVL    UBX/2      +2                         #  SM /2 REPLACES NOISE
039472,000139: 37,3605           03564                                    UBX/2                                 #  XB/2                          PLATFORM COORDS
039473,000140: 
039474,000141:                                                                                                  #  XB = ( CMCI , SM , -CMSI )
039475,000142: 
039476,000143: 37,3606           76505                           VXM      VSL1                                  
039477,000144: 37,3607           01736                                    REFSMMAT                              #  .5 UNIT
039478,000145: 37,3610           03564                           STORE    UBX/2                                 #  XB/2 DONE                     REF COORDS
039479,000146: 
039480,000147: 37,3611           76435                           VXV      VSL1                                  
039481,000148: 37,3612           03572                                    UBY/2                                 
039482,000149: 37,3613           27600                           STOVL    UBZ/2                                 #  ZB/2 DONE                     REF COORDS
039483,000150: 
039484,000151:                                                                                                  #  EQUIVALENT TO
039485,000152:                                                                                                  #  ZB = ( SOSMCI + COSI , -SOCM , -SOSMSI + COCI )
039486,000153: 
039487,000154: 37,3614           03542                                    UXA/2                                 #  -UVREL/2 = -UVA/2
039488,000155: 37,3615           53435                           VXV      UNIT                                  #  GET UNIT(-UVREL*UBY)/2 = UL/2
039489,000156: 37,3616           03572                                    UBY/2                                 #  YB/2
039490,000157: 37,3617           50206                           PUSH     DOT                                   #  UL/2 TO PDL 0,5
039491,000158: 37,3620           03556                                    UZA/2                                 #  UNA/2
039492,000159: 37,3621           24021                           STOVL    COSTH                                 #  COS(ROLL)/4
039493,000160: 37,3622           00001                                    0                                     #  UL/2
039494,000161: 
039495,000162: 37,3623           77641                           DOT                                            
039496,000163: 37,3624           03550                                    UYA/2                                 
039497,000164: 37,3625           34023                           STCALL   SINTH                                 #  -SIN(ROLL)/4
039498,000165: 37,3626           47256                                    ARCTRIG                               
039499,000166: 37,3627           24007                           STOVL    6D                                    #  -(ROLL/180) /2
039500,000167: 37,3630           03572                                    UBY/2                                 
039501,000168: 37,3631           72441                           DOT      SL1                                   #  -UVA.UBY = -SIN(BETA)
039502,000169: 37,3632           03542                                    UXA/2                                 #  -UVREL/2
039503,000170: 37,3633           77736                           ARCSIN                                         
039504,000171: 37,3634           24010                           STOVL    7D                                    #  -(BETA/180) /2
039505,000172: 37,3635           03564                                    UBX/2                                 #  XB/2
039506,000173: 37,3636           77641                           DOT                                            #  UL.UBX = -SIN(ALFA)
039507,000174: 37,3637           00001                                    0                                     #  UL/2
039508,000175: 37,3640           24023                           STOVL    SINTH                                 #  -SIN(ALFA)/4
039509,000176: 37,3641           77641                           DOT                                            #  UL/2 FROM PDL 0
039510,000177: 37,3642           03600                                    UBZ/2                                 
039511,000178: 37,3643           34021                           STCALL   COSTH                                 #  COS(ALFA)/4
039512,000179: 37,3644           47256                                    ARCTRIG                               
039513,000180: 37,3645           24011                           STOVL    8D                                    #  -(ALFA/180) /2
039514,000181: 37,3646           01760                                    UNITR                                 #  UR/2                          REF COORDS
039515,000182: 37,3647           72441                           DOT      SL1                                   

Page 886

039517,000184: 37,3650           03556                                    UZA/2                                 #  MORE ACCURATE AT LARGE ARG.
039518,000185: 37,3651           77726                           ARCCOS                                         
039519,000186: 37,3652           00013                           STORE    10D                                   #  (-GAMA/180)/2
039520,000187: 
039521,000188: 37,3653           77551                           TLOAD    EXIT                                  #  ANGLES IN MPAC IN THE ORDER
039522,000189:                                                                                                  #  -( (ROLL, BETA, ALFA) /180)/2
039523,000190: 37,3654           00007                                    6D                                    #  THESE VALUES CORRECT AT PIPUP TIME.
039524,000191: 
039525,000192:                                                                                                  #  SPACER

Page 887

039527,000194:                                                                                                  #  BASIC SUBROUTINE TO UPDATE ATTITUDE ANGLES
039528,000195: 
039529,000196: 37,3655  E6,1661                                  EBANK=   AOG                                   
039530,000197: 
039531,000198: 37,3655           35057        CM/ATUP            CA       EBAOG                                 
039532,000199: 37,3656           54003                           TS       EBANK                                 
039533,000200: 37,3657           50120        CMTR1              INDEX    FIXLOC                                
039534,000201: 37,3660           40012                           CS       10D                                   #  (GAMA/180)/2
039535,000202: 37,3661           57722                           XCH      GAMA                                  
039536,000203: 37,3662           54001                           TS       L                                     
039537,000204: 
039538,000205: 37,3663           00004                           INHINT                                         
039539,000206:                                                                                                  #  MUST REMAIN INHINTED UNTIL UPDATE OF BODY
039540,000207:                                                                                                  #  ANGLES, SO THAT GAMDIFSW IS VALID FIRST PASS
039541,000208:                                                                                                  #  INDICATOR.
039542,000209: 
039543,000210: 37,3664           40102                           CS       CM/FLAGS                              
039544,000211: 37,3665           75005                           MASK     BIT11                                 #  GAMDIFSW=94D BIT11    INITLY=0
039545,000212: 37,3666           00006                           EXTEND                                         #  DONT CALC GAMA DOT UNTIL HAVE FORMD
039546,000213:                                                                                                  #  ONE DIFFERENCE.
039547,000214: 37,3667           13672                           BZF      DOGAMDOT                              #  IS OK, GO ON.
039548,000215: 37,3670           26102                           ADS      CM/FLAGS                              #  KNOW BIT IS 0
039549,000216: 37,3671           03705                           TC       NOGAMDOT                              #  SET GAMDOT = 0
039550,000217: 
039551,000218: 37,3672           40001        DOGAMDOT           CS       L                                     
039552,000219: 37,3673           61722                           AD       GAMA                                  #  DEL GAMA/360= T GAMDOT/360
039553,000220: 37,3674           00006                           EXTEND                                         
039554,000221: 37,3675           73770                           MP       TCDU                                  #  TCDU = .1 SEC, T = 2 SEC.
039555,000222: 37,3676           55723                           TS       GAMDOT                                #  GAMA DOT TCDU / 180
039556,000223: 
039557,000224: 37,3677           00006                           EXTEND                                         #  IGNORE GAMDOT IF LEQ .5 DEG/SEC
039558,000225: 37,3700           63702                           BZMF     +2                                    
039559,000226: 37,3701           40000                           COM                                            
039560,000227: 37,3702           65022                           AD       FIVE                                  
039561,000228: 37,3703           00006                           EXTEND                                         
039562,000229: 37,3704           63707                           BZMF     +3                                    #  SET GAMDOT=+0 AS TAG IF TOO SMALL.
039563,000230: 
039564,000231: 37,3705           35021        NOGAMDOT           CA       ZERO                                  #  COME HERE INHINTED.
039565,000232: 37,3706           55723                           TS       GAMDOT                                
039566,000233:                                                                                                  #  FOR NOW LEAVE IN 2S,C
039567,000234:                                                                                                  #  UPDATE ANGLES BY CORRECTING EUILER ANG
039568,000235:                                                                                                  #  FOR ACCRUED INCREMENT SINCE PIPUP
039569,000236:                                                                                                  #  R = R EUIL + R(NOW) - R(PIPUP)
039570,000237: 37,3707           40154                           CS       MPAC                                  #  GET (R EUL/180) /2
039571,000238: 37,3710           60000                           DOUBLE                                         #  POSSIBLE OVERFLOW
039572,000239: 37,3711           03760                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
039573,000240: 37,3712           00006                           EXTEND                                         
039574,000241: 37,3713           61672                           SU       ROLL/PIP                              #  GET INCR SINCE PIPUP
039575,000242: 37,3714           61664                           AD       ROLL/180                              #  ONLY SINGLE OVFL POSSIBLE.
039576,000243: 37,3715           03760                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY

Page 888

039578,000245: 37,3716           55770                           TS       TEMPROLL                              
039579,000246: 
039580,000247: 37,3717           40156                           CS       MPAC       +2                         #  GET (ALFA EUL/180) /2
039581,000248: 37,3720           60000                           DOUBLE                                         #  SAME AS FOR ROLL.  NEEDED FOR EXT ATM DAP
039582,000249: 37,3721           03760                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
039583,000250: 37,3722           00006                           EXTEND                                         
039584,000251: 37,3723           61673                           SU       ALFA/PIP                              
039585,000252: 37,3724           61665                           AD       ALFA/180                              
039586,000253: 37,3725           03760                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
039587,000254: 37,3726           55771                           TS       TEMPALFA                              
039588,000255: 
039589,000256: 37,3727           40155                           CS       MPAC       +1                         #  GET (BETA EUL/180) /2
039590,000257: 37,3730           60000        CMTR2              DOUBLE                                         
039591,000258: 37,3731           00006                           EXTEND                                         
039592,000259: 37,3732           61674                           SU       BETA/PIP                              
039593,000260: 37,3733           61666                           AD       BETA/180                              
039594,000261: 37,3734           57772                           XCH      TEMPBETA                              #  OVFL NOT EXPECTED.
039595,000262: 
039596,000263: 37,3735           35051                           CA       EBANK3                                
039597,000264: 37,3736           54003                           TS       EBANK                                 
039598,000265: 
039599,000266: 37,3737  E3,1446                                  EBANK=   PHSNAME5                              
039600,000267: 37,3737           00006                           EXTEND                                         
039601,000268: 37,3740           33772                           DCA      REPOSADR                              #  THIS ASSUMES THAT THE         TC  PHASCHNG
039602,000269: 37,3741           53447                           DXCH     PHSNAME5                              #  IS NOT CHANGED IN             OCT 10035
039603,000270:                                                                                                  #  SERVICER.
039604,000271: 
039605,000272: 37,3742           35057                           CA       EBAOG                                 
039606,000273: 37,3743           54003                           TS       EBANK                                 
039607,000274: 
039608,000275: 37,3744  E6,1661                                  EBANK=   AOG                                   
039609,000276: 37,3744           00006        REDOPOSE           EXTEND                                         #  RE-STARTS COME HERE
039610,000277: 37,3745           31771                           DCA      TEMPROLL                              
039611,000278: 37,3746           53665                           DXCH     ROLL/180                              
039612,000279: 37,3747           31772                           CA       TEMPBETA                              
039613,000280: 37,3750           55666                           TS       BETA/180                              
039614,000281: 
039615,000282: 37,3751           00003                           RELINT                                         
039616,000283: 
039617,000284: 37,3752           06006                           TC       INTPRET                               #  CANT TC DANZIG AFTER PHASCHNG.
039618,000285: 37,3753           51575        CM/POSE3           VLOAD    ABVAL                                 #  RETURN FROM CM/ATUP.  (RESTART)
039619,000286: 37,3754           01177                                    VN                                    #  2(-7) M/CS
039620,000287: 37,3755           03723                           STORE    VMAGI                                 #  FOR DISPLAY ON CALL.
039621,000288: 
039622,000289: 37,3756           77650                           GOTO                                           
039623,000290: 37,3757           03324                                    POSEXIT                               #  ENDEXIT, STARTENT, OR SCALEPOP.
039624,000291: 
039625,000292: 37,3760           54001        CORANGOV           TS       L                                     
039626,000293: 37,3761           00002                           TC       Q                                     
039627,000294: 37,3762           50000                           INDEX    A                                     

Page 889

039629,000296: 37,3763           35000                           CA       LIMITS                                
039630,000297: 37,3764           26001                           ADS      L                                     
039631,000298: 37,3765           00002                           TC       Q                                     #  COSTS 2 MCT TO USE.  SEE ANGOVCOR.
039632,000299: 
039633,000300: 37,3766           45730 53410  -KVSCALE           2DEC     -.81491944                            #  -12800/(2 VS .3048)
039634,000301: 
039635,000302: 37,3770           03146        TCDU               DEC      .1                                    #  TCDU = .1 SEC.
039636,000303: 
039637,000304: 37,3771  E6,1661                                  EBANK=   AOG                                   
039638,000305: 37,3771           03744 76066  REPOSADR           2CADR    REDOPOSE                              
039639,000306: 

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