forked from chrislgarry/Apollo-11
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CSM_GEOMETRY.s
418 lines (382 loc) · 9.74 KB
/
CSM_GEOMETRY.s
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
# Copyright: Public domain.
# Filename: CSM_GEOMETRY.agc
# Purpose: Part of the source code for Colossus 2A, AKA Comanche 055.
# It is part of the source code for the Command Module's (CM)
# Apollo Guidance Computer (AGC), for Apollo 11.
# Assembler: yaYUL
# Contact: Ron Burkey <[email protected]>.
# Website: www.ibiblio.org/apollo.
# Pages: 285-296
# Mod history: 2009-05-08 RSB Adapted from the Colossus249/ file of the
# same name, using Comanche055 page images.
#
# This source code has been transcribed or otherwise adapted from digitized
# images of a hardcopy from the MIT Museum. The digitization was performed
# by Paul Fjeld, and arranged for by Deborah Douglas of the Museum. Many
# thanks to both. The images (with suitable reduction in storage size and
# consequent reduction in image quality as well) are available online at
# www.ibiblio.org/apollo. If for some reason you find that the images are
# illegible, contact me at [email protected] about getting access to the
# (much) higher-quality images which Paul actually created.
#
# Notations on the hardcopy document read, in part:
#
# Assemble revision 055 of AGC program Comanche by NASA
# 2021113-051. 10:28 APR. 1, 1969
#
# This AGC program shall also be referred to as
# Colossus 2A
# Page 285
BANK 22
SETLOC COMGEOM1
BANK
# THIS ROUTINE TAKES THE SHAFT AND TRUNNION ANGLES AS READ BY THE CM OPTICAL SYSTEM AND CONVERTS THEM INTO A UNIT
# VECTOR REFERENCED TO THE NAVIGATION BASE COORDINATE SYSTEM AND COINCIDENT WTIH THE SEXTANT LINE OF SIGHT.
#
# THE INPUTS ARE: 1) THE SEXTAND SHAFT AND TRUNNION ANGLES ARE STORED SP IN LOCATIONS 3 AND 5 RESPECTIVELY OF THE
# MARK VAC AREA. 2) THE COMPLEMENT OF THE BASE ADDRESS OF THE MARK VAC AREA IS STORED SP AT LOCATION X1 OF YOUR
# JOB VAC AREA.
#
# THE OUTPUT IS A HALF-UNIT VECTOR IN NAVIGATION BASE COORDINATES AND STORED AT LOCATION 32D OF THE VAC AREA. THE
# OUTPUT IS ALSO AVAILABLE AT MPAC.
COUNT 23/GEOM
SXTNB SLOAD* RTB # PUSHDOWN 00,02,04,(17D-19D),32D-36D
5,1 # TRUNNION = TA
CDULOGIC
RTB PUSH
SXTLOGIC
SIN SL1
PUSH SLOAD* # PD2 = SIN(TA)
3,1 # SHAFT = SA
RTB PUSH # PD4 = SA
CDULOGIC
COS DMP
2
STODL STARM # COS(SA)SIN(TA)
SIN DMP
STADR
STODL STARM +2 # SIN(SA)SIN(TA)
COS
STOVL STARM +4
STARM # STARM = 32D
MXV VSL1
NB1NB2
STORE 32D
RVQ
SXTLOGIC CAF 10DEGS- # CORRECT FOR 19.775 DEGREE OFFSET
ADS MPAC
CAF QUARTER
TC SHORTMP
TC DANZIG
# Page 286
# CALCSXA COMPUTES THE SEXTANT SHAFT AND TRUNNION ANGLES REQUIRED TO POSITION THE OPTICS SUCH THAT A STAR LINE-
# OF-SIGHT LIES ALONG THE STAR VECTOR. THE ROUTINE TAKES THE GIVEN STAR VECTOR AND EXPRESSES IT AS A VECTOR REF-
# ERENECED TO THE OPTICS COORDINATE SYSTEM. IN ADDITION IT SETS UP THREE UNIT VECTORS DEFINING THE X, Y, AND Z AXES
# REFERENCED TO THE OPTICS COORDINATE SYSTEM.
#
# THE INPUTS ARE: 1) THE STAR VECTOR REFERRED TO THE PRESENT STABLE MEMMBER COORDINATES STORED AT STAR. 2) SAME ANGLE
# INPUT AS *SMNB*, I.E., SINES AND COSINES OF THE CDU ANGLES, IN THE ORDER Y Z X, AT SINCDU AND COSCDU. A CALL
# TO CDUTRIG WILL PROVIDE THIS INPUT.
#
# THE OUTPUT ARE THE SEXTANT SHAFT AND TRUNNION ANGLES STORED DP AT SAC AND PAC RESPECTIVELY. (LOW ORDER PART
# EQUAL TO ZERO).
CALCSXA ITA VLOAD # PUSHDOWN 00-26D, 28D, 30D, 32D-36D
28D
STAR
CALL
*SMNB*
MXV VSL1
NB2NB1
STOVL STAR
HIUNITX
STOVL XNB1
HIUNITY
STOVL YNB1
HIUNITZ
STCALL ZNB1
SXTANG1
# Page 287
# SXTANG COMPUTES THE SEXTANT SHAFT AND TRUNNION ANGLES REQUIRED TO POSITION THE OPTICS SUCH THAT A STAR LINE-OF-
# SIGHT LIES ALONG THE STAR VECTOR.
#
# THE INPUTS ARE: 1) THE STAR VECTOR REFERRED TO ANY COORDINATE SYSTEM STORED AT STAR. 2) THE NAVIGATION BASE
# COORDINATES REFERRED TO THE SAME COORDINATE SYSTEM. THESE THREE HALF-UNIT VECTORS ARE STROED AT XNB, YNB,AND
# ZNB.
#
# THE OUTPUTS ARE THE SEXTANT SHAFT AND TRUNNION ANGLES STORED DP AT SAC AND PAC RESPECTIVELY. (LOW ORDER PART
# EQUAL TO ZERO).
SXTANG ITA RTB # PUSHDOWN 16D,18D,22D-26D,28D
28D
TRANSP1 # EREF WRT NB2
VLOAD MXV
XNB
NB2NB1
VSL1
STOVL XNB1
YNB
MXV VSL1
NB2NB1
STOVL YNB1
ZNB
MXV VSL1
NB2NB1
STORE ZNB1
RTB RTB
TRANSP1
TRANSP2
SXTANG1 VLOAD VXV
ZNB1
STAR
BOV
+1
UNIT BOV
ZNB=S1
STORE PDA # PDA = UNIT(ZNB X S)
DOT DCOMP
XNB1
STOVL SINTH # SIN(SA) = PDA . -XNB
PDA
DOT
YNB1
STCALL COSTH # COS(SA) = PDA . YNB
ARCTRIG
# Page 288
RTB
1STO2S
STOVL SAC
STAR
BOV
+1
DOT SL1
ZNB1
ACOS
BMN SL2
SXTALARM # TRUNNION ANGLE NEGATIVE
BOV DSU
SXTALARM # TRUNNION ANGLE GREATER THAN 90 DEGREES
20DEG-
RTB
1STO2S
STORE PAC # FOR FLIGHT USE, CULTFLAG IS ON IF
CLRGO # TRUNION IS GREATER THAN 90 DEG
CULTFLAG
28D
SXTALARM SETGO # ALARM HAS BEEN REMOVED FROM THIS
CULTFLAG
28D # SUBROUTINE, ALARM WILL BE SET BY MPI
ZNB=S1 DLOAD
270DEG
STODL SAC
20DEGS-
STORE PAC
CLRGO
CULTFLAG
28D
# Page 289
# THESE TWO ROUTINES COMPUTE THE ACTUAL STATE VECTOR FOR LM, CSM BY ADDING
# THE CONIC R,V AND THE DEVIATIONS R,V. THE STATE VECTORS ARE CONVERTED TO
# METERS B-29 AND METERS/CSEC B-7 AND STORED APPROPRIATELY IN RN,VN OR
# R-OTHER, V-OTHER FOR DOWNLINK. THE ROUTINES NAMES ARE SWITCHED IN THE
# OTHER VEHICLES COMPUTER.
#
# INPUT
# STATE VECTOR IN TEMPORARY STORAGE AREA
# IF STATE VECTOR IS SCALED POS B27 AND VEL B5
# SET X2 TO +2
# IF STATE VECTOR IS SCALED POS B29 AND VEL B7
# SET X2 TO 0
#
# OUTPUT
# R(T) IN RN, V(T) IN VN, T IN PIPTIME
# OR
# R(T) IN R-OTHER, V(T) IN V-OTHER (T IS DEFINED BY T-OTHER)
BANK 23
SETLOC COMGEOM2
BANK
COUNT 10/GEOM
SVDWN1 BOF RVQ # SW=1=AVETOMID DOING W-MATRIX INTEG
AVEMIDSW
+1
VLOAD VSL*
TDELTAV
0 -7,2
VAD VSL*
RCV
0,2
STOVL RN
TNUV
VSL* VAD
0 -4,2
VCV
VSL*
0,2
STODL VN
TET
STORE PIPTIME
RVQ
SVDWN2 VLOAD VSL*
TDELTAV
0 -7,2
VAD VSL*
RCV
# Page 290
0,2
STOVL R-OTHER
TNUV
VSL* VAD
0 -4,2
VCV
VSL*
0,2
STORE V-OTHER
RVQ
# Page 291
# SUBROUTINE TO COMPUTE THE NATURAL LOG OF C(MPAC, MPAC +1).
#
# ENTRY: CALL
# LOG
#
# SUBROUTINE RETURNS WITH -LOG IN DP MPAC.
#
# EBANK IS ARBITRARY.
BANK 14
SETLOC POWFLIT2
BANK
COUNT 23/GEOM
LOG NORM BDSU # GENERATES LOG BY SHIFTING ARG
MPAC +3 # UNTIL IT LIES BETWEEN .5 AND 1.
NEARLY1 # THE LOG OF THIS PART IS FOUND AND THE
EXIT # LOG OF THE SHIFTED PART IS COMPUTED
TC POLY # AND ADDED IN. SHIFT COUNT STORED
DEC 2 # (N-1, SUPPLIED BY SMERZH)
2DEC 0 # IN MPAC +3.
2DEC .031335467
2DEC .0130145859
2DEC .0215738898
CAF ZERO
TS MPAC +2
EXTEND
DCA CLOG2/32
DXCH MPAC
DXCH MPAC +3
COM # LOAD POSITIVE SHIFT COUNT IN A.
TC SHORTMP # MULTIPLY BY SHIFT COUNT.
DXCH MPAC +1
DXCH MPAC
DXCH MPAC +3
DAS MPAC
TC INTPRET # RESULT IN MPAC, MPAC +1
RVQ
NEARLY1 2DEC .999999999
# Page 292
CLOG2/32 2DEC .0216608494
# Page 293
# SUBROUTINE NAME: EARTH ROTATOR (EARROT1 OR EARROT2) DATE: 15 FEB 67
# MOD NO: N +1 LOG SECTION: POWERED FLIGHT SUBROS
# MOD BY: ENTRY GROUP (BAIRNSFATHER)
#
# FUNCTIONAL DESCRIPTION: THIS ROUTINE PROJECTS THE INITIAL EARTH TARGET VECTOR RTINIT AHEAD THROUGH
# THE ESTIMATED TIME OF FLIGHT. INITIAL CALL RESOLVES THE INITIAL TARGET VECTOR RTINIT INTO EASTERLY
# AND NORMAL COMPONENTS RTEAST AND RTNORM. INITIAL AND SUBSEQUENT CALLS ROTATE THIS VECTOR
# ABOUT THE (FULL) UNIT POLAR AXIS UNITW THROUGH THE ANGLE WIE DTEAROT TO OBTAIN THE ROTATED
# TARGET VECTOR RT. ALL VECTORS EXCEPT UNITW ARE HALF UNIT.
# THE EQUATIONS ARE:
# _ _ _ _
# RT = RTINIT + RTNORM (COS(WT) - 1) + RTEAST SIN(WT)
#
# WHERE WT = WIE DTEAROT
#
# RTINIT = INITIAL TARGET VECTOR
# _ _ _
# RTEAST = UNITW * RTINIT
# _ _ _
# RTNORM = RTEAST * UNITW
#
# FOR CONTINUOUS UPDATING, ONLY ONE ENTRY TO EARROT1 IS REQUIRED, WITH SUBSEQUENT ENTRIES AT EARROT2.
#
# CALLING SEQUENCE: FIRST CALL SUBSEQUENT CALL
# STCALL DTEAROT STCALL DTEAROT
# EARROT1 EARROT2
# C(MPAC) UNSPECIFIED C(MPAC) = DTEAROT
# PUSHLOC = PDL+0, ARBITRARY. 6 LOCATIONS USED.
#
# SUBROUTINES USED: NONE
#
# NORMAL EXIT MODES: RVQ
#
# ALARMS: NONE
#
# OUTPUT: RTEAST (-1) .5 UNIT VECTOR EAST, COMPNT OF RTINIT LEFT BY FIRST CALL
# RTNORM (-1) .5 UNIT VECTOR NORML, COMPNT OF RTINIT LEFT BY FIRST CALL
# RT (-1) .5 UNIT TARGET VECTOR, ROTATED LEFT BY ALL CALLS
# DTEAROT (-28) CS MAY BE CHANGED BY EARROT2, IF OVER 1 DAY
#
# ERASABLE INITIALIZATION REQUIRED:
# UNITW (0) UNIT POLAR VECTOR PAD LOADED
# RTINIT (-1) .5 UNIT INITIAL TARGET VECTOR LEFT BY ENTRY
# DTEAROT (-28) CS TIME OF FLIGHT LEFT BY CALLER
#
# DEBRIS: QPRET, PDL+0 ... PDL+5
# Page 294
EBANK= RTINIT
EARROT1 VLOAD VXV
UNITW # FULL UNIT VECTOR
RTINIT # .5 UNIT
STORE RTEAST # .5 UNIT
VXV
UNITW # FULL UNIT
STODL RTNORM # .5 UNIT
DTEAROT # (-28) CS
EARROT2 BOVB DDV
TCDANZIG # RESET OVFIND, IF ON
1/WIE
BOV PUSH
OVERADAY
COS DSU
HIDPHALF
VXSC PDDL # XCH W PUSH LIST
RTNORM # .5 UNIT
SIN VXSC
RTEAST # .5 UNIT
VAD VSL1
VAD UNIT # INSURE THAT RT IS "UNIT".
RTINIT # .5 UNIT
STORE RT # .5 UNIT TARGET VECTOR
RVQ
OVERADAY DLOAD SIGN
1/WIE
DTEAROT
BDSU
DTEAROT
STORE DTEAROT
GOTO
EARROT2
#WIE 2DEC .1901487997
1/WIE 2DEC 8616410
NB2NB1 2DEC +.8431756920 B-1
2DEC 0
2DEC -.5376381241 B-1
# Page 295
ZERINFLT 2DEC 0
HALFNFLT 2DEC .5
2DEC 0
2DEC +.5376381241 B-1
2DEC 0
2DEC +.8431756920 B-1
NB1NB2 2DEC +.8431756920 B-1
2DEC 0
2DEC +.5376381241 B-1
2DEC 0
2DEC .5
2DEC 0
2DEC -.5376381241 B-1
2DEC 0
2DEC +.8431756920 B-1
# Page 296
10DEGS- DEC 3600
270DEG OCT 60000 # SHAFT 270 DEGREES 25 COMP.
OCT 00000
20DEGS- DEC -07199
DEC -00000
20DEG- DEC 03600
DEC 00000