Source Code

These source-code files are part of a reconstructed copy of Luminary 69/2, the flown, final release of the Apollo 10 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction is based on the source code of Luminary 69 — i.e., the initial, unflown version, "revision 0" — of which a contemporary listing was available. The code was then updated by incorporating the differences between Luminary 69 and Luminary 69/2, known from other contemporary documentation. The only such difference is the implementation in Luminary 69/2 of the "R-2 Lunar Potential Model", the source code for which was taken from program Luminary 99/1 (Apollo 11 LM), of which a contemporary listing was also available. Finally, the now-reconstructed Luminary 69/2 was then validated by assembling it to executable form and verifying that its memory banks had the correct checksums, known from still other contemporary documentation.

Note that page numbers in the reconstructed code match those in the original Luminary 69 program listing, or in the ORBITAL INTEGRATION log section, in Luminary 99/1. Page numbers would certainly differ somewhat in a contemporary Luminary 69/2 listing. Moreover, annotations that were not present in the contemporary source code have been added to the reconstructed code to justify each change in Luminary 69/2 relative to Luminary 69. Here's a guide to the Apollo documentation referenced in those annotations:
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.

009533,000002:                                                                                                  ## Copyright:   Public domain.
009534,000003:                                                                                                  ## Filename:    AGS_INITIALIZATION.agc
009535,000004:                                                                                                  ## Purpose:     A section of LUM69 revision 2.
009536,000005:                                                                                                  ##              It is part of the reconstructed source code for the flown
009537,000006:                                                                                                  ##              version of the flight software for the Lunar Module's (LM)
009538,000007:                                                                                                  ##              Apollo Guidance Computer (AGC) for Apollo 10. The code has
009539,000008:                                                                                                  ##              been recreated from a copy of Luminary revsion 069, using
009540,000009:                                                                                                  ##              changes present in Luminary 099 which were described in
009541,000010:                                                                                                  ##              Luminary memos 75 and 78. The code has been adapted such
009542,000011:                                                                                                  ##              that the resulting bugger words exactly match those specified
009543,000012:                                                                                                  ##              for LUM69 revision 2 in NASA drawing 2021152B, which gives
009544,000013:                                                                                                  ##              relatively high confidence that the reconstruction is correct.
009545,000014:                                                                                                  ## Reference:   pp. 221-225
009546,000015:                                                                                                  ## Assembler:   yaYUL
009547,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
009548,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
009549,000018:                                                                                                  ## Mod history: 2019-07-27 MAS  Created from Luminary 69.
009550,000019: 

Page 221

