Source Code

These source-code files were from the printout at the MIT Museum, with many thanks to Deborah Douglas, the Museum's Curator of Science and Technology, for releasing it to us. The printout was digitally photographed by Paul Fjeld. A team of volunteers transcribed the source code manually from these images or, where appropriate, modified already-transcribed but similar source Luminary 131 (Apollo 13) source code to agree with the images from the printout. Note that the page images presented online are of reduced quality, and that higher-quality images are available. Report any conversion errors or legibility problems in page images to info@sandroid.org. Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 001 OF AGC PROGRAM LMY99 BY NASA 2021112-061
	16:27 JULY 14,1969
Note that the date is the date of the printout, not the date of the program revision.

008324,000002:                                                                                                  ## Copyright:   Public domain.
008325,000003:                                                                                                  ## Filename:    AGS_INITIALIZATION.agc
008326,000004:                                                                                                  ## Purpose:     Part of the source code for Luminary 1A build 099.
008327,000005:                                                                                                  ##              It is part of the source code for the Lunar Module's (LM)
008328,000006:                                                                                                  ##              Apollo Guidance Computer (AGC), for Apollo 11.
008329,000007:                                                                                                  ## Assembler:   yaYUL
008330,000008:                                                                                                  ## Contact:     Hartmuth Gutsche <hgutsche@xplornet.com>.
008331,000009:                                                                                                  ## Website:     www.ibiblio.org/apollo.
008332,000010:                                                                                                  ## Pages:       206-210
008333,000011:                                                                                                  ## Mod history: 2009-05-19 HG   Transcribed from page images.
008334,000012:                                                                                                  ##              2016-12-13 RSB  Proofed text comments with octopus/ProoferComments
008335,000013:                                                                                                  ##                              and corrected the errors found.
008336,000014:                                                                                                  ##              2017-03-14 RSB  Comment-text fixes identified in 5-way
008337,000015:                                                                                                  ##                              side-by-side diff of Luminary 69/99/116/131/210.
008338,000016:                                                                                                  ##
008339,000017:                                                                                                  ## This source code has been transcribed or otherwise adapted from
008340,000018:                                                                                                  ## digitized images of a hardcopy from the MIT Museum.  The digitization
008341,000019:                                                                                                  ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
008342,000020:                                                                                                  ## the Museum.  Many thanks to both.  The images (with suitable reduction
008343,000021:                                                                                                  ## in storage size and consequent reduction in image quality as well) are
008344,000022:                                                                                                  ## available online at www.ibiblio.org/apollo.  If for some reason you
008345,000023:                                                                                                  ## find that the images are illegible, contact me at info@sandroid.org
008346,000024:                                                                                                  ## about getting access to the (much) higher-quality images which Paul
008347,000025:                                                                                                  ## actually created.
008348,000026:                                                                                                  ##
008349,000027:                                                                                                  ## Notations on the hardcopy document read, in part:
008350,000028:                                                                                                  ##
008351,000029:                                                                                                  ##      Assemble revision 001 of AGC program LMY99 by NASA 2021112-61
008352,000030:                                                                                                  ##      16:27 JULY 14, 1969 
008353,000031: 

Page 206

