Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the third release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 96 and 97. A bug (which had been around since at least Apollo 10, Luminary 69) was discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute revision into Rev 1, which is what actually flew rather than the Rev 0 presented here. A hardcopy of Rev 0 is known to exist — it belonged to AGC developer Allan Klumpp for many years — but unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus the code you see here had been reconstructed (we believe accurately) rather than transcribed. The first step of the reconstruction of the Rev 0 source code was the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection. The process of reverting the active portion of the source code (i.e., other than program comments) from Rev 1 to Rev 0 was very minor, consisting only of moving the position of the STARTSB1 label in FRESH START AND RESTART. Allan had previously given us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read, in part:

	GAP:  ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051

A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here.

058440,000002:                                                                                                  ## Copyright:   Public domain.
058441,000003:                                                                                                  ## Filename:    KEYRUPT,_UPRUPT.agc
058442,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
058443,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the third release
058444,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
058445,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
058446,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
058447,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
058448,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
058449,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
058450,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
058451,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
058452,000014:                                                                                                  ##              the original YUL assembler.
058453,000015:                                                                                                  ##
058454,000016:                                                                                                  ## Assembler:   yaYUL
058455,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
058456,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
058457,000019:                                                                                                  ## Pages:       1338-1340
058458,000020:                                                                                                  ## Mod history: 2009-05-27 RSB  Adapted from the corresponding 
058459,000021:                                                                                                  ##                              Luminary131 file, using page 
058460,000022:                                                                                                  ##                              images from Luminary 1A.
058461,000023:                                                                                                  ##              2016-12-18 RSB  Proofed text comments with octopus/ProoferComments
058462,000024:                                                                                                  ##                              and corrected the errors found.
058463,000025:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
058464,000026:                                                                                                  ##              2021-05-30 ABS  UPCK -> UPOK
058465,000027: 
058466,000028:                                                                                                  ## This source code has been transcribed or otherwise adapted from
058467,000029:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
058468,000030:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
058469,000031:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
058470,000032:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
058471,000033:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
058472,000034:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
058473,000035:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
058474,000036:                                                                                                  ## actually created.
058475,000037:                                                                                                  ##
058476,000038:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
058477,000039:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
058478,000040:                                                                                                  ## the listing from which it was transcribed. It has been verified to
058479,000041:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
058480,000042:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
058481,000043:                                                                                                  ##
058482,000044:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
058483,000045:                                                                                                  ##
058484,000046:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
058485,000047: 

Page 1338

058487,000049: 14,3774                                           BANK     14                                    
058488,000050: 04,2000                                           SETLOC   KEYRUPT                               
058489,000051: 04,2000                                           BANK                                           
058490,000052: 04,3274                                           COUNT*   $$/KEYUP                              
058491,000053: 
058492,000054: 04,3274           54016        KEYRUPT1           TS       BANKRUPT                              
058493,000055: 04,3275           56002                           XCH      Q                                     
058494,000056: 04,3276           54012                           TS       QRUPT                                 
058495,000057: 04,3277           04400                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
058496,000058: 04,3300           34346                           CAF      LOW5                                  
058497,000059: 04,3301           00006                           EXTEND                                         
058498,000060: 04,3302           02015                           RAND     MNKEYIN                               #  CHECK IF KEYS 5M-1M ON
058499,000061: 04,3303           54073        KEYCOM             TS       RUPTREG4                              
058500,000062: 04,3304           40101                           CS       FLAGWRD5                              
058501,000063: 04,3305           74735                           MASK     DSKYFBIT                              
058502,000064: 04,3306           26101                           ADS      FLAGWRD5                              
058503,000065: 
058504,000066: 04,3307           34355        ACCEPTUP           CAF      CHRPRIO                               #  (NOTE: RUPTREG4 = KEYTEMP1)
058505,000067: 04,3310           05072                           TC       NOVAC                                 
058506,000068: 04,3311     0777                                  EBANK=   DSPCOUNT                              
058507,000069: 04,3311           02077 60101                     2CADR    CHARIN                                
058508,000070: 
058509,000071: 04,3313           30073                           CA       RUPTREG4                              
058510,000072: 04,3314           50064                           INDEX    LOCCTR                                
058511,000073: 04,3315           54154                           TS       MPAC                                  #  LEAVE 5 BIT KEY CDE IN MPAC FOR CHARIN
058512,000074: 04,3316           05270                           TC       RESUME                                
058513,000075: 

Page 1339

