forked from chrislgarry/Apollo-11
-
Notifications
You must be signed in to change notification settings - Fork 0
/
RT8_OP_CODES.s
355 lines (296 loc) · 7.63 KB
/
RT8_OP_CODES.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
# Copyright: Public domain.
# Filename: RT8_OP_CODES.agc
# Purpose: Part of the source code for Comanche, build 055. It
# is part of the source code for the Command Module's
# (CM) Apollo Guidance Computer (AGC), Apollo 11.
# Assembler: yaYUL
# Reference: pp. 1508-1516
# Contact: Ron Burkey <[email protected]>
# Website: http://www.ibiblio.org/apollo.
# Mod history: 2009-05-07 RSB Adapted from Colossus249/RT8_OP_CODES.agc
# and page images.
# 2009-05-07 RSB Oops! Left out the entire last page before.
#
# The contents of the "Comanche055" files, in general, are transcribed
# from scanned documents.
#
# Assemble revision 055 of AGC program Comanche by NASA
# 2021113-051. April 1, 1969.
#
# This AGC program shall also be referred to as Colossus 2A
#
# Prepared by
# Massachussets Institute of Technology
# 75 Cambridge Parkway
# Cambridge, Massachusetts
#
# under NASA contract NAS 9-4065.
#
# Refer directly to the online document mentioned above for further
# information. Please report any errors to [email protected].
# Page 1508
BANK 22
SETLOC RTBCODES
BANK
EBANK= XNB
COUNT* $$/RTB
# LOAD TIME2, TIME1 INTO MPAC:
LOADTIME EXTEND
DCA TIME2
TCF SLOAD2
# CONVERT THE SINGLE PRECISION 2'S COMPLEMENT NUMBER ARRIVING IN MPAC (SCALED IN HALF-REVOLUTIONS) TO A
# DP 1'S COMPLEMENT NUMBER SCALED IN REVOLUTIONS.
CDULOGIC CCS MPAC
CAF ZERO
TCF +3
NOOP
CS HALF
TS MPAC +1
CAF ZERO
XCH MPAC
EXTEND
MP HALF
DAS MPAC
TCF DANZIG # MODE IS ALREADY AT DOUBLE-PRECISION
# READ THE PIPS INTO MPAC WITHOUT CHANGING THEM:
READPIPS INHINT
CA PIPAX
TS MPAC
CA PIPAY
TS MPAC +3
CA PIPAZ
RELINT
TS MPAC +5
CAF ZERO
TS MPAC +1
TS MPAC +4
TS MPAC +6
VECMODE TCF VMODE
# FORCE TP SIGN AGREEMENT IN MPAC:
SGNAGREE TC TPAGREE
# Page 1509
TCF DANZIG
# CONVERT THE DP 1'S COMPLEMENT ANGLE SCALED IN REVOLUTIONS TO A SINGLE PRECISION 2'S COMPLEMENT ANGLE
# SCALED IN HALF-REVOLUTIONS.
1STO2S TC 1TO2SUB
CAF ZERO
TS MPAC +1
TCF NEWMODE
# DO 1STO2S ON A VECTOR OF ANGLES:
V1STO2S TC 1TO2SUB # ANSWER ARRIVES IN A AND MPAC.
DXCH MPAC +5
DXCH MPAC
TC 1TO2SUB
TS MPAC +2
DXCH MPAC +3
DXCH MPAC
TC 1TO2SUB
TS MPAC +1
CA MPAC +5
TS MPAC
TPMODE CAF ONE # MODE IS TP.
TCF NEWMODE
# V1STO2S FOR 2 COMPONENT VECTOR. USED BY RR.
2V1STO2S TC 1TO2SUB
DXCH MPAC +3
DXCH MPAC
TC 1TO2SUB
TS L
CA MPAC +3
TCF SLOAD2
# SUBROUTINE TO DO DOUBLING AND 1'S TO 2'S CONVERSION:
1TO2SUB DXCH MPAC # FINAL MPAC +1 UNSPECIFIED.
DDOUBL
CCS A
AD ONE
TCF +2
COM # THIS WAS REVERSE OF MSU.
TS MPAC # AND SKIP ON OVERFLOW.
# Page 1510
TC Q
INDEX A # OVERFLOW UNCORRECT AND IN MSU.
CAF LIMITS
ADS MPAC
TC Q
# Page 1511
# SUBROUTINE TO INCREMENT CDUS
INCRCDUS CAF LOCTHETA
TS BUF # PLACE ADRES(THETA) IN BUF.
CAE MPAC # INCREMENT IN 1'S COMPL.
TC CDUINC
INCR BUF
CAE MPAC +3
TC CDUINC
INCR BUF
CAE MPAC +5
TC CDUINC
TCF VECMODE
LOCTHETA ADRES THETAD
# THE FOLLOWING ROUTINE INCREMENTS IN 2'S COMPLEMENT THE REGISTER WHOSE ADDRESS IS IN BUF BY THE 1'S COMPL.
# QUANTITY FOUND IN TEM2. THIS MAY BE USED TO INCRMENT DESIRED IMU AND OPTICS CDU ANGLES OR ANY OTHER 2'S COMPL.
# (+0 UNEQUAL TO -0) QUANTITY. MAY BE CALLED BY BANKCALL/SWCALL.
CDUINC TS TEM2 # 1'S COMPL. QUANT. ARRIVES IN ACC. STORE IT
INDEX BUF
CCS 0 # CHANGE 2'S COMPLE. ANGEL (IN BUF) INTO 1'S
AD ONE
TCF +4
AD ONE
AD ONE # OVEFLOW HERE IF 2'S COMPL. IS 180 DEG.
COM
AD TEM2 # SULT MOVES FROM 2ND TO 3D QUAD. (OR BACK)
CCS A # BACK TO 2'S COMPL.
AD ONE
TCF +2
COM
TS TEM2 # STORE 14-BIT QUANTITY WITH PRESENT SIGN
TCF +4
INDEX A # SIGN.
CAF LIMITS # FIX IT, BY ADDING IN 37777 OR 40000
AD TEM2
INDEX BUF
TS 0 # STORE NEW ANGLE IN 2'S COMPLEMENT.
TC Q
# Page 1512
# RTB TO TORQUE GYROS, EXCEPT FOR THE CALL TO IMUSTALL. ECADR OF COMMANDS ARRIVES IN X1.
PULSEIMU INDEX FIXLOC # ADDRESS OF GYRO COMMANDS SHOULD BE IN X1
CA X1
TC BANKCALL
CADR IMUPULSE
TCF DANZIG
# Page 1513
# EACH ROUTINE TAKES A 3X3 MATRIX STORED IN DOUBLE PRECISION IN A FIXED AREA OF ERASABLE MEMORY AND REPLACES IT
# WITH THE TRANSPOSE MATRIX. TRANSP1 USES LOCATIONS XNB+0,+1 THROUGH XNB+16D,+17D AND TRANSP2 USES LOCATIONS
# XNB1+0,+1 THROUGH XNB1+16D,+17D. EACH MATRIX IS STORED BY ROWS.
XNBEB ECADR XNB
XNB1EB ECADR XNB1
EBANK= XNB
TRANSP1 CAF XNBEB
TS EBANK
DXCH XNB +2
DXCH XNB +6
DXCH XNB +2
DXCH XNB +4
DXCH XNB +12D
DXCH XNB +4
DXCH XNB +10D
DXCH XNB +14D
DXCH XNB +10D
TCF DANZIG
EBANK= XNB1
TRANSP2 CAF XNB1EB
TS EBANK
DXCH XNB1 +2
DXCH XNB1 +6
DXCH XNB1 +2
DXCH XNB1 +4
DXCH XNB1 +12D
DXCH XNB1 +4
DXCH XNB1 +10D
DXCH XNB1 +14D
DXCH XNB1 +10D
TCF DANZIG
# Page 1514
# THE SUBROUTINE SIGNMPAC SETS C(MPAC, MPAC +1) TO SIGN(MPAC).
# FOR THIS, ONLY THE CONTENTS OF MPAC ARE EXAMINED. ALSO +0 YIELDS POSMAX AND -0 YIELDS NEGMAX.
#
# ENTRY MAY BE BY EITHER OF THE FOLLOWING:
# 1. LIMIT THE SIZE OF MPAC ON INTERPRETIVE OVERFLOW:
# ENTRY: BOVB
# SIGNMPAC
# 2. GENERATE IN MPAC THE SIGNUM FUNCTION OF MPAC:
# ENTRY: RTB
# SIGNMPAC
# IN EITHER CASE, RETURN IS TO TEH NEXT INTERPRETIVE INSTRUCTION IN THE CALLING SEQUENCE.
SIGNMPAC EXTEND
DCA DPOSMAX
DXCH MPAC
CCS A
DPMODE CAF ZERO # SETS MPAC +2 TO ZERO IN THE PROCESS
TCF SLOAD2 +2
TCF +1
EXTEND
DCS DPOSMAX
TCF SLOAD2
# RTB OP CODE NORMUNIT IS LIKE INTERPRETIVE INSTRUCTION UNIT, EXCEPT THAT IT CAN BE DEPENDED ON NOT TO BLOW
# UP WHEN THE VECTOR BEING UNITIZED IS VERY SAMLL -- IT WILL BLOW UP WHEN ALL COMPONENT ARE ZERO. IF NORMUNIT
# IS USED AND THE UPPER ORDER HALVES OF ALL COMPONENTS ARE ZERO, THE MAGNITUDE RETURNS IN 36D WILL BE TOO LARGE
# BY A FACTOR OF 2(13) AND THE SQURED MAGNITUDE RETURNED AT 34D WILL BE TOO BIG BY A FACTOR OF 2(26).
NORMUNX1 CAF ONE
TCF NORMUNIT +1
NORMUNIT CAF ZERO
AD FIXLOC
TS MPAC +2
TC BANKCALL # GET SIGN AGREEMENT IN ALL COMPONENTS
CADR VECAGREE
CCS MPAC
TCF NOSHIFT
TCF +2
TCF NOSHIFT
CCS MPAC +3
TCF NOSHIFT
TCF +2
TCF NOSHIFT
CCS MPAC +5
TCF NOSHIFT
TCF +2
TCF NOSHIFT
# Page 1515
CA MPAC +1 # SHIFT ALL COMPONENTS LEFT 13
EXTEND
MP BIT14
DAS MPAC # DAS GAINS A LITTLE ACCURACY
CA MPAC +4
EXTEND
MP BIT14
DAS MPAC +3
CA MPAC +6
EXTEND
MP BIT14
DAS MPAC +5
CAF THIRTEEN
INDEX MPAC +2
TS 37D
OFFTUNIT TC POSTJUMP
CADR UNIT +1 # SKIP THE "TC VECAGREE" DONE AT UNIT
NOSHIFT CAF ZERO
TCF OFFTUNIT -2
# RTB VECSGNAG ... FORCES SIGN AGREEMENT OF VECTOR IN MPAC.
VECSGNAG TC BANKCALL
CADR VECAGREE
TC DANZIG
# Page 1516
# MODULE CHANGE FOR NEW LUNAR GRAVITY MODEL
SETLOC MODCHG3
BANK
QUALITY1 BOF DLOAD
MOONFLAG
NBRANCH
URPV
DSQ GOTO
QUALITY2
SETLOC MODCHG2
BANK
QUALITY2 PDDL DSQ # SQUARE INTO 2D, B2
URPV +2 # Y COMPONENT, B1
DSU
DMP VXSC # 5(Y**2-X**2)UR
5/8 # CONSTANT, 5B3
URPV # VECTOR, RESULT MAXIMUM IS 5, SCALING
# HERE B6
VSL3 PDDL # STORE SCALED B3 IN 2D, 4D, 6D FOR XYZ
URPV # X COMPONENT, B1
SR1 DAD # 2 X X COMPONENT FOR B3 SCALING
2D # ADD TO VECTOR X COMPONENT OF ANSWER.
# SAME AS MULTIPLYING BY UNITX. MAX IS 7.
STODL 2D
URPV +2 # Y COMPONENT, B1
SR1 BDSU # 2 X Y COMPONENT FOR B3 SCALING
4D # SUBTRACT FROM VECTOR Y COMPONENT OF
# ANSWER, SAME AS MULTIPLYING BY UNITY.
# MAX IS 7.
STORE 4D # 2D HAS VECTOR, B3.
SLOAD VXSC # MULTIPLY COEFFICIENT TIMES VECTOR IN 2D
E3J22R2M
PDDL RVQ # J22 TERM X R**4 IN 2D, SCALED B61
COSPHI/2 # SAME AS URPV +4, Z COMPONENT
# *** END OF CHIEFTAN.028 ***