Source Code

This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the second release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 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.

008467,000002:                                                                                                  ## Copyright:   Public domain.
008468,000003:                                                                                                  ## Filename:    AGS_INITIALIZATION.agc
008469,000004:                                                                                                  ## Purpose:     Part of the reconstructed source code for LMY99 Rev 0,
008470,000005:                                                                                                  ##              otherwise known as Luminary Rev 99, the second release
008471,000006:                                                                                                  ##              of the Apollo Guidance Computer (AGC) software for Apollo 11.
008472,000007:                                                                                                  ##              It differs from LMY99 Rev 1 (the flown version) only in the
008473,000008:                                                                                                  ##              placement of a single label. The corrections shown here have
008474,000009:                                                                                                  ##              been verified to have the same bank checksums as AGC developer
008475,000010:                                                                                                  ##              Allan Klumpp's copy of Luminary Rev 99, and so are believed
008476,000011:                                                                                                  ##              to be accurate. This file is intended to be a faithful 
008477,000012:                                                                                                  ##              recreation, except that the code format has been changed to 
008478,000013:                                                                                                  ##              conform to the requirements of the yaYUL assembler rather than 
008479,000014:                                                                                                  ##              the original YUL assembler.
008480,000015:                                                                                                  ##
008481,000016:                                                                                                  ## Assembler:   yaYUL
008482,000017:                                                                                                  ## Contact:     Hartmuth Gutsche <hgutsche@xplornet.com>.
008483,000018:                                                                                                  ## Website:     www.ibiblio.org/apollo.
008484,000019:                                                                                                  ## Pages:       206-210
008485,000020:                                                                                                  ## Mod history: 2009-05-19 HG   Transcribed from page images.
008486,000021:                                                                                                  ##              2016-12-13 RSB  Proofed text comments with octopus/ProoferComments
008487,000022:                                                                                                  ##                              and corrected the errors found.
008488,000023:                                                                                                  ##              2017-03-14 RSB  Comment-text fixes identified in 5-way
008489,000024:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
008490,000025:                                                                                                  ##              2017-08-01 MAS  Created from LMY99 Rev 1.
008491,000026: 
008492,000027:                                                                                                  ## This source code has been transcribed or otherwise adapted from
008493,000028:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
008494,000029:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
008495,000030:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
008496,000031:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
008497,000032:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
008498,000033:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
008499,000034:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
008500,000035:                                                                                                  ## actually created.
008501,000036:                                                                                                  ##
008502,000037:                                                                                                  ## The code has been modified to match LMY99 Revision 0, otherwise
008503,000038:                                                                                                  ## known as Luminary Revision 99, the Apollo 11 software release preceeding
008504,000039:                                                                                                  ## the listing from which it was transcribed. It has been verified to
008505,000040:                                                                                                  ## contain the same bank checksums as AGC developer Allan Klumpp's listing
008506,000041:                                                                                                  ## of Luminary Revision 99 (for which we do not have scans).
008507,000042:                                                                                                  ##
008508,000043:                                                                                                  ## Notations on Allan Klumpp's listing read, in part:
008509,000044:                                                                                                  ##
008510,000045:                                                                                                  ##      ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
008511,000046: 

Page 206

