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.

063385,000002:                                                                                                  ## Copyright:   Public domain.
063386,000003:                                                                                                  ## Filename:    ALARM_AND_ABORT.agc
063387,000004:                                                                                                  ## Purpose:     A section of Comanche revision 051.
063388,000005:                                                                                                  ##              It is part of the reconstructed source code for the
063389,000006:                                                                                                  ##              original release of the flight software for the Command
063390,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
063391,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
063392,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
063393,000010:                                                                                                  ##              exactly match those specified for Comanche 51 in NASA drawing
063394,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
063395,000012:                                                                                                  ##              reconstruction is correct.
063396,000013:                                                                                                  ## Reference:   pp. 1493-1496
063397,000014:                                                                                                  ## Assembler:   yaYUL
063398,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
063399,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
063400,000017:                                                                                                  ## Mod history: 2019-07-30 MAS  Created from Comanche 55.
063401,000018: 

Page 1493

063403,000020:                                                                                                  #  THE FOLLOWING SUBROUTINE MAY BE CALLED TO DISPLAY A NON-ABORTIVE ALARM CONDITION.  IT MAY BE CALLED
063404,000021:                                                                                                  #  EITHER IN INTERRUPT OR UNDER EXECUTIVE CONTROL.
063405,000022: 
063406,000023:                                                                                                  #  CALLING SEQUENCE IS AS FOLLOWS:
063407,000024:                                                                                                  #                TC      ALARM
063408,000025:                                                                                                  #                OCT     NNNNN
063409,000026:                                                                                                  #                                        (RETURNS HERE)
063410,000027: 
063411,000028:    5650                                           BLOCK    02                                    
063412,000029:    4000                                           SETLOC   FFTAG7                                
063413,000030:    4000                                           BANK                                           
063414,000031: 
063415,000032:    5650     0375                                  EBANK=   FAILREG                               
063416,000033: 
063417,000034:    5650                                           COUNT    02/ALARM                              
063418,000035: 
063419,000036:                                                                                                  #  ALARM TURNS ON THE PROGRAM ALARM LIGHT, BUT DOES NOT DISPLAY.
063420,000037: 
063421,000038:    5650           00004        ALARM              INHINT                                         
063422,000039: 
063423,000040:    5651           30002                           CA       Q                                     
063424,000041:    5652           55363        ALARM2             TS       ALMCADR                               
063425,000042:    5653           50002                           INDEX    Q                                     
063426,000043:    5654           30000                           CA       0                                     
063427,000044:    5655           54001        BORTENT            TS       L                                     
063428,000045: 
063429,000046:    5656           30006        PRIOENT            CA       BBANK                                 
063430,000047:    5657           00006                 +1        EXTEND                                         
063431,000048:    5660           04007                           ROR      SUPERBNK                              #  ADD SUPER BITS.
063432,000049:    5661           55364                           TS       ALMCADR    +1                         
063433,000050: 
063434,000051:    5662           30002        LARMENT            CA       Q                                     #  STORE RETURN FOR ALARM
063435,000052:    5663           54061                           TS       ITEMP1                                
063436,000053: 
063437,000054:    5664           30164                           CA       LOC                                   
063438,000055:    5665           54057                           TS       LOCALARM                              
063439,000056:    5666           30165                           CA       BANKSET                               
063440,000057:    5667           54060                           TS       BANKALRM                              
063441,000058: 
063442,000059:    5670           10375        CHKFAIL1           CCS      FAILREG                               #  IS ANYTHING IN FAILREG
063443,000060:    5671           15674                           TCF      CHKFAIL2                              #  YES TRY NEXT REG
063444,000061:    5672           22375                           LXCH     FAILREG                               
063445,000062:    5673           15706                           TCF      PROGLARM                              #  TURN ALARM LIGHT ON FOR FIRST ALARM
063446,000063: 
063447,000064:    5674           10376        CHKFAIL2           CCS      FAILREG    +1                         
063448,000065:    5675           15700                           TCF      FAIL3                                 
063449,000066:    5676           22376                           LXCH     FAILREG    +1                         
063450,000067:    5677           15711                           TCF      MULTEXIT                              
063451,000068: 
063452,000069:    5700           30377        FAIL3              CA       FAILREG    +2                         

Page 1494

