Source Code

These source-code files were derived from scans of the Colossus 237 (Apollo 8 Command Module) program listing from the private collection of original AGC developer Fred Martin. Scanning was by Ron Burkey. Pre-existing Colossus 249 (Apollo 9 CM) source files were used as a template, and changes between Colossus 249 and Colossus 237 were manually transcribed by a team of volunteers. Note that the page images presented online are of reduced quality, and that additional 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 237 OF AGC PROGRAM COLOSSUS 
	BY NASA 2021111-031  1:17 AUG. 24, 1968
Note that the date is the date of the printout, not the date of the program revision.

036370,000002:                                                                                                  ## Copyright:   Public domain.
036371,000003:                                                                                                  ## Filename:    CM_BODY_ATTITUDE.agc
036372,000004:                                                                                                  ## Purpose:     Part of the source code for Colossus build 237.  
036373,000005:                                                                                                  ##              This is for the Command Module's (CM) Apollo Guidance
036374,000006:                                                                                                  ##              Computer (AGC), for Apollo 8.
036375,000007:                                                                                                  ## Assembler:   yaYUL
036376,000008:                                                                                                  ## Contact:     Onno Hommes <ohommes@alumni.cmu.edu>
036377,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
036378,000010:                                                                                                  ## Page Scans:  www.ibiblio.org/apollo/ScansForConversion/Colossus237/
036379,000011:                                                                                                  ## Mod history: 2010-05-30 OH   Adapted from corresponding Colossus 249 file.
036380,000012:                                                                                                  ##              2010-12-04 JL   Remove Colossus 249 header comments. Change to double-has page numbers.
036381,000013:                                                                                                  ##              2011-02-07 JL   Minor fixes.
036382,000014:                                                                                                  ##              2017-01-01 RSB  Proofed comment text using octopus/ProoferComments,
036383,000015:                                                                                                  ##                              and fixed errors found.
036384,000016: 

Page 833

036386,000018: 35,3755                                           BANK     35                                    
036387,000019: 
036388,000020: 37,2000                                           SETLOC   BODYATT                               
036389,000021: 37,2000                                           BANK                                           
036390,000022: 
036391,000023: 37,3375                                           COUNT    37/CMBAT                              
036392,000024: 
036393,000025:                                                                                                  #                                          PDL 12D - 15D SAFE.
036394,000026: 
036395,000027:                                                                                                  #    VALUES OF GIMBAL AND BODY ANGLES VALID AT PIP TIME ARE SAVED DURING    READACCS.
036396,000028: 
036397,000029: 37,3375  E7,1451                                  EBANK=   RTINIT                                #  LET INTERPRETER SET EB
036398,000030: 
036399,000031: 37,3375           06006        CM/POSE            TC       INTPRET                               #  COME HERE VIA AVEGEXIT.
036400,000032: 
036401,000033: 37,3376           77201                           SETPD    VLOAD                                 
036402,000034: 37,3377           00001                                    0                                     
036403,000035: 37,3400           01177                                    VN                                    #  KVSCALE = (12800/ .3048) /2VS
036404,000036: 37,3401           63361                           VXSC     PDVL                                  
036405,000037: 37,3402           37674                                    -KVSCALE                              #  KVSCALE = .81491944
036406,000038: 37,3403           01714                                    UNITW                                 #  FULL UNIT VECTOR
036407,000039: 37,3404           74235                           VXV      VXSC                                  #  VREL = V - WE*R
036408,000040: 37,3405           01760                                    UNITR                                 
036409,000041: 37,3406           15244                                    KWE                                   
036410,000042: 37,3407           45455                           VAD      STADR                                 
036411,000043: 37,3410           74251                           STORE    -VREL                                 #  SAVE FOR ENTRY GUIDANCE.  REF COORDS
036412,000044: 
036413,000045: 37,3411           72056                           UNIT     LXA,1                                 
036414,000046: 37,3412           00044                                    36D                                   #  ABVAL( -VREL) TO X1
036415,000047: 37,3413           03542                           STORE    UXA/2                                 #  -UVREL                   REF COORDS
036416,000048: 
036417,000049: 37,3414           57435                           VXV      VCOMP                                 
036418,000050: 37,3415           01760                                    UNITR                                 #  .5 UNIT                  REF COORDS
036419,000051: 37,3416           66256                           UNIT     SSP                                   #  THE FOLLOWING IS TO PROVIDE A STABLE
036420,000052: 37,3417           00051                                    S1                                    #  UN FOR THE END OF THE TERMINAL PHASE.
036421,000053: 37,3420           00476        SPVQUIT            DEC      .019405                               #  1000/ 2 VS
036422,000054: 37,3421           77300                           TIX,1    VLOAD                                 #  IF V-VQUIT POS, BRANCH.
036423,000055: 37,3422           77424                                    CM/POSE2                              #  SAVE UYA IN OLDUYA
036424,000056: 37,3423           03534                                    OLDUYA                                #  OTHERWISE CONTINUE TO USE OLDUYA.
036425,000057: 37,3424           03550        CM/POSE2           STORE    UYA/2                                 #                           REF COORDS
036426,000058: 
036427,000059: 37,3425           03534                           STORE    OLDUYA                                #  RESTORE, OR SAVE AS CASE MAY BE.
036428,000060: 
036429,000061: 37,3426           57435                           VXV      VCOMP                                 
036430,000062: 37,3427           03542                                    UXA/2                                 #  FINISH OBTAINING TRAJECTORY TRIAD.
036431,000063: 37,3430           77772                           VSL1                                           
036432,000064: 37,3431           03556                           STORE    UZA/2                                 #                           REF COORDS

