Source Code

This source code is very close to the Apollo Guidance Computer software for the Apollo 13 Lunar module. This revision of the Luminary 131 program is from December of 1969, whereas there was a later revision in January of 1970, and still another revision in February, which is the code that flew on the mission. As far as this transcription is concerned, it was originally from a copy made in 1991 of a printout from the collection of AGC developer Don Eyles for collector David Craig. It was subsequently scanned by Gary Neff, reprocessed for online presentation at the now-discontinued History of Recent Science and Technology (HRST) website of MIT's Dibner Institute (the full-quality scans being discarded in the process), and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a high-quality replacement scan for a completely illegible page was later provided by Gary Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many errors to be introduced into the transcription. Accordingly, a second scan of the same physical printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive, and used to correct the transcription errors. All of the scanned materials mentioned, as well as other Luminary 131 related material, are available online. Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017, so the two scans are not identical in that respect. The page-headings in the printout read, in part:
	GAP:  ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091
	17:53 DEC. 19, 1969
Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together.

056023,000002:                                                                                                  ## Copyright:   Public domain.
056024,000003:                                                                                                  ## Filename:    KEYRUPT_UPRUPT.agc
056025,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
056026,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
056027,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
056028,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
056029,000008:                                                                                                  ##              that the code format has been changed to conform to the
056030,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
056031,000010:                                                                                                  ##              original YUL assembler.
056032,000011:                                                                                                  ## Reference:   pp. 1330-1332
056033,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
056034,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
056035,000014:                                                                                                  ## Mod history: 06/06/03 RSB.   Began transcribing.
056036,000015:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
056037,000016:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
056038,000017:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
056039,000018:                                                                                                  ##                              numbers in 1701.pdf.
056040,000019:                                                                                                  ##              2017-02-27 RSB  Proofed comment text using octopus/ProoferComments.
056041,000020:                                                                                                  ##              2017-03-13 RSB  Comment-text fixes noted in proofing Luminary 116.
056042,000021: 

Page 1330

056044,000023: 14,3775                                           BANK     14                                    
056045,000024: 04,2000                                           SETLOC   KEYRUPT                               
056046,000025: 04,2000                                           BANK                                           
056047,000026: 04,3253                                           COUNT*   $$/KEYUP                              
056048,000027: 
056049,000028: 04,3253           54016        KEYRUPT1           TS       BANKRUPT                              
056050,000029: 04,3254           56002                           XCH      Q                                     
056051,000030: 04,3255           54012                           TS       QRUPT                                 
056052,000031: 04,3256           04400                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
056053,000032: 04,3257           34346                           CAF      LOW5                                  
056054,000033: 04,3260           00006                           EXTEND                                         
056055,000034: 04,3261           02015                           RAND     MNKEYIN                               #  CHECK IF KEYS 5M-1M ON
056056,000035: 04,3262           54073        KEYCOM             TS       RUPTREG4                              
056057,000036: 04,3263           40101                           CS       FLAGWRD5                              
056058,000037: 04,3264           74735                           MASK     DSKYFBIT                              
056059,000038: 04,3265           26101                           ADS      FLAGWRD5                              
056060,000039: 
056061,000040: 04,3266           34355        ACCEPTUP           CAF      CHRPRIO                               #  (NOTE: RUPTREG4 = KEYTEMP1)
056062,000041: 04,3267           05072                           TC       NOVAC                                 
056063,000042: 04,3270     0776                                  EBANK=   DSPCOUNT                              
056064,000043: 04,3270           02077 60101                     2CADR    CHARIN                                
056065,000044: 
056066,000045: 04,3272           30073                           CA       RUPTREG4                              
056067,000046: 04,3273           50064                           INDEX    LOCCTR                                
056068,000047: 04,3274           54154                           TS       MPAC                                  #  LEAVE 5 BIT KEY CDE IN MPAC FOR CHARIN
056069,000048: 04,3275           05270                           TC       RESUME                                
056070,000049: 

Page 1331

