Source Code

These source-code files are part of a reconstructed copy of Luminary 173, the second (unflown) release of the Apollo 14 Lunar Module (LM) Apollo Guidance Computer (AGC) software.

The reconstruction began with reconstructed source code for Luminary 178. Changes between revision 173 and 178 were backed out, as described by Luminary memo 167 (revision 1). The reconstruction was verified by matching memory-bank checksums to those listed in drawing 2021152N. Note that page numbers in the reconstructed code match those for the baseline log section mentioned in each file's changelog; the page numbers for a real Luminary 173 listing would be different.

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.

008876,000002:                                                                                                  ## Copyright:   Public domain.
008877,000003:                                                                                                  ## Filename:    AGS_INITIALIZATION.agc
008878,000004:                                                                                                  ## Purpose:     A section of Luminary revision 173.
008879,000005:                                                                                                  ##              It is part of the reconstructed source code for the second
008880,000006:                                                                                                  ##              (unflown) release of the flight software for the Lunar
008881,000007:                                                                                                  ##              Module's (LM) Apollo Guidance Computer (AGC) for Apollo 14.
008882,000008:                                                                                                  ##              The code has been recreated from a reconstructed copy of
008883,000009:                                                                                                  ##              Luminary 178, as well as Luminary memo 167 (revision 1).
008884,000010:                                                                                                  ##              It has been adapted such that the resulting bugger words
008885,000011:                                                                                                  ##              exactly match those specified for Luminary 173 in NASA
008886,000012:                                                                                                  ##              drawing 2021152N, which gives relatively high confidence
008887,000013:                                                                                                  ##              that the reconstruction is correct.
008888,000014:                                                                                                  ## Reference:   pp. 213-217
008889,000015:                                                                                                  ## Assembler:   yaYUL
008890,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
008891,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
008892,000018:                                                                                                  ## Mod history: 2019-09-18 MAS  Created from Luminary 178.
008893,000019: 

Page 213

008895,000021:                                                                                                  #  PROGRAM NAME:   AGS INITIALIZATION (R47)
008896,000022: 
008897,000023:                                                                                                  #  WRITTEN BY  :   RHODE/KILROY/FOLLETT
008898,000024: 
008899,000025:                                                                                                  #  MOD NO. :       0
008900,000026:                                                                                                  #  DATE    :       23 MARCH 1967
008901,000027:                                                                                                  #  MOD BY  :       KILROY
008902,000028: 
008903,000029:                                                                                                  #  MOD NO. :       1
008904,000030:                                                                                                  #  DATE    :       28 OCTOBER 1967
008905,000031:                                                                                                  #  MOD BY  :       FOLLETT
008906,000032: 
008907,000033:                                                                                                  #  FUNCT. DESC.:   (1) TO PROVIDE THE AGS ABORT ELECTRONICS ASSEMBLY(AEA) WITH THE LEM AND CSM STATE VECTORS
008908,000034:                                                                                                  #                  (POSITION,VELOCITY,TIME) IN LEM IMU COORDINATES BY MEANS OF THE LGC DIGITAL DOWNLINK.
008909,000035: 
008910,000036:                                                                                                  #                  (2) TO ZERO THE ICDU, LGC AND AEA GIMBAL ANGLE COUNTERS SIMULTANEOUSLY IN ORDER TO ESTABLISH A
008911,000037:                                                                                                  #                  COMMON ZERO REFERENCE FOR THE MEASUREMENT OF GIMBAL(EULER) ANGLES WHICH DEFINE LEM ATTITUDE
008912,000038:                                                                                                  #                  (3) TO ESTABLISH THE GROUND ELAPSED TIME OF AEA CLOCK ZERO.(IF AN AEA CLOCK ZERO IS
008913,000039:                                                                                                  #                  REQUESTED DURING THIS PROGRAM
008914,000040: 
008915,000041:                                                                                                  #  LOG SECTION :   AGS INITIALIZATION
008916,000042: 
008917,000043:                                                                                                  #  CALLING SEQ :   PROGRAM IS ENTERED WHEN ASTRONAUT KEYS V47E ON DSKY.
008918,000044:                                                                                                  #                  R47 MAY BE CALLED AT ANY TIME EXCEPT WHEN ANOTHER EXTENDED VERB IS IN PROGRESS
008919,000045: 
008920,000046:                                                                                                  #  SUBROUTINES
008921,000047:                                                                                                  #  CALLED      :
008922,000048: 
008923,000049:                                                                                                  #  NORMAL EXIT :  ENDEXT
008924,000050: 
008925,000051:                                                                                                  #  ALARM/ABORT :  ALARM - BAD REFSMMAT - CODE:220
008926,000052:                                                                                                  #                 OPERATOR ERROR IF V47 SELECTED DURING ANOTHER EXTENDED VERB.
008927,000053: 
008928,000054:                                                                                                  #  ERASABLES
008929,000055:                                                                                                  #  USED        :  SAMPTIME    (2) TIME OF :ENTER: KEYSTROKE
008930,000056:                                                                                                  #                 AGSK        (2) GROUND ELAPSED TIME OF THE AEA CLOCK :ZERO:
008931,000057:                                                                                                  #                 AGSBUFF   (140) CONTAINS AGS INITIALIZATION DATA (SEE :OUTPUT: BELOW)
008932,000058:                                                                                                  #                 AGSWORD     (1) PREVIOUS DOWNLIST SAVED HERE
008933,000059: 
008934,000060: 05,2460  E6,1771                                  EBANK=   AGSK                                  
008935,000061: 40,2000                                           BANK     40                                    
008936,000062: 32,2000                                           SETLOC   R47                                   
008937,000063: 32,2000                                           BANK                                           
008938,000064: 
008939,000065: 32,2005                                           COUNT*   $$/R47                                
008940,000066: 
008941,000067: 32,2005           34737        AGSINIT            CAF      REFSMBIT                              
008942,000068: 32,2006           70077                           MASK     FLAGWRD3                              #  CHECK REFSMFLG.
008943,000069: 32,2007           10000                           CCS      A                                     
008944,000070: 32,2010           02017                           TC       REDSPTEM                              #  REFSMMAT IS OK