Page 834

036434,000066: 37,3432           77751                           TLOAD                                          #  PICK UP CDUX, CDUY, CDUZ CORRESPONDING
036435,000067: 37,3433           03270                                    AOG/PIP                               #  TO PIPUP TIME IN 2S,C AND SAVE.
036436,000068: 37,3434           14031        CM/TRIO            STODL    24D                                   
036437,000069: 37,3435           00032                                    25D                                   #  AIG/PIP
036438,000070: 
036439,000071: 37,3436           41434                           RTB      PUSH                                  #  TO PDL0
036440,000072: 37,3437           45510                                    CDULOGIC                              
036441,000073: 37,3440           77746                           COS                                            
036442,000074: 37,3441           17564                           STODL    UBX/2                                 #  CI /2
036443,000075:                                                                                                  #                                          AIG/PIP FROM PDL 0
036444,000076: 37,3442           57556                           SIN      DCOMP                                 
036445,000077: 37,3443           17570                           STODL    UBX/2      +4                         #  -SI /2
036446,000078: 37,3444           00033                                    26D                                   #  AMG/PIP
036447,000079: 37,3445           41434                           RTB      PUSH                                  #  TO PDL 0
036448,000080: 37,3446           45510                                    CDULOGIC                              
036449,000081: 37,3447           65356                           SIN      PDDL                                  #  XCH PDL 0. SAVE SM /2
036450,000082: 37,3450           65346                           COS      PDDL                                  #  CM /2 TO PDL 2
036451,000083: 37,3451           00001                                    0                                     #  SM /2
036452,000084: 37,3452           74276                           DCOMP    VXSC                                  
036453,000085: 37,3453           03564                                    UBX/2                                 
036454,000086: 37,3454           77772                           VSL1                                           #  NOISE WONT OVFL.
036455,000087: 37,3455           17572                           STODL    UBY/2                                 #  =(-SMCI, NOISE, SMSI) /2
036456,000088: 37,3456           00003                                    2                                     #  CM /2 REPLACES NOISE
036457,000089: 37,3457           17574                           STODL    UBY/2      +2                         #  UBY/2=(-SMCI, CM, SMSI)/2
036458,000090: 37,3460           00031                                    24D                                   #  AOG/PIP
036459,000091: 37,3461           41434                           RTB      PUSH                                  #  TO PDL 4
036460,000092: 37,3462           45510                                    CDULOGIC                              
036461,000093: 37,3463           65356                           SIN      PDDL                                  #  XCH PDL 4. SAVE SO /2
036462,000094: 37,3464           74346                           COS      VXSC                                  #  CO /2
036463,000095: 37,3465           03572                                    UBY/2                                 
036464,000096: 37,3466           17572                           STODL    UBY/2                                 #  UBY/2=(-COSMCI, COCM, COSMSI)/4
036465,000097: 37,3467           00005                                    4D                                    #  SO /2
036466,000098: 37,3470           57405                           DMP      DCOMP                                 
036467,000099: 37,3471           03570                                    UBX/2      +4                         #  -SI /2
036468,000100: 37,3472           77615                           DAD                                            
036469,000101: 37,3473           03572                                    UBY/2                                 #   INCREMENT BY (SOSI /4)
036470,000102: 37,3474           17572                           STODL    UBY/2                                 
036471,000103:                                                                                                  #                                          SO /2 FROM PDL 4
036472,000104: 37,3475           43205                           DMP      DAD                                   
036473,000105: 37,3476           03564                                    UBX/2                                 #  CI /2
036474,000106: 37,3477           03576                                    UBY/2      +4                         
036475,000107: 37,3500           27576                           STOVL    UBY/2      +4                         #  YB/4               PLATFORM COORDS
036476,000108: 
036477,000109:                                                                                                  #                                  YB = (-COSMCI + SOSI , COCM , COSMSI + SOCI )
036478,000110: 
036479,000111: 37,3501           03572                                    UBY/2                                 
036480,000112: 37,3502           72505                           VXM      VSL2                                  
036481,000113: 37,3503           01736                                    REFSMMAT                              #  .5 UNIT
036482,000114: 37,3504           17572                           STODL    UBY/2                                 #  YB/2 DONE                REF COORDS