008355,000033: 
008356,000034:                                                                                                  #  PROGRAM NAME:  AGS INITIALIZATION (R47)
008357,000035: 
008358,000036:                                                                                                  #  WRITTEN BY:  RHODE/KILROY/FOLLETT
008359,000037: 
008360,000038:                                                                                                  #  MOD NO. :     0
008361,000039:                                                                                                  #  DATE:         23 MARCH 1967
008362,000040:                                                                                                  #  MOD BY:       KILROY
008363,000041: 
008364,000042:                                                                                                  #  MOD NO.:      1
008365,000043:                                                                                                  #  DATE:         28 OCTOBER 1967
008366,000044:                                                                                                  #  MOD BY:       FOLLETT
008367,000045: 
008368,000046:                                                                                                  #  FUNCT. DESC.: (1) TO PROVIDE THE AGS ABORT ELECTRONICS ASSEMBLY (AEA) WITH THE LEM AND CSM STATE VECTORS
008369,000047:                                                                                                  #                (POSITION,VELOCITY,TIME) IN LEM IMU COORDINATES BY MEANS OF THE LGC DIGITAL DOWNLINK.
008370,000048: 
008371,000049:                                                                                                  #                (2) TO ZERO THE ICDU, LGC AND AEA GIMBAL ANGLE COUNTERS SIMULTANEOUSLY IN ORDER TO ESTABLISH A
008372,000050:                                                                                                  #                COMMON ZERO REFERENCE FOR THE MEASUREMENT OF GIMBAL (EULER) ANGLES WHICH DEFINE LEM ATTITUDE
008373,000051: 
008374,000052:                                                                                                  #                (3) TO ESTABLISH THE GROUND ELAPSED TIME OF AEA CLOCK ZERO.  (IF AN AEA CLOCK ZERO IS
008375,000053:                                                                                                  #                REQUESTED DURING THIS PROGRAM
008376,000054: 
008377,000055:                                                                                                  #  LOG SECTION:  AGS INITIALIZATION
008378,000056: 
008379,000057:                                                                                                  #  CALLING SEQ:  PROGRAM IS ENTERED WHEN ASTRONAUT KEYS V47E ON DSKY.
008380,000058:                                                                                                  #                R47 MAY BE CALLED AT ANY TIME EXCEPT WHEN ANOTHER EXTENDED VERB IS IN PROGRESS
008381,000059: 
008382,000060:                                                                                                  #  SUBROUTINES
008383,000061:                                                                                                  #  CALLED:
008384,000062: 
008385,000063:                                                                                                  #  NORMAL EXIT:  ENDEXT
008386,000064: 
008387,000065:                                                                                                  #  ALARM/ABORT:  ALARM - BAD REFSMMAT - CODE:220
008388,000066:                                                                                                  #                OPERATOR ERROR IF V47 SELECTED DURING ANOTHER EXTENDED VERB.
008389,000067: 
008390,000068:                                                                                                  #  ERASABLES
008391,000069:                                                                                                  #  USED:         SAMPTIME        (2)     TIME OF :ENTER: KEYSTROKE
008392,000070:                                                                                                  #                AGSK            (2)     GROUND ELAPSED TIME OF THE AEA CLOCK :ZERO:
008393,000071:                                                                                                  #                AGSBUFF         (140)   CONTAINS AGS INITIALIZATION DATA (SEE :OUTPUT: BELOW)
008394,000072:                                                                                                  #                AGSWORD         (1)     PREVIOUS DOWNLIST SAVED HERE
008395,000073: 
008396,000074: 05,2447  E4,1600                                  EBANK=   AGSBUFF                               
008397,000075: 
008398,000076: 40,2000                                           BANK     40                                    
008399,000077: 32,2000                                           SETLOC   R47                                   
008400,000078: 32,2000                                           BANK                                           
008401,000079: 
008402,000080: 32,2005                                           COUNT*   $$/R47                                
008403,000081: 
008404,000082: 32,2005           34737        AGSINIT            CAF      REFSMBIT                              
008405,000083: 32,2006           70077                           MASK     FLAGWRD3                              #  CHECK REFSMFLG.
008406,000084: 32,2007           10000                           CCS      A                                     

Page 207

