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.

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

Page 883

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

Page 884

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

Page 885

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

Page 886

039502,000184: 37,3650           03556                                    UZA/2                                 #  MORE ACCURATE AT LARGE ARG.
039503,000185: 37,3651           77726                           ARCCOS                                         
039504,000186: 37,3652           00013                           STORE    10D                                   #  (-GAMA/180)/2
039505,000187: 
039506,000188: 37,3653           77551                           TLOAD    EXIT                                  #  ANGLES IN MPAC IN THE ORDER
039507,000189:                                                                                                  #  -( (ROLL, BETA, ALFA) /180)/2
039508,000190: 37,3654           00007                                    6D                                    #  THESE VALUES CORRECT AT PIPUP TIME.
039509,000191: 
039510,000192:                                                                                                  #  SPACER

Page 887

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

Page 888

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

Page 889

039614,000296: 37,3763           35000                           CA       LIMITS                                
039615,000297: 37,3764           26001                           ADS      L                                     
039616,000298: 37,3765           00002                           TC       Q                                     #  COSTS 2 MCT TO USE.  SEE ANGOVCOR.
039617,000299: 
039618,000300: 37,3766           45730 53410  -KVSCALE           2DEC     -.81491944                            #  -12800/(2 VS .3048)
039619,000301: 
039620,000302: 37,3770           03146        TCDU               DEC      .1                                    #  TCDU = .1 SEC.
039621,000303: 
039622,000304: 37,3771  E6,1661                                  EBANK=   AOG                                   
039623,000305: 37,3771           03744 76066  REPOSADR           2CADR    REDOPOSE                              
039624,000306: 

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