Page 835

036484,000116:                                                                                                  #  CM /2 FROM PDL 2
036485,000117: 37,3505           76561                           VXSC     VSL1                                  
036486,000118: 37,3506           03564                                    UBX/2                                 
036487,000119: 37,3507           17564                           STODL    UBX/2                                 #  =( CMCI, NOISE, -CMSI)/2
036488,000120: 37,3510           77626                           STADR                                          #  SM /2 FROM PDL 0
036489,000121: 37,3511           50211                           STOVL    UBX/2      +2                         #  SM /2 REPLACES NOISE
036490,000122: 37,3512           03564                                    UBX/2                                 #  XB/2               PLATFORM COORDS
036491,000123: 
036492,000124:                                                                                                  #                                  XB = ( CMCI , SM , -CMSI )
036493,000125: 
036494,000126: 37,3513           76505                           VXM      VSL1                                  
036495,000127: 37,3514           01736                                    REFSMMAT                              #  .5 UNIT
036496,000128: 37,3515           03564                           STORE    UBX/2                                 #  XB/2  DONE               REF COORDS
036497,000129: 
036498,000130: 37,3516           76435                           VXV      VSL1                                  
036499,000131: 37,3517           03572                                    UBY/2                                 
036500,000132: 37,3520           27600                           STOVL    UBZ/2                                 #  ZB/2  DONE               REF COORDS
036501,000133: 
036502,000134:                                                                                                  #                                  EQUIVALENT TO
036503,000135:                                                                                                  #                                  ZB = ( SOSMCI + COSI , -SOCM , -SOSMSI + COCI )
036504,000136: 
036505,000137: 37,3521           03542                                    UXA/2                                 #  -UVREL/2 = -UVA/2
036506,000138: 37,3522           53435                           VXV      UNIT                                  #  GET UNIT(-UVREL*UBY)/2  = UL/2
036507,000139: 37,3523           03572                                    UBY/2                                 #  YB/2
036508,000140: 37,3524           50206                           PUSH     DOT                                   #  UL/2 TO PDL 0,5
036509,000141: 37,3525           03556                                    UZA/2                                 #  UNA/2
036510,000142: 37,3526           24021                           STOVL    COSTH                                 #  COS(ROLL)/4
036511,000143: 37,3527           00001                                    0                                     #  UL/2
036512,000144: 
036513,000145: 37,3530           77641                           DOT                                            
036514,000146: 37,3531           03550                                    UYA/2                                 
036515,000147: 37,3532           34023                           STCALL   SINTH                                 #  -SIN(ROLL)/4
036516,000148: 37,3533           47211                                    ARCTRIG                               
036517,000149: 37,3534           24007                           STOVL    6D                                    #  -(ROLL/180) /2
036518,000150: 37,3535           03572                                    UBY/2                                 
036519,000151: 37,3536           72441                           DOT      SL1                                   #  -UVA.UBY = -SIN(BETA)
036520,000152: 37,3537           03542                                    UXA/2                                 #  -UVREL/2
036521,000153: 37,3540           77736                           ARCSIN                                         
036522,000154: 37,3541           24010                           STOVL    7D                                    #  -(BETA/180) /2
036523,000155: 37,3542           03564                                    UBX/2                                 #  XB/2
036524,000156: 37,3543           77641                           DOT                                            #  UL.UBX = -SIN(ALFA)
036525,000157: 37,3544           00001                                    0                                     #  UL/2
036526,000158: 37,3545           24023                           STOVL    SINTH                                 #  -SIN(ALFA)/4
036527,000159: 37,3546           77641                           DOT                                            #  UL/2 FROM PDL 0
036528,000160: 37,3547           03600                                    UBZ/2                                 
036529,000161: 37,3550           34021                           STCALL   COSTH                                 #  COS(ALFA)/4
036530,000162: 37,3551           47211                                    ARCTRIG                               
036531,000163: 37,3552           24011                           STOVL    8D                                    #  -(ALFA/180) /2
036532,000164: 37,3553           01760                                    UNITR                                 #  UR/2                     REF COORDS
036533,000165: 37,3554           72441                           DOT      SL1                                   