Page 214

008946,000072: 32,2011           05600                           TC       ALARM                                 #  REFSMMAT IS BAD
008947,000073: 32,2012           00220                           OCT      220                                   
008948,000074: 32,2013           05503                           TC       ENDEXT                                
008949,000075: 
008950,000076: 32,2014           00006        NEWAGS             EXTEND                                         
008951,000077: 32,2015           30014                           DCA      SAMPTIME                              #  TIME OF THE :ENTER: KEYSTROKE
008952,000078: 32,2016           53772                           DXCH     AGSK                                  #  BECOMES NEW AEA CLOCK :ZERO:
008953,000079: 
008954,000080: 32,2017           00006        REDSPTEM           EXTEND                                         
008955,000081: 32,2020           31772                           DCA      AGSK                                  
008956,000082: 32,2021           53051                           DXCH     DSPTEMX                               
008957,000083: 32,2022           32172        AGSDISPK           CAF      V06N16                                
008958,000084: 32,2023           04616                           TC       BANKCALL                              #  R1 = 00XXX. HRS., R2 = 000XX MIN.,
008959,000085: 32,2024           20334                           CADR     GOMARKF                               #  R3 = 0XX.XX SEC.
008960,000086: 32,2025           05503                           TC       ENDEXT                                #  TERMINATE RETURN
008961,000087: 32,2026           02036                           TC       AGSVCALC                              #  PROCEED RETURN
008962,000088: 32,2027           44746                           CS       BIT6                                  #  IS ENTER VIA A V32
008963,000089: 32,2030           60154                           AD       MPAC                                  
008964,000090: 32,2031           00006                           EXTEND                                         
008965,000091: 32,2032           12014                           BZF      NEWAGS                                #  YES, USE KEYSTROKE TIME FOR NEW AGSK
008966,000092: 
008967,000093: 32,2033           00006                           EXTEND                                         #  NO, NEW AGSK LOADED VIA V25
008968,000094: 32,2034           31051                           DCA      DSPTEMX                               #  LOADED INTO DSPTEMX BY KEYING
008969,000095: 32,2035           02016                           TC       REDSPTEM   -1                         #  V25E FOLLOWED BY HRS.,MINS.,SECS.
008970,000096:                                                                                                  #  DISPLAY THE NEW K
008971,000097: 
008972,000098: 32,2036           06042        AGSVCALC           TC       INTPRET                               
008973,000099: 32,2037           77614                           SET                                            
008974,000100: 32,2040           01076                                    NODOFLAG                              #  DONT ALLOW V37
008975,000101: 32,2041           77414                           SET      EXIT                                  
008976,000102: 32,2042           02076                                    XDSPFLAG                              
008977,000103: 
008978,000104: 32,2043           32172                           CAF      V06N16                                
008979,000105: 32,2044           04616                           TC       BANKCALL                              
008980,000106: 32,2045           20621                           CADR     EXDSPRET                              
008981,000107: 
008982,000108: 32,2046           06042                           TC       INTPRET                               #  EXTRAPOLATE LEM AND CSM STATE VECTORS
008983,000109: 32,2047           77634                           RTB                                            #  TO THE PRESENT TIME
008984,000110: 32,2050           21574                                    LOADTIME                              #  LOAD MPAC WITH TIME2,TIME1
008985,000111: 32,2051           34041                           STCALL   TDEC1                                 #  CALCULATE LEM STATE VECTOR
008986,000112: 32,2052           27056                                    LEMPREC                               
008987,000113: 32,2053           77624                           CALL                                           #  CALL ROUTINE TO CONVERT TO SM COORDS AND
008988,000114: 32,2054           64132                                    SCALEVEC                              #  PROVIDE PROPER SCALING
008989,000115: 32,2055           16201                           STODL    AGSBUFF                               #  (LEMPREC AND CSMPREC LEAVE TDEC1 IN TAT)
008990,000116: 32,2056           00015                                    TAT                                   #  TAT = TIME TO WHICH RATT1 AND VATT1 ARE
008991,000117: 32,2057           34041                           STCALL   TDEC1                                 #  COMPUTED(CSEC SINCE CLOCK START B-28).
008992,000118: 32,2060           27042                                    CSMPREC                               #  CALCULATE CSM STATE VECTOR FOR SAME TIME
008993,000119: 32,2061           77624                           CALL                                           
008994,000120: 32,2062           64132                                    SCALEVEC                              
008995,000121: 32,2063           16207                           STODL    AGSBUFF    +6                         

