Source Code

This is a reconstructed version of Luminary 130, the initial AGC program released in November 1969 for the Apollo 13 LM. Three more releases followed before the flown revision was finally manufactured in February 1970.

This reconstruction was created from a previous transcription of the original listing of Luminary 131, combined with Luminary memo #129 which describes the small difference between the Luminary 130 and 131. The reconstructed source code was verified by matching memory-bank checksums to those listed for Luminary 130 in drawing 2021152G.

In this source code, program comments from the original (Luminary 131) code are prefixed with '#', while those added later by the Virtual AGC project are prefixed with '##'.

008359,000002:                                                                                                  ## Copyright:   Public domain.
008360,000003:                                                                                                  ## Filename:    AGS_INITIALIZATION.agc
008361,000004:                                                                                                  ## Purpose:     A section of the reconstructed source code for Luminary 130.
008362,000005:                                                                                                  ##              This was the original program released for the Apollo 13 LM,
008363,000006:                                                                                                  ##              although several more revisions would follow. It has been
008364,000007:                                                                                                  ##              reconstructed from a listing of Luminary 131, from which it
008365,000008:                                                                                                  ##              differs on only two lines in P70-P71. The difference is
008366,000009:                                                                                                  ##              described in detail in Luminary memo #129, which was used
008367,000010:                                                                                                  ##              to perform the reconstruction. This file is intended to be a
008368,000011:                                                                                                  ##              faithful reconstruction, except that the code format has been
008369,000012:                                                                                                  ##              changed to conform to the requirements of the yaYUL assembler
008370,000013:                                                                                                  ##              rather than the original YUL assembler.
008371,000014:                                                                                                  ## Reference:   pp. 208-212
008372,000015:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
008373,000016:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
008374,000017:                                                                                                  ## Mod history: 05/05/03 RSB.   Began transcribing.
008375,000018:                                                                                                  ##              05/14/05 RSB    Corrected website reference above.
008376,000019:                                                                                                  ##              2017-01-06 RSB  Page numbers now agree with those on the
008377,000020:                                                                                                  ##                              original harcopy, as opposed to the PDF page
008378,000021:                                                                                                  ##                              numbers in 1701.pdf.
008379,000022:                                                                                                  ##              2017-02-22 RSB  Proofed comment text using octopus/ProoferComments.
008380,000023:                                                                                                  ##              2018-09-04 MAS  Copied from Luminary 131 for Luminary 130.
008381,000024: 

Page 208

008383,000026: 
008384,000027:                                                                                                  #  PROGRAM NAME:  AGS INITIALIZATION (R47)
008385,000028: 
008386,000029:                                                                                                  #  WRITTEN BY:  RHODE/KILROY/FOLLETT
008387,000030: 
008388,000031:                                                                                                  #  MOD NO.:      0
008389,000032:                                                                                                  #  DATE:         23 MARCH 1967
008390,000033:                                                                                                  #  MOD BY:       KILROY
008391,000034: 
008392,000035:                                                                                                  #  MOD NO.:      1
008393,000036:                                                                                                  #  DATE:         28 OCTOBER 1967
008394,000037:                                                                                                  #  MOD BY:       FOLLETT
008395,000038: 
008396,000039:                                                                                                  #  FUNCT. DESC.: (1) TO PROVIDE THE AGS ABORT ELECTRONICS ASSEMBLY (AEA) WITH THE LEM AND CSM STATE VECTORS
008397,000040:                                                                                                  #                (POSITION,VELOCITY,TIME) IN LEM IMU COORDINATES BY MEANS OF THE LGC DIGITAL DOWNLINK.
008398,000041: 
008399,000042:                                                                                                  #                (2) TO ZERO THE ICDU, LGC AND AEA GIMBAL ANGLE COUNTERS SIMULTANEOUSLY IN ORDER TO ESTABLISH A
008400,000043:                                                                                                  #                COMMON ZERO REFERENCE FOR THE MEASUREMENT OF GIMBAL (EULER) ANGLES WHICH DEFINE LEM ATTITUDE
008401,000044: 
008402,000045:                                                                                                  #                (3) TO ESTABLISH THE GROUND ELAPSED TIME OF AEA CLOCK ZERO.  (IF AN AEA CLOCK ZERO IS
008403,000046:                                                                                                  #                REQUESTED DURING THIS PROGRAM
008404,000047: 
008405,000048:                                                                                                  #  LOG SECTION:  AGS INITIALIZATION
008406,000049: 
008407,000050:                                                                                                  #  CALLING SEQ:  PROGRAM IS ENTERED WHEN ASTRONAUT KEYS V47E ON DSKY.
008408,000051:                                                                                                  #                R47 MAY BE CALLED AT ANY TIME EXCEPT WHEN ANOTHER EXTENDED VERB IS IN PROGRESS
008409,000052: 
008410,000053:                                                                                                  #  SUBROUTINES
008411,000054:                                                                                                  #  CALLED:
008412,000055: 
008413,000056:                                                                                                  #  NORMAL EXIT:  ENDEXT
008414,000057: 
008415,000058:                                                                                                  #  ALARM/ABORT:  ALARM - BAD REFSMMAT - CODE:220
008416,000059:                                                                                                  #                OPERATOR ERROR IF V47 SELECTED DURING ANOTHER EXTENDED VERB.
008417,000060: 
008418,000061:                                                                                                  #  ERASABLES
008419,000062:                                                                                                  #  USED:         SAMPTIME        (2)     TIME OF :ENTER: KEYSTROKE
008420,000063:                                                                                                  #                AGSK            (2)     GROUND ELAPSED TIME OF THE AEA CLOCK :ZERO:
008421,000064:                                                                                                  #                AGSBUFF         (140)   CONTAINS AGS INITIALIZATION DATA (SEE :OUTPUT: BELOW)
008422,000065:                                                                                                  #                AGSWORD         (1)     PREVIOUS DOWNLIST SAVED HERE
008423,000066: 
008424,000067: 05,2447  E4,1600                                  EBANK=   AGSBUFF                               
008425,000068: 
008426,000069: 40,2000                                           BANK     40                                    
008427,000070: 32,2000                                           SETLOC   R47                                   
008428,000071: 32,2000                                           BANK                                           
008429,000072: 
008430,000073: 32,2005                                           COUNT*   $$/R47                                
008431,000074: 
008432,000075: 32,2005           34737        AGSINIT            CAF      REFSMBIT                              
008433,000076: 32,2006           70077                           MASK     FLAGWRD3                              #  CHECK REFSMFLG.
008434,000077: 32,2007           10000                           CCS      A                                     

