Source Code

These source-code files derive from a printout of Luminary 116 (the Apollo 12 Lunar Module guidance computer program), from the personal library of original AGC developer Don Eyles, digitally photographed at archive.org, financially sponsored by Ron Burkey, and transcribed to source code by a team of volunteers. This colorized, syntax-highlighted form was created by assembling that transcribed source code. Note that the full page images are available on the Virtual AGC project page at archive.org, while reduced-size images are presented at the VirtualAGC project website. Report or fix any transcription errors at the Virtual AGC project code repository.

Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 116 OF AGC PROGRAM LUMINARY BY NASA 2021112-071
	19:09 AUG. 11,1969
Note that the date is the date of the printout, not the date of the program revision.

056295,000002:                                                                                                  ## Copyright:   Public domain.
056296,000003:                                                                                                  ## Filename:    KEYRUPT,_UPRUPT.agc
056297,000004:                                                                                                  ## Purpose:     A section of Luminary revision 116.
056298,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM) 
056299,000006:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 12.
056300,000007:                                                                                                  ##              This file is intended to be a faithful transcription, except
056301,000008:                                                                                                  ##              that the code format has been changed to conform to the
056302,000009:                                                                                                  ##              requirements of the yaYUL assembler rather than the
056303,000010:                                                                                                  ##              original YUL assembler.
056304,000011:                                                                                                  ## Reference:   pp. 1328-1330
056305,000012:                                                                                                  ## Assembler:   yaYUL
056306,000013:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
056307,000014:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
056308,000015:                                                                                                  ## Mod history: 2017-01-22 MAS  Created from Luminary 99.
056309,000016:                                                                                                  ##              2017-02-03 RRB  Updated for Luminary 116.
056310,000017:                                                                                                  ##              2017-03-13 RSB  Proofed comment text via 3-way diff vs
056311,000018:                                                                                                  ##                              Luminary 99 and 131.
056312,000019: 

Page 1328

056314,000021: 14,3775                                           BANK     14                                    
056315,000022: 04,2000                                           SETLOC   KEYRUPT                               
056316,000023: 04,2000                                           BANK                                           
056317,000024: 04,3256                                           COUNT*   $$/KEYUP                              
056318,000025: 
056319,000026: 04,3256           54016        KEYRUPT1           TS       BANKRUPT                              
056320,000027: 04,3257           56002                           XCH      Q                                     
056321,000028: 04,3260           54012                           TS       QRUPT                                 
056322,000029: 04,3261           04400                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
056323,000030: 04,3262           34346                           CAF      LOW5                                  
056324,000031: 04,3263           00006                           EXTEND                                         
056325,000032: 04,3264           02015                           RAND     MNKEYIN                               #  CHECK IF KEYS 5M-1M ON
056326,000033: 04,3265           54073        KEYCOM             TS       RUPTREG4                              
056327,000034: 04,3266           40101                           CS       FLAGWRD5                              
056328,000035: 04,3267           74735                           MASK     DSKYFBIT                              
056329,000036: 04,3270           26101                           ADS      FLAGWRD5                              
056330,000037: 
056331,000038: 04,3271           34355        ACCEPTUP           CAF      CHRPRIO                               #  (NOTE: RUPTREG4 = KEYTEMP1)
056332,000039: 04,3272           05072                           TC       NOVAC                                 
056333,000040: 04,3273     0776                                  EBANK=   DSPCOUNT                              
056334,000041: 04,3273           02077 60101                     2CADR    CHARIN                                
056335,000042: 
056336,000043: 04,3275           30073                           CA       RUPTREG4                              
056337,000044: 04,3276           50064                           INDEX    LOCCTR                                
056338,000045: 04,3277           54154                           TS       MPAC                                  #  LEAVE 5 BIT KEY CDE IN MPAC FOR CHARIN
056339,000046: 04,3300           05270                           TC       RESUME                                
056340,000047: 

Page 1329

