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:
Among documentation not actually referenced in the annotations, there is a short writeup about the reconstruction process in our software repository that may be helpful in understanding it from a different perspective. There's also a handy table that lists what the number of memory-words should be for each routine in Comanche 51, which could make a nice double-check; however, we've not performed that double-check ourselves.

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.

042760,000002:                                                                                                  ## Copyright:   Public domain.
042761,000003:                                                                                                  ## Filename:    TVCSTROKETEST.agc
042762,000004:                                                                                                  ## Purpose:     A section of Comanche revision 051.
042763,000005:                                                                                                  ##              It is part of the reconstructed source code for the
042764,000006:                                                                                                  ##              original release of the flight software for the Command
042765,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
042766,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
042767,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
042768,000010:                                                                                                  ##              exactly match those specified for Comanche 51 in NASA drawing
042769,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
042770,000012:                                                                                                  ##              reconstruction is correct.
042771,000013:                                                                                                  ## Reference:   pp. 979-983
042772,000014:                                                                                                  ## Assembler:   yaYUL
042773,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
042774,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
042775,000017:                                                                                                  ## Mod history: 2019-07-30 MAS  Created from Comanche 55.
042776,000018: 

Page 979

042778,000020:                                                                                                  #  NAME          STROKE TEST PACKAGE             (INCLUDING INITIALIZATION PACKAGE)
042779,000021:                                                                                                  #  LOG SECTION...TVCSTROKETEST                   SUBROUTINE...DAPCSM
042780,000022:                                                                                                  #  MODIFIED BY SCHLUNDT                          21 OCTOBER 1968
042781,000023: 
042782,000024:                                                                                                  #  FUNCTIONAL DESCRIPTION....
042783,000025:                                                                                                  #        STROKE TEST PACKAGE GENERATES A WAVEFORM DESIGNED TO EXCITE BENDING
042784,000026:                                                                                                  #        STRKTSTI (STROKE TEST INITIALIZATION) IS CALLED AS A JOB BY VB68.
042785,000027:                                                                                                  #                IT INITIALIZES ALL ERASABLES REQD FOR A STROKE TEST, AND
042786,000028:                                                                                                  #                THEN TESTS FOR CSM/LM (BIT 13 OF DAPDATR1). IF CSM/LM,
042787,000029:                                                                                                  #                IN EITHER HIGH OR LOW-BANDWIDTH MODE, THE TEST IS STARTED
042788,000030:                                                                                                  #                IMMEDIATELY.  IF NOT CSM/LM, PROGRAM EXITS WITH NO ACTION.
042789,000031:                                                                                                  #        HACK (STROKE TEST) GENERATES THE WAVEFORM BY DUMPING PULSE BURSTS
042790,000032:                                                                                                  #                OF PROPER SIGN AND IN PROPER SEQUENCE DIRECTLY INTO
042791,000033:                                                                                                  #                TVCPITCH, WORKING IN CONJUNCITON WITH BOTH PITCH AND YAW
042792,000034:                                                                                                  #                TVC DAPS, WITH INTERMEDIATE WAITLIST CALLS.  NOTE, HOWEVER
042793,000035:                                                                                                  #                THAT THE STROKE TEST IS PERFORMED ONLY IN THE PITCH AXIS.
042794,000036:                                                                                                  #                AN EXAMPLE WAVEFORM IS GIVEN BELOW, TO DEMONSTRATE STROKE-
042795,000037:                                                                                                  #                TEST PARAMETER SELECTION
042796,000038:                                                                                                  #        RESTARTS CAUSE TEST TO BE TERMINATED.  ANOTHER V68 REQD IF TEST
042797,000039:                                                                                                  #                IS TO BE RE-RUN.
042798,000040:                                                                                                  #        PULSE BURST SIZE IS PAD-LOADED (ESTROKER) SO THAT AMPLITUDE OF
042799,000041:                                                                                                  #                WAVEFORM CAN BE CHANGED.  THERE ARE TEN PULSE BURSTS IN
042800,000042:                                                                                                  #                THE HALF-AMPLITUDE OF THE FIRST FREQUENCY SET IN THE
042801,000043:                                                                                                  #                STANDARD WAVEFORM.  AMPLITUDE IS 10(ESTROKER)(1/42.15),
042802,000044:                                                                                                  #                NOMINALLY 50/42.15 = 1.185 DEG
042803,000045: 
042804,000046:                                                                                                  #  CALLING SEQUENCE....
042805,000047:                                                                                                  #        EXTENDED VERB 68 SETS UP STRKTSTI JOB
042806,000048:                                                                                                  #        PITCH AND YAW TVCDAPS, FINDING STROKER NON-ZERO, DO A ..TC HACK..
042807,000049:                                                                                                  #        AN INTERNALLY-GENERATED WAITLIST CALL ENTERS AT ..HACKWLST..
042808,000050: 
042809,000051:                                                                                                  #  NORMAL EXIT MODES....
042810,000052:                                                                                                  #        TC BUNKER (..Q.. IF ENTRY FROM DAP, ..TCTSKOVR.. IF FROM WAITLIST) LIST
042811,000053: 
042812,000054:                                                                                                  #  SUBROUTINES CALLED....
042813,000055:                                                                                                  #        WAITLIST
042814,000056: 
042815,000057:                                                                                                  #  ALARM OR ABORT EXIT MODES....
042816,000058:                                                                                                  #        NONE
042817,000059: 
042818,000060:                                                                                                  #  ERASABLE INITIALIZATION REQUIRED....
042819,000061:                                                                                                  #        ESTROKER (PAD-LOAD)
042820,000062:                                                                                                  #        STROKER, CADDY, REVS, CARD, N
042821,000063: 
042822,000064:                                                                                                  #  OUTPUT....
042823,000065:                                                                                                  #        STRKTSTI...INITIALIZATION FOR STROKE TEST
042824,000066:                                                                                                  #        HACK, HACKWLST...PULSE BURSTS INTO TVCPITCH VIA ..ADS..
042825,000067:                                                                                                  #                          RESETS STROKER = +0 WHEN TEST COMPLETED
042826,000068: 
042827,000069:                                                                                                  #  DEBRIS....
042828,000070:                                                                                                  #        N = CADDY = +0, CARD = -0, REVS = -1
042829,000071:                                                                                                  #        BUNKER

