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.

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

Page 221

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

Page 222

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

Page 223

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

Page 224

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

Page 225

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

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