056342,000049:                                                                                                  #  UPRUPT PROGRAM
056343,000050: 
056344,000051: 04,3301           54016        UPRUPT             TS       BANKRUPT                              
056345,000052: 04,3302           56002                           XCH      Q                                     
056346,000053: 04,3303           54012                           TS       QRUPT                                 
056347,000054: 04,3304           04400                           TC       LODSAMPT                              #  TIME IS SNATCHED IN RUPT FOR NOUN 65.
056348,000055: 04,3305           34755                           CAF      ZERO                                  
056349,000056: 04,3306           56045                           XCH      INLINK                                
056350,000057: 04,3307           54073                           TS       KEYTEMP1                              
056351,000058: 04,3310           34751                           CAF      BIT3                                  #  TURN ON UPACT LIGHT
056352,000059: 04,3311           00006                           EXTEND                                         #  (BIT 3 OF CHANNEL 11)
056353,000060: 04,3312           05011                           WOR      DSALMOUT                              
056354,000061: 04,3313           34346        UPRPT1             CAF      LOW5                                  #  TEST FOR TRIPLE CHAR REDUNDANCY
056355,000062: 04,3314           70073                           MASK     KEYTEMP1                              #  LOW5 OF WORD
056356,000063: 04,3315           56073                           XCH      KEYTEMP1                              #  LOW5 INTO KEYTEMP1
056357,000064: 04,3316           00006                           EXTEND                                         
056358,000065: 04,3317           74742                           MP       BIT10                                 #  SHIFT RIGHT 5
056359,000066: 04,3320           54332                           TS       KEYTEMP2                              
056360,000067: 04,3321           74346                           MASK     LOW5                                  #  MID 5
056361,000068: 04,3322           63356                           AD       HI10                                  
056362,000069: 04,3323           03353                           TC       UPTEST                                
056363,000070: 04,3324           34742                           CAF      BIT10                                 
056364,000071: 04,3325           00006                           EXTEND                                         
056365,000072: 04,3326           70332                           MP       KEYTEMP2                              #  SHIFT RIGHT 5
056366,000073: 04,3327           74346                           MASK     LOW5                                  #  HIGH 5
056367,000074: 04,3330           40000                           COM                                            
056368,000075: 04,3331           03353                           TC       UPTEST                                
056369,000076: 
056370,000077: 04,3332           43361        UPCK               CS       ELRCODE                               #  CODE IS GOOD. IF CODE = 'ERROR RESET',
056371,000078: 04,3333           60073                           AD       KEYTEMP1                              #  CLEAR UPLOCKFL(SET BIT4 OF FLAGWRD7 = 0)
056372,000079: 04,3334           00006                           EXTEND                                         #  IF CODE DOES NOT = 'ERROR RESET', ACCEPT
056373,000080: 04,3335           13343                           BZF      CLUPLOCK                              #  CODE ONLY IF UPLOCKFL IS CLEAR (=0).
056374,000081: 
056375,000082: 04,3336           34750                           CAF      UPLOCBIT                              #  TEST UPLOCKFL FOR 0 OR 1
056376,000083: 04,3337           70103                           MASK     FLAGWRD7                              
056377,000084: 04,3340           10000                           CCS      A                                     
056378,000085: 04,3341           05270                           TC       RESUME                                #  UPLOCKFL = 1
056379,000086: 04,3342           03271                           TC       ACCEPTUP                              #  UPLOCKFL = 0
056380,000087: 
056381,000088: 04,3343           44750        CLUPLOCK           CS       UPLOCBIT                              #  CLEAR UPLOCKFL (I.E., SET BIT 4 OF )
056382,000089: 04,3344           70103                           MASK     FLAGWRD7                              #  FLAGWRD7 = 0)
056383,000090: 04,3345           54103                           TS       FLAGWRD7                              
056384,000091: 04,3346           03271                           TC       ACCEPTUP                              
056385,000092: 
056386,000093:                                                                                                  #  CODE IS BAD
056387,000094: 04,3347           40103        TMFAIL2            CS       FLAGWRD7                              #  LOCK OUT FURTHER UPLINK ACTIVITY
056388,000095: 04,3350           74750                           MASK     UPLOCBIT                              #  (BY SETTING UPLOCKFL = 1) UNTIL
056389,000096: 04,3351           26103                           ADS      FLAGWRD7                              #  'ERROR RESET' IS SENT VIA UPLINK.
056390,000097: 04,3352           05270                           TC       RESUME                                
056391,000098: 04,3353           60073        UPTEST             AD       KEYTEMP1                              

Page 1330

056393,000100: 04,3354           10000                           CCS      A                                     
056394,000101: 04,3355           03347                           TC       TMFAIL2                               
056395,000102: 04,3356           77740        HI10               OCT      77740                                 
056396,000103: 04,3357           03347                           TC       TMFAIL2                               
056397,000104: 04,3360           00002                           TC       Q                                     
056398,000105: 
056399,000106: 04,3361           00022        ELRCODE            OCT      22                                    
056400,000107: 
056401,000108:                                                                                                  #  'UPLINK ACTIVITY LIGHT' IS TURNED OFF BY .....
056402,000109:                                                                                                  #           1.     VBRELDSP
056403,000110:                                                                                                  #           2.     ERROR RESET
056404,000111:                                                                                                  #           3.     UPDATE PROGRAM (P27) ENTERED BY V70,V71,V72, AND V73.
056405,000112:                                                                                                  #                                     -
056406,000113:                                                                                                  #  THE RECEPTION OF A BAD CODE (I.E  CCC FAILURE) LOCKS OUT FURTHER UPLINK ACTIVITY BY SETTING BIT4 OF FLAGWRD7 = 1.
056407,000114:                                                                                                  #  THIS INDICATION WILL BE TRANSFERRED TO THE GROUND BY THE DOWNLINK WHICH DOWNLINKS ALL FLAGWORDS.
056408,000115:                                                                                                  #  WHEN UPLINK ACTIVITY IS LOCKED OUT, IT CAN BE ALLOWED WHEN THE GROUND UPLINKS AND 'ERROR RESET' CODE.
056409,000116:                                                                                                  #  (IT IS RECOMMENDED THAT THE 'ERROR LIGHT RESET' CODE IS PRECEEDED BY 16 BITS THE FIRST OF WHICH IS 1 FOLLOWED
056410,000117:                                                                                                  #  BY 15 ZEROES. THIS WILL ELIMINATE EXTRANEOUS BITS FROM INLINK WHICH MAY HAVE BEEN LEFT OVER FROM THE ORIGINAL
056411,000118:                                                                                                  #  FAILURE)
056412,000119: 
056413,000120:                                                                                                  #  UPLINK ACTIVITY IS ALSO ALLOWED (UNLOCKED) DURING FRESH START WHEN FRESH START SETS BIT4 OF FLAGWRD7 = 0.
056414,000121: 

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