008408,000086: 32,2010           02017                           TC       REDSPTEM                              #  REFSMMAT IS OK
008409,000087: 32,2011           05567                           TC       ALARM                                 #  REFSMMAT IS BAD
008410,000088: 32,2012           00220                           OCT      220                                   
008411,000089: 32,2013           05472                           TC       ENDEXT                                
008412,000090: 
008413,000091: 32,2014           00006        NEWAGS             EXTEND                                         
008414,000092: 32,2015           30014                           DCA      SAMPTIME                              #  TIME OF THE :ENTER: KEYSTROKE
008415,000093: 32,2016           53421                           DXCH     AGSK                                  #  BECOMES NEW AEA CLOCK :ZERO:
008416,000094: 
008417,000095: 32,2017           00006        REDSPTEM           EXTEND                                         
008418,000096: 32,2020           31421                           DCA      AGSK                                  
008419,000097: 32,2021           53052                           DXCH     DSPTEMX                               
008420,000098: 32,2022           32172        AGSDISPK           CAF      V06N16                                
008421,000099: 32,2023           04616                           TC       BANKCALL                              #  R1 = 00XXX. HRS., R2 = 000XX MIN.,
008422,000100: 32,2024           20334                           CADR     GOMARKF                               #  R3 = 0XX.XX SEC.
008423,000101: 32,2025           05472                           TC       ENDEXT                                #  TERMINATE RETURN
008424,000102: 32,2026           02036                           TC       AGSVCALC                              #  PROCEED RETURN
008425,000103: 32,2027           44746                           CS       BIT6                                  #  IS ENTER VIA A V32
008426,000104: 32,2030           60154                           AD       MPAC                                  
008427,000105: 32,2031           00006                           EXTEND                                         
008428,000106: 32,2032           12014                           BZF      NEWAGS                                #  YES, USE KEYSTROKE TIME FOR NEW AGSK
008429,000107: 
008430,000108: 32,2033           00006                           EXTEND                                         #  NO, NEW AGSK LOADED VIA V25
008431,000109: 32,2034           31052                           DCA      DSPTEMX                               #  LOADED INTO DSPTEMX BY KEYING
008432,000110: 32,2035           02016                           TC       REDSPTEM   -1                         #  V25E FOLLOWED BY HRS.,MINS.,SECS.
008433,000111:                                                                                                  #  DISPLAY THE NEW K
008434,000112: 
008435,000113: 32,2036           06037        AGSVCALC           TC       INTPRET                               
008436,000114: 32,2037           77614                           SET                                            
008437,000115: 32,2040           01076                                    NODOFLAG                              #  DONT ALLOW V37
008438,000116: 32,2041           77414                           SET      EXIT                                  
008439,000117: 32,2042           02076                                    XDSPFLAG                              
008440,000118: 
008441,000119: 32,2043           32172                           CAF      V06N16                                
008442,000120: 32,2044           04616                           TC       BANKCALL                              
008443,000121: 32,2045           20620                           CADR     EXDSPRET                              
008444,000122: 
008445,000123: 32,2046           06037                           TC       INTPRET                               #  EXTRAPOLATE LEM AND CSM STATE VECTORS
008446,000124: 32,2047           77634                           RTB                                            #  TO THE PRESENT TIME
008447,000125: 32,2050           21573                                    LOADTIME                              #  LOAD MPAC WITH TIME2,TIME1
008448,000126: 32,2051           34041                           STCALL   TDEC1                                 #  CALCULATE LEM STATE VECTOR
008449,000127: 32,2052           27057                                    LEMPREC                               
008450,000128: 32,2053           77624                           CALL                                           #  CALL ROUTINE TO CONVERT TO SM COORDS AND
008451,000129: 32,2054           64132                                    SCALEVEC                              #  PROVIDE PROPER SCALING
008452,000130: 32,2055           16201                           STODL    AGSBUFF                               #  (LEMPREC AND CSMPREC LEAVE TDEC1 IN TAT)
008453,000131: 32,2056           00015                                    TAT                                   #  TAT = TIME TO WHICH RATT1 AND VATT1 ARE
008454,000132: 32,2057           34041                           STCALL   TDEC1                                 #  COMPUTED (CSEC SINCE CLOCK START B-28).
008455,000133: 32,2060           27043                                    CSMPREC                               #  CALCULATE CSM STATE VECTOR FOR SAME TIME
008456,000134: 32,2061           77624                           CALL                                           
008457,000135: 32,2062           64132                                    SCALEVEC                              

Page 208