008513,000048: 
008514,000049:                                                                                                  #  PROGRAM NAME:  AGS INITIALIZATION (R47)
008515,000050: 
008516,000051:                                                                                                  #  WRITTEN BY:  RHODE/KILROY/FOLLETT
008517,000052: 
008518,000053:                                                                                                  #  MOD NO. :     0
008519,000054:                                                                                                  #  DATE:         23 MARCH 1967
008520,000055:                                                                                                  #  MOD BY:       KILROY
008521,000056: 
008522,000057:                                                                                                  #  MOD NO.:      1
008523,000058:                                                                                                  #  DATE:         28 OCTOBER 1967
008524,000059:                                                                                                  #  MOD BY:       FOLLETT
008525,000060: 
008526,000061:                                                                                                  #  FUNCT. DESC.: (1) TO PROVIDE THE AGS ABORT ELECTRONICS ASSEMBLY (AEA) WITH THE LEM AND CSM STATE VECTORS
008527,000062:                                                                                                  #                (POSITION,VELOCITY,TIME) IN LEM IMU COORDINATES BY MEANS OF THE LGC DIGITAL DOWNLINK.
008528,000063: 
008529,000064:                                                                                                  #                (2) TO ZERO THE ICDU, LGC AND AEA GIMBAL ANGLE COUNTERS SIMULTANEOUSLY IN ORDER TO ESTABLISH A
008530,000065:                                                                                                  #                COMMON ZERO REFERENCE FOR THE MEASUREMENT OF GIMBAL (EULER) ANGLES WHICH DEFINE LEM ATTITUDE
008531,000066: 
008532,000067:                                                                                                  #                (3) TO ESTABLISH THE GROUND ELAPSED TIME OF AEA CLOCK ZERO.  (IF AN AEA CLOCK ZERO IS
008533,000068:                                                                                                  #                REQUESTED DURING THIS PROGRAM
008534,000069: 
008535,000070:                                                                                                  #  LOG SECTION:  AGS INITIALIZATION
008536,000071: 
008537,000072:                                                                                                  #  CALLING SEQ:  PROGRAM IS ENTERED WHEN ASTRONAUT KEYS V47E ON DSKY.
008538,000073:                                                                                                  #                R47 MAY BE CALLED AT ANY TIME EXCEPT WHEN ANOTHER EXTENDED VERB IS IN PROGRESS
008539,000074: 
008540,000075:                                                                                                  #  SUBROUTINES
008541,000076:                                                                                                  #  CALLED:
008542,000077: 
008543,000078:                                                                                                  #  NORMAL EXIT:  ENDEXT
008544,000079: 
008545,000080:                                                                                                  #  ALARM/ABORT:  ALARM - BAD REFSMMAT - CODE:220
008546,000081:                                                                                                  #                OPERATOR ERROR IF V47 SELECTED DURING ANOTHER EXTENDED VERB.
008547,000082: 
008548,000083:                                                                                                  #  ERASABLES
008549,000084:                                                                                                  #  USED:         SAMPTIME        (2)     TIME OF :ENTER: KEYSTROKE
008550,000085:                                                                                                  #                AGSK            (2)     GROUND ELAPSED TIME OF THE AEA CLOCK :ZERO:
008551,000086:                                                                                                  #                AGSBUFF         (140)   CONTAINS AGS INITIALIZATION DATA (SEE :OUTPUT: BELOW)
008552,000087:                                                                                                  #                AGSWORD         (1)     PREVIOUS DOWNLIST SAVED HERE
008553,000088: 
008554,000089: 05,2447  E4,1600                                  EBANK=   AGSBUFF                               
008555,000090: 
008556,000091: 40,2000                                           BANK     40                                    
008557,000092: 32,2000                                           SETLOC   R47                                   
008558,000093: 32,2000                                           BANK                                           
008559,000094: 
008560,000095: 32,2005                                           COUNT*   $$/R47                                
008561,000096: 
008562,000097: 32,2005           34737        AGSINIT            CAF      REFSMBIT                              
008563,000098: 32,2006           70077                           MASK     FLAGWRD3                              #  CHECK REFSMFLG.
008564,000099: 32,2007           10000                           CCS      A                                     

Page 207