009552,000021: 
009553,000022:                                                                                                  #  PROGRAM NAME:   AGS INITIALIZATION (R47)
009554,000023: 
009555,000024:                                                                                                  #  WRITTEN BY  :   RHODE/KILROY/FOLLETT
009556,000025: 
009557,000026:                                                                                                  #  MOD NO. :       0
009558,000027:                                                                                                  #  DATE    :       23 MARCH 1967
009559,000028:                                                                                                  #  MOD BY  :       KILROY
009560,000029: 
009561,000030:                                                                                                  #  MOD NO. :       1
009562,000031:                                                                                                  #  DATE    :       28 OCTOBER 1967
009563,000032:                                                                                                  #  MOD BY  :       FOLLETT
009564,000033: 
009565,000034:                                                                                                  #  FUNCT. DESC.:   (1) TO PROVIDE THE AGS ABORT ELECTRONICS ASSEMBLY(AEA) WITH THE LEM AND CSM STATE VECTORS
009566,000035:                                                                                                  #                  (POSITION,VELOCITY,TIME) IN LEM IMU COORDINATES BY MEANS OF THE LGC DIGITAL DOWNLINK.
009567,000036: 
009568,000037:                                                                                                  #                  (2) TO ZERO THE ICDU, LGC AND AEA GIMBAL ANGLE COUNTERS SIMULTANEOUSLY IN ORDER TO ESTABLISH A
009569,000038:                                                                                                  #                  COMMON ZERO REFERENCE FOR THE MEASUREMENT OF GIMBAL(EULER) ANGLES WHICH DEFINE LEM ATTITUDE
009570,000039:                                                                                                  #                  (3) TO ESTABLISH THE GROUND ELAPSED TIME OF AEA CLOCK ZERO.(IF AN AEA CLOCK ZERO IS
009571,000040:                                                                                                  #                  REQUESTED DURING THIS PROGRAM
009572,000041: 
009573,000042:                                                                                                  #  LOG SECTION :   AGS INITIALIZATION
009574,000043: 
009575,000044:                                                                                                  #  CALLING SEQ :   PROGRAM IS ENTERED WHEN ASTRONAUT KEYS V47E ON DSKY.
009576,000045:                                                                                                  #                  R47 MAY BE CALLED AT ANY TIME EXCEPT WHEN ANOTHER EXTENDED VERB IS IN PROGRESS
009577,000046: 
009578,000047:                                                                                                  #  SUBROUTINES
009579,000048:                                                                                                  #  CALLED      :
009580,000049: 
009581,000050:                                                                                                  #  NORMAL EXIT :   ENDEXT
009582,000051: 
009583,000052:                                                                                                  #  ALARM/ABORT :   ALARM - BAD REFSMMAT - CODE:220
009584,000053:                                                                                                  #                  OPERATOR ERROR IF V47 SELECTED DURING ANOTHER EXTENDED VERB.
009585,000054: 
009586,000055:                                                                                                  #  ERASABLES
009587,000056:                                                                                                  #  USED        :   SAMPTIME    (2) TIME OF :ENTER: KEYSTROKE
009588,000057:                                                                                                  #                  AGSK        (2) GROUND ELAPSED TIME OF THE AEA CLOCK :ZERO:
009589,000058:                                                                                                  #                  AGSBUFF   (140) CONTAINS AGS INITIALIZATION DATA (SEE :OUTPUT: BELOW)
009590,000059:                                                                                                  #                  AGSWORD     (1) PREVIOUS DOWNLIST SAVED HERE
009591,000060: 
009592,000061: 05,2447  E4,1604                                  EBANK=   AGSBUFF                               
009593,000062: 
009594,000063: 40,2000                                           BANK     40                                    
009595,000064: 32,2000                                           SETLOC   R47                                   
009596,000065: 32,2000                                           BANK                                           
009597,000066: 
009598,000067: 32,2015                                           COUNT*   $$/R47                                
009599,000068: 
009600,000069: 32,2015           34737        AGSINIT            CAF      REFSMBIT                              
009601,000070: 32,2016           70077                           MASK     FLAGWRD3                              #  CHECK REFSMFLG.
009602,000071: 32,2017           10000                           CCS      A                                     
009603,000072: 

Page 222

