Source Code
This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the third release
of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 96 and 97.
A bug (which had been around since at least Apollo 10, Luminary 69) was
discovered in Rev 0 shortly before the Apollo 11 flight, resulting in a last minute
revision into Rev 1,
which is what actually flew rather than
the Rev 0 presented here. A hardcopy of Rev 0 is known to
exist — it belonged to AGC developer Allan Klumpp for many years — but
unfortunately the Virtual AGC Project has not had access to that hardcopy. Thus
the code you see here had been reconstructed (we believe accurately) rather than
transcribed. The first step of the reconstruction of the Rev 0 source code was
the transcription of the Rev 1 source code from a hardcopy in the MIT Museum collection.
The process of reverting the active portion of the source code (i.e., other than
program comments) from Rev 1 to Rev 0 was very minor, consisting
only of moving the position of the STARTSB1 label in
FRESH START AND RESTART. Allan had previously given
us the checksums of the memory banks of Rev 0, and we have verified the program presented here has checksums
identical to all banks of Allan's listing of Rev 0. The notations on Allan's Rev 0 program listing read,
in part:GAP: ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-051 A single program comment is known to differ between Rev 0 and Rev 1, but these are harder to reconstruct and verify than changes to the active portion of the code. Thus it is possible that there are additional differences between the program comments in Rev 0 and Rev 1 that are unknown to us, and therefore are not reflected in the code presented here. |
008470,000002: ## Copyright: Public domain.
008471,000003: ## Filename: AGS_INITIALIZATION.agc
008472,000004: ## Purpose: Part of the reconstructed source code for LMY99 Rev 0,
008473,000005: ## otherwise known as Luminary Rev 99, the third release
008474,000006: ## of the Apollo Guidance Computer (AGC) software for Apollo 11.
008475,000007: ## It differs from LMY99 Rev 1 (the flown version) only in the
008476,000008: ## placement of a single label. The corrections shown here have
008477,000009: ## been verified to have the same bank checksums as AGC developer
008478,000010: ## Allan Klumpp's copy of Luminary Rev 99, and so are believed
008479,000011: ## to be accurate. This file is intended to be a faithful
008480,000012: ## recreation, except that the code format has been changed to
008481,000013: ## conform to the requirements of the yaYUL assembler rather than
008482,000014: ## the original YUL assembler.
008483,000015: ##
008484,000016: ## Assembler: yaYUL
008485,000017: ## Contact: Hartmuth Gutsche <hgutsche@xplornet.com>.
008486,000018: ## Website: www.ibiblio.org/apollo.
008487,000019: ## Pages: 206-210
008488,000020: ## Mod history: 2009-05-19 HG Transcribed from page images.
008489,000021: ## 2016-12-13 RSB Proofed text comments with octopus/ProoferComments
008490,000022: ## and corrected the errors found.
008491,000023: ## 2017-03-14 RSB Comment-text fixes identified in 5-way
008492,000024: ## side-by-side diff of Luminary 69/99/116/131/210.
008493,000025: ## 2017-08-01 MAS Created from LMY99 Rev 1.
008494,000026:
008495,000027: ## This source code has been transcribed or otherwise adapted from
008496,000028: ## digitized images of a hardcopy from the MIT Museum. The digitization
008497,000029: ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
008498,000030: ## the Museum. Many thanks to both. The images (with suitable reduction
008499,000031: ## in storage size and consequent reduction in image quality as well) are
008500,000032: ## available online at www.ibiblio.org/apollo. If for some reason you
008501,000033: ## find that the images are illegible, contact me at info@sandroid.org
008502,000034: ## about getting access to the (much) higher-quality images which Paul
008503,000035: ## actually created.
008504,000036: ##
008505,000037: ## The code has been modified to match LMY99 Revision 0, otherwise
008506,000038: ## known as Luminary Revision 99, the Apollo 11 software release preceeding
008507,000039: ## the listing from which it was transcribed. It has been verified to
008508,000040: ## contain the same bank checksums as AGC developer Allan Klumpp's listing
008509,000041: ## of Luminary Revision 99 (for which we do not have scans).
008510,000042: ##
008511,000043: ## Notations on Allan Klumpp's listing read, in part:
008512,000044: ##
008513,000045: ## ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
008514,000046:
Page 206 |
008516,000048:
008517,000049: # PROGRAM NAME: AGS INITIALIZATION (R47)
008518,000050:
008519,000051: # WRITTEN BY: RHODE/KILROY/FOLLETT
008520,000052:
008521,000053: # MOD NO. : 0
008522,000054: # DATE: 23 MARCH 1967
008523,000055: # MOD BY: KILROY
008524,000056:
008525,000057: # MOD NO.: 1
008526,000058: # DATE: 28 OCTOBER 1967
008527,000059: # MOD BY: FOLLETT
008528,000060:
008529,000061: # FUNCT. DESC.: (1) TO PROVIDE THE AGS ABORT ELECTRONICS ASSEMBLY (AEA) WITH THE LEM AND CSM STATE VECTORS
008530,000062: # (POSITION,VELOCITY,TIME) IN LEM IMU COORDINATES BY MEANS OF THE LGC DIGITAL DOWNLINK.
008531,000063:
008532,000064: # (2) TO ZERO THE ICDU, LGC AND AEA GIMBAL ANGLE COUNTERS SIMULTANEOUSLY IN ORDER TO ESTABLISH A
008533,000065: # COMMON ZERO REFERENCE FOR THE MEASUREMENT OF GIMBAL (EULER) ANGLES WHICH DEFINE LEM ATTITUDE
008534,000066:
008535,000067: # (3) TO ESTABLISH THE GROUND ELAPSED TIME OF AEA CLOCK ZERO. (IF AN AEA CLOCK ZERO IS
008536,000068: # REQUESTED DURING THIS PROGRAM
008537,000069:
008538,000070: # LOG SECTION: AGS INITIALIZATION
008539,000071:
008540,000072: # CALLING SEQ: PROGRAM IS ENTERED WHEN ASTRONAUT KEYS V47E ON DSKY.
008541,000073: # R47 MAY BE CALLED AT ANY TIME EXCEPT WHEN ANOTHER EXTENDED VERB IS IN PROGRESS
008542,000074:
008543,000075: # SUBROUTINES
008544,000076: # CALLED:
008545,000077:
008546,000078: # NORMAL EXIT: ENDEXT
008547,000079:
008548,000080: # ALARM/ABORT: ALARM - BAD REFSMMAT - CODE:220
008549,000081: # OPERATOR ERROR IF V47 SELECTED DURING ANOTHER EXTENDED VERB.
008550,000082:
008551,000083: # ERASABLES
008552,000084: # USED: SAMPTIME (2) TIME OF :ENTER: KEYSTROKE
008553,000085: # AGSK (2) GROUND ELAPSED TIME OF THE AEA CLOCK :ZERO:
008554,000086: # AGSBUFF (140) CONTAINS AGS INITIALIZATION DATA (SEE :OUTPUT: BELOW)
008555,000087: # AGSWORD (1) PREVIOUS DOWNLIST SAVED HERE
008556,000088:
008557,000089: 05,2447 E4,1600 EBANK= AGSBUFF
008558,000090:
008559,000091: 40,2000 BANK 40
008560,000092: 32,2000 SETLOC R47
008561,000093: 32,2000 BANK
008562,000094:
008563,000095: 32,2005 COUNT* $$/R47
008564,000096:
008565,000097: 32,2005 34737 AGSINIT CAF REFSMBIT
008566,000098: 32,2006 70077 MASK FLAGWRD3 # CHECK REFSMFLG.
008567,000099: 32,2007 10000 CCS A
Page 207 |
008569,000101: 32,2010 02017 TC REDSPTEM # REFSMMAT IS OK
008570,000102: 32,2011 05567 TC ALARM # REFSMMAT IS BAD
008571,000103: 32,2012 00220 OCT 220
008572,000104: 32,2013 05472 TC ENDEXT
008573,000105:
008574,000106: 32,2014 00006 NEWAGS EXTEND
008575,000107: 32,2015 30014 DCA SAMPTIME # TIME OF THE :ENTER: KEYSTROKE
008576,000108: 32,2016 53421 DXCH AGSK # BECOMES NEW AEA CLOCK :ZERO:
008577,000109:
008578,000110: 32,2017 00006 REDSPTEM EXTEND
008579,000111: 32,2020 31421 DCA AGSK
008580,000112: 32,2021 53052 DXCH DSPTEMX
008581,000113: 32,2022 32172 AGSDISPK CAF V06N16
008582,000114: 32,2023 04616 TC BANKCALL # R1 = 00XXX. HRS., R2 = 000XX MIN.,
008583,000115: 32,2024 20334 CADR GOMARKF # R3 = 0XX.XX SEC.
008584,000116: 32,2025 05472 TC ENDEXT # TERMINATE RETURN
008585,000117: 32,2026 02036 TC AGSVCALC # PROCEED RETURN
008586,000118: 32,2027 44746 CS BIT6 # IS ENTER VIA A V32
008587,000119: 32,2030 60154 AD MPAC
008588,000120: 32,2031 00006 EXTEND
008589,000121: 32,2032 12014 BZF NEWAGS # YES, USE KEYSTROKE TIME FOR NEW AGSK
008590,000122:
008591,000123: 32,2033 00006 EXTEND # NO, NEW AGSK LOADED VIA V25
008592,000124: 32,2034 31052 DCA DSPTEMX # LOADED INTO DSPTEMX BY KEYING
008593,000125: 32,2035 02016 TC REDSPTEM -1 # V25E FOLLOWED BY HRS.,MINS.,SECS.
008594,000126: # DISPLAY THE NEW K
008595,000127:
008596,000128: 32,2036 06037 AGSVCALC TC INTPRET
008597,000129: 32,2037 77614 SET
008598,000130: 32,2040 01076 NODOFLAG # DONT ALLOW V37
008599,000131: 32,2041 77414 SET EXIT
008600,000132: 32,2042 02076 XDSPFLAG
008601,000133:
008602,000134: 32,2043 32172 CAF V06N16
008603,000135: 32,2044 04616 TC BANKCALL
008604,000136: 32,2045 20620 CADR EXDSPRET
008605,000137:
008606,000138: 32,2046 06037 TC INTPRET # EXTRAPOLATE LEM AND CSM STATE VECTORS
008607,000139: 32,2047 77634 RTB # TO THE PRESENT TIME
008608,000140: 32,2050 21573 LOADTIME # LOAD MPAC WITH TIME2,TIME1
008609,000141: 32,2051 34041 STCALL TDEC1 # CALCULATE LEM STATE VECTOR
008610,000142: 32,2052 27057 LEMPREC
008611,000143: 32,2053 77624 CALL # CALL ROUTINE TO CONVERT TO SM COORDS AND
008612,000144: 32,2054 64132 SCALEVEC # PROVIDE PROPER SCALING
008613,000145: 32,2055 16201 STODL AGSBUFF # (LEMPREC AND CSMPREC LEAVE TDEC1 IN TAT)
008614,000146: 32,2056 00015 TAT # TAT = TIME TO WHICH RATT1 AND VATT1 ARE
008615,000147: 32,2057 34041 STCALL TDEC1 # COMPUTED (CSEC SINCE CLOCK START B-28).
008616,000148: 32,2060 27043 CSMPREC # CALCULATE CSM STATE VECTOR FOR SAME TIME
008617,000149: 32,2061 77624 CALL
008618,000150: 32,2062 64132 SCALEVEC
Page 208 |
008620,000152: 32,2063 16207 STODL AGSBUFF +6
008621,000153: 32,2064 00015 TAT
008622,000154: 32,2065 56225 DSU DDV # CALCULATE AND STORE THE TIME
008623,000155: 32,2066 02021 AGSK
008624,000156: 32,2067 24175 TSCALE
008625,000157: 32,2070 02215 STORE AGSBUFF +12D
008626,000158: 32,2071 77776 EXIT
008627,000159:
008628,000160: 32,2072 34753 CAF LAGSLIST
008629,000161: 32,2073 54332 TS DNLSTCOD
008630,000162:
008631,000163: 32,2074 32176 CAF 20SEC # DELAY FOR 20 SEC WHILE THE AGS
008632,000164: 32,2075 04616 TC BANKCALL # DOWNLIST IS TRANSMITTED
008633,000165: 32,2076 01735 CADR DELAYJOB
008634,000166:
008635,000167: 32,2077 31324 CA AGSWORD
008636,000168: 32,2100 54332 TS DNLSTCOD # RETURN TO THE OLD DOWNLIST
008637,000169: 32,2101 34744 CAF IMUSEBIT
008638,000170: 32,2102 70074 MASK FLAGWRD0 # CHECK IMUSE FLAG.
008639,000171: 32,2103 10000 CCS A
008640,000172: 32,2104 02122 TC AGSEND # IMU IS BEING USED - DO NOT ZERO
008641,000173: 32,2105 11304 CKSTALL CCS IMUCADR # CHECK FOR IMU USAGE WHICH AVOIDS THE
008642,000174: 32,2106 12111 TCF +3 # IMUSE BIT: I.E., IMU COMPENSATION.
008643,000175: 32,2107 12115 TCF +6 # FREE. GO AHEAD WITH THE IMU ZERO.
008644,000176: 32,2110 12111 TCF +1
008645,000177: 32,2111 34363 +3 CAF TEN # WAIT .1 SEC AND TRY AGAIN.
008646,000178: 32,2112 04616 TC BANKCALL
008647,000179: 32,2113 01735 CADR DELAYJOB
008648,000180: 32,2114 12105 TCF CKSTALL
008649,000181:
008650,000182: 32,2115 04616 +6 TC BANKCALL # IMU IS NOT IN USE
008651,000183: 32,2116 16714 CADR IMUZERO # SET IMU ZERO DISCRETE FOR 320MSECS
008652,000184: 32,2117 04616 TC BANKCALL # WAIT 3 SEC FOR COUNTERS TO INCREMENT
008653,000185: 32,2120 17716 CADR IMUSTALL
008654,000186: 32,2121 02122 TC AGSEND
008655,000187: 32,2122 05516 AGSEND TC DOWNFLAG # ALLOW V37
008656,000188: 32,2123 00054 ADRES NODOFLAG
008657,000189:
008658,000190: 32,2124 32173 CAF V50N16
008659,000191: 32,2125 04616 TC BANKCALL
008660,000192: 32,2126 20342 CADR GOMARK3
008661,000193: 32,2127 15472 TCF ENDEXT
008662,000194: 32,2130 15472 TCF ENDEXT
008663,000195: 32,2131 05472 TC ENDEXT
008664,000196:
008665,000197: 32,2132 64375 SCALEVEC VLOAD MXV
008666,000198: 32,2133 00025 VATT1
008667,000199: 32,2134 01734 REFSMMAT
008668,000200: 32,2135 72561 VXSC VSL2
008669,000201: 32,2136 24202 VSCALE
Page 209 |
008671,000203: 32,2137 53255 VAD VAD # THIS SECTION ROUNDS THE VECTOR, AND
008672,000204: 32,2140 24204 AGSRND1 # CORRECTS FOR THE FACT THAT THE AGS
008673,000205: 32,2141 24212 AGSRND2 # IS A 2 S COMPLIMENT MACHINE WHILE THE
008674,000206: 32,2142 77634 RTB # LGC IS A 1 S COMPLIMENT MACHINE.
008675,000207: 32,2143 21772 VECSGNAG
008676,000208: 32,2144 24025 STOVL VATT1
008677,000209: 32,2145 00017 RATT1
008678,000210: 32,2146 74321 MXV VXSC
008679,000211: 32,2147 01734 REFSMMAT
008680,000212: 32,2150 24200 RSCALE
008681,000213: 32,2151 53212 VSL8 VAD # AGAIN THIS SECTION ROUNDS. TWO VECTORS
008682,000214: 32,2152 24204 AGSRND1 # ARE ADDED TO DEFEAT ALSIGNAG IN THE
008683,000215: 32,2153 47055 VAD RTB # CASE OF A HIGH-ORDER ZERO COUPLED WITH
008684,000216: 32,2154 24212 AGSRND2 # A LOW ORDER NEGATIVE PART.
008685,000217: 32,2155 21772 VECSGNAG
008686,000218: 32,2156 77750 LXA,1
008687,000219: 32,2157 00024 VATT1
008688,000220: 32,2160 72130 SXA,1 LXA,1
008689,000221: 32,2161 00155 MPAC +1
008690,000222: 32,2162 00026 VATT1 +2
008691,000223: 32,2163 72130 SXA,1 LXA,1
008692,000224: 32,2164 00160 MPAC +4
008693,000225: 32,2165 00030 VATT1 +4
008694,000226: 32,2166 43530 SXA,1 RVQ
008695,000227: 32,2167 00162 MPAC +6
008696,000228:
008697,000229: 32,2170 4753 LAGSLIST = ONE
008698,000230: 32,2170 00216 V01N14 VN 0114
008699,000231: 32,2171 14400 V50N00A VN 5000
008700,000232: 32,2172 6010 V00N25 EQUALS OCT31
008701,000233: 32,2172 01420 V06N16 VN 0616
008702,000234: 32,2173 4242 V00N34 EQUALS 34DEC
008703,000235: 32,2173 14420 V50N16 VN 5016
008704,000236: 32,2174 03100 00000 TSCALE 2DEC 100 B-10 # CSEC TO SEC SCALE FACTOR
008705,000237: 32,2176 03720 20SEC DEC 2000 B-14
008706,000238: 32,2177 15077 05041 RSCALE 2DEC 3.280839 B-3 # METERS TO FEET SCALE FACTOR
008707,000239: 32,2201 24402 25724 VSCALE 2DEC 3.280839 E2 B-9 # METERS/CS TO FEET/SEC SCALE FACTOR
008708,000240: 32,2203 00000 60000 AGSRND1 2OCT 0000060000
008709,000241: 32,2205 00000 60000 2OCT 0000060000
008710,000242: 32,2207 00000 60000 2OCT 0000060000
008711,000243: 32,2211 00000 37777 AGSRND2 2OCT 0000037777
008712,000244: 32,2213 00000 37777 2OCT 0000037777
Page 210 |
008714,000246: 32,2215 00000 37777 2OCT 0000037777
008715,000247:
008716,000248: 32,2217 30,2000 SBANK= LOWSUPER # FOR SUBSEQUENT LOW 2CADRS.
008717,000249:
End of include-file AGS_INITIALIZATION.agc. Parent file is MAIN.agc