Source Code
This is the source-code for the Apollo 9 Command Module's Guidance Computer.
These files were derived originally from the scan from MIT's Dibner Institute's
now-discontinued website titled "History of Recent Science and Technology", which
in turn was originally created by Gary Neff, though his high-quality scans were
unfortunately reduced in legibility when presented online.
The markings on the front of the
printout imply that it was the original AGC developer Norm Brodeur's copy.
A scan by Ron Burkey has superceded it, made from a more-legible copy from the collection of original
AGC developer Fred Martin. The source code was transcribed from
those images by Ron Burkey. 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:ASSEMBLE REVISION 249 OF AGC PROGRAM COLOSSUS BY NASA 2021111-041 20'35 OCT. 28,1968Note that the date is the date of the printout, not the date of the program revision. |
037297,000002: ## Copyright: Public domain.
037298,000003: ## Filename: CM_BODY_ATTITUDE.agc
037299,000004: ## Purpose: Part of the source code for Colossus, build 249.
037300,000005: ## It is part of the source code for the Command Module's (CM)
037301,000006: ## Apollo Guidance Computer (AGC), for Apollo 9.
037302,000007: ## Assembler: yaYUL
037303,000008: ## Reference: pp. 836-842.
037304,000009: ## Contact: Ron Burkey <info@sandroid.org>.
037305,000010: ## Website: www.ibiblio.org/apollo.
037306,000011: ## Mod history: 08/21/04 RSB. Began transcribing.
037307,000012: ## 2017-01-06 RSB Page numbers now agree with those on the
037308,000013: ## original harcopy, as opposed to the PDF page
037309,000014: ## numbers in 1701.pdf.
037310,000015: ## 2017-01-07 RSB Cross-diff'd comment text (not whitespace)
037311,000016: ## vs the already-proofed corresponding Colossus
037312,000017: ## 237 and Comanche 55 source-code files
037313,000018: ## and corrected errors found.
037314,000019: ##
037315,000020: ## The contents of the "Colossus249" files, in general, are transcribed
037316,000021: ## from a scanned copy of the program listing. Notations on this
037317,000022: ## document read, in part:
037318,000023: ##
037319,000024: ## Assemble revision 249 of AGC program Colossus by NASA
037320,000025: ## 2021111-041. October 28, 1968.
037321,000026: ##
037322,000027: ## This AGC program shall also be referred to as
037323,000028: ## Colossus 1A
037324,000029: ##
037325,000030: ## Prepared by
037326,000031: ## Massachusetts Institute of Technology
037327,000032: ## 75 Cambridge Parkway
037328,000033: ## Cambridge, Massachusetts
037329,000034: ## under NASA contract NAS 9-4065.
037330,000035: ##
037331,000036: ## Refer directly to the online document mentioned above for further information.
037332,000037: ## Please report any errors (relative to the scanned pages) to info@sandroid.org.
037333,000038: ##
037334,000039: ## In some cases, where the source code for Luminary 131 overlaps that of
037335,000040: ## Colossus 249, this code is instead copied from the corresponding Luminary 131
037336,000041: ## source file, and then is proofed to incorporate any changes.
037337,000042:
Page 836 |
037339,000044: 35,3755 BANK 35
037340,000045:
037341,000046: 37,2000 SETLOC BODYATT
037342,000047: 37,2000 BANK
037343,000048:
037344,000049: 37,3373 COUNT 37/CMBAT
037345,000050:
037346,000051: # PDL 12D - 15D SAFE.
037347,000052:
037348,000053: # VALUES OF GIMBAL AND BODY ANGLES VALID AT PIP TIME ARE SAVED DURING READACCS.
037349,000054:
037350,000055: 37,3373 E7,1451 EBANK= RTINIT # LET INTERPRETER SET EB
037351,000056:
037352,000057: 37,3373 06006 CM/POSE TC INTPRET # COME HERE VIA AVEGEXIT.
037353,000058:
037354,000059: 37,3374 77201 SETPD VLOAD
037355,000060: 37,3375 00001 0
037356,000061: 37,3376 01177 VN # KVSCALE = (12800/ .3048) /2VS
037357,000062: 37,3377 63361 VXSC PDVL
037358,000063: 37,3400 37672 -KVSCALE # KVSCALE = .81491944
037359,000064: 37,3401 01714 UNITW # FULL UNIT VECTOR
037360,000065: 37,3402 74235 VXV VXSC # VREL = V - WE*R
037361,000066: 37,3403 01760 UNITR
037362,000067: 37,3404 15244 KWE
037363,000068: 37,3405 45455 VAD STADR
037364,000069: 37,3406 74251 STORE -VREL # SAVE FOR ENTRY GUIDANCE. REF COORDS
037365,000070:
037366,000071: 37,3407 72056 UNIT LXA,1
037367,000072: 37,3410 00044 36D # ABVAL( -VREL) TO X1
037368,000073: 37,3411 03542 STORE UXA/2 # -UVREL REF COORDS
037369,000074:
037370,000075: 37,3412 57435 VXV VCOMP
037371,000076: 37,3413 01760 UNITR # .5 UNIT REF COORDS
037372,000077: 37,3414 66256 UNIT SSP # THE FOLLOWING IS TO PROVIDE A STABLE
037373,000078: 37,3415 00051 S1 # UN FOR THE END OF THE TERMINAL PHASE.
037374,000079: 37,3416 00476 SPVQUIT DEC .019405 # 1000/ 2 VS
037375,000080: 37,3417 77300 TIX,1 VLOAD # IF V-VQUIT POS, BRANCH.
037376,000081: 37,3420 77422 CM/POSE2 # SAVE UYA IN OLDUYA
037377,000082: 37,3421 03534 OLDUYA # OTHERWISE CONTINUE TO USE OLDUYA.
037378,000083: 37,3422 03550 CM/POSE2 STORE UYA/2 # REF COORDS
037379,000084:
037380,000085: 37,3423 03534 STORE OLDUYA # RESTORE, OR SAVE AS CASE MAY BE.
037381,000086:
037382,000087: 37,3424 57435 VXV VCOMP
037383,000088: 37,3425 03542 UXA/2 # FINISH OBTAINING TRAJECTORY TRIAD.
037384,000089: 37,3426 77772 VSL1
037385,000090: 37,3427 03556 STORE UZA/2 # REF COORDS
Page 837 |
037387,000092: 37,3430 77751 TLOAD # PICK UP CDUX, CDUY, CDUZ CORRESPONDING
037388,000093: 37,3431 03270 AOG/PIP # TO PIPUP TIME IN 2S,C AND SAVE.
037389,000094: 37,3432 14031 CM/TRIO STODL 24D
037390,000095: 37,3433 00032 25D # AIG/PIP
037391,000096:
037392,000097: 37,3434 41434 RTB PUSH # TO PDL0
037393,000098: 37,3435 45510 CDULOGIC
037394,000099: 37,3436 77746 COS
037395,000100: 37,3437 17564 STODL UBX/2 # CI /2
037396,000101: # AIG/PIP FROM PDL 0
037397,000102: 37,3440 57556 SIN DCOMP
037398,000103: 37,3441 17570 STODL UBX/2 +4 # -SI /2
037399,000104: 37,3442 00033 26D # AMG/PIP
037400,000105: 37,3443 41434 RTB PUSH # TO PDL 0
037401,000106: 37,3444 45510 CDULOGIC
037402,000107: 37,3445 65356 SIN PDDL # XCH PDL 0. SAVE SM /2
037403,000108: 37,3446 65346 COS PDDL # CM /2 TO PDL 2
037404,000109: 37,3447 00001 0 # SM /2
037405,000110: 37,3450 74276 DCOMP VXSC
037406,000111: 37,3451 03564 UBX/2
037407,000112: 37,3452 77772 VSL1 # NOISE WONT OVFL.
037408,000113: 37,3453 17572 STODL UBY/2 # =(-SMCI, NOISE, SMSI)/2
037409,000114: 37,3454 00003 2 # CM /2 REPLACES NOISE
037410,000115: 37,3455 17574 STODL UBY/2 +2 # UBY/2=(-SMCI, CM, SMSI)/2
037411,000116: 37,3456 00031 24D # AOG/PIP
037412,000117: 37,3457 41434 RTB PUSH # TO PDL 4
037413,000118: 37,3460 45510 CDULOGIC
037414,000119: 37,3461 65356 SIN PDDL # XCH PDL 4. SAVE SO /2
037415,000120: 37,3462 74346 COS VXSC # CO /2
037416,000121: 37,3463 03572 UBY/2
037417,000122: 37,3464 17572 STODL UBY/2 # UBY/2=(-COSMCI, COCM, COSMSI)/4
037418,000123: 37,3465 00005 4D # SO /2
037419,000124: 37,3466 57405 DMP DCOMP
037420,000125: 37,3467 03570 UBX/2 +4 # -SI /2
037421,000126: 37,3470 77615 DAD
037422,000127: 37,3471 03572 UBY/2 # INCREMENT BY (SOSI /4)
037423,000128: 37,3472 17572 STODL UBY/2
037424,000129: # SO /2 FROM PDL 4
037425,000130: 37,3473 43205 DMP DAD
037426,000131: 37,3474 03564 UBX/2 # CI /2
037427,000132: 37,3475 03576 UBY/2 +4
037428,000133: 37,3476 27576 STOVL UBY/2 +4 # YB/4 PLATFORM COORDS
037429,000134:
037430,000135: # YB = (-COSMCI + SOSI , COCM , COSMSI + SOCI )
037431,000136:
037432,000137: 37,3477 03572 UBY/2
037433,000138: 37,3500 72505 VXM VSL2
037434,000139: 37,3501 01736 REFSMMAT # .5 UNIT
037435,000140: 37,3502 17572 STODL UBY/2 # YB/2 DONE REF COORDS
Page 838 |
037437,000142: # CM /2 FROM PDL 2
037438,000143: 37,3503 76561 VXSC VSL1
037439,000144: 37,3504 03564 UBX/2
037440,000145: 37,3505 17564 STODL UBX/2 # =( CMCI, NOISE, -CMSI)/2
037441,000146: 37,3506 77626 STADR # SM /2 FROM PDL 0
037442,000147: 37,3507 50211 STOVL UBX/2 +2 # SM /2 REPLACES NOISE
037443,000148: 37,3510 03564 UBX/2 # XB/2 PLATFORM COORDS
037444,000149:
037445,000150: # XB = ( CMCI , SM , -CMSI )
037446,000151:
037447,000152: 37,3511 76505 VXM VSL1
037448,000153: 37,3512 01736 REFSMMAT # .5 UNIT
037449,000154: 37,3513 03564 STORE UBX/2 # XB/2 DONE REF COORDS
037450,000155:
037451,000156: 37,3514 76435 VXV VSL1
037452,000157: 37,3515 03572 UBY/2
037453,000158: 37,3516 27600 STOVL UBZ/2 # ZB/2 DONE REF COORDS
037454,000159:
037455,000160: # EQUIVALENT TO
037456,000161: # ZB = ( SOSMCI + COSI , -SOCM , -SOSMSI + COCI )
037457,000162:
037458,000163: 37,3517 03542 UXA/2 # -UVREL/2 = -UVA/2
037459,000164: 37,3520 53435 VXV UNIT # GET UNIT(-UVREL*UBY)/2 = UL/2
037460,000165: 37,3521 03572 UBY/2 # YB/2
037461,000166: 37,3522 50206 PUSH DOT # UL/2 TO PDL 0,5
037462,000167: 37,3523 03556 UZA/2 # UNA/2
037463,000168: 37,3524 24021 STOVL COSTH # COS(ROLL)/4
037464,000169: 37,3525 00001 0 # UL/2
037465,000170:
037466,000171: 37,3526 77641 DOT
037467,000172: 37,3527 03550 UYA/2
037468,000173: 37,3530 34023 STCALL SINTH # -SIN(ROLL)/4
037469,000174: 37,3531 47211 ARCTRIG
037470,000175: 37,3532 24007 STOVL 6D # -(ROLL/180) /2
037471,000176: 37,3533 03572 UBY/2
037472,000177: 37,3534 72441 DOT SL1 # -UVA.UBY = -SIN(BETA)
037473,000178: 37,3535 03542 UXA/2 # -UVREL/2
037474,000179: 37,3536 77736 ARCSIN
037475,000180: 37,3537 24010 STOVL 7D # -(BETA/180) /2
037476,000181: 37,3540 03564 UBX/2 # XB/2
037477,000182: 37,3541 77641 DOT # UL.UBX = -SIN(ALFA)
037478,000183: 37,3542 00001 0 # UL/2
037479,000184: 37,3543 24023 STOVL SINTH # -SIN(ALFA)/4
037480,000185: 37,3544 77641 DOT # UL/2 FROM PDL 0
037481,000186: 37,3545 03600 UBZ/2
037482,000187: 37,3546 34021 STCALL COSTH # COS(ALFA)/4
037483,000188: 37,3547 47211 ARCTRIG
037484,000189: 37,3550 24011 STOVL 8D # -(ALFA/180) /2
037485,000190: 37,3551 01760 UNITR # UR/2 REF COORDS
037486,000191: 37,3552 72441 DOT SL1
Page 839 |
037488,000193: 37,3553 03556 UZA/2 # MORE ACCURATE AT LARGE ARG.
037489,000194: 37,3554 77726 ARCCOS
037490,000195: 37,3555 00013 STORE 10D # (-GAMA/180)/2
037491,000196:
037492,000197: 37,3556 77551 TLOAD EXIT # ANGLES IN MPAC IN THE ORDER
037493,000198: # -( (ROLL, BETA, ALFA) /180)/2
037494,000199: 37,3557 00007 6D # THESE VALUES CORRECT AT PIPUP TIME.
037495,000200:
037496,000201: # SPACER
Page 840 |
037498,000203: # BASIC SUBROUTINE TO UPDATE ATTITUDE ANGLES
037499,000204:
037500,000205: 37,3560 E6,1661 EBANK= AOG
037501,000206:
037502,000207: 37,3560 34752 CM/ATUP CA EBAOG
037503,000208: 37,3561 54003 TS EBANK
037504,000209: 37,3562 50120 CMTR1 INDEX FIXLOC
037505,000210: 37,3563 40012 CS 10D # (GAMA/180)/2
037506,000211: 37,3564 57722 XCH GAMA
037507,000212: 37,3565 54001 TS L
037508,000213:
037509,000214: 37,3566 00004 INHINT
037510,000215: # MUST REMAIN INHINTED UNTIL UPDATE OF BODY
037511,000216: # ANGLES, SO THAT GAMDIFSW IS VALID FIRST PASS
037512,000217: # INDICATOR.
037513,000218:
037514,000219: 37,3567 40102 CS CM/FLAGS
037515,000220: 37,3570 74700 MASK BIT11 # GAMDIFSW=94D BIT11 INITLY=0
037516,000221: 37,3571 00006 EXTEND # DONT CALC GAMA DOT UNTIL HAVE FORMD
037517,000222: # ONE DIFFERENCE.
037518,000223: 37,3572 13575 BZF DOGAMDOT # IS OK, GO ON.
037519,000224: 37,3573 26102 ADS CM/FLAGS # KNOW BIT IS 0
037520,000225: 37,3574 03610 TC NOGAMDOT # SET GAMDOT = 0
037521,000226:
037522,000227: 37,3575 40001 DOGAMDOT CS L
037523,000228: 37,3576 61722 AD GAMA # DEL GAMA/360= T GAMDOT/360
037524,000229: 37,3577 00006 EXTEND
037525,000230: 37,3600 73673 MP TCDU # TCDU = .1 SEC, T = 2 SEC.
037526,000231: 37,3601 55723 TS GAMDOT # GAMA DOT TCDU / 180
037527,000232:
037528,000233: 37,3602 00006 EXTEND # IGNORE GAMDOT IF LEQ .5 DEG/SEC
037529,000234: 37,3603 63605 BZMF +2
037530,000235: 37,3604 40000 COM
037531,000236: 37,3605 64715 AD FIVE
037532,000237: 37,3606 00006 EXTEND
037533,000238: 37,3607 63612 BZMF +3 # SET GAMDOT=+0 AS TAG IF TOO SMALL.
037534,000239:
037535,000240: 37,3610 34714 NOGAMDOT CA ZERO # COME HERE INHINTED.
037536,000241: 37,3611 55723 TS GAMDOT
037537,000242: # FOR NOW LEAVE IN 2S,C
037538,000243: # UPDATE ANGLES BY CORRECTING EUILER ANG
037539,000244: # FOR ACCRUED INCREMENT SINCE PIPUP
037540,000245: # R = R EUIL + R(NOW) - R(PIPUP)
037541,000246: 37,3612 40154 CS MPAC # GET (R EUL/180) /2
037542,000247: 37,3613 60000 DOUBLE # POSSIBLE OVERFLOW
037543,000248: 37,3614 03663 TC CORANGOV # CORRECT FOR OVFL IF ANY
037544,000249: 37,3615 00006 EXTEND
037545,000250: 37,3616 61672 SU ROLL/PIP # GET INCR SINCE PIPUP
037546,000251: 37,3617 61664 AD ROLL/180 # ONLY SINGLE OVFL POSSIBLE.
037547,000252: 37,3620 03663 TC CORANGOV # CORRECT FOR OVFL IF ANY
Page 841 |
037549,000254: 37,3621 55770 TS TEMPROLL
037550,000255:
037551,000256: 37,3622 40156 CS MPAC +2 # GET (ALFA EUL/180) /2
037552,000257: 37,3623 60000 DOUBLE # SAME AS FOR ROLL. NEEDED FOR EXT ATM DAP
037553,000258: 37,3624 03663 TC CORANGOV # CORRECT FOR OVFL IF ANY
037554,000259: 37,3625 00006 EXTEND
037555,000260: 37,3626 61673 SU ALFA/PIP
037556,000261: 37,3627 61665 AD ALFA/180
037557,000262: 37,3630 03663 TC CORANGOV # CORRECT FOR OVFL IF ANY
037558,000263: 37,3631 55771 TS TEMPALFA
037559,000264:
037560,000265: 37,3632 40155 CS MPAC +1 # GET (BETA EUL/180) /2
037561,000266: 37,3633 60000 CMTR2 DOUBLE
037562,000267: 37,3634 00006 EXTEND
037563,000268: 37,3635 61674 SU BETA/PIP
037564,000269: 37,3636 61666 AD BETA/180
037565,000270: 37,3637 57772 XCH TEMPBETA # OVFL NOT EXPECTED.
037566,000271:
037567,000272: 37,3640 34744 CA EBANK3
037568,000273: 37,3641 54003 TS EBANK
037569,000274:
037570,000275: 37,3642 E3,1446 EBANK= PHSNAME5
037571,000276: 37,3642 00006 EXTEND
037572,000277: 37,3643 33675 DCA REPOSADR # THIS ASSUMES THAT THE TC PHASCHNG
037573,000278: 37,3644 53447 DXCH PHSNAME5 # IS NOT CHANGED IN OCT 10035
037574,000279: # SERVICER.
037575,000280:
037576,000281: 37,3645 34752 CA EBAOG
037577,000282: 37,3646 54003 TS EBANK
037578,000283:
037579,000284: 37,3647 E6,1661 EBANK= AOG
037580,000285: 37,3647 00006 REDOPOSE EXTEND # RE-STARTS COME HERE
037581,000286: 37,3650 31771 DCA TEMPROLL
037582,000287: 37,3651 53665 DXCH ROLL/180
037583,000288: 37,3652 31772 CA TEMPBETA
037584,000289: 37,3653 55666 TS BETA/180
037585,000290:
037586,000291: 37,3654 00003 RELINT
037587,000292:
037588,000293: 37,3655 06006 TC INTPRET # CANT TC DANZIG AFTER PHASCHNG.
037589,000294: 37,3656 51575 CM/POSE3 VLOAD ABVAL # RETURN FROM CM/ATUP. (RESTART)
037590,000295: 37,3657 01177 VN # 2(-7) M/CS
037591,000296: 37,3660 03723 STORE VMAGI # FOR DISPLAY ON CALL.
037592,000297:
037593,000298: 37,3661 77650 GOTO
037594,000299: 37,3662 03324 POSEXIT # ENDEXIT, STARTENT, OR SCALEPOP.
037595,000300:
037596,000301: 37,3663 54001 CORANGOV TS L
037597,000302: 37,3664 00002 TC Q
037598,000303: 37,3665 50000 INDEX A
Page 842 |
037600,000305: 37,3666 34673 CA LIMITS
037601,000306: 37,3667 26001 ADS L
037602,000307: 37,3670 00002 TC Q # COSTS 2 MCT TO USE. SEE ANGOVCOR.
037603,000308:
037604,000309: 37,3671 45730 53410 -KVSCALE 2DEC -.81491944 # -12800/(2 VS .3048)
037605,000310:
037606,000311: 37,3673 03146 TCDU DEC .1 # TCDU = .1 SEC.
037607,000312:
037608,000313: 37,3674 E6,1661 EBANK= AOG
037609,000314: 37,3674 03647 76066 REPOSADR 2CADR REDOPOSE
037610,000315:
End of include-file CM_BODY_ATTITUDE.agc. Parent file is MAIN.agc