Source Code

These source-code files were transcribed from scans made from Don Eyles's personal copy of Luminary 069. They were scanned at archive.org's Boston facility, and the scanning was sponsored by Onno Hommes. The code was transcribed from these scans by a team of volunteers who are referenced in the program comments. Comments from the original source code are prefixed with a single '#' symbol, whereas comments added later are prefixed by "##" or "###". In some cases, where similar code blocks exist in previously-transcribed AGC programs (primarily Luminary 99, from Apollo 11) those code blocks were used as a starting point and then corrected to agree with the Luminary 69 scans. The full scans are available at the Virtual AGC project's collection at archive.org, while more-convenient reduced-size (but reduced-quality) images are available at the main Virtual AGC website. Report any errors noted by creating an issue report at the Virtual AGC project's GitHub repository. Notations on the program listing read, in part:

	GAP:  ASSEMBLE REVISION 069 OF AGC PROGRAM LUMINARY BY NASA 2021112-011
	19:02 NOV. 25,1968
Note that the date is the date of the printout, not the date of the program revision.

009526,000002:                                                                                                  ## Copyright:   Public domain.
009527,000003:                                                                                                  ## Filename:    AGS_INITIALIZATION.agc
009528,000004:                                                                                                  ## Purpose:     The main source file for Luminary revision 069.
009529,000005:                                                                                                  ##              It is part of the source code for the original release
009530,000006:                                                                                                  ##              of the flight software for the Lunar Module's (LM) Apollo
009531,000007:                                                                                                  ##              Guidance Computer (AGC) for Apollo 10. The actual flown
009532,000008:                                                                                                  ##              version was Luminary 69 revision 2, which included a
009533,000009:                                                                                                  ##              newer lunar gravity model and only affected module 2.
009534,000010:                                                                                                  ##              This file is intended to be a faithful transcription, except
009535,000011:                                                                                                  ##              that the code format has been changed to conform to the
009536,000012:                                                                                                  ##              requirements of the yaYUL assembler rather than the
009537,000013:                                                                                                  ##              original YUL assembler.
009538,000014:                                                                                                  ## Reference:   pp. 221-225
009539,000015:                                                                                                  ## Assembler:   yaYUL
009540,000016:                                                                                                  ## Contact:     Ron Burkey <info@sandroid.org>.
009541,000017:                                                                                                  ## Website:     www.ibiblio.org/apollo/index.html
009542,000018:                                                                                                  ## Mod history: 2016-12-13 MAS  Created from Luminary 99.
009543,000019:                                                                                                  ##              2017-01-08 HG   Transcribed
009544,000020:                                                                                                  ##              2017-01-25 RSB  Proofed comment text using octopus/prooferComments
009545,000021:                                                                                                  ##                              but no errors found.
009546,000022: 

Page 221