Page 209

008436,000079: 32,2010           02017                           TC       REDSPTEM                              #  REFSMMAT IS OK
008437,000080: 32,2011           05567                           TC       ALARM                                 #  REFSMMAT IS BAD
008438,000081: 32,2012           00220                           OCT      220                                   
008439,000082: 32,2013           05472                           TC       ENDEXT                                
008440,000083: 
008441,000084: 32,2014           00006        NEWAGS             EXTEND                                         
008442,000085: 32,2015           30014                           DCA      SAMPTIME                              #  TIME OF THE :ENTER: KEYSTROKE
008443,000086: 32,2016           53421                           DXCH     AGSK                                  #  BECOMES NEW AEA CLOCK :ZERO:
008444,000087: 
008445,000088: 32,2017           00006        REDSPTEM           EXTEND                                         
008446,000089: 32,2020           31421                           DCA      AGSK                                  
008447,000090: 32,2021           53051                           DXCH     DSPTEMX                               
008448,000091: 32,2022           32172        AGSDISPK           CAF      V06N16                                
008449,000092: 32,2023           04616                           TC       BANKCALL                              #  R1 = 00XXX. HRS., R2 = 000XX MIN.,
008450,000093: 32,2024           20334                           CADR     GOMARKF                               #  R3 = 0XX.XX SEC.
008451,000094: 32,2025           05472                           TC       ENDEXT                                #  TERMINATE RETURN
008452,000095: 32,2026           02036                           TC       AGSVCALC                              #  PROCEED RETURN
008453,000096: 32,2027           44746                           CS       BIT6                                  #  IS ENTER VIA A V32
008454,000097: 32,2030           60154                           AD       MPAC                                  
008455,000098: 32,2031           00006                           EXTEND                                         
008456,000099: 32,2032           12014                           BZF      NEWAGS                                #  YES, USE KEYSTROKE TIME FOR NEW AGSK
008457,000100: 
008458,000101: 32,2033           00006                           EXTEND                                         #  NO, NEW AGSK LOADED VIA V25
008459,000102: 32,2034           31051                           DCA      DSPTEMX                               #  LOADED INTO DSPTEMX BY KEYING
008460,000103: 32,2035           02016                           TC       REDSPTEM   -1                         #  V25E FOLLOWED BY HRS.,MINS.,SECS.
008461,000104:                                                                                                  #  DISPLAY THE NEW K
008462,000105: 
008463,000106: 32,2036           06042        AGSVCALC           TC       INTPRET                               
008464,000107: 32,2037           77614                           SET                                            
008465,000108: 32,2040           01076                                    NODOFLAG                              #  DONT ALLOW V37
008466,000109: 32,2041           77414                           SET      EXIT                                  
008467,000110: 32,2042           02076                                    XDSPFLAG                              
008468,000111: 
008469,000112: 32,2043           32172                           CAF      V06N16                                
008470,000113: 32,2044           04616                           TC       BANKCALL                              
008471,000114: 32,2045           20621                           CADR     EXDSPRET                              
008472,000115: 
008473,000116: 32,2046           06042                           TC       INTPRET                               #  EXTRAPOLATE LEM AND CSM STATE VECTORS
008474,000117: 32,2047           77634                           RTB                                            #  TO THE PRESENT TIME
008475,000118: 32,2050           21574                                    LOADTIME                              #  LOAD MPAC WITH TIME2,TIME1
008476,000119: 32,2051           34041                           STCALL   TDEC1                                 #  CALCULATE LEM STATE VECTOR
008477,000120: 32,2052           27056                                    LEMPREC                               
008478,000121: 32,2053           77624                           CALL                                           #  CALL ROUTINE TO CONVERT TO SM COORDS AND
008479,000122: 32,2054           64132                                    SCALEVEC                              #  PROVIDE PROPER SCALING
008480,000123: 32,2055           16201                           STODL    AGSBUFF                               #  (LEMPREC AND CSMPREC LEAVE TDEC1 IN TAT)
008481,000124: 32,2056           00015                                    TAT                                   #  TAT = TIME TO WHICH RATT1 AND VATT1 ARE
008482,000125: 32,2057           34041                           STCALL   TDEC1                                 #  COMPUTED (CSEC SINCE CLOCK START B-28).
008483,000126: 32,2060           27042                                    CSMPREC                               #  CALCULATE CSM STATE VECTOR FOR SAME TIME
008484,000127: 32,2061           77624                           CALL                                           
008485,000128: 32,2062           64132                                    SCALEVEC                              