008459,000137: 32,2063           16207                           STODL    AGSBUFF    +6                         
008460,000138: 32,2064           00015                                    TAT                                   
008461,000139: 32,2065           56225                           DSU      DDV                                   #  CALCULATE AND STORE THE TIME
008462,000140: 32,2066           02021                                    AGSK                                  
008463,000141: 32,2067           24175                                    TSCALE                                
008464,000142: 32,2070           02215                           STORE    AGSBUFF    +12D                       
008465,000143: 32,2071           77776                           EXIT                                           
008466,000144: 
008467,000145: 32,2072           34753                           CAF      LAGSLIST                              
008468,000146: 32,2073           54332                           TS       DNLSTCOD                              
008469,000147: 
008470,000148: 32,2074           32176                           CAF      20SEC                                 #  DELAY FOR 20 SEC WHILE THE AGS
008471,000149: 32,2075           04616                           TC       BANKCALL                              #  DOWNLIST IS TRANSMITTED
008472,000150: 32,2076           01735                           CADR     DELAYJOB                              
008473,000151: 
008474,000152: 32,2077           31324                           CA       AGSWORD                               
008475,000153: 32,2100           54332                           TS       DNLSTCOD                              #  RETURN TO THE OLD DOWNLIST
008476,000154: 32,2101           34744                           CAF      IMUSEBIT                              
008477,000155: 32,2102           70074                           MASK     FLAGWRD0                              #  CHECK IMUSE FLAG.
008478,000156: 32,2103           10000                           CCS      A                                     
008479,000157: 32,2104           02122                           TC       AGSEND                                #  IMU IS BEING USED - DO NOT ZERO
008480,000158: 32,2105           11304        CKSTALL            CCS      IMUCADR                               #  CHECK FOR IMU USAGE WHICH AVOIDS THE
008481,000159: 32,2106           12111                           TCF      +3                                    #  IMUSE BIT:  I.E., IMU COMPENSATION.
008482,000160: 32,2107           12115                           TCF      +6                                    #  FREE.  GO AHEAD WITH THE IMU ZERO.
008483,000161: 32,2110           12111                           TCF      +1                                    
008484,000162: 32,2111           34363                 +3        CAF      TEN                                   #  WAIT .1 SEC AND TRY AGAIN.
008485,000163: 32,2112           04616                           TC       BANKCALL                              
008486,000164: 32,2113           01735                           CADR     DELAYJOB                              
008487,000165: 32,2114           12105                           TCF      CKSTALL                               
008488,000166: 
008489,000167: 32,2115           04616                 +6        TC       BANKCALL                              #  IMU IS NOT IN USE
008490,000168: 32,2116           16714                           CADR     IMUZERO                               #  SET IMU ZERO DISCRETE FOR 320MSECS
008491,000169: 32,2117           04616                           TC       BANKCALL                              #  WAIT 3 SEC FOR COUNTERS TO INCREMENT
008492,000170: 32,2120           17716                           CADR     IMUSTALL                              
008493,000171: 32,2121           02122                           TC       AGSEND                                
008494,000172: 32,2122           05516        AGSEND             TC       DOWNFLAG                              #  ALLOW V37
008495,000173: 32,2123           00054                           ADRES    NODOFLAG                              
008496,000174: 
008497,000175: 32,2124           32173                           CAF      V50N16                                
008498,000176: 32,2125           04616                           TC       BANKCALL                              
008499,000177: 32,2126           20342                           CADR     GOMARK3                               
008500,000178: 32,2127           15472                           TCF      ENDEXT                                
008501,000179: 32,2130           15472                           TCF      ENDEXT                                
008502,000180: 32,2131           05472                           TC       ENDEXT                                
008503,000181: 
008504,000182: 32,2132           64375        SCALEVEC           VLOAD    MXV                                   
008505,000183: 32,2133           00025                                    VATT1                                 
008506,000184: 32,2134           01734                                    REFSMMAT                              
008507,000185: 32,2135           72561                           VXSC     VSL2                                  
008508,000186: 32,2136           24202                                    VSCALE                                

Page 209