009548,000024: 
009549,000025:                                                                                                  #  PROGRAM NAME:   AGS INITIALIZATION (R47)
009550,000026: 
009551,000027:                                                                                                  #  WRITTEN BY  :   RHODE/KILROY/FOLLETT
009552,000028: 
009553,000029:                                                                                                  #  MOD NO. :       0
009554,000030:                                                                                                  #  DATE    :       23 MARCH 1967
009555,000031:                                                                                                  #  MOD BY  :       KILROY
009556,000032: 
009557,000033:                                                                                                  #  MOD NO. :       1
009558,000034:                                                                                                  #  DATE    :       28 OCTOBER 1967
009559,000035:                                                                                                  #  MOD BY  :       FOLLETT
009560,000036: 
009561,000037:                                                                                                  #  FUNCT. DESC.:   (1) TO PROVIDE THE AGS ABORT ELECTRONICS ASSEMBLY(AEA) WITH THE LEM AND CSM STATE VECTORS
009562,000038:                                                                                                  #                  (POSITION,VELOCITY,TIME) IN LEM IMU COORDINATES BY MEANS OF THE LGC DIGITAL DOWNLINK.
009563,000039: 
009564,000040:                                                                                                  #                  (2) TO ZERO THE ICDU, LGC AND AEA GIMBAL ANGLE COUNTERS SIMULTANEOUSLY IN ORDER TO ESTABLISH A
009565,000041:                                                                                                  #                  COMMON ZERO REFERENCE FOR THE MEASUREMENT OF GIMBAL(EULER) ANGLES WHICH DEFINE LEM ATTITUDE
009566,000042:                                                                                                  #                  (3) TO ESTABLISH THE GROUND ELAPSED TIME OF AEA CLOCK ZERO.(IF AN AEA CLOCK ZERO IS
009567,000043:                                                                                                  #                  REQUESTED DURING THIS PROGRAM
009568,000044: 
009569,000045:                                                                                                  #  LOG SECTION :   AGS INITIALIZATION
009570,000046: 
009571,000047:                                                                                                  #  CALLING SEQ :   PROGRAM IS ENTERED WHEN ASTRONAUT KEYS V47E ON DSKY.
009572,000048:                                                                                                  #                  R47 MAY BE CALLED AT ANY TIME EXCEPT WHEN ANOTHER EXTENDED VERB IS IN PROGRESS
009573,000049: 
009574,000050:                                                                                                  #  SUBROUTINES
009575,000051:                                                                                                  #  CALLED      :
009576,000052: 
009577,000053:                                                                                                  #  NORMAL EXIT :   ENDEXT
009578,000054: 
009579,000055:                                                                                                  #  ALARM/ABORT :   ALARM - BAD REFSMMAT - CODE:220
009580,000056:                                                                                                  #                  OPERATOR ERROR IF V47 SELECTED DURING ANOTHER EXTENDED VERB.
009581,000057: 
009582,000058:                                                                                                  #  ERASABLES
009583,000059:                                                                                                  #  USED        :   SAMPTIME    (2) TIME OF :ENTER: KEYSTROKE
009584,000060:                                                                                                  #                  AGSK        (2) GROUND ELAPSED TIME OF THE AEA CLOCK :ZERO:
009585,000061:                                                                                                  #                  AGSBUFF   (140) CONTAINS AGS INITIALIZATION DATA (SEE :OUTPUT: BELOW)
009586,000062:                                                                                                  #                  AGSWORD     (1) PREVIOUS DOWNLIST SAVED HERE
009587,000063: 
009588,000064: 05,2447  E4,1604                                  EBANK=   AGSBUFF                               
009589,000065: 
009590,000066: 40,2000                                           BANK     40                                    
009591,000067: 32,2000                                           SETLOC   R47                                   
009592,000068: 32,2000                                           BANK                                           
009593,000069: 
009594,000070: 32,2015                                           COUNT*   $$/R47                                
009595,000071: 
009596,000072: 32,2015           34737        AGSINIT            CAF      REFSMBIT                              
009597,000073: 32,2016           70077                           MASK     FLAGWRD3                              #  CHECK REFSMFLG.
009598,000074: 32,2017           10000                           CCS      A                                     
009599,000075: 

Page 222

