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