Page 215

008997,000123: 32,2064           00015                                    TAT                                   
008998,000124: 32,2065           56225                           DSU      DDV                                   #  CALCULATE AND STORE THE TIME
008999,000125: 
009000,000126: 32,2066           03372                                    AGSK                                  
009001,000127: 32,2067           24175                                    TSCALE                                
009002,000128: 32,2070           02215                           STORE    AGSBUFF    +12D                       
009003,000129: 32,2071           77776                           EXIT                                           
009004,000130: 
009005,000131: 32,2072           34753                           CAF      LAGSLIST                              
009006,000132: 32,2073           54333                           TS       DNLSTCOD                              
009007,000133: 
009008,000134: 32,2074           32176                           CAF      20SEC                                 #  DELAY FOR 20 SEC WHILE THE AGS
009009,000135: 32,2075           04616                           TC       BANKCALL                              #  DOWNLIST IS TRANSMITTED
009010,000136: 32,2076           01736                           CADR     DELAYJOB                              
009011,000137: 
009012,000138: 32,2077           31321                           CA       AGSWORD                               
009013,000139: 32,2100           54333                           TS       DNLSTCOD                              #  RETURN TO THE OLD DOWNLIST
009014,000140: 32,2101           34744                           CAF      IMUSEBIT                              
009015,000141: 32,2102           70074                           MASK     FLAGWRD0                              #  CHECK IMUSE FLAG.
009016,000142: 32,2103           10000                           CCS      A                                     
009017,000143: 32,2104           02122                           TC       AGSEND                                #  IMU IS BEING USED - DO NOT ZERO
009018,000144: 32,2105           11301        CKSTALL            CCS      IMUCADR                               #  CHECK FOR IMU USAGE WHICH AVOIDS THE
009019,000145: 32,2106           12111                           TCF      +3                                    #  IMUSE BIT:  I.E., IMU COMPENSATION.
009020,000146: 32,2107           12115                           TCF      +6                                    #  FREE.  GO AHEAD WITH THE IMU ZERO.
009021,000147: 32,2110           12111                           TCF      +1                                    
009022,000148: 32,2111           34363                 +3        CAF      TEN                                   #  WAIT .1 SEC AND TRY AGAIN.
009023,000149: 32,2112           04616                           TC       BANKCALL                              
009024,000150: 32,2113           01736                           CADR     DELAYJOB                              
009025,000151: 32,2114           12105                           TCF      CKSTALL                               
009026,000152: 
009027,000153: 32,2115           04616                 +6        TC       BANKCALL                              #  IMU IS NOT IN USE
009028,000154: 32,2116           16700                           CADR     IMUZERO                               #  SET IMU ZERO DISCRETE FOR 320 MSECS
009029,000155: 32,2117           04616                           TC       BANKCALL                              #  WAIT 3 SEC FOR COUNTERS TO INCREMENT
009030,000156: 32,2120           17722                           CADR     IMUSTALL                              
009031,000157: 32,2121           02122                           TC       AGSEND                                
009032,000158: 32,2122           05527        AGSEND             TC       DOWNFLAG                              #  ALLOW V37
009033,000159: 32,2123           00054                           ADRES    NODOFLAG                              
009034,000160: 32,2124           32173                           CAF      V50N16                                
009035,000161: 32,2125           04616                           TC       BANKCALL                              
009036,000162: 32,2126           20342                           CADR     GOMARK3                               
009037,000163: 32,2127           15503                           TCF      ENDEXT                                
009038,000164: 32,2130           15503                           TCF      ENDEXT                                
009039,000165: 32,2131           05503                           TC       ENDEXT                                
009040,000166: 
009041,000167: 32,2132           64375        SCALEVEC           VLOAD    MXV                                   
009042,000168: 32,2133           00025                                    VATT1                                 
009043,000169: 32,2134           01732                                    REFSMMAT                              
009044,000170: 32,2135           72561                           VXSC     VSL2                                  
009045,000171: 32,2136           24202                                    VSCALE                                
009046,000172: 32,2137           53255                           VAD      VAD                                   #  THIS SECTION ROUNDS THE VECTOR, AND