Page 836

036535,000167: 37,3555           03556                                    UZA/2                                 #  MORE ACCURATE AT LARGE ARG.
036536,000168: 37,3556           77726                           ARCCOS                                         
036537,000169: 37,3557           00013                           STORE    10D                                   #  (-GAMA/180)/2
036538,000170: 
036539,000171: 37,3560           77551                           TLOAD    EXIT                                  #  ANGLES IN MPAC IN THE ORDER
036540,000172:                                                                                                  #                                          -( (ROLL, BETA, ALFA) /180)/2
036541,000173: 37,3561           00007                                    6D                                    #  THESE VALUES CORRECT AT PIPUP TIME.
036542,000174:                                                                                                  #  SPACER

Page 837

036544,000176:                                                                                                  #  BASIC SUBROUTINE TO UPDATE ATTITUDE ANGLES
036545,000177: 
036546,000178: 37,3562  E6,1661                                  EBANK=   AOG                                   
036547,000179: 
036548,000180: 37,3562           34752        CM/ATUP            CA       EBAOG                                 
036549,000181: 37,3563           54003                           TS       EBANK                                 
036550,000182: 37,3564           50120        CMTR1              INDEX    FIXLOC                                
036551,000183: 37,3565           40012                           CS       10D                                   #  (GAMA/180)/2
036552,000184: 37,3566           57722                           XCH      GAMA                                  
036553,000185: 37,3567           54001                           TS       L                                     
036554,000186: 
036555,000187: 37,3570           00004                           INHINT                                         
036556,000188:                                                                                                  #                                  MUST REMAIN INHINTED UNTIL UPDATE OF BODY
036557,000189:                                                                                                  #                                  ANGLES, SO THAT GAMDIFSW IS VALID FIRST PASS
036558,000190:                                                                                                  #                                  INDICATOR.
036559,000191: 
036560,000192: 37,3571           40102                           CS       CM/FLAGS                              
036561,000193: 37,3572           74700                           MASK     BIT11                                 #  GAMDIFSW=94D BIT11   INITLY=0
036562,000194: 37,3573           00006                           EXTEND                                         #  DONT CALC GAMA DOT UNTIL HAVE FORMD
036563,000195:                                                                                                  #                                          ONE DIFFERENCE.
036564,000196: 37,3574           13577                           BZF      DOGAMDOT                              #  IS OK, GO ON.
036565,000197: 37,3575           26102                           ADS      CM/FLAGS                              #  KNOW BIT IS 0
036566,000198: 37,3576           03612                           TC       NOGAMDOT                              #  SET GAMDOT = 0
036567,000199: 
036568,000200: 37,3577           40001        DOGAMDOT           CS       L                                     
036569,000201: 37,3600           61722                           AD       GAMA                                  #  DEL GAMA/360= T GAMDOT/360
036570,000202: 37,3601           00006                           EXTEND                                         
036571,000203: 37,3602           73675                           MP       TCDU                                  #  TCDU = .1 SEC,   T = 2 SEC.
036572,000204: 37,3603           55723                           TS       GAMDOT                                #  GAMA DOT TCDU / 180
036573,000205: 
036574,000206: 37,3604           00006                           EXTEND                                         #  IGNORE GAMDOT IF LEQ  .5 DEG/SEC
036575,000207: 37,3605           63607                           BZMF     +2                                    
036576,000208: 37,3606           40000                           COM                                            
036577,000209: 37,3607           64715                           AD       FIVE                                  
036578,000210: 37,3610           00006                           EXTEND                                         
036579,000211: 37,3611           63614                           BZMF     +3                                    #  SET GAMDOT=+0 AS TAG IF TOO SMALL.
036580,000212: 
036581,000213: 37,3612           34714        NOGAMDOT           CA       ZERO                                  #  COME HERE INHINTED.
036582,000214: 37,3613           55723                           TS       GAMDOT                                
036583,000215:                                                                                                  #                                          FOR NOW LEAVE IN 2S,C
036584,000216:                                                                                                  #                                          UPDATE ANGLES BY CORRECTING EUILER ANG
036585,000217:                                                                                                  #                                          FOR ACCRUED INCREMENT SINCE PIPUP
036586,000218:                                                                                                  #                                          R = R EUIL + R(NOW) -R(PIPUP)
036587,000219: 37,3614           40154                           CS       MPAC                                  #  GET (R EUL/180) /2
036588,000220: 37,3615           60000                           DOUBLE                                         #  POSSIBLE OVERFLOW
036589,000221: 37,3616           03665                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
036590,000222: 37,3617           00006                           EXTEND                                         
036591,000223: 37,3620           61672                           SU       ROLL/PIP                              #  GET INCR SINCE PIPUP
036592,000224: 37,3621           61664                           AD       ROLL/180                              #  ONLY SINGLE OVFL POSSIBLE.
036593,000225: 37,3622           03665                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY

Page 838

036595,000227: 37,3623           55770                           TS       TEMPROLL                              
036596,000228: 
036597,000229: 37,3624           40156                           CS       MPAC       +2                         #  GET (ALFA EUL/180) /2
036598,000230: 37,3625           60000                           DOUBLE                                         #  SAME AS FOR ROLL. NEEDED FOR EXT ATM DAP
036599,000231: 37,3626           03665                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
036600,000232: 37,3627           00006                           EXTEND                                         
036601,000233: 37,3630           61673                           SU       ALFA/PIP                              
036602,000234: 37,3631           61665                           AD       ALFA/180                              
036603,000235: 37,3632           03665                           TC       CORANGOV                              #  CORRECT FOR OVFL IF ANY
036604,000236: 37,3633           55771                           TS       TEMPALFA                              
036605,000237: 
036606,000238: 37,3634           40155                           CS       MPAC       +1                         #  GET (BETA EUL/180) /2
036607,000239: 37,3635           60000        CMTR2              DOUBLE                                         
036608,000240: 37,3636           00006                           EXTEND                                         
036609,000241: 37,3637           61674                           SU       BETA/PIP                              
036610,000242: 37,3640           61666                           AD       BETA/180                              
036611,000243: 37,3641           57772                           XCH      TEMPBETA                              #  OVFL NOT EXPECTED.
036612,000244: 
036613,000245: 37,3642           34744                           CA       EBANK3                                
036614,000246: 37,3643           54003                           TS       EBANK                                 
036615,000247: 
036616,000248: 37,3644  E3,1446                                  EBANK=   PHSNAME5                              
036617,000249: 37,3644           00006                           EXTEND                                         
036618,000250: 37,3645           33677                           DCA      REPOSADR                              #  THIS ASSUMES THAT THE   TC   PHASCHNG
036619,000251: 37,3646           53447                           DXCH     PHSNAME5                              #  IS NOT CHANGED IN       OCT  10035
036620,000252:                                                                                                  #                                          SERVICER.
036621,000253: 
036622,000254: 37,3647           34752                           CA       EBAOG                                 
036623,000255: 37,3650           54003                           TS       EBANK                                 
036624,000256: 
036625,000257: 37,3651  E6,1661                                  EBANK=   AOG                                   
036626,000258: 37,3651           00006        REDOPOSE           EXTEND                                         #  RE-STARTS COME HERE
036627,000259: 37,3652           31771                           DCA      TEMPROLL                              
036628,000260: 37,3653           53665                           DXCH     ROLL/180                              
036629,000261: 37,3654           31772                           CA       TEMPBETA                              
036630,000262: 37,3655           55666                           TS       BETA/180                              
036631,000263: 
036632,000264: 37,3656           00003                           RELINT                                         
036633,000265: 
036634,000266: 37,3657           06006                           TC       INTPRET                               #  CANT TC DANZIG AFTER PHASCHNG.
036635,000267: 37,3660           51575        CM/POSE3           VLOAD    ABVAL                                 #  RETURN FROM CM/ATUP.  (RESTART)
036636,000268: 37,3661           01177                                    VN                                    #  2(-7)  M/CS
036637,000269: 37,3662           03723                           STORE    VMAGI                                 #  FOR DISPLAY ON CALL.
036638,000270: 
036639,000271: 37,3663           77650                           GOTO                                           
036640,000272: 37,3664           03324                                    POSEXIT                               #  ENDEXIT, STARTENT, OR SCALEPOP.
036641,000273: 
036642,000274: 37,3665           54001        CORANGOV           TS       L                                     
036643,000275: 37,3666           00002                           TC       Q                                     
036644,000276: 37,3667           50000                           INDEX    A                                     

Page 839

036646,000278: 37,3670           34673                           CA       LIMITS                                
036647,000279: 37,3671           26001                           ADS      L                                     
036648,000280: 37,3672           00002                           TC       Q                                     #  COSTS 2 MCT TO USE. SEE ANGOVCOR.
036649,000281: 
036650,000282: 37,3673           45730 53410  -KVSCALE           2DEC     -.81491944                            #  -12800/(2 VS .3048)
036651,000283: 37,3675           03146        TCDU               DEC      .1                                    #  TCDU = .1 SEC.
036652,000284: 
036653,000285: 37,3676  E6,1661                                  EBANK=   AOG                                   
036654,000286: 37,3676           03651 76066  REPOSADR           2CADR    REDOPOSE                              

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