Page 980

042831,000073: 
042832,000074:                                                                                                  #  EXAMPLE STROKE TEST WAVE FORM, DEMONSTRATING PARAMETER SELECTION
042833,000075: 
042834,000076:                                                                                                  #  NOTE....THIS IS NOT THE OFFICIAL WAVEFORM....
042835,000077: 
042836,000078:                                                                                                  #         **              **
042837,000079:                                                                                                  #         **              **
042838,000080:                                                                                                  #         **              **             EXAMPLE WAVEFORM (EACH * REPRESENTS
042839,000081:                                                                                                  #        *  *            *  *                 85.41 ARCSEC OF ACTUATOR CMND)
042840,000082:                                                                                                  #        *  *            *  *
042841,000083:                                                                                                  #        *  *            *  *
042842,000084:                                                                                                  #       *    *          *    *          **      **      **      **      **
042843,000085:                                                                                                  #       *    *          *    *          **      **      **      **      **
042844,000086:                                                                                                  #       *    *          *    *          **      **      **      **      **
042845,000087:                                                                                                  #      *      *        *      *        *  *    *  *    *  *    *  *    *  *    **  **  **  **  **
042846,000088:                                                                                                  #      *      *        *      *        *  *    *  *    *  *    *  *    *  *    **  **  **  **  **
042847,000089:                                                                                                  #      *      *        *      *        *  *    *  *    *  *    *  *    *  *    **  **  **  **  **
042848,000090:                                                                                                  #  -----------------------------------------------------------------------------------------------------
042849,000091:                                                                                                  #              *      *        *      *    *  *    *  *    *  *    *  *    *  *  **  **  **  **  **
042850,000092:                                                                                                  #              *      *        *      *    *  *    *  *    *  *    *  *    *  *  **  **  **  **  **
042851,000093:                                                                                                  #              *      *        *      *    *  *    *  *    *  *    *  *    *  *  **  **  **  **  **
042852,000094:                                                                                                  #               *    *          *    *      **      **      **      **      **
042853,000095:                                                                                                  #               *    *          *    *      **      **      **      **      **
042854,000096:                                                                                                  #               *    *          *    *      **      **      **      **      **
042855,000097:                                                                                                  #                *  *            *  *
042856,000098:                                                                                                  #                *  *            *  *
042857,000099:                                                                                                  #                *  *            *  *
042858,000100:                                                                                                  #                 **              **
042859,000101:                                                                                                  #                 **              **
042860,000102:                                                                                                  #                 **              **
042861,000103: 
042862,000104:                                                                                                  #  FOR THIS (UNOFFICIAL, EXAMPLE) WAVEFORM, THE REQUIRED PARAMETERS ARE AS FOLLOWS....
042863,000105: 
042864,000106:                                                                                                  #        FCARD    = +3           (NUMBER OF SETS)
042865,000107:                                                                                                  #        ESTROKER = +3           (PULSE BURST SIZE, SC.AT 85.41 ARCSEC/BIT)
042866,000108: 
042867,000109:                                                                                                  #        SET1..
042868,000110:                                                                                                  #                FREVS   = +3    (NUMBER REVERSALS MINUS 1)
042869,000111:                                                                                                  #                FCADDY  = +4    (NUMBER OF PULSE BURSTS IN 1/2 AMPLITUDE)
042870,000112:                                                                                                  #        SET2..
042871,000113:                                                                                                  #                FCARD1  = +9    (NUMBER REVERSALS MINUS 1)
042872,000114:                                                                                                  #                FCARD4  = +2    (NUMBER OF PULSE BURSTS IN 1/2 AMPLITUDE)
042873,000115:                                                                                                  #        SET3..
042874,000116:                                                                                                  #                FCARD2  = +9    (NUMBER REVERSALS MINUS 1)
042875,000117:                                                                                                  #                FCARD5  = +1    (NUMBER OF PULSE BURSTS IN 1/2 AMPLITUDE)
042876,000118:                                                                                                  #        SET4..
042877,000119:                                                                                                  #                FCARD3  = +0    (NUMBER REVERSALS MINUS 1)
042878,000120:                                                                                                  #                FCARD6  = +0    (NUMBER OF PULSE BURSTS IN 1/2 AMPLITUDE)
042879,000121: 