009605,000074: 32,2020           02027                           TC       REDSPTEM                              #  REFSMMAT IS OK
009606,000075: 32,2021           05567                           TC       ALARM                                 #  REFSMMAT IS BAD
009607,000076: 32,2022           00220                           OCT      220                                   
009608,000077: 32,2023           05472                           TC       ENDEXT                                
009609,000078: 
009610,000079: 32,2024           00006        NEWAGS             EXTEND                                         
009611,000080: 32,2025           30014                           DCA      SAMPTIME                              #  TIME OF THE :ENTER: KEYSTROKE
009612,000081: 32,2026           53421                           DXCH     AGSK                                  #  BECOMES NEW AEA CLOCK :ZERO:
009613,000082: 
009614,000083: 32,2027           00006        REDSPTEM           EXTEND                                         
009615,000084: 32,2030           31421                           DCA      AGSK                                  
009616,000085: 32,2031           53052                           DXCH     DSPTEMX                               
009617,000086: 32,2032           32202        AGSDISPK           CAF      V06N16                                
009618,000087: 32,2033           04616                           TC       BANKCALL                              #  R1 = 00XXX. HRS., R2 = 000XX MIN.,
009619,000088: 32,2034           20212                           CADR     GOMARKF                               #  R3 = 0XX.XX SEC.
009620,000089: 32,2035           05472                           TC       ENDEXT                                #  TERMINATE RETURN
009621,000090: 32,2036           02046                           TC       AGSVCALC                              #  PROCEED   RETURN
009622,000091: 32,2037           44746                           CS       BIT6                                  #  IS ENTER VIA A V32
009623,000092: 32,2040           60154                           AD       MPAC                                  
009624,000093: 32,2041           00006                           EXTEND                                         
009625,000094: 32,2042           12024                           BZF      NEWAGS                                #  YES, USE KEYSTROKE TIME FOR NEW AGSK
009626,000095: 
009627,000096: 32,2043           00006                           EXTEND                                         #  NO, NEW AGSK LOADED VIA V25
009628,000097: 32,2044           31052                           DCA      DSPTEMX                               #  LOADED INTO DSPTEMX BY KEYING
009629,000098: 32,2045           02026                           TC       REDSPTEM   -1                         #  V25E FOLLOWED BY HRS.,MINS.,SECS.
009630,000099:                                                                                                  #  DISPLAY THE NEW K
009631,000100: 
009632,000101: 32,2046           06036        AGSVCALC           TC       INTPRET                               
009633,000102: 32,2047           77614                           SET                                            
009634,000103: 32,2050           01076                                    NODOFLAG                              #  DONT ALLOW V37
009635,000104: 32,2051           77414                           SET      EXIT                                  
009636,000105: 32,2052           02076                                    XDSPFLAG                              
009637,000106: 
009638,000107: 32,2053           32202                           CAF      V06N16                                
009639,000108: 32,2054           04616                           TC       BANKCALL                              
009640,000109: 32,2055           20473                           CADR     EXDSPRET                              
009641,000110: 
009642,000111: 32,2056           06036                           TC       INTPRET                               #  EXTRAPOLATE LEM AND CSM STATE VECTORS
009643,000112: 32,2057           77634                           RTB                                            #  TO THE PRESENT TIME
009644,000113: 32,2060           21462                                    LOADTIME                              #  LOAD MPAC WITH TIME2,TIME1
009645,000114: 32,2061           34041                           STCALL   TDEC1                                 #  CALCULATE LEM STATE VECTOR
009646,000115: 32,2062           27057                                    LEMPREC                               
009647,000116: 32,2063           77624                           CALL                                           #  CALL ROUTINE TO CONVERT TO SM COORDS AND
009648,000117: 32,2064           64142                                    SCALEVEC                              #  PROVIDE PROPER SCALING
009649,000118: 32,2065           16205                           STODL    AGSBUFF                               #  (LEMPREC AND CSMPREC LEAVE TDEC1 IN TAT)
009650,000119: 32,2066           00015                                    TAT                                   #  TAT = TIME TO WHICH RATT1 AND VATT1 ARE
009651,000120: 32,2067           34041                           STCALL   TDEC1                                 #  COMPUTED(CSEC SINCE CLOCK START B-28).
009652,000121: 32,2070           27043                                    CSMPREC                               #  CALCULATE CSM STATE VECTOR FOR SAME TIME
009653,000122: 32,2071           77624                           CALL                                           
009654,000123: 32,2072           64142                                    SCALEVEC                              
009655,000124: 

Page 223