058515,000077:                                                                                                  #  UPRUPT PROGRAM
058516,000078: 
058517,000079: 04,3317           54016        UPRUPT             TS       BANKRUPT                              
058518,000080: 04,3320           56002                           XCH      Q                                     
058519,000081: 04,3321           54012                           TS       QRUPT                                 
058520,000082: 04,3322           04400                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
058521,000083: 04,3323           34755                           CAF      ZERO                                  
058522,000084: 04,3324           56045                           XCH      INLINK                                
058523,000085: 04,3325           54073                           TS       KEYTEMP1                              
058524,000086: 04,3326           34751                           CAF      BIT3                                  #  TURN ON UPACT LIGHT
058525,000087: 04,3327           00006                           EXTEND                                         #  (BIT 3 OF CHANNEL 11)
058526,000088: 04,3330           05011                           WOR      DSALMOUT                              
058527,000089: 04,3331           34346        UPRPT1             CAF      LOW5                                  #  TEST FOR TRIPLE CHAR REDUNDANCY
058528,000090: 04,3332           70073                           MASK     KEYTEMP1                              #  LOW5 OF WORD
058529,000091: 04,3333           56073                           XCH      KEYTEMP1                              #  LOW5 INTO KEYTEMP1
058530,000092: 04,3334           00006                           EXTEND                                         
058531,000093: 04,3335           74742                           MP       BIT10                                 #  SHIFT RIGHT 5
058532,000094: 04,3336           54734                           TS       KEYTEMP2                              
058533,000095: 04,3337           74346                           MASK     LOW5                                  #  MID 5
058534,000096: 04,3340           63374                           AD       HI10                                  
058535,000097: 04,3341           03371                           TC       UPTEST                                
058536,000098: 04,3342           34742                           CAF      BIT10                                 
058537,000099: 04,3343           00006                           EXTEND                                         
058538,000100: 04,3344           70734                           MP       KEYTEMP2                              #  SHIFT RIGHT 5
058539,000101: 04,3345           74346                           MASK     LOW5                                  #  HIGH 5
058540,000102: 04,3346           40000                           COM                                            
058541,000103: 04,3347           03371                           TC       UPTEST                                
058542,000104: 
058543,000105: 04,3350           43377        UPOK               CS       ELRCODE                               #  CODE IS GOOD.  IF CODE = 'ERROR RESET',
058544,000106: 04,3351           60073                           AD       KEYTEMP1                              #  CLEAR UPLOCKFL (SET BIT4 OF FLAGWRD7 = 0)
058545,000107: 04,3352           00006                           EXTEND                                         #  IF CODE DOES NOT = 'ERROR RESET', ACCEPT
058546,000108: 04,3353           13361                           BZF      CLUPLOCK                              #  CODE ONLY IF UPLOCKFL IS CLEAR (=0).
058547,000109: 
058548,000110: 04,3354           34750                           CAF      UPLOCBIT                              #  TEST UPLOCKFL FOR 0 OR 1
058549,000111: 04,3355           70103                           MASK     FLAGWRD7                              
058550,000112: 04,3356           10000                           CCS      A                                     
058551,000113: 04,3357           05270                           TC       RESUME                                #  UPLOCKFL = 1
058552,000114: 04,3360           03307                           TC       ACCEPTUP                              #  UPLOCKFL = 0
058553,000115: 
058554,000116: 04,3361           44750        CLUPLOCK           CS       UPLOCBIT                              #  CLEAR UPLOCKFL (I.E., SET BIT 4 OF )
058555,000117: 04,3362           70103                           MASK     FLAGWRD7                              #  FLAGWRD7 = 0)
058556,000118: 04,3363           54103                           TS       FLAGWRD7                              
058557,000119: 04,3364           03307                           TC       ACCEPTUP                              
058558,000120: 
058559,000121:                                                                                                  #  CODE IS BAD
058560,000122: 04,3365           40103        TMFAIL2            CS       FLAGWRD7                              #  LOCK OUT FURTHER UPLINK ACTIVITY
058561,000123: 04,3366           74750                           MASK     UPLOCBIT                              #  (BY SETTING UPLOCKFL = 1) UNTIL
058562,000124: 04,3367           26103                           ADS      FLAGWRD7                              #  'ERROR RESET' IS SENT VIA UPLINK.
058563,000125: 04,3370           05270                           TC       RESUME                                
058564,000126: 04,3371           60073        UPTEST             AD       KEYTEMP1                              

Page 1340

058566,000128: 04,3372           10000                           CCS      A                                     
058567,000129: 04,3373           03365                           TC       TMFAIL2                               
058568,000130: 04,3374           77740        HI10               OCT      77740                                 
058569,000131: 04,3375           03365                           TC       TMFAIL2                               
058570,000132: 04,3376           00002                           TC       Q                                     
058571,000133: 
058572,000134: 04,3377           00022        ELRCODE            OCT      22                                    
058573,000135: 
058574,000136:                                                                                                  #  'UPLINK ACTIVITY LIGHT' IS TURNED OFF BY .....
058575,000137:                                                                                                  #        1.      VBRELDSP
058576,000138:                                                                                                  #        2.      ERROR RESET
058577,000139:                                                                                                  #        3.      UPDATE PROGRAM (P27) ENTERED BY V70,V71,V72, AND V73.
058578,000140:                                                                                                  #                                     -
058579,000141:                                                                                                  #  THE RECEPTION OF A BAD CODE (I.E  CCC FAILURE) LOCKS OUT FURTHER UPLINK ACTIVITY BY SETTING BIT4 OF FLAGWRD7 = 1.
058580,000142:                                                                                                  #  THIS INDICATION WILL BE TRANSFERRED TO THE GROUND BY THE DOWNLINK WHICH DOWNLINKS ALL FLAGWORDS.
058581,000143:                                                                                                  #  WHEN UPLINK ACTIVITY IS LOCKED OUT, IT CAN BE ALLOWED WHEN THE GROUND UPLINKS AND 'ERROR RESET' CODE.
058582,000144:                                                                                                  #  (IT IS RECOMMENDED THAT THE 'ERROR LIGHT RESET' CODE IS PRECEEDED BY 16 BITS THE FIRST OF WHICH IS 1 FOLLOWED
058583,000145:                                                                                                  #  BY 15 ZEROES.  THIS WILL ELIMINATE EXTRANEOUS BITS FROM INLINK WHICH MAY HAVE BEEN LEFT OVER FROM THE ORIGINAL
058584,000146:                                                                                                  #  FAILURE)
058585,000147: 
058586,000148:                                                                                                  #  UPLINK ACTIVITY IS ALSO ALLOWED (UNLOCKED) DURING FRESH START WHEN FRESH START SETS BIT4 OF FLAGWRD7 = 0.
058587,000149: 
058588,000150: 04,3400           44753                           CS       XDSPBIT                               
058589,000151: 

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