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