Source Code

These source-code files are part of a reconstructed copy of LM131 revision 1, the final release of the Apollo 13 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The source reconstruction began with source code of Luminary 131 previously transcribed from a digitized copy of that program. A dump of the flight spare core rope memory module B5, part number 2010802-171, serial number RAY 411, was obtained. This module is the only module different between Luminary 131 and LM131 revision 1. The dump was disassembled and all changes were incorporated into these source files. Note that page numbers in the reconstructed code match those on the Luminary 131 printout, although the changed code would likely have changed page numbers for a real LM131 revision 1 listing.

Comments from 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.

055887,000002:                                                                                                  ## Copyright:   Public domain.
055888,000003:                                                                                                  ## Filename:    KEYRUPT,_UPRUPT.agc
055889,000004:                                                                                                  ## Purpose:     A section of LM131 revision 1.
055890,000005:                                                                                                  ##              It is part of the reconstructed source code for the final
055891,000006:                                                                                                  ##              release of the flight software for the Lunar Module's (LM)
055892,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13. The code has
055893,000008:                                                                                                  ##              been reconstructed from a listing of Luminary 131 and a dump
055894,000009:                                                                                                  ##              of a core rope memory module B5, part number 2010802-171,
055895,000010:                                                                                                  ##              which is the only module different between LM131 revision 1
055896,000011:                                                                                                  ##              and Luminary 131. The executable generated from this source
055897,000012:                                                                                                  ##              has been verified against the module dump, so while the names,
055898,000013:                                                                                                  ##              comments, and ordering may not be exactly correct, the
055899,000014:                                                                                                  ##              resulting binary is.
055900,000015:                                                                                                  ## Reference:   pp. 1330-1332
055901,000016:                                                                                                  ## Assembler:   yaYUL
055902,000017:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
055903,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
055904,000019:                                                                                                  ## Mod history: 2022-10-28 MAS  Created from Luminary 131.
055905,000020: 

Page 1330

055907,000022: 14,3775                                           BANK     14                                    
055908,000023: 04,2000                                           SETLOC   KEYRUPT                               
055909,000024: 04,2000                                           BANK                                           
055910,000025: 04,3253                                           COUNT*   $$/KEYUP                              
055911,000026: 
055912,000027: 04,3253           54016        KEYRUPT1           TS       BANKRUPT                              
055913,000028: 04,3254           56002                           XCH      Q                                     
055914,000029: 04,3255           54012                           TS       QRUPT                                 
055915,000030: 04,3256           04400                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
055916,000031: 04,3257           34346                           CAF      LOW5                                  
055917,000032: 04,3260           00006                           EXTEND                                         
055918,000033: 04,3261           02015                           RAND     MNKEYIN                               #  CHECK IF KEYS 5M-1M ON
055919,000034: 04,3262           54073        KEYCOM             TS       RUPTREG4                              
055920,000035: 04,3263           40101                           CS       FLAGWRD5                              
055921,000036: 04,3264           74735                           MASK     DSKYFBIT                              
055922,000037: 04,3265           26101                           ADS      FLAGWRD5                              
055923,000038: 
055924,000039: 04,3266           34355        ACCEPTUP           CAF      CHRPRIO                               #  (NOTE: RUPTREG4 = KEYTEMP1)
055925,000040: 04,3267           05072                           TC       NOVAC                                 
055926,000041: 04,3270     0776                                  EBANK=   DSPCOUNT                              
055927,000042: 04,3270           02077 60101                     2CADR    CHARIN                                
055928,000043: 
055929,000044: 04,3272           30073                           CA       RUPTREG4                              
055930,000045: 04,3273           50064                           INDEX    LOCCTR                                
055931,000046: 04,3274           54154                           TS       MPAC                                  #  LEAVE 5 BIT KEY CDE IN MPAC FOR CHARIN
055932,000047: 04,3275           05270                           TC       RESUME                                
055933,000048: 

Page 1331