009601,000077: 32,2020           02027                           TC       REDSPTEM                              #  REFSMMAT IS OK
009602,000078: 32,2021           05567                           TC       ALARM                                 #  REFSMMAT IS BAD
009603,000079: 32,2022           00220                           OCT      220                                   
009604,000080: 32,2023           05472                           TC       ENDEXT                                
009605,000081: 
009606,000082: 32,2024           00006        NEWAGS             EXTEND                                         
009607,000083: 32,2025           30014                           DCA      SAMPTIME                              #  TIME OF THE :ENTER: KEYSTROKE
009608,000084: 32,2026           53421                           DXCH     AGSK                                  #  BECOMES NEW AEA CLOCK :ZERO:
009609,000085: 
009610,000086: 32,2027           00006        REDSPTEM           EXTEND                                         
009611,000087: 32,2030           31421                           DCA      AGSK                                  
009612,000088: 32,2031           53052                           DXCH     DSPTEMX                               
009613,000089: 32,2032           32202        AGSDISPK           CAF      V06N16                                
009614,000090: 32,2033           04616                           TC       BANKCALL                              #  R1 = 00XXX. HRS., R2 = 000XX MIN.,
009615,000091: 32,2034           20212                           CADR     GOMARKF                               #  R3 = 0XX.XX SEC.
009616,000092: 32,2035           05472                           TC       ENDEXT                                #  TERMINATE RETURN
009617,000093: 32,2036           02046                           TC       AGSVCALC                              #  PROCEED   RETURN
009618,000094: 32,2037           44746                           CS       BIT6                                  #  IS ENTER VIA A V32
009619,000095: 32,2040           60154                           AD       MPAC                                  
009620,000096: 32,2041           00006                           EXTEND                                         
009621,000097: 32,2042           12024                           BZF      NEWAGS                                #  YES, USE KEYSTROKE TIME FOR NEW AGSK
009622,000098: 
009623,000099: 32,2043           00006                           EXTEND                                         #  NO, NEW AGSK LOADED VIA V25
009624,000100: 32,2044           31052                           DCA      DSPTEMX                               #  LOADED INTO DSPTEMX BY KEYING
009625,000101: 32,2045           02026                           TC       REDSPTEM   -1                         #  V25E FOLLOWED BY HRS.,MINS.,SECS.
009626,000102:                                                                                                  #  DISPLAY THE NEW K
009627,000103: 
009628,000104: 32,2046           06036        AGSVCALC           TC       INTPRET                               
009629,000105: 32,2047           77614                           SET                                            
009630,000106: 32,2050           01076                                    NODOFLAG                              #  DONT ALLOW V37
009631,000107: 32,2051           77414                           SET      EXIT                                  
009632,000108: 32,2052           02076                                    XDSPFLAG                              
009633,000109: 
009634,000110: 32,2053           32202                           CAF      V06N16                                
009635,000111: 32,2054           04616                           TC       BANKCALL                              
009636,000112: 32,2055           20473                           CADR     EXDSPRET                              
009637,000113: 
009638,000114: 32,2056           06036                           TC       INTPRET                               #  EXTRAPOLATE LEM AND CSM STATE VECTORS
009639,000115: 32,2057           77634                           RTB                                            #  TO THE PRESENT TIME
009640,000116: 32,2060           21462                                    LOADTIME                              #  LOAD MPAC WITH TIME2,TIME1
009641,000117: 32,2061           34041                           STCALL   TDEC1                                 #  CALCULATE LEM STATE VECTOR
009642,000118: 32,2062           27057                                    LEMPREC                               
009643,000119: 32,2063           77624                           CALL                                           #  CALL ROUTINE TO CONVERT TO SM COORDS AND
009644,000120: 32,2064           64142                                    SCALEVEC                              #  PROVIDE PROPER SCALING
009645,000121: 32,2065           16205                           STODL    AGSBUFF                               #  (LEMPREC AND CSMPREC LEAVE TDEC1 IN TAT)
009646,000122: 32,2066           00015                                    TAT                                   #  TAT = TIME TO WHICH RATT1 AND VATT1 ARE
009647,000123: 32,2067           34041                           STCALL   TDEC1                                 #  COMPUTED(CSEC SINCE CLOCK START B-28).
009648,000124: 32,2070           27043                                    CSMPREC                               #  CALCULATE CSM STATE VECTOR FOR SAME TIME
009649,000125: 32,2071           77624                           CALL                                           
009650,000126: 32,2072           64142                                    SCALEVEC                              
009651,000127: 

Page 223