063454,000071:    5701           74777                           MASK     POSMAX                                
063455,000072:    5702           10000                           CCS      A                                     
063456,000073:    5703           15715                           TCF      MULTFAIL                              
063457,000074:    5704           22377                           LXCH     FAILREG    +2                         
063458,000075:    5705           15711                           TCF      MULTEXIT                              
063459,000076: 
063460,000077:    5706           41036        PROGLARM           CS       DSPTAB     +11D                       
063461,000078:    5707           77765                           MASK     OCT40400                              
063462,000079:    5710           27036                           ADS      DSPTAB     +11D                       
063463,000080: 
063464,000081:    5711           56061        MULTEXIT           XCH      ITEMP1                                #  OBTAIN RETURN ADDRESS IN A
063465,000082:    5712           00003                           RELINT                                         
063466,000083:    5713           50000                           INDEX    A                                     
063467,000084:    5714           00001                           TC       1                                     
063468,000085: 
063469,000086:    5715           30001        MULTFAIL           CA       L                                     
063470,000087:    5716           65001                           AD       BIT15                                 
063471,000088:    5717           54377                           TS       FAILREG    +2                         
063472,000089: 
063473,000090:    5720           15711                           TCF      MULTEXIT                              
063474,000091: 
063475,000092:                                                                                                  #  PRIOLARM DISPLAYS V05N09 VIA PRIODSPR WITH 3 RETURNS TO THE USER FROM THE ASTRONAUT AT CALL LOC +1,+2,+3 AND
063476,000093:                                                                                                  #  AN IMMEDIATE RETURN TO THE USER AT CALL LOC +4.  EXAMPLE FOLLOWS,
063477,000094:                                                                                                  #                CAF     OCTXX           ALARM CODE
063478,000095:                                                                                                  #                TC      BANKCALL
063479,000096:                                                                                                  #                CADR    PRIOLARM
063480,000097: 
063481,000098:                                                                                                  #                ...     ...
063482,000099:                                                                                                  #                ...     ...
063483,000100:                                                                                                  #                ...     ...             ASTRONAUT RETURN
063484,000101:                                                                                                  #                TC      PHASCHNG        IMMEDIATE RETURN TO USER.  RESTART
063485,000102:                                                                                                  #                OCT     X.1             PHASE CHANGE FOR PRIO DISPLAY
063486,000103: 
063487,000104: 10,3766                                           BANK     10                                    
063488,000105: 10,2000                                           SETLOC   DISPLAYS                              
063489,000106: 10,2000                                           BANK                                           
063490,000107: 
063491,000108: 10,3766                                           COUNT    10/DSPLA                              
063492,000109: 10,3766           00004        PRIOLARM           INHINT                                         #  * * * KEEP IN DISPLAY ROUTINES BANK
063493,000110: 10,3767           54001                           TS       L                                     #  SAVE ALARM CODE
063494,000111: 
063495,000112: 10,3770           30133                           CA       BUF2                                  #  2 CADR OF PRIOLARM USER
063496,000113: 10,3771           55363                           TS       ALMCADR                               
063497,000114: 10,3772           30134                           CA       BUF2       +1                         
063498,000115: 10,3773           05657                           TC       PRIOENT    +1                         #  * LEAVE L ALONE
063499,000116: 10,3774           77467        -2SEC              DEC      -200       B-14                       #  *** DONT MOVE
063500,000117: 10,3775           35050                           CAF      V05N09                                
063501,000118: 10,3776           12726                           TCF      PRIODSPR                              
063502,000119: 

Page 1495

