Source Code
This source code is very close to the Apollo Guidance Computer software for the
Apollo 13 Lunar module. This revision of the Luminary 131 program is from December
of 1969, whereas there was a later revision in January of 1970, and still another
revision in February, which is the code that flew on the mission.
As far as this transcription is concerned, it was originally from a copy made in 1991 of
a printout from the collection of AGC developer Don Eyles for collector David Craig.
It was subsequently scanned by Gary Neff, reprocessed for online
presentation at the now-discontinued History of Recent Science and Technology (HRST) website
of MIT's Dibner Institute (the full-quality scans being discarded in the process),
and finally transcribed by Ron Burkey for the Virtual AGC Project. Although a
high-quality replacement scan for a completely illegible page was later provided by Gary
Neff, the reduced legibility of the reprocessed HRST posting nevertheless caused many
errors to be introduced into the transcription. Accordingly, a second scan of the same physical
printout was made in 2017 for the Virtual AGC Project's collection at the Internet Archive,
and used to correct the transcription errors. All of the scanned materials mentioned,
as well as other Luminary 131 related material, are available online.
Don Eyles apprently made additional hand-written notes in printout between 1991 and 2017,
so the two scans are not identical in that respect. The page-headings in the printout read, in part:GAP: ASSEMBLE REVISION 131 OF AGC PROGRAM LUMINARY BY NASA 2021112-091 17:53 DEC. 19, 1969Note that the date is the date the printout was made, not the date on which the program revision was released, although these happen to be very close together. |
013405,000002: ## Copyright: Public domain.
013406,000003: ## Filename: LEM_GEOMETRY.agc
013407,000004: ## Purpose: A section of Luminary 1C, revision 131.
013408,000005: ## It is part of the source code for the Lunar Module's (LM)
013409,000006: ## Apollo Guidance Computer (AGC) for Apollo 13.
013410,000007: ## This file is intended to be a faithful transcription, except
013411,000008: ## that the code format has been changed to conform to the
013412,000009: ## requirements of the yaYUL assembler rather than the
013413,000010: ## original YUL assembler.
013414,000011: ## Reference: pp. 322-327
013415,000012: ## Contact: Ron Burkey <info@sandroid.org>.
013416,000013: ## Website: www.ibiblio.org/apollo/index.html
013417,000014: ## Mod history: 05/10/03 RSB. Began transcribing.
013418,000015: ## 05/14/05 RSB Corrected website reference above.
013419,000016: ## 2010-08-24 JL Fixed page 330 number.
013420,000017: ## 2017-01-06 RSB Page numbers now agree with those on the
013421,000018: ## original harcopy, as opposed to the PDF page
013422,000019: ## numbers in 1701.pdf.
013423,000020: ## 2017-02-23 RSB Proofed comment text using octopus/ProoferComments.
013424,000021: ## 2017-03-07 RSB Fixed comment-text error noted while proofing
013425,000022: ## Luminary 116.
013426,000023:
Page 322 |
013428,000025: 23,2041 BANK 23
013429,000026: 13,2000 SETLOC LEMGEOM
013430,000027: 13,2000 BANK
013431,000028:
013432,000029: 13,2070 30,2000 SBANK= LOWSUPER
013433,000030: 13,2070 E5,1642 EBANK= XSM
013434,000031:
013435,000032: # THESE TWO ROUTINES COMPUTE THE ACTUAL STATE VECTOR FOR LM,CSM BY ADDING
013436,000033: # THE CONIC R,V AND THE DEVIATIONS R,V. THE STATE VECTORS ARE CONVERTED TO
013437,000034: # METERS B-29 AND METERS/CSEC B-7 AND STORED APPROPRIATELY IN RN,VN OR
013438,000035: # R-OTHER,V-OTHER FOR DOWNLINK. THE ROUTINES NAMES ARE SWITCHED IN THE
013439,000036: # OTHER VEHICLES COMPUTER.
013440,000037:
013441,000038: # INPUT
013442,000039: # STATE VECTOR IN TEMPORARY STORAGE AREA
013443,000040: # IF STATE VECTOR IS SCALED POS B27 AND VEL B5
013444,000041: # SET X2 TO +2
013445,000042: # IF STATE VECTOR IS SCALED POS B29 AND VEL B7
013446,000043: # SET X2 TO 0
013447,000044:
013448,000045: # OUTPUT
013449,000046: # R(T) IN RN, V(T) IN VN, T IN PIPTIME
013450,000047: # OR
013451,000048: # R(T) IN R-OTHER, V(T) IN V-OTHER (T IS DEFINED BY T-OTHER)
013452,000049:
013453,000050: 13,2070 COUNT* $$/GEOM
013454,000051: 13,2070 43414 SVDWN2 BOF RVQ # SW=1=AVETOMID DOING W-MATRIX INTEG.
013455,000052: 13,2071 04756 AVEMIDSW
013456,000053: 13,2072 26073 +1
013457,000054: 13,2073 53775 VLOAD VSL*
013458,000055: 13,2074 01521 TDELTAV
013459,000056: 13,2075 57605 0 -7,2
013460,000057: 13,2076 53655 VAD VSL*
013461,000058: 13,2077 01535 RCV
013462,000059: 13,2100 57576 0,2
013463,000060: 13,2101 25220 STOVL RN
013464,000061: 13,2102 01527 TNUV
013465,000062: 13,2103 53257 VSL* VAD
013466,000063: 13,2104 57602 0 -4,2
013467,000064: 13,2105 01543 VCV
013468,000065: 13,2106 77657 VSL*
013469,000066: 13,2107 57576 0,2
013470,000067: 13,2110 15226 STODL VN
013471,000068: 13,2111 01517 TET
013472,000069: 13,2112 01234 STORE PIPTIME
013473,000070: 13,2113 77616 RVQ
Page 323 |
013475,000072: 13,2114 53775 SVDWN1 VLOAD VSL*
013476,000073: 13,2115 01521 TDELTAV
013477,000074: 13,2116 57605 0 -7,2
013478,000075: 13,2117 53655 VAD VSL*
013479,000076: 13,2120 01535 RCV
013480,000077: 13,2121 57576 0,2
013481,000078: 13,2122 25720 STOVL R-OTHER
013482,000079: 13,2123 01527 TNUV
013483,000080: 13,2124 53257 VSL* VAD
013484,000081: 13,2125 57602 0 -4,2
013485,000082: 13,2126 01543 VCV
013486,000083: 13,2127 77657 VSL*
013487,000084: 13,2130 57576 0,2
013488,000085: 13,2131 01726 STORE V-OTHER
013489,000086: 13,2132 77616 RVQ
013490,000087:
Page 324 |
013492,000089: # THE FOLLOWING ROUTINE TAKES A HALF UNIT TARGET VECTOR REFERRED TO NAV BASE COORDINATES AND FINDS BOTH
013493,000090: # GIMBAL ORIENTATIONS AT WHICH THE RR MIGHT SIGHT THE TARGET. THE GIMBAL ANGLES CORRESPONDING TO THE PRESENT MODE
013494,000091: # ARE LEFT IN MODEA AND THOSE WHICH WOULD BE USED AFTER A REMODE IN MODEB. THIS ROUTINE ASSUMES MODE 1 IS TRUNNION
013495,000092: # ANGLE LESS THAN 90 DEGS IN ABS VALUE WITH ARBITRARY SHAFT, WITH A CORRESPONDING DEFINITION FOR MODE 2. MODE
013496,000093: # SELECTION AND LIMIT CHECKING ARE DONE ELSEWHERE.
013497,000094:
013498,000095: # THE MODE 1 CONFIGURATION IS CALCULATED FROM THE VECTOR AND THEN MODE 2 IS FOUND USING THE RELATIONS
013499,000096:
013500,000097: # S(2) = 180 + S(1)
013501,000098: # T(2) = 180 - T(1)
013502,000099:
013503,000100: # THE VECTOR ARRIVES IN MPAC WHERE TRG*SMNG OR *SMNB* WILL HAVE LEFT IT.
013504,000101:
013505,000102: 13,2133 00041 RRANGLES STORE 32D
013506,000103: 13,2134 57545 DLOAD DCOMP # SINCE WE WILL FIND THE MODE 1 SHAFT
013507,000104: 13,2135 00043 34D # ANGLE LATER, WE CAN FIND THE MODE 1
013508,000105: 13,2136 67401 SETPD ASIN # TRUNNION BY SIMPLY TAKING THE ARCSIN OF
013509,000106: 13,2137 00001 0 # THE Y COMPONENT, THE ASIN GIVING AN
013510,000107: 13,2140 44206 PUSH BDSU # ANSWER WHOSE ABS VAL IS LESS THAN 90 DEG
013511,000108: 13,2141 24005 LODPHALF
013512,000109: 13,2142 14005 STODL 4 # MODE 2 TRUNNION TO 4.
013513,000110: 13,2143 24007 LO6ZEROS
013514,000111: 13,2144 24043 STOVL 34D # UNIT THE PROJECTION OF THE VECTOR
013515,000112: 13,2145 00041 32D # IN THE X-Z PLANE
013516,000113: 13,2146 41056 UNIT BOVB # IF OVERFLOW, TARGET VECTOR IS ALONG Y
013517,000114: 13,2147 52432 LUNDESCH # CALL FOR MANEUVER UNLESS ON LUNAR SURF
013518,000115: 13,2150 14041 STODL 32D # PROJECTION VECTOR.
013519,000116: 13,2151 00041 32D
013520,000117: 13,2152 44142 SR1 STQ
013521,000118: 13,2153 00051 S2
013522,000119: 13,2154 14023 STODL SINTH # USE ARCTRIG SINCE SHAFT COULD BE ARB.
013523,000120: 13,2155 00045 36D
013524,000121: 13,2156 77742 SR1
013525,000122: 13,2157 34021 STCALL COSTH
013526,000123: 13,2160 47322 ARCTRIG
Page 325 |
013528,000125: 13,2161 43206 PUSH DAD # MODE 1 SHAFT TO 2.
013529,000126: 13,2162 24005 LODPHALF
013530,000127: 13,2163 24007 STOVL 6
013531,000128: 13,2164 00005 4
013532,000129: 13,2165 77634 RTB # FIND MODE 2 CDU ANGLES.
013533,000130: 13,2166 21636 2V1STO2S
013534,000131: 13,2167 25111 STOVL MODEB
013535,000132: 13,2170 00001 0
013536,000133: 13,2171 77634 RTB # MODE 1 ANGLES TO MODE A.
013537,000134: 13,2172 21636 2V1STO2S
013538,000135: 13,2173 01107 STORE MODEA
013539,000136: 13,2174 77776 EXIT
013540,000137:
013541,000138: 13,2175 40110 CS RADMODES # SWAP MODEA AND MODEB IF RR IN MODE 2.
013542,000139: 13,2176 74740 MASK ANTENBIT
013543,000140: 13,2177 10000 CCS A
013544,000141: 13,2200 12204 TCF +4
013545,000142:
013546,000143: 13,2201 53107 DXCH MODEA
013547,000144: 13,2202 53111 DXCH MODEB
013548,000145: 13,2203 53107 DXCH MODEA
013549,000146:
013550,000147: 13,2204 06042 TC INTPRET
013551,000148: 13,2205 77650 GOTO
013552,000149: 13,2206 00051 S2
Page 326 |
013554,000151: # GIVEN RR TRUNNION AND SHAFT (T,S) IN TANGNB,+1, FIND THE ASSOCIATED
013555,000152: # LINE OF SIGHT IN NAV BASE AXES. THE HALF UNIT VECTOR, .5(SIN(S)COS(T),
013556,000153: # -SIN(T),COS(S)COS(T)) IS LEFT IN MPAC AND 32D.
013557,000154:
013558,000155: 23,2000 SETLOC INFLIGHT
013559,000156: 23,2000 BANK
013560,000157:
013561,000158: 23,2041 COUNT* $$/GEOM
013562,000159:
013563,000160: 23,2041 47135 RRNB SLOAD RTB
013564,000161: 23,2042 03753 TANGNB
013565,000162: 23,2043 21577 CDULOGIC
013566,000163: 23,2044 41401 SETPD PUSH # TRUNNION ANGLE TO 0
013567,000164: 23,2045 00001 0
013568,000165: 23,2046 57556 SIN DCOMP
013569,000166: 23,2047 14043 STODL 34D # Y COMPONENT
013570,000167:
013571,000168: 23,2050 41546 COS PUSH # .5 COS(T) TO 0
013572,000169: 23,2051 47135 SLOAD RTB
013573,000170: 23,2052 03754 TANGNB +1
013574,000171: 23,2053 21577 CDULOGIC
013575,000172: 23,2054 71406 RRNB1 PUSH COS # SHAFT ANGLE TO 2
013576,000173: 23,2055 72405 DMP SL1
013577,000174: 23,2056 00001 0
013578,000175: 23,2057 14045 STODL 36D # Z COMPONENT
013579,000176:
013580,000177: 23,2060 41356 SIN DMP
013581,000178: 23,2061 77752 SL1
013582,000179: 23,2062 24041 STOVL 32D
013583,000180: 23,2063 00041 32D
013584,000181: 23,2064 77616 RVQ
013585,000182:
013586,000183: # THIS ENTRY TO RRNB REQUIRES THE TRUNNION AND SHAFT ANGLES IN MPAC AND MPAC +1 RESPECTIVELY
013587,000184:
013588,000185: 23,2065 14025 RRNBMPAC STODL 20D # SAVE SHAFT CDU IN 21.
013589,000186: 23,2066 00155 MPAC # SET MODE TO DP. (THE PRECEEDING STORE
013590,000187: # MAY BE DP, TP OR VECTOR.)
013591,000188: 23,2067 40234 RTB SETPD
013592,000189: 23,2070 21577 CDULOGIC
013593,000190: 23,2071 00001 0
013594,000191: 23,2072 73406 PUSH SIN # TRUNNION ANGLE TO 0
013595,000192: 23,2073 77676 DCOMP
013596,000193: 23,2074 14043 STODL 34D # Y COMPONENT
013597,000194: 23,2075 41546 COS PUSH # .5COS(T) TO 0
013598,000195: 23,2076 47135 SLOAD RTB # PICK UP CDU'S.
013599,000196: 23,2077 00026 21D
013600,000197: 23,2100 21577 CDULOGIC
013601,000198: 23,2101 77650 GOTO
013602,000199: 23,2102 46054 RRNB1
Page 327
This page has nothing on it. |
013605,000202:
013606,000203:
End of include-file LEM_GEOMETRY.agc. Parent file is MAIN.agc