Source Code
![]() |
This is a reconstruction of the AGC program Luminary 99 Rev 0. It was the
second release of the Lunar Module flight software targeted for use in Apollo 11, after Luminary 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. |
013659,000002: ## Copyright: Public domain.
013660,000003: ## Filename: LEM_GEOMETRY.agc
013661,000004: ## Purpose: Part of the reconstructed source code for LMY99 Rev 0,
013662,000005: ## otherwise known as Luminary Rev 99, the second release
013663,000006: ## of the Apollo Guidance Computer (AGC) software for Apollo 11.
013664,000007: ## It differs from LMY99 Rev 1 (the flown version) only in the
013665,000008: ## placement of a single label. The corrections shown here have
013666,000009: ## been verified to have the same bank checksums as AGC developer
013667,000010: ## Allan Klumpp's copy of Luminary Rev 99, and so are believed
013668,000011: ## to be accurate. This file is intended to be a faithful
013669,000012: ## recreation, except that the code format has been changed to
013670,000013: ## conform to the requirements of the yaYUL assembler rather than
013671,000014: ## the original YUL assembler.
013672,000015: ##
013673,000016: ## Assembler: yaYUL
013674,000017: ## Contact: Ron Burkey <info@sandroid.org>.
013675,000018: ## Website: www.ibiblio.org/apollo.
013676,000019: ## Pages: 320-325
013677,000020: ## Mod history: 2009-05-16 RSB Adapted from the corresponding
013678,000021: ## Luminary131 file, using page
013679,000022: ## images from Luminary 1A.
013680,000023: ## 2016-12-13 RSB Proofed text comments with octopus/ProoferComments
013681,000024: ## and corrected the errors found.
013682,000025: ## 2017-03-07 RSB Fixed comment-text error noticed while proofing
013683,000026: ## Luminary 116.
013684,000027: ## 2017-08-01 MAS Created from LMY99 Rev 1.
013685,000028:
013686,000029: ## This source code has been transcribed or otherwise adapted from
013687,000030: ## digitized images of a hardcopy from the MIT Museum. The digitization
013688,000031: ## was performed by Paul Fjeld, and arranged for by Deborah Douglas of
013689,000032: ## the Museum. Many thanks to both. The images (with suitable reduction
013690,000033: ## in storage size and consequent reduction in image quality as well) are
013691,000034: ## available online at www.ibiblio.org/apollo. If for some reason you
013692,000035: ## find that the images are illegible, contact me at info@sandroid.org
013693,000036: ## about getting access to the (much) higher-quality images which Paul
013694,000037: ## actually created.
013695,000038: ##
013696,000039: ## The code has been modified to match LMY99 Revision 0, otherwise
013697,000040: ## known as Luminary Revision 99, the Apollo 11 software release preceeding
013698,000041: ## the listing from which it was transcribed. It has been verified to
013699,000042: ## contain the same bank checksums as AGC developer Allan Klumpp's listing
013700,000043: ## of Luminary Revision 99 (for which we do not have scans).
013701,000044: ##
013702,000045: ## Notations on Allan Klumpp's listing read, in part:
013703,000046: ##
013704,000047: ## ASSEMBLE REVISION 099 OF AGC PROGRAM LUMINARY BY NASA 2021112-51
013705,000048:
![]() |
Page 320 |
013707,000050: 23,2041 BANK 23
013708,000051: 13,2000 SETLOC LEMGEOM
013709,000052: 13,2000 BANK
013710,000053:
013711,000054: 13,2070 30,2000 SBANK= LOWSUPER
013712,000055: 13,2070 E5,1642 EBANK= XSM
013713,000056:
013714,000057: # THESE TWO ROUTINES COMPUTE THE ACTUAL STATE VECTOR FOR LM,CSM BY ADDING
013715,000058: # THE CONIC R,V AND THE DEVIATIONS R,V. THE STATE VECTORS ARE CONVERTED TO
013716,000059: # METERS B-29 AND METERS/CSEC B-7 AND STORED APPROPRIATELY IN RN,VN OR
013717,000060: # R-OTHER,V-OTHER FOR DOWNLINK. THE ROUTINES NAMES ARE SWITCHED IN THE
013718,000061: # OTHER VEHICLES COMPUTER.
013719,000062:
013720,000063: # INPUT
013721,000064: # STATE VECTOR IN TEMPORARY STORAGE AREA
013722,000065: # IF STATE VECTOR IS SCALED POS B27 AND VEL B5
013723,000066: # SET X2 TO +2
013724,000067: # IF STATE VECTOR IS SCALED POS B29 AND VEL B7
013725,000068: # SET X2 TO 0
013726,000069:
013727,000070: # OUTPUT
013728,000071: # R(T) IN RN, V(T) IN VN, T IN PIPTIME
013729,000072: # OR
013730,000073: # R(T) IN R-OTHER, V(T) IN V-OTHER (T IS DEFINED BY T-OTHER)
013731,000074:
013732,000075: 13,2070 COUNT* $$/GEOM
013733,000076: 13,2070 43414 SVDWN2 BOF RVQ # SW=1=AVETOMID DOING W-MATRIX INTEG.
013734,000077: 13,2071 04756 AVEMIDSW
013735,000078: 13,2072 26073 +1
013736,000079: 13,2073 53775 VLOAD VSL*
013737,000080: 13,2074 01521 TDELTAV
013738,000081: 13,2075 57605 0 -7,2
013739,000082: 13,2076 53655 VAD VSL*
013740,000083: 13,2077 01535 RCV
013741,000084: 13,2100 57576 0,2
013742,000085: 13,2101 25221 STOVL RN
013743,000086: 13,2102 01527 TNUV
013744,000087: 13,2103 53257 VSL* VAD
013745,000088: 13,2104 57602 0 -4,2
013746,000089: 13,2105 01543 VCV
013747,000090: 13,2106 77657 VSL*
013748,000091: 13,2107 57576 0,2
013749,000092: 13,2110 15227 STODL VN
013750,000093: 13,2111 01517 TET
013751,000094: 13,2112 01235 STORE PIPTIME
013752,000095: 13,2113 77616 RVQ
![]() |
Page 321 |
013754,000097: 13,2114 53775 SVDWN1 VLOAD VSL*
013755,000098: 13,2115 01521 TDELTAV
013756,000099: 13,2116 57605 0 -7,2
013757,000100: 13,2117 53655 VAD VSL*
013758,000101: 13,2120 01535 RCV
013759,000102: 13,2121 57576 0,2
013760,000103: 13,2122 25720 STOVL R-OTHER
013761,000104: 13,2123 01527 TNUV
013762,000105: 13,2124 53257 VSL* VAD
013763,000106: 13,2125 57602 0 -4,2
013764,000107: 13,2126 01543 VCV
013765,000108: 13,2127 77657 VSL*
013766,000109: 13,2130 57576 0,2
013767,000110: 13,2131 01726 STORE V-OTHER
013768,000111: 13,2132 77616 RVQ
013769,000112:
![]() |
Page 322 |
013771,000114: # THE FOLLOWING ROUTINE TAKES A HALF UNIT TARGET VECTOR REFERRED TO NAV BASE COORDINATES AND FINDS BOTH
013772,000115: # GIMBAL ORIENTATIONS AT WHICH THE RR MIGHT SIGHT THE TARGET. THE GIMBAL ANGLES CORRESPONDING TO THE PRESENT MODE
013773,000116: # ARE LEFT IN MODEA AND THOSE WHICH WOULD BE USED AFTER A REMODE IN MODEB. THIS ROUTINE ASSUMES MODE 1 IS TRUNNION
013774,000117: # ANGLE LESS THAN 90 DEGS IN ABS VALUE WITH ARBITRARY SHAFT, WITH A CORRESPONDING DEFINITION FOR MODE 2. MODE
013775,000118: # SELECTION AND LIMIT CHECKING ARE DONE ELSEWHERE.
013776,000119:
013777,000120: # THE MODE 1 CONFIGURATION IS CALCULATED FROM THE VECTOR AND THEN MODE 2 IS FOUND USING THE RELATIONS
013778,000121:
013779,000122: # S(2) = 180 + S(1)
013780,000123: # T(2) = 180 - T(1)
013781,000124:
013782,000125: # THE VECTOR ARRIVES IN MPAC WHERE TRG*SMNG OR *SMNB* WILL HAVE LEFT IT.
013783,000126:
013784,000127: 13,2133 00041 RRANGLES STORE 32D
013785,000128: 13,2134 57545 DLOAD DCOMP # SINCE WE WILL FIND THE MODE 1 SHAFT
013786,000129: 13,2135 00043 34D # ANGLE LATER, WE CAN FIND THE MODE 1
013787,000130: 13,2136 67401 SETPD ASIN # TRUNNION BY SIMPLY TAKING THE ARCSIN OF
013788,000131: 13,2137 00001 0 # THE Y COMPONENT, THE ASIN GIVING AN
013789,000132: 13,2140 44206 PUSH BDSU # ANSWER WHOSE ABS VAL IS LESS THAN 90 DEG
013790,000133: 13,2141 24005 LODPHALF
013791,000134: 13,2142 14005 STODL 4 # MODE 2 TRUNNION TO 4.
013792,000135:
013793,000136: 13,2143 24007 LO6ZEROS
013794,000137: 13,2144 24043 STOVL 34D # UNIT THE PROJECTION OF THE VECTOR
013795,000138: 13,2145 00041 32D # IN THE X-Z PLANE
013796,000139: 13,2146 41056 UNIT BOVB # IF OVERFLOW, TARGET VECTOR IS ALONG Y
013797,000140: 13,2147 52421 LUNDESCH # CALL FOR MANEUVER UNLESS ON LUNAR SURF
013798,000141: 13,2150 14041 STODL 32D # PROJECTION VECTOR.
013799,000142: 13,2151 00041 32D
013800,000143: 13,2152 44142 SR1 STQ
013801,000144: 13,2153 00051 S2
013802,000145: 13,2154 14023 STODL SINTH # USE ARCTRIG SINCE SHAFT COULD BE ARB.
013803,000146: 13,2155 00045 36D
013804,000147: 13,2156 77742 SR1
013805,000148: 13,2157 34021 STCALL COSTH
013806,000149: 13,2160 47320 ARCTRIG
![]() |
Page 323 |
013808,000151: 13,2161 43206 PUSH DAD # MODE 1 SHAFT TO 2.
013809,000152: 13,2162 24005 LODPHALF
013810,000153: 13,2163 24007 STOVL 6
013811,000154: 13,2164 00005 4
013812,000155: 13,2165 77634 RTB # FIND MODE 2 CDU ANGLES.
013813,000156: 13,2166 21635 2V1STO2S
013814,000157: 13,2167 25112 STOVL MODEB
013815,000158: 13,2170 00001 0
013816,000159: 13,2171 77634 RTB # MODE 1 ANGLES TO MODE A.
013817,000160: 13,2172 21635 2V1STO2S
013818,000161: 13,2173 01110 STORE MODEA
013819,000162: 13,2174 77776 EXIT
013820,000163:
013821,000164: 13,2175 40110 CS RADMODES # SWAP MODEA AND MODEB IF RR IN MODE 2.
013822,000165: 13,2176 74740 MASK ANTENBIT
013823,000166: 13,2177 10000 CCS A
013824,000167: 13,2200 12204 TCF +4
013825,000168:
013826,000169: 13,2201 53110 DXCH MODEA
013827,000170: 13,2202 53112 DXCH MODEB
013828,000171: 13,2203 53110 DXCH MODEA
013829,000172:
013830,000173: 13,2204 06037 TC INTPRET
013831,000174: 13,2205 77650 GOTO
013832,000175: 13,2206 00051 S2
![]() |
Page 324 |
013834,000177: # GIVEN RR TRUNNION AND SHAFT (T,S) IN TANGNB,+1, FIND THE ASSOCIATED
013835,000178: # LINE OF SIGHT IN NAV BASE AXES. THE HALF UNIT VECTOR, .5(SIN(S)COS(T),
013836,000179: # -SIN(T),COS(S)COS(T)) IS LEFT IN MPAC AND 32D.
013837,000180:
013838,000181: 23,2000 SETLOC INFLIGHT
013839,000182: 23,2000 BANK
013840,000183:
013841,000184: 23,2041 COUNT* $$/GEOM
013842,000185:
013843,000186: 23,2041 47135 RRNB SLOAD RTB
013844,000187: 23,2042 03753 TANGNB
013845,000188: 23,2043 21576 CDULOGIC
013846,000189: 23,2044 41401 SETPD PUSH # TRUNNION ANGLE TO 0
013847,000190: 23,2045 00001 0
013848,000191: 23,2046 57556 SIN DCOMP
013849,000192: 23,2047 14043 STODL 34D # Y COMPONENT
013850,000193:
013851,000194: 23,2050 41546 COS PUSH # .5 COS(T) TO 0
013852,000195: 23,2051 47135 SLOAD RTB
013853,000196: 23,2052 03754 TANGNB +1
013854,000197: 23,2053 21576 CDULOGIC
013855,000198: 23,2054 71406 RRNB1 PUSH COS # SHAFT ANGLE TO 2
013856,000199: 23,2055 72405 DMP SL1
013857,000200: 23,2056 00001 0
013858,000201: 23,2057 14045 STODL 36D # Z COMPONENT
013859,000202:
013860,000203: 23,2060 41356 SIN DMP
013861,000204: 23,2061 77752 SL1
013862,000205: 23,2062 24041 STOVL 32D
013863,000206: 23,2063 00041 32D
013864,000207: 23,2064 77616 RVQ
013865,000208:
013866,000209: # THIS ENTRY TO RRNB REQUIRES THE TRUNNION AND SHAFT ANGLES IN MPAC AND MPAC +1 RESPECTIVELY
013867,000210:
013868,000211: 23,2065 14025 RRNBMPAC STODL 20D # SAVE SHAFT CDU IN 21.
013869,000212: 23,2066 00155 MPAC # SET MODE TO DP. (THE PRECEEDING STORE
013870,000213: # MAY BE DP, TP OR VECTOR.)
013871,000214: 23,2067 40234 RTB SETPD
013872,000215: 23,2070 21576 CDULOGIC
013873,000216: 23,2071 00001 0
013874,000217: 23,2072 73406 PUSH SIN # TRUNNION ANGLE TO 0
013875,000218: 23,2073 77676 DCOMP
013876,000219: 23,2074 14043 STODL 34D # Y COMPONENT
013877,000220: 23,2075 41546 COS PUSH # .5COS(T) TO 0
013878,000221: 23,2076 47135 SLOAD RTB # PICK UP CDU'S.
013879,000222: 23,2077 00026 21D
013880,000223: 23,2100 21576 CDULOGIC
013881,000224: 23,2101 77650 GOTO
013882,000225: 23,2102 46054 RRNB1
![]() |
Page 325
This page has nothing on it. |
013885,000228:
013886,000229:
End of include-file LEM_GEOMETRY.agc. Parent file is MAIN.agc