009653,000129: 32,2073           16213                           STODL    AGSBUFF    +6                         
009654,000130: 32,2074           00015                                    TAT                                   
009655,000131: 32,2075           56225                           DSU      DDV                                   #  CALCULATE AND STORE THE TIME
009656,000132: 32,2076           02021                                    AGSK                                  
009657,000133: 32,2077           24205                                    TSCALE                                
009658,000134: 32,2100           02221                           STORE    AGSBUFF    +12D                       
009659,000135: 32,2101           77776                           EXIT                                           
009660,000136: 
009661,000137: 32,2102           34753                           CAF      LAGSLIST                              
009662,000138: 32,2103           54332                           TS       DNLSTCOD                              
009663,000139: 
009664,000140: 32,2104           32206                           CAF      20SEC                                 #  DELAY FOR 20 SEC WHILE THE AGS
009665,000141: 32,2105           04616                           TC       BANKCALL                              #  DOWNLIST IS TRANSMITTED
009666,000142: 32,2106           01735                           CADR     DELAYJOB                              
009667,000143: 
009668,000144: 32,2107           31324                           CA       AGSWORD                               
009669,000145: 32,2110           54332                           TS       DNLSTCOD                              #  RETURN TO THE OLD DOWNLIST
009670,000146: 32,2111           34744                           CAF      IMUSEBIT                              
009671,000147: 32,2112           70074                           MASK     FLAGWRD0                              #  CHECK IMUSE FLAG.
009672,000148: 32,2113           10000                           CCS      A                                     
009673,000149: 32,2114           02132                           TC       AGSEND                                #  IMU IS BEING USED - DO NOT ZERO
009674,000150: 32,2115           11304        CKSTALL            CCS      IMUCADR                               #  CHECK FOR IMU USAGE WHICH AVOIDS THE
009675,000151: 32,2116           12121                           TCF      +3                                    #  IMUSE BIT:  I.E., IMU COMPENSATION.
009676,000152: 32,2117           12125                           TCF      +6                                    #  FREE.  GO AHEAD WITH THE IMU ZERO.
009677,000153: 32,2120           12121                           TCF      +1                                    
009678,000154: 32,2121           34363                 +3        CAF      TEN                                   #  WAIT .1 SEC AND TRY AGAIN.
009679,000155: 32,2122           04616                           TC       BANKCALL                              
009680,000156: 32,2123           01735                           CADR     DELAYJOB                              
009681,000157: 32,2124           12115                           TCF      CKSTALL                               
009682,000158: 
009683,000159: 32,2125           04616                 +6        TC       BANKCALL                              #  IMU IS NOT IN USE
009684,000160: 32,2126           16667                           CADR     IMUZERO                               #  SET IMU ZERO DISCRETE FOR 320MSECS
009685,000161: 32,2127           04616                           TC       BANKCALL                              #  WAIT 3 SEC FOR COUNTERS TO INCREMENT
009686,000162: 32,2130           17671                           CADR     IMUSTALL                              
009687,000163: 32,2131           02132                           TC       AGSEND                                
009688,000164: 32,2132           05516        AGSEND             TC       DOWNFLAG                              #  ALLOW V37
009689,000165: 32,2133           00054                           ADRES    NODOFLAG                              
009690,000166: 
009691,000167: 32,2134           32203                           CAF      V50N16                                
009692,000168: 32,2135           04616                           TC       BANKCALL                              
009693,000169: 32,2136           20220                           CADR     GOMARK3                               
009694,000170: 32,2137           15472                           TCF      ENDEXT                                
009695,000171: 32,2140           15472                           TCF      ENDEXT                                
009696,000172: 32,2141           05472                           TC       ENDEXT                                
009697,000173: 
009698,000174: 32,2142           64375        SCALEVEC           VLOAD    MXV                                   
009699,000175: 32,2143           00025                                    VATT1                                 
009700,000176: 32,2144           01734                                    REFSMMAT                              
009701,000177: 32,2145           72561                           VXSC     VSL2                                  
009702,000178: 32,2146           24212                                    VSCALE                                
009703,000179: 

Page 224

