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.

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

Page 206

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

Page 207

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

Page 208

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

Page 209

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

Page 210

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

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