056072,000051:                                                                                                  #  UPRUPT PROGRAM
056073,000052: 
056074,000053: 04,3276           54016        UPRUPT             TS       BANKRUPT                              
056075,000054: 04,3277           56002                           XCH      Q                                     
056076,000055: 04,3300           54012                           TS       QRUPT                                 
056077,000056: 04,3301           04400                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
056078,000057: 04,3302           34755                           CAF      ZERO                                  
056079,000058: 04,3303           56045                           XCH      INLINK                                
056080,000059: 04,3304           54073                           TS       KEYTEMP1                              
056081,000060: 04,3305           34751                           CAF      BIT3                                  #  TURN ON UPACT LIGHT
056082,000061: 04,3306           00006                           EXTEND                                         #  (BIT 3 OF CHANNEL 11)
056083,000062: 04,3307           05011                           WOR      DSALMOUT                              
056084,000063: 04,3310           34346        UPRPT1             CAF      LOW5                                  #  TEST FOR TRIPLE CHAR REDUNDANCY
056085,000064: 04,3311           70073                           MASK     KEYTEMP1                              #  LOW5 OF WORD
056086,000065: 04,3312           56073                           XCH      KEYTEMP1                              #  LOW5 INTO KEYTEMP1
056087,000066: 04,3313           00006                           EXTEND                                         
056088,000067: 04,3314           74742                           MP       BIT10                                 #  SHIFT RIGHT 5
056089,000068: 04,3315           54332                           TS       KEYTEMP2                              
056090,000069: 04,3316           74346                           MASK     LOW5                                  #  MID 5
056091,000070: 04,3317           63353                           AD       HI10                                  
056092,000071: 04,3320           03350                           TC       UPTEST                                
056093,000072: 04,3321           34742                           CAF      BIT10                                 
056094,000073: 04,3322           00006                           EXTEND                                         
056095,000074: 04,3323           70332                           MP       KEYTEMP2                              #  SHIFT RIGHT 5
056096,000075: 04,3324           74346                           MASK     LOW5                                  #  HIGH 5
056097,000076: 04,3325           40000                           COM                                            
056098,000077: 04,3326           03350                           TC       UPTEST                                
056099,000078: 
056100,000079: 04,3327           43356        UPCK               CS       ELRCODE                               #  CODE IS GOOD.  IF CODE = 'ERROR RESET',
056101,000080: 04,3330           60073                           AD       KEYTEMP1                              #  CLEAR UPLOCKFL (SET BIT4 OF FLAGWRD7 = 0)
056102,000081: 04,3331           00006                           EXTEND                                         #  IF CODE DOES NOT = 'ERROR RESET', ACCEPT
056103,000082: 04,3332           13340                           BZF      CLUPLOCK                              #  CODE ONLY IF UPLOCKFL IS CLEAR (=0).
056104,000083: 
056105,000084: 04,3333           34750                           CAF      UPLOCBIT                              #  TEST UPLOCKFL FOR 0 OR 1
056106,000085: 04,3334           70103                           MASK     FLAGWRD7                              
056107,000086: 04,3335           10000                           CCS      A                                     
056108,000087: 04,3336           05270                           TC       RESUME                                #  UPLOCKFL = 1
056109,000088: 04,3337           03266                           TC       ACCEPTUP                              #  UPLOCKFL = 0
056110,000089: 
056111,000090: 04,3340           44750        CLUPLOCK           CS       UPLOCBIT                              #  CLEAR UPLOCKFL (I.E., SET BIT 4 OF )
056112,000091: 04,3341           70103                           MASK     FLAGWRD7                              #  FLAGWRD7 = 0)
056113,000092: 04,3342           54103                           TS       FLAGWRD7                              
056114,000093: 04,3343           03266                           TC       ACCEPTUP                              
056115,000094: 
056116,000095:                                                                                                  #  CODE IS BAD
056117,000096: 04,3344           40103        TMFAIL2            CS       FLAGWRD7                              #  LOCK OUT FURTHER UPLINK ACTIVITY
056118,000097: 04,3345           74750                           MASK     UPLOCBIT                              #  (BY SETTING UPLOCKFL = 1) UNTIL
056119,000098: 04,3346           26103                           ADS      FLAGWRD7                              #  'ERROR RESET' IS SENT VIA UPLINK.
056120,000099: 04,3347           05270                           TC       RESUME                                
056121,000100: 04,3350           60073        UPTEST             AD       KEYTEMP1                              

Page 1332

056123,000102: 04,3351           10000                           CCS      A                                     
056124,000103: 04,3352           03344                           TC       TMFAIL2                               
056125,000104: 04,3353           77740        HI10               OCT      77740                                 
056126,000105: 04,3354           03344                           TC       TMFAIL2                               
056127,000106: 04,3355           00002                           TC       Q                                     
056128,000107: 
056129,000108: 04,3356           00022        ELRCODE            OCT      22                                    
056130,000109: 
056131,000110:                                                                                                  #  'UPLINK ACTIVITY LIGHT' IS TURNED OFF BY .....
056132,000111:                                                                                                  #        1.      VBRELDSP
056133,000112:                                                                                                  #        2.      ERROR RESET
056134,000113:                                                                                                  #        3.      UPDATE PROGRAM (P27) ENTERED BY V70,V71,V72, AND V73.
056135,000114:                                                                                                  #                                      -
056136,000115:                                                                                                  #  THE RECEPTION OF A BAD CODE (I.E   CCC FAILURE) LOCKS OUT FURTHER UPLINK ACTIVITY BY SETTING BIT4 OF FLAGWRD7 = 1.
056137,000116:                                                                                                  #  THIS INDICATION WILL BE TRANSFERRED TO THE GROUND BY THE DOWNLINK WHICH DOWNLINKS ALL FLAGWORDS.
056138,000117:                                                                                                  #  WHEN UPLINK ACTIVITY IS LOCKED OUT, IT CAN BE ALLOWED WHEN THE GROUND UPLINKS AND 'ERROR RESET' CODE.
056139,000118:                                                                                                  #  (IT IS RECOMMENDED THAT THE 'ERROR LIGHT RESET' CODE IS PRECEEDED BY 16 BITS THE FIRST OF WHICH IS 1 FOLLOWED
056140,000119:                                                                                                  #  BY 15 ZEROES.  THIS WILL ELIMINATE EXTRANEOUS BITS FROM INLINK WHICH MAY HAVE BEEN LEFT OVER FROM THE ORIGINAL
056141,000120:                                                                                                  #  FAILURE)
056142,000121: 
056143,000122:                                                                                                  #  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