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.

061529,000002:                                                                                                  ## Copyright:   Public domain.
061530,000003:                                                                                                  ## Filename:    KEYRUPT,_UPRUPT.agc
061531,000004:                                                                                                  ## Purpose:     A section of Comanche revision 051.
061532,000005:                                                                                                  ##              It is part of the reconstructed source code for the
061533,000006:                                                                                                  ##              original release of the flight software for the Command
061534,000007:                                                                                                  ##              Module's (CM) Apollo Guidance Computer (AGC) for Apollo 11.
061535,000008:                                                                                                  ##              The code has been recreated from a copy of Comanche 055. It
061536,000009:                                                                                                  ##              has been adapted such that the resulting bugger words
061537,000010:                                                                                                  ##              exactly match those specified for Comanche 51 in NASA drawing
061538,000011:                                                                                                  ##              2021153D, which gives relatively high confidence that the
061539,000012:                                                                                                  ##              reconstruction is correct.
061540,000013:                                                                                                  ## Reference:   pp. 1449-1451
061541,000014:                                                                                                  ## Assembler:   yaYUL
061542,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
061543,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
061544,000017:                                                                                                  ## Mod history: 2019-07-30 MAS  Created from Comanche 55.
061545,000018: 

Page 1449

061547,000020: 14,3761                                           BANK     14                                    
061548,000021: 07,2000                                           SETLOC   KEYRUPT                               
061549,000022: 07,2000                                           BANK                                           
061550,000023: 07,3673                                           COUNT*   $$/KEYUP                              
061551,000024: 
061552,000025: 07,3673           54016        KEYRUPT1           TS       BANKRUPT                              
061553,000026: 07,3674           56002                           XCH      Q                                     
061554,000027: 07,3675           54012                           TS       QRUPT                                 
061555,000028: 07,3676           04414                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
061556,000029: 07,3677           34362                           CAF      LOW5                                  
061557,000030: 07,3700           00006                           EXTEND                                         
061558,000031: 07,3701           02015                           RAND     MNKEYIN                               #  CHECK IF KEYS 5M-1M ON
061559,000032: 07,3702           54073        KEYCOM             TS       RUPTREG4                              
061560,000033: 07,3703           40101                           CS       FLAGWRD5                              
061561,000034: 07,3704           75001                           MASK     BIT15                                 
061562,000035: 07,3705           26101                           ADS      FLAGWRD5                              
061563,000036: 
061564,000037: 07,3706           34371        ACCEPTUP           CAF      CHRPRIO                               #  (NOTE: RUPTREG4 = KEYTEMP1)
061565,000038: 07,3707           05134                           TC       NOVAC                                 
061566,000039: 07,3710     0777                                  EBANK=   DSPCOUNT                              
061567,000040: 07,3710           02000 60101                     2CADR    CHARIN                                
061568,000041: 
061569,000042: 07,3712           30073                           CA       RUPTREG4                              
061570,000043: 07,3713           50064                           INDEX    LOCCTR                                
061571,000044: 07,3714           54154                           TS       MPAC                                  #  LEAVE 5 BIT KEY CDE IN MPAC FOR CHARIN
061572,000045: 07,3715           05333                           TC       RESUME                                
061573,000046: 

Page 1450