Page 210

008487,000130: 32,2063           16207                           STODL    AGSBUFF    +6                         
008488,000131: 32,2064           00015                                    TAT                                   
008489,000132: 32,2065           56225                           DSU      DDV                                   #  CALCULATE AND STORE THE TIME
008490,000133: 32,2066           02021                                    AGSK                                  
008491,000134: 32,2067           24175                                    TSCALE                                
008492,000135: 32,2070           02215                           STORE    AGSBUFF    +12D                       
008493,000136: 32,2071           77776                           EXIT                                           
008494,000137: 
008495,000138: 32,2072           34753                           CAF      LAGSLIST                              
008496,000139: 32,2073           54333                           TS       DNLSTCOD                              
008497,000140: 
008498,000141: 32,2074           32176                           CAF      20SEC                                 #  DELAY FOR 20 SEC WHILE THE AGS
008499,000142: 32,2075           04616                           TC       BANKCALL                              #  DOWNLIST IS TRANSMITTED
008500,000143: 32,2076           01736                           CADR     DELAYJOB                              
008501,000144: 
008502,000145: 32,2077           31321                           CA       AGSWORD                               
008503,000146: 32,2100           54333                           TS       DNLSTCOD                              #  RETURN TO THE OLD DOWNLIST
008504,000147: 32,2101           34744                           CAF      IMUSEBIT                              
008505,000148: 32,2102           70074                           MASK     FLAGWRD0                              #  CHECK IMUSE FLAG.
008506,000149: 32,2103           10000                           CCS      A                                     
008507,000150: 32,2104           02122                           TC       AGSEND                                #  IMU IS BEING USED - DO NOT ZERO
008508,000151: 32,2105           11301        CKSTALL            CCS      IMUCADR                               #  CHECK FOR IMU USAGE WHICH AVOIDS THE
008509,000152: 32,2106           12111                           TCF      +3                                    #  IMUSE BIT:  I.E., IMU COMPENSATION.
008510,000153: 32,2107           12115                           TCF      +6                                    #  FREE.  GO AHEAD WITH THE IMU ZERO.
008511,000154: 32,2110           12111                           TCF      +1                                    
008512,000155: 32,2111           34363                 +3        CAF      TEN                                   #  WAIT .1 SEC AND TRY AGAIN.
008513,000156: 32,2112           04616                           TC       BANKCALL                              
008514,000157: 32,2113           01736                           CADR     DELAYJOB                              
008515,000158: 32,2114           12105                           TCF      CKSTALL                               
008516,000159: 
008517,000160: 32,2115           04616                 +6        TC       BANKCALL                              #  IMU IS NOT IN USE
008518,000161: 32,2116           16705                           CADR     IMUZERO                               #  SET IMU ZERO DISCRETE FOR 320 MSECS
008519,000162: 32,2117           04616                           TC       BANKCALL                              #  WAIT 3SEC FOR COUNTERS TO INCREMENT
008520,000163: 32,2120           17707                           CADR     IMUSTALL                              
008521,000164: 32,2121           02122                           TC       AGSEND                                
008522,000165: 32,2122           05516        AGSEND             TC       DOWNFLAG                              #  ALLOW V37
008523,000166: 32,2123           00054                           ADRES    NODOFLAG                              
008524,000167: 
008525,000168: 32,2124           32173                           CAF      V50N16                                
008526,000169: 32,2125           04616                           TC       BANKCALL                              
008527,000170: 32,2126           20342                           CADR     GOMARK3                               
008528,000171: 32,2127           15472                           TCF      ENDEXT                                
008529,000172: 32,2130           15472                           TCF      ENDEXT                                
008530,000173: 32,2131           05472                           TC       ENDEXT                                
008531,000174: 
008532,000175: 32,2132           64375        SCALEVEC           VLOAD    MXV                                   
008533,000176: 32,2133           00025                                    VATT1                                 
008534,000177: 32,2134           01734                                    REFSMMAT                              
008535,000178: 32,2135           72561                           VXSC     VSL2                                  
008536,000179: 32,2136           24202                                    VSCALE                                

