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.

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

Page 833

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

Page 834

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

Page 835

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

Page 836

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

Page 837

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

Page 838

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

Page 839

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

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