008510,000188: 32,2137           53255                           VAD      VAD                                   #  THIS SECTION ROUNDS THE VECTOR, AND
008511,000189: 32,2140           24204                                    AGSRND1                               #  CORRECTS FOR THE FACT THAT THE AGS
008512,000190: 32,2141           24212                                    AGSRND2                               #  IS A 2 S COMPLIMENT MACHINE WHILE THE
008513,000191: 32,2142           77634                           RTB                                            #  LGC IS A 1 S COMPLIMENT MACHINE.
008514,000192: 32,2143           21772                                    VECSGNAG                              
008515,000193: 32,2144           24025                           STOVL    VATT1                                 
008516,000194: 32,2145           00017                                    RATT1                                 
008517,000195: 32,2146           74321                           MXV      VXSC                                  
008518,000196: 32,2147           01734                                    REFSMMAT                              
008519,000197: 32,2150           24200                                    RSCALE                                
008520,000198: 32,2151           53212                           VSL8     VAD                                   #  AGAIN THIS SECTION ROUNDS.  TWO VECTORS
008521,000199: 32,2152           24204                                    AGSRND1                               #  ARE ADDED TO DEFEAT ALSIGNAG IN THE
008522,000200: 32,2153           47055                           VAD      RTB                                   #  CASE OF A HIGH-ORDER ZERO COUPLED WITH
008523,000201: 32,2154           24212                                    AGSRND2                               #  A LOW ORDER NEGATIVE PART.
008524,000202: 32,2155           21772                                    VECSGNAG                              
008525,000203: 32,2156           77750                           LXA,1                                          
008526,000204: 32,2157           00024                                    VATT1                                 
008527,000205: 32,2160           72130                           SXA,1    LXA,1                                 
008528,000206: 32,2161           00155                                    MPAC       +1                         
008529,000207: 32,2162           00026                                    VATT1      +2                         
008530,000208: 32,2163           72130                           SXA,1    LXA,1                                 
008531,000209: 32,2164           00160                                    MPAC       +4                         
008532,000210: 32,2165           00030                                    VATT1      +4                         
008533,000211: 32,2166           43530                           SXA,1    RVQ                                   
008534,000212: 32,2167           00162                                    MPAC       +6                         
008535,000213: 
008536,000214: 32,2170     4753               LAGSLIST           =        ONE                                   
008537,000215: 32,2170           00216        V01N14             VN       0114                                  
008538,000216: 32,2171           14400        V50N00A            VN       5000                                  
008539,000217: 32,2172     6010               V00N25             EQUALS   OCT31                                 
008540,000218: 32,2172           01420        V06N16             VN       0616                                  
008541,000219: 32,2173     4242               V00N34             EQUALS   34DEC                                 
008542,000220: 32,2173           14420        V50N16             VN       5016                                  
008543,000221: 32,2174           03100 00000  TSCALE             2DEC     100        B-10                       #  CSEC TO SEC SCALE FACTOR
008544,000222: 32,2176           03720        20SEC              DEC      2000       B-14                       
008545,000223: 32,2177           15077 05041  RSCALE             2DEC     3.280839   B-3                        #  METERS TO FEET SCALE FACTOR
008546,000224: 32,2201           24402 25724  VSCALE             2DEC     3.280839   E2         B-9             #  METERS/CS TO FEET/SEC SCALE FACTOR
008547,000225: 32,2203           00000 60000  AGSRND1            2OCT     0000060000                            
008548,000226: 32,2205           00000 60000                     2OCT     0000060000                            
008549,000227: 32,2207           00000 60000                     2OCT     0000060000                            
008550,000228: 32,2211           00000 37777  AGSRND2            2OCT     0000037777                            
008551,000229: 32,2213           00000 37777                     2OCT     0000037777                            

Page 210

008553,000231: 32,2215           00000 37777                     2OCT     0000037777                            
008554,000232: 
008555,000233: 32,2217  30,2000                                  SBANK=   LOWSUPER                              #  FOR SUBSEQUENT LOW 2CADRS.
008556,000234: 

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