Page 216

009048,000174: 32,2140           24204                                    AGSRND1                               #  CORRECTS FOR THE FACT THAT THE AGS
009049,000175: 32,2141           24212                                    AGSRND2                               #  IS A 2 S COMPLIMENT MACHINE WHILE THE
009050,000176: 32,2142           77634                           RTB                                            #  LGC IS A 1 S COMPLIMENT MACHINE.
009051,000177: 32,2143           21773                                    VECSGNAG                              
009052,000178: 32,2144           24025                           STOVL    VATT1                                 
009053,000179: 32,2145           00017                                    RATT1                                 
009054,000180: 32,2146           74321                           MXV      VXSC                                  
009055,000181: 32,2147           01732                                    REFSMMAT                              
009056,000182: 32,2150           24200                                    RSCALE                                
009057,000183: 32,2151           53212                           VSL8     VAD                                   #  AGAIN THIS SECTION ROUNDS.  TWO VECTORS
009058,000184: 32,2152           24204                                    AGSRND1                               #  ARE ADDED TO DEFEAT ALSIGNAG IN THE
009059,000185: 32,2153           47055                           VAD      RTB                                   #  CASE OF A HIGH-ORDER ZERO COUPLED WITH
009060,000186: 32,2154           24212                                    AGSRND2                               #  A LOW ORDER NEGATIVE PART.
009061,000187: 32,2155           21773                                    VECSGNAG                              
009062,000188: 32,2156           77750                           LXA,1                                          
009063,000189: 32,2157           00024                                    VATT1                                 
009064,000190: 32,2160           72130                           SXA,1    LXA,1                                 
009065,000191: 32,2161           00155                                    MPAC       +1                         
009066,000192: 32,2162           00026                                    VATT1      +2                         
009067,000193: 32,2163           72130                           SXA,1    LXA,1                                 
009068,000194: 32,2164           00160                                    MPAC       +4                         
009069,000195: 32,2165           00030                                    VATT1      +4                         
009070,000196: 32,2166           43530                           SXA,1    RVQ                                   
009071,000197: 32,2167           00162                                    MPAC       +6                         
009072,000198: 
009073,000199: 32,2170     4753               LAGSLIST           =        ONE                                   
009074,000200: 32,2170           00216        V01N14             VN       0114                                  
009075,000201: 32,2171           14400        V50N00A            VN       5000                                  
009076,000202: 32,2172     6010               V00N25             EQUALS   OCT31                                 
009077,000203: 32,2172           01420        V06N16             VN       0616                                  
009078,000204: 32,2173     4242               V00N34             EQUALS   34DEC                                 
009079,000205: 32,2173           14420        V50N16             VN       5016                                  
009080,000206: 32,2174           03100 00000  TSCALE             2DEC     100        B-10                       #  CSEC TO SEC SCALE FACTOR
009081,000207: 32,2176           03720        20SEC              DEC      2000       B-14                       
009082,000208: 32,2177           15077 05041  RSCALE             2DEC     3.280839   B-3                        #  METERS TO FEET SCALE FACTOR
009083,000209: 32,2201           24402 25724  VSCALE             2DEC     3.280839   E2         B-9             #  METERS/CS TO FEET/SEC SCALE FACTOR
009084,000210: 32,2203           00000 60000  AGSRND1            2OCT     0000060000                            
009085,000211: 32,2205           00000 60000                     2OCT     0000060000                            
009086,000212: 32,2207           00000 60000                     2OCT     0000060000                            
009087,000213: 32,2211           00000 37777  AGSRND2            2OCT     0000037777                            
009088,000214: 32,2213           00000 37777                     2OCT     0000037777                            
009089,000215: 32,2215           00000 37777                     2OCT     0000037777                            

Page 217

009091,000217: 32,2217  30,2000                                  SBANK=   LOWSUPER                              #  FOR SUBSEQUENT LOW 2CADRS.

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