008566,000101: 32,2010           02017                           TC       REDSPTEM                              #  REFSMMAT IS OK
008567,000102: 32,2011           05567                           TC       ALARM                                 #  REFSMMAT IS BAD
008568,000103: 32,2012           00220                           OCT      220                                   
008569,000104: 32,2013           05472                           TC       ENDEXT                                
008570,000105: 
008571,000106: 32,2014           00006        NEWAGS             EXTEND                                         
008572,000107: 32,2015           30014                           DCA      SAMPTIME                              #  TIME OF THE :ENTER: KEYSTROKE
008573,000108: 32,2016           53421                           DXCH     AGSK                                  #  BECOMES NEW AEA CLOCK :ZERO:
008574,000109: 
008575,000110: 32,2017           00006        REDSPTEM           EXTEND                                         
008576,000111: 32,2020           31421                           DCA      AGSK                                  
008577,000112: 32,2021           53052                           DXCH     DSPTEMX                               
008578,000113: 32,2022           32172        AGSDISPK           CAF      V06N16                                
008579,000114: 32,2023           04616                           TC       BANKCALL                              #  R1 = 00XXX. HRS., R2 = 000XX MIN.,
008580,000115: 32,2024           20334                           CADR     GOMARKF                               #  R3 = 0XX.XX SEC.
008581,000116: 32,2025           05472                           TC       ENDEXT                                #  TERMINATE RETURN
008582,000117: 32,2026           02036                           TC       AGSVCALC                              #  PROCEED RETURN
008583,000118: 32,2027           44746                           CS       BIT6                                  #  IS ENTER VIA A V32
008584,000119: 32,2030           60154                           AD       MPAC                                  
008585,000120: 32,2031           00006                           EXTEND                                         
008586,000121: 32,2032           12014                           BZF      NEWAGS                                #  YES, USE KEYSTROKE TIME FOR NEW AGSK
008587,000122: 
008588,000123: 32,2033           00006                           EXTEND                                         #  NO, NEW AGSK LOADED VIA V25
008589,000124: 32,2034           31052                           DCA      DSPTEMX                               #  LOADED INTO DSPTEMX BY KEYING
008590,000125: 32,2035           02016                           TC       REDSPTEM   -1                         #  V25E FOLLOWED BY HRS.,MINS.,SECS.
008591,000126:                                                                                                  #  DISPLAY THE NEW K
008592,000127: 
008593,000128: 32,2036           06037        AGSVCALC           TC       INTPRET                               
008594,000129: 32,2037           77614                           SET                                            
008595,000130: 32,2040           01076                                    NODOFLAG                              #  DONT ALLOW V37
008596,000131: 32,2041           77414                           SET      EXIT                                  
008597,000132: 32,2042           02076                                    XDSPFLAG                              
008598,000133: 
008599,000134: 32,2043           32172                           CAF      V06N16                                
008600,000135: 32,2044           04616                           TC       BANKCALL                              
008601,000136: 32,2045           20620                           CADR     EXDSPRET                              
008602,000137: 
008603,000138: 32,2046           06037                           TC       INTPRET                               #  EXTRAPOLATE LEM AND CSM STATE VECTORS
008604,000139: 32,2047           77634                           RTB                                            #  TO THE PRESENT TIME
008605,000140: 32,2050           21573                                    LOADTIME                              #  LOAD MPAC WITH TIME2,TIME1
008606,000141: 32,2051           34041                           STCALL   TDEC1                                 #  CALCULATE LEM STATE VECTOR
008607,000142: 32,2052           27057                                    LEMPREC                               
008608,000143: 32,2053           77624                           CALL                                           #  CALL ROUTINE TO CONVERT TO SM COORDS AND
008609,000144: 32,2054           64132                                    SCALEVEC                              #  PROVIDE PROPER SCALING
008610,000145: 32,2055           16201                           STODL    AGSBUFF                               #  (LEMPREC AND CSMPREC LEAVE TDEC1 IN TAT)
008611,000146: 32,2056           00015                                    TAT                                   #  TAT = TIME TO WHICH RATT1 AND VATT1 ARE
008612,000147: 32,2057           34041                           STCALL   TDEC1                                 #  COMPUTED (CSEC SINCE CLOCK START B-28).
008613,000148: 32,2060           27043                                    CSMPREC                               #  CALCULATE CSM STATE VECTOR FOR SAME TIME
008614,000149: 32,2061           77624                           CALL                                           
008615,000150: 32,2062           64132                                    SCALEVEC                              

Page 208

