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.

056050,000002:                                                                                                  ## Copyright:   Public domain.
056051,000003:                                                                                                  ## Filename:    KEYRUPT_UPRUPT.agc
056052,000004:                                                                                                  ## Purpose:     A section of Luminary 1C, revision 131.
056053,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
056054,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 13.
056055,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
056056,000008:                                                                                                  ##              that the code format has been changed to conform to the
056057,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
056058,000010:                                                                                                  ##              original YUL assembler.
056059,000011:                                                                                                  ## Reference:   pp. 1330-1332
056060,000012:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
056061,000013:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
056062,000014:                                                                                                  ## Mod history: 06/06/03 RSB.   Began transcribing.
056063,000015:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
056064,000016:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
056065,000017:                                                                                                  ##                              original hardcopy, as opposed to the PDF page
056066,000018:                                                                                                  ##                              numbers in 1701.pdf.
056067,000019:                                                                                                  ##              2017-02-27 RSB  Proofed comment text using octopus/ProoferComments.
056068,000020:                                                                                                  ##              2017-03-13 RSB  Comment-text fixes noted in proofing Luminary 116.
056069,000021:                                                                                                  ##              2021-05-30 ABS  UPCK -> UPOK
056070,000022:                                                                                                  ##                              Removed typo "- )" on empty line.
056071,000023: 

Page 1330

056073,000025: 14,3775                                           BANK     14                                    
056074,000026: 04,2000                                           SETLOC   KEYRUPT                               
056075,000027: 04,2000                                           BANK                                           
056076,000028: 04,3253                                           COUNT*   $$/KEYUP                              
056077,000029: 
056078,000030: 04,3253           54016        KEYRUPT1           TS       BANKRUPT                              
056079,000031: 04,3254           56002                           XCH      Q                                     
056080,000032: 04,3255           54012                           TS       QRUPT                                 
056081,000033: 04,3256           04400                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
056082,000034: 04,3257           34346                           CAF      LOW5                                  
056083,000035: 04,3260           00006                           EXTEND                                         
056084,000036: 04,3261           02015                           RAND     MNKEYIN                               #  CHECK IF KEYS 5M-1M ON
056085,000037: 04,3262           54073        KEYCOM             TS       RUPTREG4                              
056086,000038: 04,3263           40101                           CS       FLAGWRD5                              
056087,000039: 04,3264           74735                           MASK     DSKYFBIT                              
056088,000040: 04,3265           26101                           ADS      FLAGWRD5                              
056089,000041: 
056090,000042: 04,3266           34355        ACCEPTUP           CAF      CHRPRIO                               #  (NOTE: RUPTREG4 = KEYTEMP1)
056091,000043: 04,3267           05072                           TC       NOVAC                                 
056092,000044: 04,3270     0776                                  EBANK=   DSPCOUNT                              
056093,000045: 04,3270           02077 60101                     2CADR    CHARIN                                
056094,000046: 
056095,000047: 04,3272           30073                           CA       RUPTREG4                              
056096,000048: 04,3273           50064                           INDEX    LOCCTR                                
056097,000049: 04,3274           54154                           TS       MPAC                                  #  LEAVE 5 BIT KEY CDE IN MPAC FOR CHARIN
056098,000050: 04,3275           05270                           TC       RESUME                                
056099,000051: 

Page 1331

