forked from chrislgarry/Apollo-11
-
Notifications
You must be signed in to change notification settings - Fork 3
/
PHASE_TABLE_MAINTENANCE.s
406 lines (342 loc) · 11.9 KB
/
PHASE_TABLE_MAINTENANCE.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
# Copyright: Public domain.
# Filename: PHASE_TABLE_MAINTENANCE.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: 1404-1413
# Mod history: 2009-05-10 SN (Sergio Navarro). Started adapting
# 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 1404
# SUBROUTINE TO UPDATE THE PROGRAM NUMBER DISPLAY ON THE DSKY.
COUNT 02/PHASE
BLOCK 02
SETLOC FFTAG1
BANK
NEWMODEX INDEX Q # UPDATE MODREG. ENTRY FOR MODE IN FIXED.
CAF 0
INCR Q
NEWMODEA TS MODREG # ENTRY FOR MODE IN A.
MMDSPLAY CAF +3 # DISPLAY MAJOR MODE.
PREBJUMP LXCH BBANK # PUTS BBANK IN L
TCF BANKJUMP # PUTS Q INTO A
CADR SETUPDSP
# RETURN TO CALLER +3 IF MODE = THAT AT CALLER +1. OTHERWISE RETURN TO CALLER +2.
CHECKMM INDEX Q
CS 0
AD MODREG
EXTEND
BZF Q+2
TCF Q+1 # NO MATCH
TCQ = Q+2 +1
BANK 14
SETLOC PHASETAB
BANK
COUNT 10/PHASE
SETUPDSP INHINT
DXCH RUPTREG1 # SAVE CALLER'S RETURN 2CADR
CAF PRIO30 # EITHER A TASK OR JOB CAN COME TO
TC NOVAC # NEWMODEX
EBANK= MODREG
2CADR DSPMMJOB
DXCH RUPTREG1
RELINT
DXCH Z # RETURN
DSPMMJOB EQUALS DSPMMJB
BLOCK 02
# Page 1405
SETLOC FFTAG1
BANK
# Page 1406
# PHASCHNG IS THE MAIN WAY OF MAKING PHASE CHANGES FOR RESTARTS. THERE ARE THREE FORMS OF PHASCHNG, KNOWN AS TYPE
# A, TYPE B, AND TYPE C. THEY ARE ALL CALLED AS FOLLOWS, WHERE OCT XXXXX CONTAINS THE PHASE INFORMATION,
# TC PHASCHNG
# OCT XXXXX
# TYPE A IS CONCERNED WITH FIXED PHASE CHANGES, THAT IS, PHASE INFORMATION THAT IS STORED PERMANENTLY. THESE
# OPTIONS ARE, WHERE G STANDS FOR A GROUP AND .X FOR THE PHASE,
# G.0 INACTIVE, WILL NOT PERMIT A GROUP G RESTART
# G.1 WILL CAUSE THE LAST DISPLAY TO BE REACTIVATED, USED MAINLY IN MANNED FLIGHTS
# G.EVEN A DOUBLE TABLE RESTART, CAN CAUSE ANY COMBINATION OF TWO JOBS, TASKS, AND/OR
# LONGCALL TO BE RESTARTED.
# G.ODD NOT .1 A SINGLE TABLE RESTART, CAN CAUSE EITHER A JOB, TASK, OR LONGCALL RESTART.
#
# THIS INFORMATION IS PUT INTO THE OCTAL WORD AFTER TC PHASCHNG AS FOLLOWS
# TL0 00P PPP PPP GGG
# WHERE EACH LETTER OR NUMBER STANTS FOR A BIT. THE G'S STAND FOR THE GROUP, OCTAL 1-7, THE P'S FOR THE PHASE,
# OCTAL 0 - 127. 0'S MUST BE 0. IF ONE WISHES TO HAVE THE TBASE OF GROUP G TO BE SET AT THIS TIME,
# T IS SET TO 1, OTHERWISE IT IS SET TO 0. SIMILARLY IF ONE WISHES TO SET LONGBASE, THEN L IS SET TO 1, OTHERWISE
# IT IS SET TO 0. SOME EXAMLES,
# TC PHASCHNG # THIS WILL CAUSE GROUP 3 TO BE SET TO 0,
# OCT 00003 # MAKING GROUP 3 INACTIVE
#
# TC PHASCHNG # IF A RESTART OCCURS THIS WOULD CAUSE
# OCT 00012 # GROUP 2 TO RESTART THE LAST DISPLAY
#
# TC PHASCHNG # THIS SETS THE TBASE OF GROUP 4 AND IN
# OCT 40064 # CASE OF A RESTART WOULD START UP THE TWO
# # THINGS LOCATED IN THE DOUBLE 4.6 RESTART
# # LOCATION.
#
# TC PHASCHNG # THIS SETS LONGBASE AND UPON A RESTART
# OCT 20135 # CAUSES 5.13 TO BE RESTARTED (SINCE
# # LONGBASE WAS SET THIS SINGLE ENTRY
# # SHOULD BE A LONGCALL)
#
# TC PHASCHNG # SINCE BOTH TBASE4 AND LONGBASE ARE SET,
# OCT 60124 # 4.12 SHOULD CONTAIN BOTH A TASK AND A
# # LONGCALL TO BE RESTARTED
#
# TYPE C PHASCHNG CONTAINS THE VARIABLE TYPE OF PHASCHNG INFORMATION. INSTEAD OF THE INFORMATION BEING IN A
# PERMANENT FORM, ONE STORES THE DESIRED RESTART INFORMATION IN A VARIABLE LOCATION. THE BITS ARE AS FOLLOWS,
# TL0 1AD XXX CJW GGG
# WHERE EACH LETTER OR NUMBER STANDS FOR A BIT. THE G'S STAND FOR THE GROUP, OCTAL 1 - 7. IF THE RESTART IS TO
# BE BY WAITLIST, W IS SET TO 1, IF IT IS A JOB, J IS SET TO 1, IF IT IS A LONGCALL, C IS SET TO 1. ONLY ONE OF
# THESE THREE BITS MAY BE SET. X'S ARE IGNORED, 1 MUST BE 1, AND 0 MUST BE 0. AGAIN T STANDS FOR THE TBASE,
# Page 1407
# AND L FOR LONGBASE. THE BITS A AND D ARE CONCERNED WITH THE VARIABLE INFORMATION. IF D IS SET TO 1, A PRIORITY
# OR DELTA TIME WILL BE READ FROM THE NEXT LOCATION AFTER THE OCTAL INFORMATION., IF THIS IS TO BE INDIRECT, THAT
# IS, THE NAME OF A LOCATION CONTAINING THE INFORMATION (DELTA TIME ONLY), THEN THIS IS GIVEN AS THE -GENADR OF
# THAT LOCATION WHICH CONTAINS THE DELTA TIME. IF THE OLD PRIORITY OR DELTA TIME IS TO BE USED, THAT WHICH IS
# ALREADY IN THE VARIABLE STORAGE, THEN D IS SET TO 0. NEXT THE A BIT IS USED. IF IT IS SET TO 0, THE ADDRESS
# THAT WOULD BE RESTARTED DURING A RESTART IS THE NEXT LOCATION AFTER THE PHASE INFORMATION, THAT IS, EITHER
# (TC PHASCHNG) +2 OR +3, DEPENDING ON WHETHER D HAD BEEN SET OR NOT. IF A IS SET TO 1, THEN THE ADDRESS THAT
# WOULD BE RESTARTED IS THE 2CADR THAT IS READ FROM THE NEXT TWO LOCATION. EXAMPLES,
# AD TC PHASCHNG # THIS WOULD CAUSE LOCATION AD +3 TO BE
# AD+1 OCT 05023 # RESTARTED BY GROUP THREE WITH A PRIORITY
# AD+2 OCT 23000 # OF 23. NOTE UPON RETURNING IT WOULD
# AD+3 # ALSO GO TO AD+3
#
# AD TC PHASCHNG # GROUP 1 WOULD CAUSE CALLCALL TO BE
# AD+1 OCT 27441 # BE STARTED AS A LONGCALL FROM THE TIME
# AD+2 -GENADR DELTIME # STORED IN LONGBASE (LONGBASE WAS SET) BY
# AD+3 2CADR CALLCALL # A DELTATIME STORED IN DELTIME. THE
# AD+4 # BBCON OF THE 2CADR SHOULD CONTAIN THE E
# AD+5 # BANK OF DELTIME. PHASCHNG RETURNS TO
# # LOCATION AD+5
#
# NOTE THAT IF A VARIABLE PRIORITY IS GIVEN FOR A JOB, THE JOB WILL BE RESTARTED AS A NOVAC IF THE PRIORITY IS
# NEGATIVE, AS A FINDVAC IF THE PRIORITY IS POSITIVE.
#
# TYPE B PHASCHNG IS A COMBINATION OF VARIABLE AND FIXED PHASE CHANGES. IT WILL START UP A JOB AS INDICATED
# BELOW AND ALSO START UP ONE FIXED RESTART, THAT IS EITHER AN G.1 OR A G.ODD OR THE FIRST ENTRY OF G.EVEN
# DOUBLE ENTRY. THE BIT INFORMATION IS AS FOLLOW,
# TL1 DAP PPP PPP GGG
# WHERE EACH LETTER OR NUMBER STANDS FOR A BIT. THE G'S STAND FOR THE GROUP, OCTAL 1 - 7, THE P'S FOR THE FIXED
# PHASE INFORMATION, OCTAL 0 - 127. 1 MUST BE 1. AND AGAIN T STANDS FOR THE TBASE AND L FOR LONGBASE. D THIS
# TIME STANDS ONLY FOR PRIORITY SINCE THIS WILL BE CONSIDERED A JOB, AND IT MUST BE GIVEN DIRECTLY IF GIVEN.
# AGAIN A STANDS FOR THE ADDRESS OF THE LOCATION TO BE RESTARTED, 1 IF THE 2CADR IS GIVEN, OR 0 IF IT IS TO BE
# THE NEXT LOCATION. (THE RETURN LOCATION OF PHASCHNG) EXAMPLES,
# AD TC PHASCHNG # TBASE IS SET AND A RESTART CAUSE GROUP 3
# AD+1 OCT 56043 # TO START THE JOB AJOBAJOB WITH PRIORITY
# AD+2 OCT 31000 # 31 AND THE FIRST ENTRY OF 3.4SPOT (WE CAN
# AD+3 2CADR AJOBAJOB # ASSUME IT IS A TASK SINCE WE SET TBASE3)
# AD+4 # UPON RETURN FROM PHASCHNG CONTROL WOULD
# AD+5 # GO TO AD+5
#
# AD TC PHASCHNG # UPON A RESTART THE LAST DISPLAY WOULD BE
# AD+1 OCT 10015 # RESTARTED AND A JOB WITH THE PREVIOUSLY
# AD+2 # STORED PRIORITY WOULD BE BEGUN AT AD+2
# # BY MEANS OF GROUP 5
# Page 1408
# THE NOVAC-FINDVAC CHOICE FOR JOBS HOLDS HERE ALSO -- NEGATIVE PRIORITY CAUSES A NOVAC CALL, POSITIVE A FINDVAC.
# SUMMARY OF BITS:
# TYPE A TL0 00P PPP PPP GGG
# TYPE B TL1 DAP PPP PPP GGG
# TYPE C TL0 1AD XXX CJW GGG
# Page 1409
# 2PHSCHNG IS USED WHEN ONE WISHES TO START UP A GROUP OR CHANGE A GROUP WHILE UNDER THE CONTROL OF A DIFFERENT
# GROUP. FOR EXAMPLE, CHANGE THE PHASE OF GROUP 3 WHILE THE PORTION OF THE PROGRAM IS UNDER GROUP 5. ALL 2PHSCHNG
# CALLS ARE MADE IN THE FOLLOWING MANNER,
# TC 2PHSCHNG
# OCT XXXXX
# OCT YYYYY
# WHERE OCT XXXXX MUST BE OF TYPE A AND OCT YYYYY MAY BE OF EITHER TYPE A OR TYPE B OR TYPE C. THERE IS ONE
# DIFFERENCE --- NOTE: IF LONGBASE IS TO BE SET THIS INFORMATION IS GIVEN IN THE OCT YYYYY INFORMATION, IT WILL
# BE DISREGARDED IF GIVEN WITH THE OCT XXXXX INFORMATION. A COUPLE OF EXAMPLES MAY HELP,
# AD TC 2PHACHNG # SET TBASE3 AND IF A RESTART OCCURS START
# AD+1 OCT 40083 # THE TWO ENTRIES IN 3.8 TABLE LOCATION
# AD+2 OCT 05025 # THIS IS OF TYPE C, SET THE JOB TO BE
# AD+3 OCT 18000 # TO BE LOCATION AD+4, WITH A PRIORITY 18,
# AD+4 # FOR GROUP 5 PHASE INFORMATION.
COUNT 02/PHASE
2PHSCHNG INHINT # THE ENTRY FOR A DOUBLE PHASE CHANGE
NDX Q
CA 0
INCR Q
TS TEMPP2
MASK OCT7
DOUBLE
TS TEMPG2
CA TEMPP2
MASK OCT17770 # NEED ONLY 1770, BUT WHY GET A NEW CONST.
EXTEND
MP BIT12
XCH TEMPP2
MASK BIT15
TS TEMPSW2 # INDICATES WHETHER TO SET TBASE OR NOT
TCF PHASCHNG +3
PHASCHNG INHINT
CA ONE # INDICATES CAME FROM A PHASCHNG ENTRY
TS TEMPSW2
NDX Q
CA 0
INCR Q
TS TEMPSW
# Page 1410
EXTEND
DCA ADRPCHN2 # OFF TO SWITCHED BANK
DTCB
EBANK= LST1
ADRPCHN2 2CADR PHSCHNG2
ONEORTWO LXCH TEMPBBCN
LXCH BBANK
LXCH TEMPBBCN
MASK OCT14000 # SEE WHAT KIND OF PHASE CHANGE IT IS
CCS A
TCF CHECKB # IT IS OF TYPE `B'.
CA TEMPP
MASK BIT7
CCS A # SHALL WE USE THE OLD PRIORITY
TCF GETPRIO # NO GET A NEW PRIORITY (OR DELTA T)
OLDPRIO NDX TEMPG # USE THE OLD PRIORITY (OR DELTA T)
CA PHSPRDT1 -2
TS TEMPPR
CON1 CA TEMPP # SEE IF A 2CADR IS GIVEN
MASK BIT8
CCS A
TCF GETNEWNM
CA Q
TS TEMPNM
CA BB
EXTEND # PICK UP USER'S SUPERBANK
ROR SUPERBNK
TS TEMPBB
TOCON2 CA CON2ADR # BACK TO SWITCHED BANK
LXCH TEMPBBCN
DTCB
CON2ADR GENADR CON2
GETPRIO NDX Q # DON'T CARE IF DIRECT OR INDIRECT
CA 0 # LEAVE THAT DECISION TO RESTARTS
INCR Q # OBTAIN RETURN ADDRESS
TCF CON1 -1
GETNEWNM EXTEND
# Page 1411
INDEX Q
DCA 0
DXCH TEMPNM
CA TWO
ADS Q # OBTAIN RETURN ADDRESS
TCF TOCON2
OCT14000 EQUALS PRIO14
TEMPG EQUALS ITEMP1
TEMPP EQUALS ITEMP2
TEMPNM EQUALS ITEMP3
TEMPBB EQUALS ITEMP4
TEMPSW EQUALS ITEMP5
TEMPSW2 EQUALS ITEMP6
TEMPPR EQUALS RUPTREG1
TEMPG2 EQUALS RUPTREG2
TEMPP2 EQUALS RUPTREG3
TEMPBBCN EQUALS RUPTREG4
BB EQUALS BBANK
BANK 14
SETLOC PHASETAB
BANK
EBANK= PHSNAME1
COUNT 10/PHASE
PHSCHNG2 LXCH TEMPBBCN
CA TEMPSW
MASK OCT7
DOUBLE
TS TEMPG
CA TEMPSW
MASK OCT17770
EXTEND
MP BIT12
TS TEMPP
CA TEMPSW
MASK OCT60000
XCH TEMPSW
MASK OCT14000
CCS A
TCF ONEORTWO
# Page 1412
CA TEMPP # START STORING THE PHASE INFORMATION
NDX TEMPG
TS PHASE1 -2
BELOW1 CCS TEMPSW2 # IS IT A PHASCHNG OR A 2PHSCHNG
TCF BELOW2 # IT'S A PHASCHNG
TCF +1 # IT'S A 2PHSCHNG
CS TEMPP2
LXCH TEMPP2
NDX TEMPG2
DXCH -PHASE1 -2
CCS TEMPSW2
NOOP # CAN'T GET HERE
TCF BELOW2
CS TIME1
NDX TEMPG2
TS TBASE1 -2
BELOW2 CCS TEMPSW # SEE IF WE SHOULD SET TBASE OR LONGBASE
TCF BELOW3 # SET LONGBASE ONLY
TCF BELOW4 # SET NEITHER
CS TIME1 # SET TBASE TO BEGIN WITH
NDX TEMPG
TS TBASE1 -2
CA TEMPSW # SHALL WE NOW SET LONGBASE
AD BIT14COM
CCS A
NOOP # ***** CAN'T GET HERE *****
BIT14COM OCT 17777 # ***** CAN'T GET HERE *****
TCF BELOW4 # NO WE NEED ONLY SET TBASE
BELOW3 EXTEND # SET LONGBASE
DCA TIME2
DXCH LONGBASE
BELOW4 CS TEMPP # AND STORE THE FINAL PART OF THE PHASE
NDX TEMPG
TS -PHASE1 -2
CA Q
LXCH TEMPBBCN
RELINT
DTCB
CON2 LXCH TEMPBBCN
# Page 1413
CA TEMPP
NDX TEMPG
TS PHASE1 -2
CA TEMPPR
NDX TEMPG
TS PHSPRDT1 -2
EXTEND
DCA TEMPNM
NDX TEMPG
DXCH PHSNAME1 -2
TCF BELOW1
BLOCK 02
SETLOC FFTAG1
BANK
COUNT 02/PHASE
CHECKB MASK BIT12 # SINCE THIS IS OF TYPE B, THIS BIT SHOULD
CCS A # BE HERE IF WE ARE TO GET A NEW PRIORITY
TCF GETPRIO # IT IS, SO GET NEW PRIORITY
TCF OLDPRIO # IT ISN'T, USE THE OLD PRIORITY.