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. |
021624,000002: ## Copyright: Public domain.
021625,000003: ## Filename: R31.agc
021626,000004: ## Purpose: Part of the source code for Colossus, build 249.
021627,000005: ## It is part of the source code for the Command Module's (CM)
021628,000006: ## Apollo Guidance Computer (AGC), for Apollo 9.
021629,000007: ## Assembler: yaYUL
021630,000008: ## Reference: pp. 496-501.
021631,000009: ## Contact: Ron Burkey <info@sandroid.org>.
021632,000010: ## Website: www.ibiblio.org/apollo.
021633,000011: ## Mod history: 08/11/04 RSB. Began adapting from corresponding Luminary131
021634,000012: ## source file.
021635,000013: ## 2010-10-24 JL Fixed indentation of last line (interpretive operand).
021636,000014: ## 2017-01-06 RSB Page numbers now agree with those on the
021637,000015: ## original harcopy, as opposed to the PDF page
021638,000016: ## numbers in 1701.pdf.
021639,000017: ## 2017-01-18 RSB Cross-diff'd comment text (not whitespace)
021640,000018: ## vs the already-proofed corresponding Colossus
021641,000019: ## 237 and Comanche 55 source-code files
021642,000020: ## and corrected errors found.
021643,000021: ##
021644,000022: ## The contents of the "Colossus249" files, in general, are transcribed
021645,000023: ## from a scanned copy of the program listing. Notations on this
021646,000024: ## document read, in part:
021647,000025: ##
021648,000026: ## Assemble revision 249 of AGC program Colossus by NASA
021649,000027: ## 2021111-041. October 28, 1968.
021650,000028: ##
021651,000029: ## This AGC program shall also be referred to as
021652,000030: ## Colossus 1A
021653,000031: ##
021654,000032: ## Prepared by
021655,000033: ## Massachusetts Institute of Technology
021656,000034: ## 75 Cambridge Parkway
021657,000035: ## Cambridge, Massachusetts
021658,000036: ## under NASA contract NAS 9-4065.
021659,000037: ##
021660,000038: ## Refer directly to the online document mentioned above for further information.
021661,000039: ## Please report any errors (relative to the scanned pages) to info@sandroid.org.
021662,000040: ##
021663,000041: ## In some cases, where the source code for Luminary 131 overlaps that of
021664,000042: ## Colossus 249, this code is instead copied from the corresponding Luminary 131
021665,000043: ## source file, and then is proofed to incorporate any changes.
021666,000044:
![]() |
Page 496 |
021668,000046: 34,2002 BANK 34
021669,000047: 35,2000 SETLOC R31
021670,000048: 35,2000 BANK
021671,000049:
021672,000050: 35,3150 COUNT* $$/R31
021673,000051:
021674,000052: 35,3150 34752 R31CALL CAF PRIO3
021675,000053: 35,3151 05042 TC FINDVAC
021676,000054: 35,3152 E4,1770 EBANK= SUBEXIT
021677,000055: 35,3152 03204 72064 2CADR V83CALL
021678,000056:
021679,000057: 35,3154 34734 DSPDELAY CAF 1SEC
021680,000058: 35,3155 04555 TC BANKCALL
021681,000059: 35,3156 01732 CADR DELAYJOB
021682,000060: 35,3157 31044 CA EXTVBACT
021683,000061: 35,3160 74677 MASK BIT12
021684,000062: 35,3161 00006 EXTEND
021685,000063: 35,3162 13154 BZF DSPDELAY
021686,000064:
021687,000065: 35,3163 30105 DISPN5X CA FLAGWRD9 # TEST R31FLAG (IN SUNDANCE R31FLAG WILL
021688,000066: 35,3164 74707 MASK BIT4 # ALWAYS BE SET AS R34 DOES NOT EXIST)
021689,000067: 35,3165 00006 EXTEND
021690,000068: 35,3166 13171 BZF +3
021691,000069: 35,3167 33310 CAF V16N54 # R31 USE NOUN 54
021692,000070: 35,3170 03172 TC +2
021693,000071: 35,3171 33311 CAF V16N53 # R34 USE NOUN 53
021694,000072: 35,3172 04555 TC BANKCALL
021695,000073: 35,3173 20465 CADR GOMARKF
021696,000074: 35,3174 05514 TC B5OFF
021697,000075: 35,3175 05514 TC B5OFF
021698,000076: 35,3176 13163 TCF DISPN5X
021699,000077:
021700,000078: 35,3177 06006 V83 TC INTPRET
021701,000079: 35,3200 77624 CALL
021702,000080: 35,3201 73426 REDOEXTP
021703,000081: 35,3202 77650 GOTO
021704,000082: 35,3203 73207 COMPDISP
021705,000083: 35,3204 06006 V83CALL TC INTPRET
021706,000084: 35,3205 77624 CALL
021707,000085: 35,3206 73312 STATEXTP # EXTRAPOLATE STATE VECTORS
021708,000086: 35,3207 52375 COMPDISP VLOAD VSU
021709,000087: 35,3210 00001 RATT
021710,000088: 35,3211 02327 RONE
021711,000089: 35,3212 51406 PUSH ABVAL # RATT-RONE TO 0D PD= 6
021712,000090: 35,3213 02321 STORE RANGE # METERS B-29
021713,000091: 35,3214 77301 NORM VLOAD
021714,000092: 35,3215 00047 X1 # RATT-RONE PD= 0
021715,000093: 35,3216 77762 VSR1
021716,000094: 35,3217 53457 VSL* UNIT
![]() |
Page 497 |
021718,000096: 35,3220 20201 0,1
021719,000097: 35,3221 52315 PDVL VSU # UNIT(LOS) TO 0D PD= 6
021720,000098: 35,3222 00007 VATT
021721,000099: 35,3223 02335 VONE
021722,000100: 35,3224 77641 DOT # (VATT-VONE).UNIT(LOS) PD= 0
021723,000101: 35,3225 77752 SL1
021724,000102: 35,3226 36323 STCALL RRATE # RANGE RATE M/CS B-7
021725,000103: 35,3227 47432 CDUTRIG # TO INITIALIZE FOR *NBSM*
021726,000104: 35,3230 77624 CALL
021727,000105: 35,3231 62000 R34LOS # NOTE. PDL MUST = 0.
021728,000106: 35,3232 53575 R34ANG VLOAD UNIT
021729,000107: 35,3233 02327 RONE
021730,000108: 35,3234 77715 PDVL # UR TO 0D PD= 6
021731,000109: 35,3235 15330 THISAXIS # UNITX FOR CM, UNITZ FOR LM
021732,000110: 35,3236 77214 BON VLOAD # CHK R31FLAG. ON=R31 THETA, OFF=R34 PHI
021733,000111: 35,3237 04713 R31FLAG
021734,000112: 35,3240 73242 +2 # R31-THETA
021735,000113: 35,3241 00015 12D
021736,000114: 35,3242 77624 CALL
021737,000115: 35,3243 47601 *NBSM*
021738,000116: 35,3244 41505 VXM PUSH # UXORZ TO 6D PD=12D
021739,000117: 35,3245 01736 REFSMMAT
021740,000118: 35,3246 72431 VPROJ VSL2
021741,000119: 35,3247 00001 0D
021742,000120: 35,3250 53445 BVSU UNIT
021743,000121: 35,3251 00007 6D
021744,000122: 35,3252 47315 PDVL VXV # UP/2 TO 12D PD=18D
021745,000123: 35,3253 02327 RONE
021746,000124: 35,3254 02335 VONE
021747,000125: 35,3255 47256 UNIT VXV
021748,000126: 35,3256 02327 RONE
021749,000127: 35,3257 63241 DOT PDVL # SIGN TO 12D, UP/2 TO MPAC PD=18D
021750,000128: 35,3260 00015 12D
021751,000129: 35,3261 50372 VSL1 DOT # UP.UXORZ
021752,000130: 35,3262 00007 6D
021753,000131: 35,3263 72565 SIGN SL1
021754,000132: 35,3264 00015 12D
021755,000133: 35,3265 77726 ACOS
021756,000134: 35,3266 26325 STOVL RTHETA
021757,000135: 35,3267 02327 RONE
021758,000136: 35,3270 51041 DOT BPL
021759,000137: 35,3271 00007 6D
021760,000138: 35,3272 73277 +5
021761,000139: 35,3273 44345 DLOAD BDSU # IF UXORZ.R NEG, RTHETA = 1 - RTHETA
021762,000140: 35,3274 02325 RTHETA
021763,000141: 35,3275 15340 DPPOSMAX
021764,000142: 35,3276 02325 STORE RTHETA # RTHETA BETWEEN 0 AND 1 REV.
021765,000143: 35,3277 77776 EXIT
021766,000144: 35,3300 34706 CAF BIT5 # HAVE WE BEEN ANSWERED
021767,000145: 35,3301 71044 MASK EXTVBACT
![]() |
Page 498 |
021769,000147: 35,3302 00006 EXTEND
021770,000148: 35,3303 15423 BZF ENDEXT # YES, DIE
021771,000149:
021772,000150: 35,3304 41044 CS EXTVBACT
021773,000151: 35,3305 74677 MASK BIT12
021774,000152: 35,3306 27044 ADS EXTVBACT
021775,000153:
021776,000154: 35,3307 13177 TCF V83
021777,000155: 35,3310 04066 V16N54 VN 1654
021778,000156: 35,3311 04065 V16N53 VN 1653
021779,000157:
![]() |
Page 499 |
021781,000159: # THE STATEXTP SUBROUTINE DOES A PRECISION EXTRAPOLATION OF BOTH VEHICLES
021782,000160: # STATE VECTORS TO PRESENT TIME AND SAVES THEM AS BASE VECTORS.
021783,000161: # IF SERVICER IS OFF ---
021784,000162: # THIS VEHICLES BASE VECTOR IS CONIC EXTRAPOLATED TO
021785,000163: # PRESENT TIME AND SAVED AS RONE, VONE.
021786,000164: # THE OTHER VEHICLES BASE VECTOR IS CONIC EXTRAPOLATED
021787,000165: # TO THE SAME TIME, THE OUTPUT BEING LEFT IN RATT, VATT.
021788,000166: # IF SERVICER IS ON ---
021789,000167: # RONE, VONE ARE SET EQUAL TO RN, VN AND THE OTHER
021790,000168: # VEHICLES STATE VECTOR IS PREC. EXTRAPOLATED TO PIPTIME.
021791,000169:
021792,000170: 35,3312 47020 STATEXTP STQ RTB
021793,000171: 35,3313 00112 STATEXIT
021794,000172: 35,3314 45505 LOADTIME
021795,000173: 35,3315 34041 STCALL TDEC1
021796,000174: 35,3316 27036 OTHPREC # GET BASE VECTORS
021797,000175: 35,3317 77775 VLOAD
021798,000176: 35,3320 00017 RATT1
021799,000177: 35,3321 26225 STOVL BASEOTP # OTHER POS.
021800,000178: 35,3322 00025 VATT1
021801,000179: 35,3323 16241 STODL BASEOTV # OTHER VEL.
021802,000180: 35,3324 00015 TAT
021803,000181: 35,3325 02272 STORE BASETIME
021804,000182: 35,3326 34041 STCALL TDEC1
021805,000183: 35,3327 27022 THISPREC
021806,000184: 35,3330 77775 VLOAD
021807,000185: 35,3331 00017 RATT1
021808,000186: 35,3332 26255 STOVL BASETHP # THIS POS.
021809,000187: 35,3333 00025 VATT1
021810,000188: 35,3334 02263 STORE BASETHV # THIS VEL
021811,000189: 35,3335 47014 HAVEBASE BON RTB
021812,000190: 35,3336 03711 V37FLAG
021813,000191: 35,3337 73413 GETRVN # IF AVG ON ,GET RN ETC.
021814,000192: 35,3340 45505 LOADTIME
021815,000193: 35,3341 34041 STCALL TDEC1 # BEGIN SET UP FOR CONIC EXTRAP. FOR THIS.
021816,000194: 35,3342 27371 INTSTALL
021817,000195: 35,3343 43175 VLOAD CLEAR
021818,000196: 35,3344 02255 BASETHP
021819,000197: 35,3345 00263 MOONFLAG
021820,000198: 35,3346 25535 STOVL RCV
021821,000199: 35,3347 02263 BASETHV
021822,000200: 35,3350 15543 STODL VCV
021823,000201: 35,3351 02272 BASETIME
021824,000202: 35,3352 43014 BOF SET # GET APPROPRIATE MOONFLAG SETTING
021825,000203: 35,3353 04343 MOONTHIS
021826,000204: 35,3354 73356 +2
021827,000205: 35,3355 00063 MOONFLAG
021828,000206: 35,3356 77614 SET
021829,000207: 35,3357 01473 INTYPFLG # CONIC EXTRAP.
021830,000208: 35,3360 35517 STCALL TET
021831,000209: 35,3361 27066 INTEGRVS # INTEGRATION --- AT LAST---
![]() |
Page 500 |
021833,000211: 35,3362 77775 VLOAD
021834,000212: 35,3363 00001 RATT
021835,000213: 35,3364 26327 STOVL RONE
021836,000214: 35,3365 00007 VATT
021837,000215: 35,3366 36335 STCALL VONE # GET SET FOR CONIC EXTRAP., OTHER.
021838,000216: 35,3367 27371 INTSTALL
021839,000217: 35,3370 71214 SET DLOAD
021840,000218: 35,3371 01473 INTYPFLG
021841,000219: 35,3372 00015 TAT
021842,000220: 35,3373 00041 OTHINT STORE TDEC1
021843,000221: 35,3374 43175 VLOAD CLEAR
021844,000222: 35,3375 02225 BASEOTP
021845,000223: 35,3376 00263 MOONFLAG
021846,000224: 35,3377 25535 STOVL RCV
021847,000225: 35,3400 02241 BASEOTV
021848,000226: 35,3401 15543 STODL VCV
021849,000227: 35,3402 02272 BASETIME
021850,000228: 35,3403 43014 BOF SET
021851,000229: 35,3404 04343 MOONTHIS
021852,000230: 35,3405 73407 +2
021853,000231: 35,3406 00063 MOONFLAG
021854,000232: 35,3407 35517 STCALL TET
021855,000233: 35,3410 27066 INTEGRVS
021856,000234: 35,3411 77650 GOTO
021857,000235: 35,3412 00112 STATEXIT # THIS VEHICLES POS.,VEL. IN PUSHLIST.
021858,000236:
021859,000237: 35,3413 77775 GETRVN VLOAD
021860,000238: 35,3414 01171 RN
021861,000239: 35,3415 26327 STOVL RONE
021862,000240: 35,3416 01177 VN
021863,000241: 35,3417 16335 STODL VONE
021864,000242: 35,3420 01205 PIPTIME
021865,000243: 35,3421 77624 CALL
021866,000244: 35,3422 27371 INTSTALL
021867,000245: 35,3423 52014 CLEAR GOTO
021868,000246: 35,3424 01673 INTYPFLG # PREC EXTRAP FOR OTHER
021869,000247: 35,3425 73373 OTHINT
021870,000248:
021871,000249: 35,3426 52020 REDOEXTP STQ GOTO
021872,000250: 35,3427 00112 STATEXIT
021873,000251: 35,3430 73335 HAVEBASE
021874,000252: 31,2000 SETLOC R34
021875,000253: 31,2000 BANK
021876,000254: 31,2000 77776 R34LOS EXIT
021877,000255: 31,2001 30036 CA CDUS
021878,000256: 31,2002 50120 INDEX FIXLOC
021879,000257: 31,2003 54011 TS 9D
021880,000258: 31,2004 30035 CA CDUT
021881,000259: 31,2005 50120 INDEX FIXLOC
021882,000260: 31,2006 54013 TS 11D
![]() |
Page 501 |
021884,000262: 31,2007 30120 CA FIXLOC
021885,000263: 31,2010 66211 AD SIX
021886,000264: 31,2011 40000 COM
021887,000265: 31,2012 50120 INDEX FIXLOC
021888,000266: 31,2013 54046 TS X1
021889,000267: 31,2014 06006 TC INTPRET
021890,000268: 31,2015 77624 CALL
021891,000269: 31,2016 46000 SXTNB
021892,000270: 31,2017 34015 STCALL 12D
021893,000271: 31,2020 73232 R34ANG
021894,000272:
End of include-file R31.agc. Parent file is MAIN.agc