Page 981

042881,000123:                                                                                                  #  STROKE TEST INITIALIZATION PACKAGE (AS A JOB, FROM VERB 68)
042882,000124: 
042883,000125: 17,2552                                           BANK     17                                    
042884,000126: 20,2000                                           SETLOC   DAPS2                                 
042885,000127: 20,2000                                           BANK                                           
042886,000128: 
042887,000129: 20,3501                                           COUNT*   $$/STRK                               
042888,000130: 20,3501  E6,1655                                  EBANK=   CADDY                                 
042889,000131: 
042890,000132: 20,3501           03512        STRKTSTI           TCR      TSTINIT                               #  STROKE TEST INITIALIZATION PKG (CALLED
042891,000133:                                                                                                  #  AS A JOB BY VERB68)
042892,000134: 
042893,000135: 20,3502           00004        STRKCHK            INHINT                                         
042894,000136: 
042895,000137: 20,3503           31466                           CAE      DAPDATR1                              #  CHECK FOR CSM/LM CONFIGURATION
042896,000138: 20,3504           75002                           MASK     BIT14                                 
042897,000139: 20,3505           00006                           EXTEND                                         
042898,000140: 20,3506           13511                           BZF      +3                                    
042899,000141: 
042900,000142: 20,3507           31413                           CAE      ESTROKER                              #  BEGIN ON NEXT DAP PASS (PITCH OR YAW)
042901,000143: 20,3510           55574                           TS       STROKER                               #  (STROKING DONE IN PITCH ONLY, HOWEVER)
042902,000144: 
042903,000145: 20,3511           15217                           TCF      ENDOFJOB                              
042904,000146: 
042905,000147: 20,3512           43522        TSTINIT            CS       FCADDY                                #  NORMAL ENTRY FROM STRKTSTI
042906,000148: 20,3513           55655                           TS       CADDY                                 
042907,000149: 20,3514           55656                           TS       N                                     #        NOTE SGN CHNG FCADDY(+) TO CADDY(-)
042908,000150: 
042909,000151: 20,3515           33523                           CAF      FREVS                                 
042910,000152: 20,3516           55660                           TS       REVS                                  
042911,000153: 
042912,000154: 20,3517           43524                           CS       FCARD                                 #        NOTE SGN CHNG FCARD(+) TO CARD(-)
042913,000155: 20,3520           55661                           TS       CARD                                  
042914,000156: 
042915,000157: 20,3521           00002                           TC       Q                                     #  RETURN TO STRKTSTI+1 (OR CHKSTRK+2 OR +4)
042916,000158: 