009657,000126: 32,2073           16213                           STODL    AGSBUFF    +6                         
009658,000127: 32,2074           00015                                    TAT                                   
009659,000128: 32,2075           56225                           DSU      DDV                                   #  CALCULATE AND STORE THE TIME
009660,000129: 32,2076           02021                                    AGSK                                  
009661,000130: 32,2077           24205                                    TSCALE                                
009662,000131: 32,2100           02221                           STORE    AGSBUFF    +12D                       
009663,000132: 32,2101           77776                           EXIT                                           
009664,000133: 
009665,000134: 32,2102           34753                           CAF      LAGSLIST                              
009666,000135: 32,2103           54332                           TS       DNLSTCOD                              
009667,000136: 
009668,000137: 32,2104           32206                           CAF      20SEC                                 #  DELAY FOR 20 SEC WHILE THE AGS
009669,000138: 32,2105           04616                           TC       BANKCALL                              #  DOWNLIST IS TRANSMITTED
009670,000139: 32,2106           01735                           CADR     DELAYJOB                              
009671,000140: 
009672,000141: 32,2107           31324                           CA       AGSWORD                               
009673,000142: 32,2110           54332                           TS       DNLSTCOD                              #  RETURN TO THE OLD DOWNLIST
009674,000143: 32,2111           34744                           CAF      IMUSEBIT                              
009675,000144: 32,2112           70074                           MASK     FLAGWRD0                              #  CHECK IMUSE FLAG.
009676,000145: 32,2113           10000                           CCS      A                                     
009677,000146: 32,2114           02132                           TC       AGSEND                                #  IMU IS BEING USED - DO NOT ZERO
009678,000147: 32,2115           11304        CKSTALL            CCS      IMUCADR                               #  CHECK FOR IMU USAGE WHICH AVOIDS THE
009679,000148: 32,2116           12121                           TCF      +3                                    #  IMUSE BIT:  I.E., IMU COMPENSATION.
009680,000149: 32,2117           12125                           TCF      +6                                    #  FREE.  GO AHEAD WITH THE IMU ZERO.
009681,000150: 32,2120           12121                           TCF      +1                                    
009682,000151: 32,2121           34363                 +3        CAF      TEN                                   #  WAIT .1 SEC AND TRY AGAIN.
009683,000152: 32,2122           04616                           TC       BANKCALL                              
009684,000153: 32,2123           01735                           CADR     DELAYJOB                              
009685,000154: 32,2124           12115                           TCF      CKSTALL                               
009686,000155: 
009687,000156: 32,2125           04616                 +6        TC       BANKCALL                              #  IMU IS NOT IN USE
009688,000157: 32,2126           16667                           CADR     IMUZERO                               #  SET IMU ZERO DISCRETE FOR 320MSECS
009689,000158: 32,2127           04616                           TC       BANKCALL                              #  WAIT 3 SEC FOR COUNTERS TO INCREMENT
009690,000159: 32,2130           17671                           CADR     IMUSTALL                              
009691,000160: 32,2131           02132                           TC       AGSEND                                
009692,000161: 32,2132           05516        AGSEND             TC       DOWNFLAG                              #  ALLOW V37
009693,000162: 32,2133           00054                           ADRES    NODOFLAG                              
009694,000163: 
009695,000164: 32,2134           32203                           CAF      V50N16                                
009696,000165: 32,2135           04616                           TC       BANKCALL                              
009697,000166: 32,2136           20220                           CADR     GOMARK3                               
009698,000167: 32,2137           15472                           TCF      ENDEXT                                
009699,000168: 32,2140           15472                           TCF      ENDEXT                                
009700,000169: 32,2141           05472                           TC       ENDEXT                                
009701,000170: 
009702,000171: 32,2142           64375        SCALEVEC           VLOAD    MXV                                   
009703,000172: 32,2143           00025                                    VATT1                                 
009704,000173: 32,2144           01734                                    REFSMMAT                              
009705,000174: 32,2145           72561                           VXSC     VSL2                                  
009706,000175: 32,2146           24212                                    VSCALE                                
009707,000176: 

Page 224

