Source Code
These source-code files are part of a reconstructed copy of Comanche 51, the
initial release (though not the final mission release) of the Apollo 11
Command Module (CM) Apollo Guidance Computer (AGC) software. The flown, final
release was Comanche 55. The reconstruction is believed to be exactly accurate,
but in the absence of an actual Apollo-era listing of Comanche 51, some
explanation of the reconstruction process is needed to insure confidence in
that accuracy.
The starting point was the source code of Comanche 55, whose original source code is available. Comanche 55 source code was then modified by undoing changes known to have been made between revisions 51 and 55. The most-significant steps involved reverting changes related to the R-2 lunar potential model, the details of which were known from the previous, separate, independent reconstruction of the Apollo 10 Lunar Module software Luminary 69/2. The now-reconstructed Comanche 51 source code was verified by assembling it and checking that the assembled code had the expected known-correct memory-bank checksums. Note that page numbers in the reconstructed code match those on the Comanche 55 or Luminary 69 printouts, although the source code would likely have different page numbers in a contemporary Comanche 51 listing. Annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change relative to Comanche 55. Here's a guide to some of the Apollo documentation relevant to those annotations:
Comments expected to have been present in the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". Report any errors noted by creating an issue report at the Virtual AGC Project's GitHub repository. |
041740,000002: ## Copyright: Public domain.
041741,000003: ## Filename: TVCRESTARTS.agc
041742,000004: ## Purpose: A section of Comanche revision 051.
041743,000005: ## It is part of the reconstructed source code for the
041744,000006: ## original release of the flight software for the Command
041745,000007: ## Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
041746,000008: ## The code has been recreated from a copy of Comanche 055. It
041747,000009: ## has been adapted such that the resulting bugger words
041748,000010: ## exactly match those specified for Comanche 51 in NASA drawing
041749,000011: ## 2021153D, which gives relatively high confidence that the
041750,000012: ## reconstruction is correct.
041751,000013: ## Reference: pp. 956-960
041752,000014: ## Assembler: yaYUL
041753,000015: ## Contact: Ron Burkey <info@sandroid.org>.
041754,000016: ## Website: www.ibiblio.org/apollo/index.html
041755,000017: ## Mod history: 2019-07-30 MAS Created from Comanche 55.
041756,000018:
Page 956 |
041758,000020: # NAME....TVCRESTART PACKAGE, CONSISTING OF REDOTVC, ENABL1, 2, CMDSOUT, PHSCHK2, ETC.
041759,000021: # LOG SECTION...TVCRESTARTS SUBROUTINE...DAPCSM
041760,000022: # MODIFIED BY SCHLUNDT 21 OCTOBER 1968
041761,000023:
041762,000024: # FUNCTIONAL DESCRIPTION....
041763,000025:
041764,000026: # *RESTART-PROOFS THE TVC DAPS, INCLUDING PITCHDAP, YAWDAP,
041765,000027: # TVCEXECUTIVE, ROLLDAP, TVCINIT4, TVCDAPON, AND CSM/.M V46 SWTCHOVR.
041766,000028:
041767,000029: # *TVC RESTARTS DESERVE SPECIAL CONSIDERATION IN SEVERAL AREAS.
041768,000030: # RESTART DOWN-TIME IS IMPORTANT BECAUSE OF THE TRANSIENTS INTRODUCED
041769,000031: # BY THE THRUST VECTOR RETURN TO THE ACTUATOR MECHANICAL NULLS
041770,000032: # FOLLOWING TVC- AND OPTICS-ERROR-COUNTER-DISENABLES (CHANNEL 12).
041771,000033: # TVC USES A MIXTURE OF WAITLIST, T5, T6, AND JOB CALLS. THERE IS
041772,000034: # FILTER MEMORY (UP TO 6TH ORDER) TO BE PROTECTED IF WILD TRANSIENTS
041773,000035: # ARE TO BE AVOIDED. COUNTERS ARE INVOLVED FOR ONE-SHOT
041774,000036: # CORRECTIONS AND GAIN UPDATES. THE GIMBAL TRIM ESTIMATORS AND THE
041775,000037: # BODY AXIS ATTITUDE ERROR INTEGRATORS INVOLVE DIGITAL SUMMATION.
041776,000038: # DIGITAL DIFFERENTIATORS ARE INVOLVED IN THE BODY AXIS RATE ESTIMA-
041777,000039: # TIONS AND IN THE OUTPUTTING OF ACTUATOR COMMANDS. THERE IS AN
041778,000040: # OFFSET-TRACKER-FILTER TO PROTECT. ETC., ETC.
041779,000041:
041780,000042: # *THOSE QUANTITIES WHICH MUST BE PROTECTED ARE STORED IN TEMPORARY
041781,000043: # REGISTERS AS THEY ARE COMPUTED, FOR UPDATING THE REAL REGISTERS
041782,000044: # DURING COPYCYCLES.
041783,000045:
041784,000046: # *THE SEVERAL COPYCYCLES ARE EACH PROTECTED BY PHASE POINTS AT THEIR
041785,000047: # BEGINNING AND AT THEIR TERMINATION. THE PHASE POINTS ARE SIMPLY
041786,000048: # ..INCR.. INSTRUCTIONS, EITHER ..INCR TVCEXPHS.. FOR COPYCYCLES
041787,000049: # IN THE TVCEXECUTIVE, OR ..INCR TVCPHASE.. FOR THE PITCH AND YAW
041788,000050: # COPYCYCLES. INDEXING ON EACH OF THESE POINTERS THEN PERMITS A
041789,000051: # RETURN TO THE APPROPRIATE RESTART POINTS.
041790,000052:
041791,000053: # *IF A RESTART OCCURS DURING EITHER COPYCYCLE, THAT COPYCYCLE IS
041792,000054: # COMPLETED. THEN THE NORMAL TVCINIT4....DAPINIT....PITCHDAP STARTUP
041793,000055: # SEQUENCE IS CALLED UPON TO GET THINGS GOING AGAIN.
041794,000056:
041795,000057: # *TVC-ENABLE AND OPTICS-ERROR-COUNTER ENABLE MUST BE SET ASAP
041796,000058: # (ALLOWING FOR PROCEDURAL DELAYS). THEN THE ENGINES ARE COMMANDED
041797,000059: # TO THE P,YACTOFF TRIM VALUES. THE DAPS ARE THEN READY TO GO ON THE
041798,000060: # AIR, WITH THE REGULAR STARTUP SEQUENCE, EITHER AT MRCLEAN FOR A
041799,000061: # COMPLETE INITIALIZATION OR AT TVCINIT4 FOR A PARTIAL INITIALIZATION
041800,000062:
041801,000063: # *FOR RESTARTS PRIOR TO THE SETTING OF THE T5 BITS AT DOTVCON THE
041802,000064: # PRE40.6 SECTION OF S40.6 TAKES CARE OF RE-ESTABLISHING TRIMS.
041803,000065:
041804,000066: # *IF A RESTART OCCURS DURING THE TVCEXEC....TVCEXFIN SEQUENCE THE
041805,000067: # COMPUTATIONS WILL BE COMPLETED, STARTING AT THE APPROPRIATE RESTART
041806,000068: # POINT, AFTER THE DAPS ARE READY TO GO ON THE AIR.
041807,000069:
041808,000070: # *IF A RESTART OCCURS PRIOR TO TVCINIT4 (TVCPHASE = -1) E.G. DURING
041809,000071: # THE EARLY DAP INITIALIZATION PHASE, THE DAP STARTUP SEQUENCE IS
041810,000072: # ENTERED AT MRCLEAN FOR A FULL INITIALIZATION.
041811,000073:
041812,000074: # *FOR RESTARTS DURING CSM/LM V46 SWITCH-OVER, TVCPHASE IS SET TO -2.
041813,000075: # AND THE RESTART LOGIC GOES BACK TO REDO SWITCH-OVER (AFTER THE
041814,000076: # NORMAL DAP RESTART SEQUENCE IS FOLLOWED).
041815,000077:
041816,000078: # *RESTARTS ARE NOT CRITICAL TO THE ROLL DAP PERFORMANCES HENCE THE
041817,000079: # THE ROLL DAP IS MERELY RESTARTED.
041818,000080:
041819,000081: # *RESTARTS DURING A STROKE TEST (STROKER IS NON-ZERO) WILL CAUSE THE
Page 957 |
041821,000083: # STROKE TEST TO BE TERMINATED. A NEW V68 ENTRY WILL BE REQUIRED
041822,000084: # TO GET IT GOING AGAIN (NO AUTOMATIC RESTART).
041823,000085: #
041824,000086: # *REDOTVC IS REACHED FOLLOWING ANY RESTART WHICH FINDS THE T5 BITS
041825,000087: # (BITS 15,14 OF FLAGWRD6) SET FOR TVC. DOTVCON SETS TVCPHASE = -1
041826,000088: # AND TVC EXPHS = 0 JUST BEFORE SETTING THESE BITS, JUST BEFORE
041827,000089: # MAKING THE T5 CALL TO TVCDAPON. ON A NORMAL SHUTDOWN DOTVCRCS
041828,000090: # CALLS RCSDAPON, WHICH RESETS THE T5 BITS FOR RCS.
041829,000091:
041830,000092: # CALLING SEQUENCE....T5, IN PARTICULAR BY ELRSKIP OF FRESH START/RESTART
041831,000093:
041832,000094: # NORMAL EXIT MODES....RESUME, NOQRSM, POSTJUMP (TO TVCINIT4 OR MRCLEAN)
041833,000095:
041834,000096: # ALARM OR ABORT EXIT MODES....NONE
041835,000097:
041836,000098: # SUBROUTINES CALLED....
041837,000099:
041838,000100: # *PCOPY+1, YCOPY+1 (PITCH AND YAW COPYCYCLES)
041839,000101: # *ENABLE1,2, CMDSOUT (RE-ESTABLISH ACTUATOR TRIMS)
041840,000102: # *MRCLEAN OR TVCINIT4 (TVCDAP INITIALIZATIONS)
041841,000103: # *SWICHOVR +5 (CSM/LM V46 SWITCH-OVER)
041842,000104: # *EXRSTRT AND TVCEXECUTIVE PHASE POINTS 1 THRU 6
041843,000105: # *WAITLIST, IBNKCALL, POSTJUMP, ISWCALL
041844,000106:
041845,000107: # OTHER INTERFACES....DOTVCON AND RCSDAPON (T5 BITS), ELRSKIP (CALLS IT)
041846,000108:
041847,000109: # ERASABLE INITIALIZATION REQUIRED....
041848,000110:
041849,000111: # *T5 BITS (1,0), TVCPHASE (-2,-1,0,1,2,3), TVCEXPHS (1 THRU 6)
041850,000112: # *TVC DAP VARIABLES
041851,000113: # *OPERATIONS PERFORMED BY REDOTVC ARE BASED ON THE ASSUMPTION THAT
041852,000114: # THE TVC DAPS ARE RUNNING NORMALLY
041853,000115:
041854,000116: # OUTPUT....
041855,000117:
041856,000118: # *PITCH AND YAW TVC DAP COPYCYCLES COMPLETED IF INTERUPTED
041857,000119: # *TVCEXECUTIVE COMPLETED IF INTERUPTED
041858,000120: # *STROKE TEST TERMINATED IF INTERRUPTED
041859,000121: # *CSM/LM V46 SWITCH-OVER REPEATED IF INTERRUPTED
041860,000122: # *ACTUATOR TRIMS RE-ESTABLISHED (ACTUATORS BACK ON THE AIR)
041861,000123: # *TVC DAP INITIALIZATION AS REQUIRED
041862,000124: # *ALL TVC DAP OPERATIONS ON THE AIR
041863,000125:
041864,000126: # DEBRIS....TVC TEMPORARIES IN EBANK6
041865,000127:
Page 958 |
041867,000129:
041868,000130: 16,3140 BANK 16
041869,000131: 16,2000 SETLOC DAPROLL
041870,000132: 16,2000 BANK
041871,000133: 16,3140 E6,1644 EBANK= TVCPHASE
041872,000134: 16,3140 COUNT* $$/RSRT
041873,000135:
041874,000136: 16,3140 22016 REDOTVC LXCH BANKRUPT # TVC RESTART PACKAGE
041875,000137: 16,3141 00006 EXTEND
041876,000138: 16,3142 22012 QXCH QRUPT # (..TCR.. IN ..FINCOPY..)
041877,000139:
041878,000140: 16,3143 11651 EXECPHS CCS TVCEXPHS # CHECK TVCEXECUTIVE PHASE
041879,000141: 16,3144 13146 TCF +2 # MUST RESTART TVCEXECUTIVE
041880,000142: 16,3145 13152 TCF TVCDAPHS # NO NEED TO RESTART TVCEXECUTIVE
041881,000143:
041882,000144: 16,3146 34334 CAF NINE # 9CS DELAY TO FORCE EXRSTRT TO OCCUR
041883,000145: 16,3147 05245 TC WAITLIST # BEFORE PITCHDAP, AFTER CMDSOUT
041884,000146: 16,3150 E6,1651 EBANK= TVCEXPHS
041885,000147: 16,3150 03253 34066 2CADR EXRSTRT
041886,000148:
041887,000149: 16,3152 47700 TVCDAPHS CS OCT37776 # CHECK BITS 15 AND 1 OF TVCPHASE TO SEE
041888,000150: 16,3153 71644 MASK TVCPHASE # DAP RESTART LOCATION (-1,1,2,3)
041889,000151: 16,3154 10000 CCS A
041890,000152: 16,3155 13240 TCF FINCOPY # FINISH THE COPYCYCLE FIRST
041891,000153: 16,3156 13163 TCF ENABL1 # JUST PREPARE THE OUTCOUNTERS AND GO
041892,000154:
041893,000155: 16,3157 41644 CS TVCPHASE # TEST FOR TVCPHASE = -2
041894,000156: 16,3160 75016 MASK BIT2 # (THIS INDICATES RESTART OCCURRED
041895,000157: 16,3161 00006 EXTEND # DURING CSM/LM V46 SWITCH-OVER)
041896,000158: 16,3162 13244 BZF TRIM/CMD # NO, TVCPHASE = -1, RSTRT WAS IN TVCINIT
041897,000159:
041898,000160: 16,3163 35010 ENABL1 CAF BIT8 # TVC ENABLE, FOLLOWED BY 40 MS (MIN) WAIT
041899,000161: 16,3164 65005 AD BIT11 # SET BIT FOR OPTICS-DAC-ENABLE ALSO
041900,000162: 16,3165 00006 EXTEND # (ENABL1 ENTERED FROM TVCDAPHS / FINCOPY)
041901,000163: 16,3166 05012 WOR CHAN12
041902,000164: 16,3167 33257 CAF TVCADDR # WAIT, CALLING ENABL2 (BBCON THERE)
041903,000165: 16,3170 55312 TS T5LOC
041904,000166: 16,3171 33263 CAF TVCADDR +4 # 60 MS (TVCEXADR)
041905,000167: 16,3172 54030 TS TIME5
041906,000168:
041907,000169: 16,3173 15333 TCF RESUME
041908,000170:
041909,000171: 16,3174 22016 ENABL2 LXCH BANKRUPT # CONTINUE PREPARATION OF OUTCOUNTERS
041910,000172:
041911,000173: 16,3175 35016 CAF BIT2 # OPTICS ERROR CNTR ENABLE, 4MS MIN WAIT
041912,000174: 16,3176 00006 EXTEND
041913,000175: 16,3177 05012 WOR CHAN12
Page 959 |
041915,000177: 16,3200 33261 CAF TVCADDR +2 # WAIT, CALLING CMDSOUT (BBCON THERE)
041916,000178: 16,3201 55312 TS T5LOC
041917,000179: 16,3202 37700 CAF OCT37776 # 20MS
041918,000180: 16,3203 54030 TS TIME5
041919,000181:
041920,000182: 16,3204 15335 TCF NOQRSM
041921,000183:
041922,000184: 16,3205 22016 CMDSOUT LXCH BANKRUPT # CONTINUE PREPARATION OF OUTCOUNTERS
041923,000185: 16,3206 00006 EXTEND
041924,000186: 16,3207 22012 QXCH QRUPT
041925,000187:
041926,000188: 16,3210 45021 CS ZERO # MOST RECENT ACTUATOR COMMANDS
041927,000189: 16,3211 61623 AD PCMD # (AVOID +0)
041928,000190: 16,3212 54054 TS TVCPITCH
041929,000191: 16,3213 45021 CS ZERO
041930,000192: 16,3214 61624 AD YCMD
041931,000193: 16,3215 54053 TS TVCYAW
041932,000194:
041933,000195: 16,3216 35062 CAF PRIO6 # RELEASE THE COUNTERS (BITS 11,12)
041934,000196: 16,3217 00006 EXTEND
041935,000197: 16,3220 05014 WOR CHAN14
041936,000198:
041937,000199: 16,3221 11644 PHSCHK2 CCS TVCPHASE # CHECK TVCPHASE AGAIN
041938,000200: 16,3222 13232 TCF CHKSTRK
041939,000201: 16,3223 13232 TCF CHKSTRK
041940,000202: 16,3224 10000 CCS A # A CONTAINS THE DIMINISHED ABSOLUTE OF
041941,000203: 16,3225 03230 TC +3 # TVCPHASE (-2 BECOMES +1. -1 BECOMES +0)
041942,000204:
041943,000205: 16,3226 04701 TC POSTJUMP # REPEAT TVC INITIALIZATION
041944,000206: 16,3227 36152 CADR MRCLEAN # (DO NOT RETURN)
041945,000207:
041946,000208: 16,3230 04740 +3 TC IBNKCALL # REPEAT CSM/LM V46 SWITCH-OVER
041947,000209: 16,3231 36361 CADR SWICHOVR +5 # (RETURN TO CHECK FOR STROKE TEST)
041948,000210:
041949,000211: 16,3232 11574 CHKSTRK CCS STROKER # CHECK FOR STROKE TEST IN PROGRESS
041950,000212: 16,3233 13250 TCF TSTINITJ # YES, KILL IT
041951,000213: 16,3234 13236 TCF +2 # NO, PROCEED
041952,000214: 16,3235 13250 TCF TSTINITJ # YES, KILL IT
041953,000215:
041954,000216: 16,3236 04701 +4 TC POSTJUMP # IF POSITIVE OR ZERO, RESTART AT
041955,000217: 16,3237 36324 CADR TVCINIT4 # TVCINIT4 (ZEROS TVCPHASE, AND
041956,000218: # CALLS TVC DAPS VIA DAPINIT)
041957,000219: 16,3240 51644 FINCOPY INDEX TVCPHASE # PICK UP THE APPROPRIATE COPYCYCLE
041958,000220: 16,3241 33257 CAF TVCCADR
041959,000221: 16,3242 04744 TCR ISWCALL # RE-ENTER THE COPYCYCLE, RETURN AT END
041960,000222: 16,3243 13163 TCF ENABL1 # NOW PREPARE THE OUTCOUNTERS
041961,000223:
041962,000224: 16,3244 00006 TRIM/CMD EXTEND # TVCDAPON INITIALIZATION NOT COMPLETED,
Page 960 |
041964,000226: 16,3245 31424 DCA PACTOFF # EG. P,YCMD MAY NOT BE SET. SET...
041965,000227: 16,3246 53624 DXCH PCMD
041966,000228: 16,3247 13163 TCF ENABL1 # NOW PREPARE THE OUTCOUNTERS
041967,000229:
041968,000230: 16,3250 35021 TSTINITJ CAF ZERO # DISABLE STROKE TEST (-0 SHOWS PRIOR V68)
041969,000231: 16,3251 55574 TS STROKER # (+0 MEANS NEW V68 REQUIRED FOR STARTUP)
041970,000232:
041971,000233: 16,3252 13236 TCF CHKSTRK +4
041972,000234:
041973,000235: 16,3253 51651 EXRSTRT INDEX TVCEXPHS # TVCEXECUTIVE RESTARTS....GO TO
041974,000236: 16,3254 33263 CAF TVCEXADR # APPROPRIATE RESTART POINT
041975,000237: 16,3255 50000 INDEX A
041976,000238: 16,3256 10000 TCF 0
041977,000239:
041978,000240: # TVC RESTART TABLES.... ORDER IS REQUIRED. HI-ORDER WORDS ONLY, OF 2CADRS, SINCE BBCON IS ALREADY THERE.
041979,000241:
041980,000242: 16,3257 16,3257 TVCADDR = TVCCADR # TABLE OF CADRS, UNUSED LOCS FOR GENADRS
041981,000243: 16,3257 03174 TVCCADR GENADR ENABL2 # (FOR T5 CALL, UNUSED TABLE LOC)
041982,000244: 16,3260 40675 +1 CADR PCOPY +1 # PITCH COPYCYCLE
041983,000245: 16,3261 03205 +2 GENADR CMDSOUT # (FOR T5 CALL, UNUSED TABLE LOC)
041984,000246: 16,3262 41051 +3 CADR YCOPY +1 # YAW COPYCYCLE
041985,000247: 16,3263 37772 TVCEXADR OCT 37772 # (UNUSED TABLE LOC, FILL WITH 60MS, T5)
041986,000248: 16,3264 03003 +1 GENADR EXECCOPY +1 # TVCEXECUTIVE RESTART POINTS (ORDERED)
041987,000249: 16,3265 03011 +2 GENADR 1SHOTCHK
041988,000250: 16,3266 03040 +3 GENADR TEMPSET
041989,000251: 16,3267 03043 +4 GENADR CORSETUP
041990,000252: 16,3270 03121 +5 GENADR CORCOPY +1
041991,000253: 16,3271 03132 +6 GENADR CNTRCOPY
End of include-file TVCRESTARTS.agc. Parent file is MAIN.agc