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
	20'35 OCT. 28,1968
Note that the date is the date of the printout, not the date of the program revision.

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

Page 206

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

Page 207

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

Page 208

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

Page 209

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

Page 210

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

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