009709,000178: 32,2147           53255                           VAD      VAD                                   #  THIS SECTION ROUNDS THE VECTOR, AND
009710,000179: 32,2150           24214                                    AGSRND1                               #  CORRECTS FOR THE FACT THAT THE AGS
009711,000180: 32,2151           24222                                    AGSRND2                               #  IS A 2 S COMPLIMENT MACHINE WHILE THE
009712,000181: 32,2152           77634                           RTB                                            #  LGC IS A 1 S COMPLIMENT MACHINE.
009713,000182: 32,2153           21744                                    VECSGNAG                              
009714,000183: 32,2154           24025                           STOVL    VATT1                                 
009715,000184: 32,2155           00017                                    RATT1                                 
009716,000185: 32,2156           74321                           MXV      VXSC                                  
009717,000186: 32,2157           01734                                    REFSMMAT                              
009718,000187: 32,2160           24210                                    RSCALE                                
009719,000188: 32,2161           53212                           VSL8     VAD                                   #  AGAIN THIS SECTION ROUNDS.  TWO VECTORS
009720,000189: 32,2162           24214                                    AGSRND1                               #  ARE ADDED TO DEFEAT ALSIGNAG IN THE
009721,000190: 32,2163           47055                           VAD      RTB                                   #  CASE OF A HIGH-ORDER ZERO COUPLED WITH
009722,000191: 32,2164           24222                                    AGSRND2                               #  A LOW ORDER NEGATIVE PART.
009723,000192: 32,2165           21744                                    VECSGNAG                              
009724,000193: 32,2166           77750                           LXA,1                                          
009725,000194: 32,2167           00024                                    VATT1                                 
009726,000195: 32,2170           72130                           SXA,1    LXA,1                                 
009727,000196: 32,2171           00155                                    MPAC       +1                         
009728,000197: 32,2172           00026                                    VATT1      +2                         
009729,000198: 32,2173           72130                           SXA,1    LXA,1                                 
009730,000199: 32,2174           00160                                    MPAC       +4                         
009731,000200: 32,2175           00030                                    VATT1      +4                         
009732,000201: 32,2176           43530                           SXA,1    RVQ                                   
009733,000202: 32,2177           00162                                    MPAC       +6                         
009734,000203: 
009735,000204: 32,2200     4753               LAGSLIST           =        ONE                                   
009736,000205: 32,2200           00216        V01N14             VN       0114                                  
009737,000206: 32,2201           14400        V50N00A            VN       5000                                  
009738,000207: 32,2202     6010               V00N25             EQUALS   OCT31                                 
009739,000208: 32,2202           01420        V06N16             VN       0616                                  
009740,000209: 32,2203     4242               V00N34             EQUALS   34DEC                                 
009741,000210: 32,2203           14420        V50N16             VN       5016                                  
009742,000211: 32,2204           03100 00000  TSCALE             2DEC     100        B-10                       #  CSEC TO SEC SCALE FACTOR
009743,000212: 32,2206           03720        20SEC              DEC      2000       B-14                       
009744,000213: 32,2207           15077 05041  RSCALE             2DEC     3.280839   B-3                        #  METERS TO FEET SCALE FACTOR
009745,000214: 32,2211           24402 25724  VSCALE             2DEC     3.280839   E2         B-9             #  METERS/CS TO FEET/SEC SCALE FACTOR
009746,000215: 32,2213           00000 60000  AGSRND1            2OCT     0000060000                            
009747,000216: 32,2215           00000 60000                     2OCT     0000060000                            
009748,000217: 32,2217           00000 60000                     2OCT     0000060000                            
009749,000218: 32,2221           00000 37777  AGSRND2            2OCT     0000037777                            
009750,000219: 32,2223           00000 37777                     2OCT     0000037777                            
009751,000220: 

Page 225

009753,000222: 32,2225           00000 37777                     2OCT     0000037777                            
009754,000223: 
009755,000224: 32,2227  30,2000                                  SBANK=   LOWSUPER                              #  FOR SUBSEQUENT LOW 2CADRS.

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