Page 982

042918,000160:                                                                                                  #  THE OFFICIAL STROKE TEST WAVEFORM (3 JAN, 1967) CONSISTS OF FOUR STROKE SETS, AS FOLLOWS....
042919,000161: 
042920,000162:                                                                                                  #        SET 1...10 BURSTS IN 1/2 AMP,   4 REVERSALS
042921,000163:                                                                                                  #        SET 2... 6 BURSTS IN 1/2 AMP,   6 REVERSALS
042922,000164:                                                                                                  #        SET 3... 5 BURSTS IN 1/2 AMP,  10 REVERSALS
042923,000165:                                                                                                  #        SET 4... 4 BURSTS IN 1/2 AMP,  14 REVERSALS
042924,000166: 
042925,000167:                                                                                                  #  THE PULSE BURST SIZE (ESTROKER) IS PAD-LOADED (5 BITS AS OF 3 JAN, 1967)
042926,000168:                                                                                                  #  THE REMAINING WAVEFORM-GENERATING PARAMETERS ARE AS FOLLOWS....
042927,000169: 
042928,000170: 20,3522           00012        FCADDY             DEC      10         B-14                       #  NO. PULSE BURSTS IN 1/2 AMP, SET1..(+10)
042929,000171: 20,3523           00003        FREVS              DEC      3          B-14                       #  NO. REVERSALS MINUS 1, SET1........(  3)
042930,000172: 
042931,000173: 20,3524           00004        FCARD              DEC      4          B-14                       #  NO. STROKE SETS....................(+ 4)
042932,000174: 
042933,000175: 20,3525           00005        FCARD1             DEC      5          B-14                       #  NO. REVERSALS MINUS 1, SET2........(  5)
042934,000176: 
042935,000177: 20,3526           00011        FCARD2             DEC      9          B-14                       #                            3........(  9)
042936,000178: 20,3527           00015        FCARD3             DEC      13         B-14                       #                            4........( 13)
042937,000179: 
042938,000180: 20,3530           00006        FCARD4             DEC      6          B-14                       #  NO. PULSE BURSTS IN 1/2 AMP, SET2..(+ 6)
042939,000181: 20,3531           00005        FCARD5             DEC      5          B-14                       #                               SET3..(+ 5)
042940,000182: 20,3532           00004        FCARD6             DEC      4          B-14                       #                               SET4..(+ 4)
042941,000183: 
042942,000184: 20,3533     5016               20MS               =        BIT2                                  
042943,000185: 
042944,000186:                                                                                                  #  STROKE TEST PACKAGE PROPER....
042945,000187: 
042946,000188: 20,3533  E6,1657                                  EBANK=   BUNKER                                
042947,000189: 
042948,000190: 20,3533           00006        HACK               EXTEND                                         #  ENTRY (IN T5 RUPT) FROM TVCDAPS
042949,000191: 20,3534           23657                           QXCH     BUNKER                                #  SAVE Q FOR DAP RETURN
042950,000192: 
042951,000193: 20,3535           35016                           CAF      20MS                                  #  2DAPSX2(PASSES/DAP)X2(CS/PASS)=8CS=TVCDT
042952,000194: 20,3536           05245                           TC       WAITLIST                              
042953,000195: 20,3537  E6,1657                                  EBANK=   BUNKER                                
042954,000196: 20,3537           03542 40066                     2CADR    HACKWLST                              
042955,000197: 
042956,000198: 20,3541           13544                           TCF      +3                                    
042957,000199: 
042958,000200: 20,3542           34367        HACKWLST           CAF      TCTSKOVR                              #  ENTRY FROM WAITLIST
042959,000201: 20,3543           55657                           TS       BUNKER                                #  BUNKER IS TC TASKOVER
042960,000202: 
042961,000203: 20,3544           31574                           CA       STROKER                               #  STROKE
042962,000204: 20,3545           26054                           ADS      TVCPITCH                              
042963,000205: 
042964,000206: 20,3546           35005                           CAF      BIT11                                 #  RELEASE THE ERROR COUNTERS
042965,000207: 20,3547           00006                           EXTEND                                         
042966,000208: 20,3550           05014                           WOR      CHAN14                                
042967,000209: 20,3551           25655                           INCR     CADDY                                 #  COUNT DOWN THE NO. BURSTS, THIS SLOPE