008617,000152: 32,2063           16207                           STODL    AGSBUFF    +6                         
008618,000153: 32,2064           00015                                    TAT                                   
008619,000154: 32,2065           56225                           DSU      DDV                                   #  CALCULATE AND STORE THE TIME
008620,000155: 32,2066           02021                                    AGSK                                  
008621,000156: 32,2067           24175                                    TSCALE                                
008622,000157: 32,2070           02215                           STORE    AGSBUFF    +12D                       
008623,000158: 32,2071           77776                           EXIT                                           
008624,000159: 
008625,000160: 32,2072           34753                           CAF      LAGSLIST                              
008626,000161: 32,2073           54332                           TS       DNLSTCOD                              
008627,000162: 
008628,000163: 32,2074           32176                           CAF      20SEC                                 #  DELAY FOR 20 SEC WHILE THE AGS
008629,000164: 32,2075           04616                           TC       BANKCALL                              #  DOWNLIST IS TRANSMITTED
008630,000165: 32,2076           01735                           CADR     DELAYJOB                              
008631,000166: 
008632,000167: 32,2077           31324                           CA       AGSWORD                               
008633,000168: 32,2100           54332                           TS       DNLSTCOD                              #  RETURN TO THE OLD DOWNLIST
008634,000169: 32,2101           34744                           CAF      IMUSEBIT                              
008635,000170: 32,2102           70074                           MASK     FLAGWRD0                              #  CHECK IMUSE FLAG.
008636,000171: 32,2103           10000                           CCS      A                                     
008637,000172: 32,2104           02122                           TC       AGSEND                                #  IMU IS BEING USED - DO NOT ZERO
008638,000173: 32,2105           11304        CKSTALL            CCS      IMUCADR                               #  CHECK FOR IMU USAGE WHICH AVOIDS THE
008639,000174: 32,2106           12111                           TCF      +3                                    #  IMUSE BIT:  I.E., IMU COMPENSATION.
008640,000175: 32,2107           12115                           TCF      +6                                    #  FREE.  GO AHEAD WITH THE IMU ZERO.
008641,000176: 32,2110           12111                           TCF      +1                                    
008642,000177: 32,2111           34363                 +3        CAF      TEN                                   #  WAIT .1 SEC AND TRY AGAIN.
008643,000178: 32,2112           04616                           TC       BANKCALL                              
008644,000179: 32,2113           01735                           CADR     DELAYJOB                              
008645,000180: 32,2114           12105                           TCF      CKSTALL                               
008646,000181: 
008647,000182: 32,2115           04616                 +6        TC       BANKCALL                              #  IMU IS NOT IN USE
008648,000183: 32,2116           16714                           CADR     IMUZERO                               #  SET IMU ZERO DISCRETE FOR 320MSECS
008649,000184: 32,2117           04616                           TC       BANKCALL                              #  WAIT 3 SEC FOR COUNTERS TO INCREMENT
008650,000185: 32,2120           17716                           CADR     IMUSTALL                              
008651,000186: 32,2121           02122                           TC       AGSEND                                
008652,000187: 32,2122           05516        AGSEND             TC       DOWNFLAG                              #  ALLOW V37
008653,000188: 32,2123           00054                           ADRES    NODOFLAG                              
008654,000189: 
008655,000190: 32,2124           32173                           CAF      V50N16                                
008656,000191: 32,2125           04616                           TC       BANKCALL                              
008657,000192: 32,2126           20342                           CADR     GOMARK3                               
008658,000193: 32,2127           15472                           TCF      ENDEXT                                
008659,000194: 32,2130           15472                           TCF      ENDEXT                                
008660,000195: 32,2131           05472                           TC       ENDEXT                                
008661,000196: 
008662,000197: 32,2132           64375        SCALEVEC           VLOAD    MXV                                   
008663,000198: 32,2133           00025                                    VATT1                                 
008664,000199: 32,2134           01734                                    REFSMMAT                              
008665,000200: 32,2135           72561                           VXSC     VSL2                                  
008666,000201: 32,2136           24202                                    VSCALE                                

Page 209