061575,000048:                                                                                                  #  UPRUPT PROGRAM
061576,000049: 
061577,000050: 07,3716           54016        UPRUPT             TS       BANKRUPT                              
061578,000051: 07,3717           56002                           XCH      Q                                     
061579,000052: 07,3720           54012                           TS       QRUPT                                 
061580,000053: 07,3721           04414                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
061581,000054: 07,3722           35021                           CAF      ZERO                                  
061582,000055: 07,3723           56045                           XCH      INLINK                                
061583,000056: 07,3724           54073                           TS       KEYTEMP1                              
061584,000057: 07,3725           35015                           CAF      BIT3                                  #  TURN ON UPACT LIGHT
061585,000058: 07,3726           00006                           EXTEND                                         #  (BIT 3 OF CHANNEL 11)
061586,000059: 07,3727           05011                           WOR      DSALMOUT                              
061587,000060: 07,3730           34362        UPRPT1             CAF      LOW5                                  #  TEST FOR TRIPLE CHAR REDUNDANCY
061588,000061: 07,3731           70073                           MASK     KEYTEMP1                              #  LOW5 OF WORD
061589,000062: 07,3732           56073                           XCH      KEYTEMP1                              #  LOW5 INTO KEYTEMP1
061590,000063: 07,3733           00006                           EXTEND                                         
061591,000064: 07,3734           75006                           MP       BIT10                                 #  SHIFT RIGHT 5
061592,000065: 07,3735           54734                           TS       KEYTEMP2                              
061593,000066: 07,3736           74362                           MASK     LOW5                                  #  MID 5
061594,000067: 07,3737           63773                           AD       HI10                                  
061595,000068: 07,3740           03770                           TC       UPTEST                                
061596,000069: 07,3741           35006                           CAF      BIT10                                 
061597,000070: 07,3742           00006                           EXTEND                                         
061598,000071: 07,3743           70734                           MP       KEYTEMP2                              #  SHIFT RIGHT 5
061599,000072: 07,3744           74362                           MASK     LOW5                                  #  HIGH 5
061600,000073: 07,3745           40000                           COM                                            
061601,000074: 07,3746           03770                           TC       UPTEST                                
061602,000075: 
061603,000076: 07,3747           43776        UPOK               CS       ELRCODE                               #  CODE IS GOOD.  IF CODE = 'ERROR RESET',
061604,000077: 07,3750           60073                           AD       KEYTEMP1                              #  CLEAR UPLOCKFL (SET BIT4 OF FLAGWRD7 = 0)
061605,000078: 07,3751           00006                           EXTEND                                         #  IF CODE DOES NOT = 'ERROR RESET', ACCEPT
061606,000079: 07,3752           13760                           BZF      CLUPLOCK                              #  CODE ONLY IF UPLOCKFL IS CLEAR (=0).
061607,000080: 
061608,000081: 07,3753           35014                           CAF      BIT4                                  #  TEST UPLOCKFL FOR 0 OR 1.
061609,000082: 07,3754           70103                           MASK     FLAGWRD7                              
061610,000083: 07,3755           10000                           CCS      A                                     
061611,000084: 07,3756           05333                           TC       RESUME                                #  UPLOCKFL = 1
061612,000085: 07,3757           03706                           TC       ACCEPTUP                              #  UPLOCKFL = 0
061613,000086: 
061614,000087: 07,3760           45014        CLUPLOCK           CS       BIT4                                  #  CLEAR UPLOCKFL (I.E., SET BIT 4 OF
061615,000088: 07,3761           70103                           MASK     FLAGWRD7                              #  FLAGWRD7 = 0)
061616,000089: 07,3762           54103                           TS       FLAGWRD7                              
061617,000090: 07,3763           03706                           TC       ACCEPTUP                              
061618,000091: 
061619,000092:                                                                                                  #  CODE IS BAD
061620,000093: 07,3764           40103        TMFAIL2            CS       FLAGWRD7                              #  LOCK OUT FURTHER UPLINK ACTIVITY
061621,000094: 07,3765           75014                           MASK     BIT4                                  #  (BY SETTING UPLOCKFL = 1) UNTIL
061622,000095: 07,3766           26103                           ADS      FLAGWRD7                              #  'ERROR RESET' IS SENT VIA UPLINK.
061623,000096: 07,3767           05333                           TC       RESUME                                
061624,000097: 07,3770           60073        UPTEST             AD       KEYTEMP1                              

Page 1451

061626,000099: 07,3771           10000                           CCS      A                                     
061627,000100: 07,3772           03764                           TC       TMFAIL2                               
061628,000101: 07,3773           77740        HI10               OCT      77740                                 
061629,000102: 07,3774           03764                           TC       TMFAIL2                               
061630,000103: 07,3775           00002                           TC       Q                                     
061631,000104: 
061632,000105: 07,3776           00022        ELRCODE            OCT      22                                    
061633,000106: 
061634,000107:                                                                                                  #  'UPLINK ACTIVITY LIGHT' IS TURNED OFF BY .....
061635,000108:                                                                                                  #        1.      VBRELDSP
061636,000109:                                                                                                  #        2.      ERROR RESET
061637,000110:                                                                                                  #        3.      UPDATE PROGRAM (P27) ENTERED BY V70,V71,V72, AND V73.
061638,000111: 
061639,000112:                                                                                                  #                                     -
061640,000113:                                                                                                  #  THE RECEPTION OF A BAD CODE (I.E  CCC FAILURE) LOCKS OUT FURTHER UPLINK ACTIVITY BY SETTING BIT4 OF FLAGWRD7 = 1.
061641,000114:                                                                                                  #  THIS INDICATION WILL BE TRANSFERRED TO THE GROUND BY THE DOWNLINK WHICH DOWNLINKS ALL FLAGWORDS.
061642,000115:                                                                                                  #  WHEN UPLINK ACTIVITY IS LOCKED OUT, IT CAN BE ALLOWED WHEN THE GROUND UPLINKS AND 'ERROR RESET' CODE.
061643,000116:                                                                                                  #  (IT IS RECOMMENDED THAT THE 'ERROR LIGHT RESET' CODE IS PRECEEDED BY 16 BITS THE FIRST OF WHICH IS 1 FOLLOWED
061644,000117:                                                                                                  #  BY 15 ZEROES.  THIS WILL ELIMINATE EXTRANEOUS BITS FROM INLINK WHICH MAY HAVE BEEN LEFT OVER FROM THE ORIGINAL
061645,000118:                                                                                                  #  FAILURE)
061646,000119: 
061647,000120:                                                                                                  #  UPLINK ACTIVITY IS ALSO ALLOWED (UNLOCKED) DURING FRESH START WHEN FRESH START SETS BIT4 OF FLAGWRD7 = 0.
061648,000121: 
061649,000122: 

End of include-file KEYRUPT,_UPRUPT.agc.  Parent file is MAIN.agc