Page 983

042969,000211: 20,3552           41655                           CS       CADDY                                 
042970,000212: 20,3553           00006                           EXTEND                                         
042971,000213: 20,3554           63556                           BZMF     +2                                    
042972,000214: 20,3555           01657                           TC       BUNKER                                #  EXIT, WHILE ON A SLOPE
042973,000215: 
042974,000216: 20,3556           11660                           CCS      REVS                                  
042975,000217: 20,3557           13577                           TCF      REVUP                                 #  POSITIVE REVS
042976,000218: 20,3560           13603                           TCF      REVUP      +4                         #  FINAL REVERSAL, THIS SET
042977,000219: 
042978,000220: 20,3561           25661                           INCR     CARD                                  #  NEGATIVE REVS SET LAST PASS, READY FOR
042979,000221: 20,3562           41661                           CS       CARD                                  #        THE NEXT SET.  CHECK IF NO MORE SETS
042980,000222: 20,3563           00006                           EXTEND                                         
042981,000223: 20,3564           13575                           BZF      STROKILL                              #  ALL SETS COMPLETED
042982,000224: 
042983,000225: 20,3565           51661                           INDEX    CARD                                  
042984,000226: 20,3566           33530                           CAF      FCARD      +4                         #  PICK UP NO. REVERSALS (-), NEXT SET
042985,000227: 20,3567           55660                           TS       REVS                                  #  REINITIALIZE
042986,000228: 20,3570           51661                           INDEX    CARD                                  
042987,000229: 20,3571           43533                           CS       FCARD      +7                         #  PICK UP NO. BURSTS IN 1/2AMP, NEXT SET
042988,000230: 20,3572           55656                           TS       N                                     #  REINITIALIZE
042989,000231: 20,3573           55655                           TS       CADDY                                 
042990,000232: 20,3574           01657                           TC       BUNKER                                #  EXIT, AT END OF SET
042991,000233: 
042992,000234: 20,3575           55574        STROKILL           TS       STROKER                               #  RESET (TO +0) TO END TEST
042993,000235: 20,3576           01657                           TC       BUNKER                                #  EXIT, STROKE TEST FINIS
042994,000236: 
042995,000237: 20,3577           55660        REVUP              TS       REVS                                  #  ALL REVERSALS EXCEPT LAST OF SET
042996,000238: 20,3600           31656                           CA       N                                     
042997,000239: 20,3601           60000                           DOUBLE                                         #  2 X 1/2AMP
042998,000240: 20,3602           13606                           TCF      +4                                    
042999,000241: 
043000,000242: 20,3603           45017                 +4        CS       ONE                                   #  FINAL REVERSAL, THIS SET
043001,000243: 20,3604           55660                           TS       REVS                                  #  PREPARE TO BRANCH TO NEW BURST
043002,000244: 20,3605           31656                           CA       N                                     #  JUST RETURN TO ZERO, FINAL SLOPE OF SET
043003,000245: 20,3606           55655                           TS       CADDY                                 #  CADUP
043004,000246: 
043005,000247: 20,3607           41574                           CS       STROKER                               #  CHANGE SIGN OF SLOPE
043006,000248: 20,3610           55574                           TS       STROKER                               
043007,000249: 20,3611           01657                           TC       BUNKER                                #  EXIT AT A REVERSAL (SLOPE CHANGE)
043008,000250: 

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