Source Code

These source-code files are part of a reconstructed copy of Comanche 72, the first release of the Apollo Guidance Computer (AGC) Command Module (CM) software for Apollo 13.

They have been adapted from sources files created from a listing of Comanche 55. These source files were updated to match binary dumps of a set of Comanche 67 rope modules. They were then further modified by applying known changes between Comanche 67 and Comanche 72. A binary dump of module B2 of Comanche 72, part number 2010802-021, was also used to validate changes made to banks 05-13. 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 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.

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

End of include-file TVCRESTARTS.agc.  Parent file is MAIN.agc