055935,000050:                                                                                                  #  UPRUPT PROGRAM
055936,000051: 
055937,000052: 04,3276           54016        UPRUPT             TS       BANKRUPT                              
055938,000053: 04,3277           56002                           XCH      Q                                     
055939,000054: 04,3300           54012                           TS       QRUPT                                 
055940,000055: 04,3301           04400                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
055941,000056: 04,3302           34755                           CAF      ZERO                                  
055942,000057: 04,3303           56045                           XCH      INLINK                                
055943,000058: 04,3304           54073                           TS       KEYTEMP1                              
055944,000059: 04,3305           34751                           CAF      BIT3                                  #  TURN ON UPACT LIGHT
055945,000060: 04,3306           00006                           EXTEND                                         #  (BIT 3 OF CHANNEL 11)
055946,000061: 04,3307           05011                           WOR      DSALMOUT                              
055947,000062: 04,3310           34346        UPRPT1             CAF      LOW5                                  #  TEST FOR TRIPLE CHAR REDUNDANCY
055948,000063: 04,3311           70073                           MASK     KEYTEMP1                              #  LOW5 OF WORD
055949,000064: 04,3312           56073                           XCH      KEYTEMP1                              #  LOW5 INTO KEYTEMP1
055950,000065: 04,3313           00006                           EXTEND                                         
055951,000066: 04,3314           74742                           MP       BIT10                                 #  SHIFT RIGHT 5
055952,000067: 04,3315           54332                           TS       KEYTEMP2                              
055953,000068: 04,3316           74346                           MASK     LOW5                                  #  MID 5
055954,000069: 04,3317           63353                           AD       HI10                                  
055955,000070: 04,3320           03350                           TC       UPTEST                                
055956,000071: 04,3321           34742                           CAF      BIT10                                 
055957,000072: 04,3322           00006                           EXTEND                                         
055958,000073: 04,3323           70332                           MP       KEYTEMP2                              #  SHIFT RIGHT 5
055959,000074: 04,3324           74346                           MASK     LOW5                                  #  HIGH 5
055960,000075: 04,3325           40000                           COM                                            
055961,000076: 04,3326           03350                           TC       UPTEST                                
055962,000077: 
055963,000078: 04,3327           43356        UPOK               CS       ELRCODE                               #  CODE IS GOOD.  IF CODE = 'ERROR RESET',
055964,000079: 04,3330           60073                           AD       KEYTEMP1                              #  CLEAR UPLOCKFL (SET BIT4 OF FLAGWRD7 = 0)
055965,000080: 04,3331           00006                           EXTEND                                         #  IF CODE DOES NOT = 'ERROR RESET', ACCEPT
055966,000081: 04,3332           13340                           BZF      CLUPLOCK                              #  CODE ONLY IF UPLOCKFL IS CLEAR (=0).
055967,000082: 
055968,000083: 04,3333           34750                           CAF      UPLOCBIT                              #  TEST UPLOCKFL FOR 0 OR 1
055969,000084: 04,3334           70103                           MASK     FLAGWRD7                              
055970,000085: 04,3335           10000                           CCS      A                                     
055971,000086: 04,3336           05270                           TC       RESUME                                #  UPLOCKFL = 1
055972,000087: 04,3337           03266                           TC       ACCEPTUP                              #  UPLOCKFL = 0
055973,000088: 
055974,000089: 04,3340           44750        CLUPLOCK           CS       UPLOCBIT                              #  CLEAR UPLOCKFL (I.E., SET BIT 4 OF )
055975,000090: 04,3341           70103                           MASK     FLAGWRD7                              #  FLAGWRD7 = 0)
055976,000091: 04,3342           54103                           TS       FLAGWRD7                              
055977,000092: 04,3343           03266                           TC       ACCEPTUP                              
055978,000093: 
055979,000094:                                                                                                  #  CODE IS BAD
055980,000095: 04,3344           40103        TMFAIL2            CS       FLAGWRD7                              #  LOCK OUT FURTHER UPLINK ACTIVITY
055981,000096: 04,3345           74750                           MASK     UPLOCBIT                              #  (BY SETTING UPLOCKFL = 1) UNTIL
055982,000097: 04,3346           26103                           ADS      FLAGWRD7                              #  'ERROR RESET' IS SENT VIA UPLINK.
055983,000098: 04,3347           05270                           TC       RESUME                                
055984,000099: 04,3350           60073        UPTEST             AD       KEYTEMP1                              

Page 1332

055986,000101: 04,3351           10000                           CCS      A                                     
055987,000102: 04,3352           03344                           TC       TMFAIL2                               
055988,000103: 04,3353           77740        HI10               OCT      77740                                 
055989,000104: 04,3354           03344                           TC       TMFAIL2                               
055990,000105: 04,3355           00002                           TC       Q                                     
055991,000106: 
055992,000107: 04,3356           00022        ELRCODE            OCT      22                                    
055993,000108: 
055994,000109:                                                                                                  #  'UPLINK ACTIVITY LIGHT' IS TURNED OFF BY .....
055995,000110:                                                                                                  #        1.      VBRELDSP
055996,000111:                                                                                                  #        2.      ERROR RESET
055997,000112:                                                                                                  #        3.      UPDATE PROGRAM (P27) ENTERED BY V70,V71,V72, AND V73.
055998,000113:                                                                                                  #                                      -
055999,000114:                                                                                                  #  THE RECEPTION OF A BAD CODE (I.E   CCC FAILURE) LOCKS OUT FURTHER UPLINK ACTIVITY BY SETTING BIT4 OF FLAGWRD7 = 1.
056000,000115:                                                                                                  #  THIS INDICATION WILL BE TRANSFERRED TO THE GROUND BY THE DOWNLINK WHICH DOWNLINKS ALL FLAGWORDS.
056001,000116:                                                                                                  #  WHEN UPLINK ACTIVITY IS LOCKED OUT, IT CAN BE ALLOWED WHEN THE GROUND UPLINKS AND 'ERROR RESET' CODE.
056002,000117:                                                                                                  #  (IT IS RECOMMENDED THAT THE 'ERROR LIGHT RESET' CODE IS PRECEEDED BY 16 BITS THE FIRST OF WHICH IS 1 FOLLOWED
056003,000118:                                                                                                  #  BY 15 ZEROES.  THIS WILL ELIMINATE EXTRANEOUS BITS FROM INLINK WHICH MAY HAVE BEEN LEFT OVER FROM THE ORIGINAL
056004,000119:                                                                                                  #  FAILURE)
056005,000120: 
056006,000121:                                                                                                  #  UPLINK ACTIVITY IS ALSO ALLOWED (UNLOCKED) DURING FRESH START WHEN FRESH START SETS BIT4 OF FLAGWRD7 = 0.

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