Page 211

008538,000181: 32,2137           53255                           VAD      VAD                                   #  THIS SECTION ROUNDS THE VECTOR, AND
008539,000182: 32,2140           24204                                    AGSRND1                               #  CORRECTS FOR THE FACT THAT THE AGS
008540,000183: 32,2141           24212                                    AGSRND2                               #  IS A 2 S COMPLIMENT MACHINE WHILE THE
008541,000184: 32,2142           77634                           RTB                                            #  LGC IS A 1 S COMPLIMENT MACHINE.
008542,000185: 32,2143           21773                                    VECSGNAG                              
008543,000186: 32,2144           24025                           STOVL    VATT1                                 
008544,000187: 32,2145           00017                                    RATT1                                 
008545,000188: 32,2146           74321                           MXV      VXSC                                  
008546,000189: 32,2147           01734                                    REFSMMAT                              
008547,000190: 32,2150           24200                                    RSCALE                                
008548,000191: 32,2151           53212                           VSL8     VAD                                   #  AGAIN THIS SECTION ROUNDS.  TWO VECTORS
008549,000192: 32,2152           24204                                    AGSRND1                               #  ARE ADDED TO DEFEAT ALSIGNAG IN THE
008550,000193: 32,2153           47055                           VAD      RTB                                   #  CASE OF A HIGH-ORDER ZERO COUPLED WITH
008551,000194: 32,2154           24212                                    AGSRND2                               #  A LOW ORDER NEGATIVE PART.
008552,000195: 32,2155           21773                                    VECSGNAG                              
008553,000196: 32,2156           77750                           LXA,1                                          
008554,000197: 32,2157           00024                                    VATT1                                 
008555,000198: 32,2160           72130                           SXA,1    LXA,1                                 
008556,000199: 32,2161           00155                                    MPAC       +1                         
008557,000200: 32,2162           00026                                    VATT1      +2                         
008558,000201: 32,2163           72130                           SXA,1    LXA,1                                 
008559,000202: 32,2164           00160                                    MPAC       +4                         
008560,000203: 32,2165           00030                                    VATT1      +4                         
008561,000204: 32,2166           43530                           SXA,1    RVQ                                   
008562,000205: 32,2167           00162                                    MPAC       +6                         
008563,000206: 
008564,000207: 32,2170     4753               LAGSLIST           =        ONE                                   
008565,000208: 32,2170           00216        V01N14             VN       0114                                  
008566,000209: 32,2171           14400        V50N00A            VN       5000                                  
008567,000210: 32,2172     6010               V00N25             EQUALS   OCT31                                 
008568,000211: 32,2172           01420        V06N16             VN       0616                                  
008569,000212: 32,2173     4242               V00N34             EQUALS   34DEC                                 
008570,000213: 32,2173           14420        V50N16             VN       5016                                  
008571,000214: 32,2174           03100 00000  TSCALE             2DEC     100        B-10                       #  CSEC TO SEC SCALE FACTOR
008572,000215: 32,2176           03720        20SEC              DEC      2000       B-14                       
008573,000216: 32,2177           15077 05041  RSCALE             2DEC     3.280839   B-3                        #  METERS TO FEET SCALE FACTOR
008574,000217: 32,2201           24402 25724  VSCALE             2DEC     3.280839   E2         B-9             #  METERS/CS TO FEET/SEC SCALE FACTOR
008575,000218: 32,2203           00000 60000  AGSRND1            2OCT     0000060000                            
008576,000219: 32,2205           00000 60000                     2OCT     0000060000                            
008577,000220: 32,2207           00000 60000                     2OCT     0000060000                            
008578,000221: 32,2211           00000 37777  AGSRND2            2OCT     0000037777                            
008579,000222: 32,2213           00000 37777                     2OCT     0000037777                            

Page 212

008581,000224: 32,2215           00000 37777                     2OCT     0000037777                            
008582,000225: 
008583,000226: 32,2217  30,2000                                  SBANK=   LOWSUPER                              #  FOR SUBSEQUENT LOW 2CADRS.
008584,000227: 

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