Source Code
These source-code files are part of a reconstructed copy of Comanche 72/3 (AKA Manche72 revision 3),
the final, flown mission release of the Apollo Guidance Computer (AGC) Command Module (CM) software
for Apollo 13.
The starting point was the source code of Comanche 72 (itself previously reconstructed). Comanche 72 source code was then modified by incorporating changes known from contemporary documentation to have been made between revisions 72 and 72/3. The resulting code assembles to have identical memory-bank checksums as those specified in NASA drawing 2021153G; this gives reasonably high confidence that the changes that have been made are correct. In places where ambiguity exists, this ambiguity is discussed in "## Reconstruction:" comments. Since no contemporary listings of Comanche 72/3 are available as source material, all comments and labels are approximate. They have been taken from other AGC programs where possible, or, in some places, written from scratch to match what we believe would have been in the original listing. |
041046,000002: ## Copyright: Public domain.
041047,000003: ## Filename: TVCRESTARTS.agc
041048,000004: ## Purpose: A section of Manche72 revision 3.
041049,000005: ## It is part of the reconstructed source code for the final, flown
041050,000006: ## release of the software for the Command Module's (CM) Apollo
041051,000007: ## Guidance Computer (AGC) for Apollo 13. No original listings
041052,000008: ## of this program are available; instead, this file was recreated
041053,000009: ## from a reconstructed copy of Comanche 072. It has been adapted
041054,000010: ## such that the resulting bugger words exactly match those
041055,000011: ## specified for Manche72 revision 3 in NASA drawing 2021153G,
041056,000012: ## which gives relatively high confidence that the reconstruction
041057,000013: ## is correct.
041058,000014: ## Assembler: yaYUL
041059,000015: ## Contact: Ron Burkey <info@sandroid.org>.
041060,000016: ## Website: www.ibiblio.org/apollo/index.html
041061,000017: ## Mod history: 2024-05-19 MAS Created from Comanche 072.
041062,000018:
041063,000019: # NAME....TVCRESTART PACKAGE, CONSISTING OF REDOTVC, ENABL1, 2, CMDSOUT, PHSCHK2, ETC.
041064,000020: # LOG SECTION...TVCRESTARTS SUBROUTINE...DAPCSM
041065,000021: # MODIFIED BY SCHLUNDT 21 OCTOBER 1968
041066,000022:
041067,000023: # FUNCTIONAL DESCRIPTION....
041068,000024:
041069,000025: # *RESTART-PROOFS THE TVC DAPS, INCLUDING PITCHDAP, YAWDAP,
041070,000026: # TVCEXECUTIVE, ROLLDAP, TVCINIT4, TVCDAPON, AND CSM/.M V46 SWTCHOVR.
041071,000027:
041072,000028: # *TVC RESTARTS DESERVE SPECIAL CONSIDERATION IN SEVERAL AREAS.
041073,000029: # RESTART DOWN-TIME IS IMPORTANT BECAUSE OF THE TRANSIENTS INTRODUCED
041074,000030: # BY THE THRUST VECTOR RETURN TO THE ACTUATOR MECHANICAL NULLS
041075,000031: # FOLLOWING TVC- AND OPTICS-ERROR-COUNTER-DISENABLES (CHANNEL 12).
041076,000032: # TVC USES A MIXTURE OF WAITLIST, T5, T6, AND JOB CALLS. THERE IS
041077,000033: # FILTER MEMORY (UP TO 6TH ORDER) TO BE PROTECTED IF WILD TRANSIENTS
041078,000034: # ARE TO BE AVOIDED. COUNTERS ARE INVOLVED FOR ONE-SHOT
041079,000035: # CORRECTIONS AND GAIN UPDATES. THE GIMBAL TRIM ESTIMATORS AND THE
041080,000036: # BODY AXIS ATTITUDE ERROR INTEGRATORS INVOLVE DIGITAL SUMMATION.
041081,000037: # DIGITAL DIFFERENTIATORS ARE INVOLVED IN THE BODY AXIS RATE ESTIMA-
041082,000038: # TIONS AND IN THE OUTPUTTING OF ACTUATOR COMMANDS. THERE IS AN
041083,000039: # OFFSET-TRACKER-FILTER TO PROTECT. ETC., ETC.
041084,000040:
041085,000041: # *THOSE QUANTITIES WHICH MUST BE PROTECTED ARE STORED IN TEMPORARY
041086,000042: # REGISTERS AS THEY ARE COMPUTED, FOR UPDATING THE REAL REGISTERS
041087,000043: # DURING COPYCYCLES.
041088,000044:
041089,000045: # *THE SEVERAL COPYCYCLES ARE EACH PROTECTED BY PHASE POINTS AT THEIR
041090,000046: # BEGINNING AND AT THEIR TERMINATION. THE PHASE POINTS ARE SIMPLY
041091,000047: # ..INCR.. INSTRUCTIONS, EITHER ..INCR TVCEXPHS.. FOR COPYCYCLES
041092,000048: # IN THE TVCEXECUTIVE, OR ..INCR TVCPHASE.. FOR THE PITCH AND YAW
041093,000049: # COPYCYCLES. INDEXING ON EACH OF THESE POINTERS THEN PERMITS A
041094,000050: # RETURN TO THE APPROPRIATE RESTART POINTS.
041095,000051:
041096,000052: # *IF A RESTART OCCURS DURING EITHER COPYCYCLE, THAT COPYCYCLE IS
041097,000053: # COMPLETED. THEN THE NORMAL TVCINIT4....DAPINIT....PITCHDAP STARTUP
041098,000054: # SEQUENCE IS CALLED UPON TO GET THINGS GOING AGAIN.
041099,000055:
041100,000056: # *TVC-ENABLE AND OPTICS-ERROR-COUNTER ENABLE MUST BE SET ASAP
041101,000057: # (ALLOWING FOR PROCEDURAL DELAYS). THEN THE ENGINES ARE COMMANDED
041102,000058: # TO THE P,YACTOFF TRIM VALUES. THE DAPS ARE THEN READY TO GO ON THE
041103,000059: # AIR, WITH THE REGULAR STARTUP SEQUENCE, EITHER AT MRCLEAN FOR A
041104,000060: # COMPLETE INITIALIZATION OR AT TVCINIT4 FOR A PARTIAL INITIALIZATION
041105,000061:
041106,000062: # *FOR RESTARTS PRIOR TO THE SETTING OF THE T5 BITS AT DOTVCON THE
041107,000063: # PRE40.6 SECTION OF S40.6 TAKES CARE OF RE-ESTABLISHING TRIMS.
041108,000064:
041109,000065: # *IF A RESTART OCCURS DURING THE TVCEXEC....TVCEXFIN SEQUENCE THE
041110,000066: # COMPUTATIONS WILL BE COMPLETED, STARTING AT THE APPROPRIATE RESTART
041111,000067: # POINT, AFTER THE DAPS ARE READY TO GO ON THE AIR.
041112,000068:
041113,000069: # *IF A RESTART OCCURS PRIOR TO TVCINIT4 (TVCPHASE = -1) E.G. DURING
041114,000070: # THE EARLY DAP INITIALIZATION PHASE, THE DAP STARTUP SEQUENCE IS
041115,000071: # ENTERED AT MRCLEAN FOR A FULL INITIALIZATION.
041116,000072:
041117,000073: # *FOR RESTARTS DURING CSM/LM V46 SWITCH-OVER, TVCPHASE IS SET TO -2.
041118,000074: # AND THE RESTART LOGIC GOES BACK TO REDO SWITCH-OVER (AFTER THE
041119,000075: # NORMAL DAP RESTART SEQUENCE IS FOLLOWED).
041120,000076:
041121,000077: # *RESTARTS ARE NOT CRITICAL TO THE ROLL DAP PERFORMANCES HENCE THE
041122,000078: # THE ROLL DAP IS MERELY RESTARTED.
041123,000079:
041124,000080: # *RESTARTS DURING A STROKE TEST (STROKER IS NON-ZERO) WILL CAUSE THE
041125,000081: # STROKE TEST TO BE TERMINATED. A NEW V68 ENTRY WILL BE REQUIRED
041126,000082: # TO GET IT GOING AGAIN (NO AUTOMATIC RESTART).
041127,000083: #
041128,000084: # *REDOTVC IS REACHED FOLLOWING ANY RESTART WHICH FINDS THE T5 BITS
041129,000085: # (BITS 15,14 OF FLAGWRD6) SET FOR TVC. DOTVCON SETS TVCPHASE = -1
041130,000086: # AND TVC EXPHS = 0 JUST BEFORE SETTING THESE BITS, JUST BEFORE
041131,000087: # MAKING THE T5 CALL TO TVCDAPON. ON A NORMAL SHUTDOWN DOTVCRCS
041132,000088: # CALLS RCSDAPON, WHICH RESETS THE T5 BITS FOR RCS.
041133,000089:
041134,000090: # CALLING SEQUENCE....T5, IN PARTICULAR BY ELRSKIP OF FRESH START/RESTART
041135,000091:
041136,000092: # NORMAL EXIT MODES....RESUME, NOQRSM, POSTJUMP (TO TVCINIT4 OR MRCLEAN)
041137,000093:
041138,000094: # ALARM OR ABORT EXIT MODES....NONE
041139,000095:
041140,000096: # SUBROUTINES CALLED....
041141,000097:
041142,000098: # *PCOPY+1, YCOPY+1 (PITCH AND YAW COPYCYCLES)
041143,000099: # *ENABLE1,2, CMDSOUT (RE-ESTABLISH ACTUATOR TRIMS)
041144,000100: # *MRCLEAN OR TVCINIT4 (TVCDAP INITIALIZATIONS)
041145,000101: # *SWICHOVR +5 (CSM/LM V46 SWITCH-OVER)
041146,000102: # *EXRSTRT AND TVCEXECUTIVE PHASE POINTS 1 THRU 6
041147,000103: # *WAITLIST, IBNKCALL, POSTJUMP, ISWCALL
041148,000104:
041149,000105: # OTHER INTERFACES....DOTVCON AND RCSDAPON (T5 BITS), ELRSKIP (CALLS IT)
041150,000106:
041151,000107: # ERASABLE INITIALIZATION REQUIRED....
041152,000108:
041153,000109: # *T5 BITS (1,0), TVCPHASE (-2,-1,0,1,2,3), TVCEXPHS (1 THRU 6)
041154,000110: # *TVC DAP VARIABLES
041155,000111: # *OPERATIONS PERFORMED BY REDOTVC ARE BASED ON THE ASSUMPTION THAT
041156,000112: # THE TVC DAPS ARE RUNNING NORMALLY
041157,000113:
041158,000114: # OUTPUT....
041159,000115:
041160,000116: # *PITCH AND YAW TVC DAP COPYCYCLES COMPLETED IF INTERUPTED
041161,000117: # *TVCEXECUTIVE COMPLETED IF INTERUPTED
041162,000118: # *STROKE TEST TERMINATED IF INTERRUPTED
041163,000119: # *CSM/LM V46 SWITCH-OVER REPEATED IF INTERRUPTED
041164,000120: # *ACTUATOR TRIMS RE-ESTABLISHED (ACTUATORS BACK ON THE AIR)
041165,000121: # *TVC DAP INITIALIZATION AS REQUIRED
041166,000122: # *ALL TVC DAP OPERATIONS ON THE AIR
041167,000123:
041168,000124: # DEBRIS....TVC TEMPORARIES IN EBANK6
041169,000125:
041170,000126:
041171,000127: 16,3212 BANK 16
041172,000128: 16,2000 SETLOC DAPROLL
041173,000129: 16,2000 BANK
041174,000130: 16,3212 E6,1644 EBANK= TVCPHASE
041175,000131: 16,3212 COUNT* $$/RSRT
041176,000132:
041177,000133: 16,3212 22016 REDOTVC LXCH BANKRUPT # TVC RESTART PACKAGE
041178,000134: 16,3213 00006 EXTEND
041179,000135: 16,3214 22012 QXCH QRUPT # (..TCR.. IN ..FINCOPY..)
041180,000136:
041181,000137: 16,3215 11653 EXECPHS CCS TVCEXPHS # CHECK TVCEXECUTIVE PHASE
041182,000138: 16,3216 13220 TCF +2 # MUST RESTART TVCEXECUTIVE
041183,000139: 16,3217 13224 TCF TVCDAPHS # NO NEED TO RESTART TVCEXECUTIVE
041184,000140:
041185,000141: 16,3220 34334 CAF NINE # 9CS DELAY TO FORCE EXRSTRT TO OCCUR
041186,000142: 16,3221 05261 TC WAITLIST # BEFORE PITCHDAP, AFTER CMDSOUT
041187,000143: 16,3222 E6,1653 EBANK= TVCEXPHS
041188,000144: 16,3222 03325 34066 2CADR EXRSTRT
041189,000145:
041190,000146: 16,3224 47700 TVCDAPHS CS OCT37776 # CHECK BITS 15 AND 1 OF TVCPHASE TO SEE
041191,000147: 16,3225 71644 MASK TVCPHASE # DAP RESTART LOCATION (-1,1,2,3)
041192,000148: 16,3226 10000 CCS A
041193,000149: 16,3227 13312 TCF FINCOPY # FINISH THE COPYCYCLE FIRST
041194,000150: 16,3230 13235 TCF ENABL1 # JUST PREPARE THE OUTCOUNTERS AND GO
041195,000151:
041196,000152: 16,3231 41644 CS TVCPHASE # TEST FOR TVCPHASE = -2
041197,000153: 16,3232 75032 MASK BIT2 # (THIS INDICATES RESTART OCCURRED
041198,000154: 16,3233 00006 EXTEND # DURING CSM/LM V46 SWITCH-OVER)
041199,000155: 16,3234 13316 BZF TRIM/CMD # NO, TVCPHASE = -1, RSTRT WAS IN TVCINIT
041200,000156:
041201,000157: 16,3235 35024 ENABL1 CAF BIT8 # TVC ENABLE, FOLLOWED BY 40 MS (MIN) WAIT
041202,000158: 16,3236 65021 AD BIT11 # SET BIT FOR OPTICS-DAC-ENABLE ALSO
041203,000159: 16,3237 00006 EXTEND # (ENABL1 ENTERED FROM TVCDAPHS / FINCOPY)
041204,000160: 16,3240 05012 WOR CHAN12
041205,000161: 16,3241 33331 CAF TVCADDR # WAIT, CALLING ENABL2 (BBCON THERE)
041206,000162: 16,3242 55312 TS T5LOC
041207,000163: 16,3243 33335 CAF TVCADDR +4 # 60 MS (TVCEXADR)
041208,000164: 16,3244 54030 TS TIME5
041209,000165:
041210,000166: 16,3245 15347 TCF RESUME
041211,000167:
041212,000168: 16,3246 22016 ENABL2 LXCH BANKRUPT # CONTINUE PREPARATION OF OUTCOUNTERS
041213,000169:
041214,000170: 16,3247 35032 CAF BIT2 # OPTICS ERROR CNTR ENABLE, 4MS MIN WAIT
041215,000171: 16,3250 00006 EXTEND
041216,000172: 16,3251 05012 WOR CHAN12
041217,000173: 16,3252 33333 CAF TVCADDR +2 # WAIT, CALLING CMDSOUT (BBCON THERE)
041218,000174: 16,3253 55312 TS T5LOC
041219,000175: 16,3254 37700 CAF OCT37776 # 20MS
041220,000176: 16,3255 54030 TS TIME5
041221,000177:
041222,000178: 16,3256 15351 TCF NOQRSM
041223,000179:
041224,000180: 16,3257 22016 CMDSOUT LXCH BANKRUPT # CONTINUE PREPARATION OF OUTCOUNTERS
041225,000181: 16,3260 00006 EXTEND
041226,000182: 16,3261 22012 QXCH QRUPT
041227,000183:
041228,000184: 16,3262 45035 CS ZERO # MOST RECENT ACTUATOR COMMANDS
041229,000185: 16,3263 61623 AD PCMD # (AVOID +0)
041230,000186: 16,3264 54054 TS TVCPITCH
041231,000187: 16,3265 45035 CS ZERO
041232,000188: 16,3266 61624 AD YCMD
041233,000189: 16,3267 54053 TS TVCYAW
041234,000190:
041235,000191: 16,3270 35076 CAF PRIO6 # RELEASE THE COUNTERS (BITS 11,12)
041236,000192: 16,3271 00006 EXTEND
041237,000193: 16,3272 05014 WOR CHAN14
041238,000194:
041239,000195: 16,3273 11644 PHSCHK2 CCS TVCPHASE # CHECK TVCPHASE AGAIN
041240,000196: 16,3274 13304 TCF CHKSTRK
041241,000197: 16,3275 13304 TCF CHKSTRK
041242,000198: 16,3276 10000 CCS A # A CONTAINS THE DIMINISHED ABSOLUTE OF
041243,000199: 16,3277 03302 TC +3 # TVCPHASE (-2 BECOMES +1. -1 BECOMES +0)
041244,000200:
041245,000201: 16,3300 04715 TC POSTJUMP # REPEAT TVC INITIALIZATION
041246,000202: 16,3301 36210 CADR MRCLEAN # (DO NOT RETURN)
041247,000203:
041248,000204: 16,3302 04754 +3 TC IBNKCALL # REPEAT CSM/LM V46 SWITCH-OVER
041249,000205: 16,3303 36417 CADR SWICHOVR +5 # (RETURN TO CHECK FOR STROKE TEST)
041250,000206:
041251,000207: 16,3304 11574 CHKSTRK CCS STROKER # CHECK FOR STROKE TEST IN PROGRESS
041252,000208: 16,3305 13322 TCF TSTINITJ # YES, KILL IT
041253,000209: 16,3306 13310 TCF +2 # NO, PROCEED
041254,000210: 16,3307 13322 TCF TSTINITJ # YES, KILL IT
041255,000211:
041256,000212: 16,3310 04715 +4 TC POSTJUMP # IF POSITIVE OR ZERO, RESTART AT
041257,000213: 16,3311 36362 CADR TVCINIT4 # TVCINIT4 (ZEROS TVCPHASE, AND
041258,000214: # CALLS TVC DAPS VIA DAPINIT)
041259,000215: 16,3312 51644 FINCOPY INDEX TVCPHASE # PICK UP THE APPROPRIATE COPYCYCLE
041260,000216: 16,3313 33331 CAF TVCCADR
041261,000217: 16,3314 04760 TCR ISWCALL # RE-ENTER THE COPYCYCLE, RETURN AT END
041262,000218: 16,3315 13235 TCF ENABL1 # NOW PREPARE THE OUTCOUNTERS
041263,000219:
041264,000220: 16,3316 00006 TRIM/CMD EXTEND # TVCDAPON INITIALIZATION NOT COMPLETED,
041265,000221: 16,3317 31424 DCA PACTOFF # EG. P,YCMD MAY NOT BE SET. SET...
041266,000222: 16,3320 53624 DXCH PCMD
041267,000223: 16,3321 13235 TCF ENABL1 # NOW PREPARE THE OUTCOUNTERS
041268,000224:
041269,000225: 16,3322 35035 TSTINITJ CAF ZERO # DISABLE STROKE TEST (-0 SHOWS PRIOR V68)
041270,000226: 16,3323 55574 TS STROKER # (+0 MEANS NEW V68 REQUIRED FOR STARTUP)
041271,000227:
041272,000228: 16,3324 13310 TCF CHKSTRK +4
041273,000229:
041274,000230: 16,3325 51653 EXRSTRT INDEX TVCEXPHS # TVCEXECUTIVE RESTARTS....GO TO
041275,000231: 16,3326 33335 CAF TVCEXADR # APPROPRIATE RESTART POINT
041276,000232: 16,3327 50000 INDEX A
041277,000233: 16,3330 10000 TCF 0
041278,000234:
041279,000235: # TVC RESTART TABLES.... ORDER IS REQUIRED. HI-ORDER WORDS ONLY, OF 2CADRS, SINCE BBCON IS ALREADY THERE.
041280,000236:
041281,000237: 16,3331 16,3331 TVCADDR = TVCCADR # TABLE OF CADRS, UNUSED LOCS FOR GENADRS
041282,000238: 16,3331 03246 TVCCADR GENADR ENABL2 # (FOR T5 CALL, UNUSED TABLE LOC)
041283,000239: 16,3332 40714 +1 CADR PCOPY +1 # PITCH COPYCYCLE
041284,000240: 16,3333 03257 +2 GENADR CMDSOUT # (FOR T5 CALL, UNUSED TABLE LOC)
041285,000241: 16,3334 41104 +3 CADR YCOPY +1 # YAW COPYCYCLE
041286,000242: 16,3335 37772 TVCEXADR OCT 37772 # (UNUSED TABLE LOC, FILL WITH 60MS, T5)
041287,000243: 16,3336 03055 +1 GENADR EXECCOPY +1 # TVCEXECUTIVE RESTART POINTS (ORDERED)
041288,000244: 16,3337 03063 +2 GENADR 1SHOTCHK
041289,000245: 16,3340 03112 +3 GENADR TEMPSET
041290,000246: 16,3341 03115 +4 GENADR CORSETUP
041291,000247: 16,3342 03173 +5 GENADR CORCOPY +1
041292,000248: 16,3343 03204 +6 GENADR CNTRCOPY
End of include-file TVCRESTARTS.agc. Parent file is MAIN.agc