056101,000053:                                                                                                  #  UPRUPT PROGRAM
056102,000054: 
056103,000055: 04,3276           54016        UPRUPT             TS       BANKRUPT                              
056104,000056: 04,3277           56002                           XCH      Q                                     
056105,000057: 04,3300           54012                           TS       QRUPT                                 
056106,000058: 04,3301           04400                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
056107,000059: 04,3302           34755                           CAF      ZERO                                  
056108,000060: 04,3303           56045                           XCH      INLINK                                
056109,000061: 04,3304           54073                           TS       KEYTEMP1                              
056110,000062: 04,3305           34751                           CAF      BIT3                                  #  TURN ON UPACT LIGHT
056111,000063: 04,3306           00006                           EXTEND                                         #  (BIT 3 OF CHANNEL 11)
056112,000064: 04,3307           05011                           WOR      DSALMOUT                              
056113,000065: 04,3310           34346        UPRPT1             CAF      LOW5                                  #  TEST FOR TRIPLE CHAR REDUNDANCY
056114,000066: 04,3311           70073                           MASK     KEYTEMP1                              #  LOW5 OF WORD
056115,000067: 04,3312           56073                           XCH      KEYTEMP1                              #  LOW5 INTO KEYTEMP1
056116,000068: 04,3313           00006                           EXTEND                                         
056117,000069: 04,3314           74742                           MP       BIT10                                 #  SHIFT RIGHT 5
056118,000070: 04,3315           54332                           TS       KEYTEMP2                              
056119,000071: 04,3316           74346                           MASK     LOW5                                  #  MID 5
056120,000072: 04,3317           63353                           AD       HI10                                  
056121,000073: 04,3320           03350                           TC       UPTEST                                
056122,000074: 04,3321           34742                           CAF      BIT10                                 
056123,000075: 04,3322           00006                           EXTEND                                         
056124,000076: 04,3323           70332                           MP       KEYTEMP2                              #  SHIFT RIGHT 5
056125,000077: 04,3324           74346                           MASK     LOW5                                  #  HIGH 5
056126,000078: 04,3325           40000                           COM                                            
056127,000079: 04,3326           03350                           TC       UPTEST                                
056128,000080: 
056129,000081: 04,3327           43356        UPOK               CS       ELRCODE                               #  CODE IS GOOD.  IF CODE = 'ERROR RESET',
056130,000082: 04,3330           60073                           AD       KEYTEMP1                              #  CLEAR UPLOCKFL (SET BIT4 OF FLAGWRD7 = 0)
056131,000083: 04,3331           00006                           EXTEND                                         #  IF CODE DOES NOT = 'ERROR RESET', ACCEPT
056132,000084: 04,3332           13340                           BZF      CLUPLOCK                              #  CODE ONLY IF UPLOCKFL IS CLEAR (=0).
056133,000085: 
056134,000086: 04,3333           34750                           CAF      UPLOCBIT                              #  TEST UPLOCKFL FOR 0 OR 1
056135,000087: 04,3334           70103                           MASK     FLAGWRD7                              
056136,000088: 04,3335           10000                           CCS      A                                     
056137,000089: 04,3336           05270                           TC       RESUME                                #  UPLOCKFL = 1
056138,000090: 04,3337           03266                           TC       ACCEPTUP                              #  UPLOCKFL = 0
056139,000091: 
056140,000092: 04,3340           44750        CLUPLOCK           CS       UPLOCBIT                              #  CLEAR UPLOCKFL (I.E., SET BIT 4 OF )
056141,000093: 04,3341           70103                           MASK     FLAGWRD7                              #  FLAGWRD7 = 0)
056142,000094: 04,3342           54103                           TS       FLAGWRD7                              
056143,000095: 04,3343           03266                           TC       ACCEPTUP                              
056144,000096: 
056145,000097:                                                                                                  #  CODE IS BAD
056146,000098: 04,3344           40103        TMFAIL2            CS       FLAGWRD7                              #  LOCK OUT FURTHER UPLINK ACTIVITY
056147,000099: 04,3345           74750                           MASK     UPLOCBIT                              #  (BY SETTING UPLOCKFL = 1) UNTIL
056148,000100: 04,3346           26103                           ADS      FLAGWRD7                              #  'ERROR RESET' IS SENT VIA UPLINK.
056149,000101: 04,3347           05270                           TC       RESUME                                
056150,000102: 04,3350           60073        UPTEST             AD       KEYTEMP1                              

Page 1332

056152,000104: 04,3351           10000                           CCS      A                                     
056153,000105: 04,3352           03344                           TC       TMFAIL2                               
056154,000106: 04,3353           77740        HI10               OCT      77740                                 
056155,000107: 04,3354           03344                           TC       TMFAIL2                               
056156,000108: 04,3355           00002                           TC       Q                                     
056157,000109: 
056158,000110: 04,3356           00022        ELRCODE            OCT      22                                    
056159,000111: 
056160,000112:                                                                                                  #  'UPLINK ACTIVITY LIGHT' IS TURNED OFF BY .....
056161,000113:                                                                                                  #        1.      VBRELDSP
056162,000114:                                                                                                  #        2.      ERROR RESET
056163,000115:                                                                                                  #        3.      UPDATE PROGRAM (P27) ENTERED BY V70,V71,V72, AND V73.
056164,000116:                                                                                                  #                                      -
056165,000117:                                                                                                  #  THE RECEPTION OF A BAD CODE (I.E   CCC FAILURE) LOCKS OUT FURTHER UPLINK ACTIVITY BY SETTING BIT4 OF FLAGWRD7 = 1.
056166,000118:                                                                                                  #  THIS INDICATION WILL BE TRANSFERRED TO THE GROUND BY THE DOWNLINK WHICH DOWNLINKS ALL FLAGWORDS.
056167,000119:                                                                                                  #  WHEN UPLINK ACTIVITY IS LOCKED OUT, IT CAN BE ALLOWED WHEN THE GROUND UPLINKS AND 'ERROR RESET' CODE.
056168,000120:                                                                                                  #  (IT IS RECOMMENDED THAT THE 'ERROR LIGHT RESET' CODE IS PRECEEDED BY 16 BITS THE FIRST OF WHICH IS 1 FOLLOWED
056169,000121:                                                                                                  #  BY 15 ZEROES.  THIS WILL ELIMINATE EXTRANEOUS BITS FROM INLINK WHICH MAY HAVE BEEN LEFT OVER FROM THE ORIGINAL
056170,000122:                                                                                                  #  FAILURE)
056171,000123: 
056172,000124:                                                                                                  #  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