063504,000121: 
063505,000122:    5721                                           BLOCK    02                                    
063506,000123:    6000                                           SETLOC   FFTAG13                               
063507,000124:    6000                                           BANK                                           
063508,000125: 
063509,000126:    7755                                           COUNT    02/ALARM                              
063510,000127: 
063511,000128:    7755           00004        BAILOUT            INHINT                                         
063512,000129:    7756           30002                           CA       Q                                     
063513,000130:    7757           55363                           TS       ALMCADR                               
063514,000131: 
063515,000132:    7760           04662                           TC       BANKCALL                              
063516,000133:    7761           40000                           CADR     VAC5STOR                              
063517,000134: 
063518,000135:    7762           51363                           INDEX    ALMCADR                               
063519,000136:    7763           30000                           CAF      0                                     
063520,000137:    7764           05655                           TC       BORTENT                               
063521,000138:    7765           40400        OCT40400           OCT      40400                                 
063522,000139: 
063523,000140:    7766           00004                           INHINT                                         
063524,000141:    7767           35016        WHIMPER            CA       TWO                                   
063525,000142:    7770           60005                           AD       Z                                     
063526,000143:    7771           54017                           TS       BRUPT                                 
063527,000144:    7772           50017                           RESUME                                         
063528,000145:    7773           04701                           TC       POSTJUMP                              #  RESUME SENDS CONTROL HERE
063529,000146:    7774           12651                           CADR     ENEMA                                 
063530,000147: 
063531,000148:    4000                                           SETLOC   FFTAG7                                
063532,000149:    4000                                           BANK                                           
063533,000150: 
063534,000151:    5721           00004        POODOO             INHINT                                         
063535,000152:    5722           30002                           CA       Q                                     
063536,000153:    5723           55363                           TS       ALMCADR                               
063537,000154: 
063538,000155:    5724           04662                           TC       BANKCALL                              
063539,000156:    5725           40000                           CADR     VAC5STOR                              #  STORE ERASABLES FOR DEBUGGING PURPOSES.
063540,000157: 
063541,000158:    5726           51363                           INDEX    ALMCADR                               
063542,000159:    5727           30000                           CAF      0                                     
063543,000160:    5730           05655        ABORT2             TC       BORTENT                               
063544,000161:    5731           77770        OCT77770           OCT      77770                                 #  DONT MOVE
063545,000162:    5732           35012                           CA       V37FLBIT                              #  IS AVERAGE G ON
063546,000163:    5733           70103                           MASK     FLAGWRD7                              
063547,000164:    5734           10000                           CCS      A                                     
063548,000165:    5735           07766                           TC       WHIMPER    -1                         #  YES.  DONT DO POODOO.  DO BAILOUT.
063549,000166: 
063550,000167:    5736           05560                           TC       DOWNFLAG                              
063551,000168:    5737           00067                           ADRES    STATEFLG                              
063552,000169: 
063553,000170:    5740           05560                           TC       DOWNFLAG                              
063554,000171: 

Page 1496

063556,000173:    5741           00236                           ADRES    REINTFLG                              
063557,000174: 
063558,000175:    5742           05560                           TC       DOWNFLAG                              
063559,000176:    5743           00054                           ADRES    NODOFLAG                              
063560,000177: 
063561,000178:    5744           04662                           TC       BANKCALL                              
063562,000179:    5745           12501                           CADR     MR.KLEAN                              
063563,000180:    5746           07767                           TC       WHIMPER                               
063564,000181: 
063565,000182:    5747           00004        CCSHOLE            INHINT                                         
063566,000183:    5750           30002                           CA       Q                                     
063567,000184:    5751           55363                           TS       ALMCADR                               
063568,000185:    5752           04662                           TC       BANKCALL                              
063569,000186:    5753           40000                           CADR     VAC5STOR                              
063570,000187:    5754           35756                           CA       OCT1103                               
063571,000188:    5755           05730                           TC       ABORT2                                
063572,000189:    5756           01103        OCT1103            OCT      1103                                  
063573,000190:    5757           00004        CURTAINS           INHINT                                         
063574,000191:    5760           30002                           CA       Q                                     
063575,000192:    5761           05652                           TC       ALARM2                                
063576,000193:    5762           00217        OCT217             OCT      00217                                 
063577,000194:    5763           01363                           TC       ALMCADR                               #  RETURN TO USER
063578,000195: 
063579,000196:    5764     5217               DOALARM            EQUALS   ENDOFJOB                              
063580,000197: 
063581,000198:                                                                                                  #  CALLING SEQUENCE FOR VARALARM
063582,000199: 
063583,000200:                                                                                                  #                CAF     (ALARM)
063584,000201:                                                                                                  #                TC      VARALARM
063585,000202: 
063586,000203:                                                                                                  #  VARALARM TURNS ON PROGRAM ALARM LIGHT BUT DOES NOT DISPLAY
063587,000204: 
063588,000205:    5764           00004        VARALARM           INHINT                                         
063589,000206: 
063590,000207:    5765           54001                           TS       L                                     #  SAVE USERS ALARM CODE
063591,000208: 
063592,000209:    5766           30002                           CA       Q                                     #  SAVE USERS Q
063593,000210:    5767           55363                           TS       ALMCADR                               
063594,000211: 
063595,000212:    5770           05656                           TC       PRIOENT                               
063596,000213:    5771           00014        OCT14              OCT      14                                    #  DONT MOVE
063597,000214: 
063598,000215:    5772           01363                           TC       ALMCADR                               #  RETURN TO USER
063599,000216: 
063600,000217:    5773     7755               ABORT              EQUALS   BAILOUT                               #  *** TEMPORARY UNTIL ABORT CALLS OUT

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