009705,000181: 32,2147           53255                           VAD      VAD                                   #  THIS SECTION ROUNDS THE VECTOR, AND
009706,000182: 32,2150           24214                                    AGSRND1                               #  CORRECTS FOR THE FACT THAT THE AGS
009707,000183: 32,2151           24222                                    AGSRND2                               #  IS A 2 S COMPLIMENT MACHINE WHILE THE
009708,000184: 32,2152           77634                           RTB                                            #  LGC IS A 1 S COMPLIMENT MACHINE.
009709,000185: 32,2153           21744                                    VECSGNAG                              
009710,000186: 32,2154           24025                           STOVL    VATT1                                 
009711,000187: 32,2155           00017                                    RATT1                                 
009712,000188: 32,2156           74321                           MXV      VXSC                                  
009713,000189: 32,2157           01734                                    REFSMMAT                              
009714,000190: 32,2160           24210                                    RSCALE                                
009715,000191: 32,2161           53212                           VSL8     VAD                                   #  AGAIN THIS SECTION ROUNDS.  TWO VECTORS
009716,000192: 32,2162           24214                                    AGSRND1                               #  ARE ADDED TO DEFEAT ALSIGNAG IN THE
009717,000193: 32,2163           47055                           VAD      RTB                                   #  CASE OF A HIGH-ORDER ZERO COUPLED WITH
009718,000194: 32,2164           24222                                    AGSRND2                               #  A LOW ORDER NEGATIVE PART.
009719,000195: 32,2165           21744                                    VECSGNAG                              
009720,000196: 32,2166           77750                           LXA,1                                          
009721,000197: 32,2167           00024                                    VATT1                                 
009722,000198: 32,2170           72130                           SXA,1    LXA,1                                 
009723,000199: 32,2171           00155                                    MPAC       +1                         
009724,000200: 32,2172           00026                                    VATT1      +2                         
009725,000201: 32,2173           72130                           SXA,1    LXA,1                                 
009726,000202: 32,2174           00160                                    MPAC       +4                         
009727,000203: 32,2175           00030                                    VATT1      +4                         
009728,000204: 32,2176           43530                           SXA,1    RVQ                                   
009729,000205: 32,2177           00162                                    MPAC       +6                         
009730,000206: 
009731,000207: 32,2200     4753               LAGSLIST           =        ONE                                   
009732,000208: 32,2200           00216        V01N14             VN       0114                                  
009733,000209: 32,2201           14400        V50N00A            VN       5000                                  
009734,000210: 32,2202     6010               V00N25             EQUALS   OCT31                                 
009735,000211: 32,2202           01420        V06N16             VN       0616                                  
009736,000212: 32,2203     4242               V00N34             EQUALS   34DEC                                 
009737,000213: 32,2203           14420        V50N16             VN       5016                                  
009738,000214: 32,2204           03100 00000  TSCALE             2DEC     100        B-10                       #  CSEC TO SEC SCALE FACTOR
009739,000215: 32,2206           03720        20SEC              DEC      2000       B-14                       
009740,000216: 32,2207           15077 05041  RSCALE             2DEC     3.280839   B-3                        #  METERS TO FEET SCALE FACTOR
009741,000217: 32,2211           24402 25724  VSCALE             2DEC     3.280839   E2         B-9             #  METERS/CS TO FEET/SEC SCALE FACTOR
009742,000218: 32,2213           00000 60000  AGSRND1            2OCT     0000060000                            
009743,000219: 32,2215           00000 60000                     2OCT     0000060000                            
009744,000220: 32,2217           00000 60000                     2OCT     0000060000                            
009745,000221: 32,2221           00000 37777  AGSRND2            2OCT     0000037777                            
009746,000222: 32,2223           00000 37777                     2OCT     0000037777                            
009747,000223: 

Page 225

009749,000225: 32,2225           00000 37777                     2OCT     0000037777                            
009750,000226: 
009751,000227: 32,2227  30,2000                                  SBANK=   LOWSUPER                              #  FOR SUBSEQUENT LOW 2CADRS.

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