008668,000203: 32,2137           53255                           VAD      VAD                                   #  THIS SECTION ROUNDS THE VECTOR, AND
008669,000204: 32,2140           24204                                    AGSRND1                               #  CORRECTS FOR THE FACT THAT THE AGS
008670,000205: 32,2141           24212                                    AGSRND2                               #  IS A 2 S COMPLIMENT MACHINE WHILE THE
008671,000206: 32,2142           77634                           RTB                                            #  LGC IS A 1 S COMPLIMENT MACHINE.
008672,000207: 32,2143           21772                                    VECSGNAG                              
008673,000208: 32,2144           24025                           STOVL    VATT1                                 
008674,000209: 32,2145           00017                                    RATT1                                 
008675,000210: 32,2146           74321                           MXV      VXSC                                  
008676,000211: 32,2147           01734                                    REFSMMAT                              
008677,000212: 32,2150           24200                                    RSCALE                                
008678,000213: 32,2151           53212                           VSL8     VAD                                   #  AGAIN THIS SECTION ROUNDS.  TWO VECTORS
008679,000214: 32,2152           24204                                    AGSRND1                               #  ARE ADDED TO DEFEAT ALSIGNAG IN THE
008680,000215: 32,2153           47055                           VAD      RTB                                   #  CASE OF A HIGH-ORDER ZERO COUPLED WITH
008681,000216: 32,2154           24212                                    AGSRND2                               #  A LOW ORDER NEGATIVE PART.
008682,000217: 32,2155           21772                                    VECSGNAG                              
008683,000218: 32,2156           77750                           LXA,1                                          
008684,000219: 32,2157           00024                                    VATT1                                 
008685,000220: 32,2160           72130                           SXA,1    LXA,1                                 
008686,000221: 32,2161           00155                                    MPAC       +1                         
008687,000222: 32,2162           00026                                    VATT1      +2                         
008688,000223: 32,2163           72130                           SXA,1    LXA,1                                 
008689,000224: 32,2164           00160                                    MPAC       +4                         
008690,000225: 32,2165           00030                                    VATT1      +4                         
008691,000226: 32,2166           43530                           SXA,1    RVQ                                   
008692,000227: 32,2167           00162                                    MPAC       +6                         
008693,000228: 
008694,000229: 32,2170     4753               LAGSLIST           =        ONE                                   
008695,000230: 32,2170           00216        V01N14             VN       0114                                  
008696,000231: 32,2171           14400        V50N00A            VN       5000                                  
008697,000232: 32,2172     6010               V00N25             EQUALS   OCT31                                 
008698,000233: 32,2172           01420        V06N16             VN       0616                                  
008699,000234: 32,2173     4242               V00N34             EQUALS   34DEC                                 
008700,000235: 32,2173           14420        V50N16             VN       5016                                  
008701,000236: 32,2174           03100 00000  TSCALE             2DEC     100        B-10                       #  CSEC TO SEC SCALE FACTOR
008702,000237: 32,2176           03720        20SEC              DEC      2000       B-14                       
008703,000238: 32,2177           15077 05041  RSCALE             2DEC     3.280839   B-3                        #  METERS TO FEET SCALE FACTOR
008704,000239: 32,2201           24402 25724  VSCALE             2DEC     3.280839   E2         B-9             #  METERS/CS TO FEET/SEC SCALE FACTOR
008705,000240: 32,2203           00000 60000  AGSRND1            2OCT     0000060000                            
008706,000241: 32,2205           00000 60000                     2OCT     0000060000                            
008707,000242: 32,2207           00000 60000                     2OCT     0000060000                            
008708,000243: 32,2211           00000 37777  AGSRND2            2OCT     0000037777                            
008709,000244: 32,2213           00000 37777                     2OCT     0000037777                            

Page 210

008711,000246: 32,2215           00000 37777                     2OCT     0000037777                            
008712,000247: 
008713,000248: 32,2217  30,2000                                  SBANK=   LOWSUPER                              #  FOR SUBSEQUENT LOW 2CADRS.
008714,000249: 

End of include-file AGS_INITIALIZATION.agc.  Parent file is MAIN.agc