forked from chrislgarry/Apollo-11
-
Notifications
You must be signed in to change notification settings - Fork 0
/
EXECUTIVE.s
497 lines (413 loc) · 11.3 KB
/
EXECUTIVE.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
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
# Copyright: Public domain.
# Filename: EXECUTIVE.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: 1208-1220
# Mod history: 2009-05-14 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 1208
BLOCK 02
# TO ENTER A JOB REQUEST REQUIRING NO VAC AREA:
COUNT 02/EXEC
NOVAC INHINT
AD FAKEPRET # LOC(MPAC +6) - LOC(QPRET)
TS NEWPRIO # PRIORITY OF NEW JOB + NOVAC C(FIXLOC)
EXTEND
INDEX Q # Q WILL BE UNDISTURBED THROUGHOUT.
DCA 0 # 2CADR OF JOB ENTERED.
DXCH NEWLOC
CAF EXECBANK
XCH FBANK
TS EXECTEM1
TCF NOVAC2 # ENTER EXECUTIVE BANK.
# TO ENTER A JOB REQUEST REQUIREING A VAC AREA -- E.G., ALL (PARTIALLY) INTERPRETIVE JOBS.
FINDVAC INHINT
TS NEWPRIO
EXTEND
INDEX Q
DCA 0
SPVACIN DXCH NEWLOC
CAF EXECBANK
XCH FBANK
TCF FINDVAC2 # OFF TO EXECUTIVE SWITCHED-BANK.
# TO ENTER A FINDVAC WITH THE PRIORITY IN NEWPRIO TO THE 2CADR ARRIVING IN A AND L:
# USERS OF SPVAC MUST INHINT BEFORE STORING IN NEWPRIO.
SPVAC XCH Q
AD NEG2
XCH Q
TCF SPVACIN
# TO SUSPEND A BASIC JOB SO A HIGHER PRIORITY JOB MAY BE SERVICED:
CHANG1 LXCH Q
CAF EXECBANK
XCH BBANK
TCF CHANJOB
# TO SUSPEND AN INTERPRETIVE JOB:
CHANG2 CS LOC # NEGATIVE LOC SHOWS JOB = INTERPRETIVE.
# ITRACE (4) REFERS TO "CHANG2"
# Page 1209
TS L
+2 CAF EXECBANK
TS BBANK
TCF CHANJOB -1
# Page 1210
# TO VOLUNTARILY SUSPEND A JOB UNTIL THE COMPLETION OF SOME ANTICIPATED EVENT (I/O EVENT ETC.):
JOBSLEEP TS LOC
CAF EXECBANK
TS FBANK
TCF JOBSLP1
# TO AWAKEN A JOB PUT TO SLEEP IN THE ABOVE FASHION:
JOBWAKE INHINT
TS NEWLOC
CS TWO # EXIT IS VIA FINDVAC/NOVAC PROCEDURES.
ADS Q
CAF EXECBANK
XCH FBANK
TCF JOBWAKE2
# TO CHANGE THE PRIORITY OF A JOB CURRENTLY UNDER EXECUTION:
PRIOCHNG INHINT # NEW PRIORITY ARRIVES IN A. RETURNS TO
TS NEWPRIO # CALLER AS SOON AS NEW JOB PRIORITY IS
CAF EXECBANK # HIGHEST. PREPARE FOR POSSIBLE BASIC-
XCH BBANK # STYLE CHANGE-JOB.
TS BANKSET
CA Q
TCF PRIOCH2
# TO REMOVE A JOB FROM EXECUTIVE CONSIDERATIONS:
ENDOFJOB CAF EXECBANK
TS FBANK
TCF ENDJOB1
ENDFIND CA EXECTEM1 # RETURN TO CALLER AFTER JOB ENTRY
TS FBANK # COMPLETE.
TCF Q+2
EXECBANK CADR FINDVAC2
FAKEPRET ADRES MPAC -36D # LOC(MPAC +6) - LOC(QPRET)
# Page 1211
# LOCATE AN AVAILABLE VAC AREA
BANK 01
COUNT 01/EXEC
FINDVAC2 TS EXECTEM1 # (SAVE CALLER'S BANK FIRST.)
CCS VAC1USE
TCF VACFOUND
CCS VAC2USE
TCF VACFOUND
CCS VAC3USE
TCF VACFOUND
CCS VAC4USE
TCF VACFOUND
CCS VAC5USE
TCF VACFOUND
TC BAILOUT
OCT 1201 # NO VAC AREAS.
VACFOUND AD TWO # RESERVE THIS VAC AREA BY STORING A ZERO
ZL # IN ITS VAC USE REGISTER AND STORE THE
INDEX A # ADDRESS OF THE FIRST WORD OF IT IN THE
LXCH 0 -1 # LOW NINE BITS OF THE PRIORITY WORD.
ADS NEWPRIO
NOVAC2 CAF ZERO # NOVAC ENTERS HERE. FIND A CORE SET.
TS LOCCTR
CAF NO.CORES # SEVEN SETS OF ELEVEN REGISTERS EACH.
NOVAC3 TS EXECTEM2
INDEX LOCCTR
CCS PRIORITY # EACH PRIORITY REGISTER CONTAINS -0 IF
TCF NEXTCORE # THE CORESPONDING CORE SET IS AVAILABLE.
NO.CORES DEC 6
TCF NEXTCORE # AN ACTIVE JOB HAS A POSITIVE PRIORITY
# BUT A DORMANT JOB'S PRIORITY IS NEGATIVE
# Page 1212
CORFOUND CA NEWPRIO # SET THE PRIORITY OF THIS JOB IN THE CORE
INDEX LOCCTR # SET'S PRIORITY REGISTER AND SET THE
TS PRIORITY # JOB'S PUSH-DOWN POINTER AT THE BEGINNING
MASK LOW9 # OF THE WORK AREA AND OVERFLOW INDICATOR.
INDEX LOCCTR
TS PUSHLOC # OFF TO PREPARE FOR INTERPRETIVE PROGRAMS.
CCS LOCCTR # IF CORE SET ZERO IS BEING LOADED, SET UP
TCF SETLOC # OVFIND AND FIXLOC IMMEDIATELY.
TS OVFIND
CA PUSHLOC
TS FIXLOC
SPECTEST CCS NEWJOB # SEE IF ANY ACTIVE JOBS WAITING (RARE).
TCF SETLOC # MUST BE AWAKENED OUT UNCHANGED JOB.
TC CCSHOLE
TC CCSHOLE
TS NEWJOB # +0 SHOWS ACTIVE JOB ALREADY SET.
DXCH NEWLOC
DXCH LOC
TCF ENDFIND
SETLOC DXCH NEWLOC # SET UP THE LOCATION REGISTERS FOR THIS
INDEX LOCCTR
DXCH LOC
INDEX NEWJOB # THIS INDEX INSTRUCTION INSURES THAT THE
CS PRIORITY # HIGHEST ACTIVE PRIORITY WILL BE COMPARED
AD NEWPRIO # WITH THE NEW PRIORITY TO SEE IF NEWJOB
EXTEND # SHOULD BE SET TO SIGNAL A SWITCH.
BZMF ENDFIND
CA LOCCTR # LOCCTR IS LEFT SET AT THIS CORE SET IF
TS NEWJOB # THE CALLER WANTS TO LOAD ANY MPAC
TCF ENDFIND # REGISTERS, ETC.
NEXTCORE CAF COREINC
ADS LOCCTR
CCS EXECTEM2
TCF NOVAC3
TC BAILOUT # NO CORE SETS.
OCT 1202
# Page 1213
# THE FOLLOWING ROUTINE SWAPS CORE SET 0 WITH THAT WHOSE RELATIVE ADDRESS IS IN NEWJOB.
-2 LXCH LOC
-1 CAE BANKSET # BANKSET, NOT BBANK, HAS RIGHT CONTENTS.
CHANJOB INHINT
EXTEND
ROR SUPERBNK # PICK UP CURRENT SBANK FOR BBCON
XCH L # LOC IN A AND BBCON IN L.
+4 INDEX NEWJOB # SWAP LOC AND BANKSET.
DXCH LOC
DXCH LOC
CAE BANKSET
EXTEND
WRITE SUPERBNK # SET SBANK FOR NEW JOB.
DXCH MPAC # SWAP MULTI-PURPOSE ACCUMULATOR AREAS.
INDEX NEWJOB
DXCH MPAC
DXCH MPAC
DXCH MPAC +2
INDEX NEWJOB
DXCH MPAC +2
DXCH MPAC +2
DXCH MPAC +4
INDEX NEWJOB
DXCH MPAC +4
DXCH MPAC +4
DXCH MPAC +6
INDEX NEWJOB
DXCH MPAC +6
DXCH MPAC +6
CAF ZERO
XCH OVFIND # MAKE PUSHLOC NEGATIVE IF OVFIND NZ.
EXTEND
BZF +3
CS PUSHLOC
TS PUSHLOC
DXCH PUSHLOC
INDEX NEWJOB
DXCH PUSHLOC
DXCH PUSHLOC # SWAPS PUSHLOC AND PRIORITY.
CAF LOW9 # SET FIXLOC TO BASE OF VAC AREA.
MASK PRIORITY
TS FIXLOC
CCS PUSHLOC # SET OVERFLOW INDICATOR ACCORDING TO
CAF ZERO
TCF ENDPRCHG -1
# Page 1214
CS PUSHLOC
TS PUSHLOC
CAF ONE
XCH OVFIND
TS NEWJOB
ENDPRCHG RELINT
DXCH LOC # BASIC JOBS HAVE POSITIVE ADDRESSES, SO
EXTEND # DISPATCH WITH A DTCB.
BZMF +2 # IF INTERPRETIVE, SET UP EBANK, ETC.
DTCB
# Page 1215
COM # EPILOGUE TO JOB CHANGE FOR INTERPRETIVE
AD ONE
TS LOC # RESUME
TCF INTRSM
# COMPLETE JOBSLEEP PREPARATIONS.
JOBSLP1 INHINT
CS PRIORITY # NNZ PRIORITY SHOWS JOB ASLEEP.
TS PRIORITY
CAF LOW7
MASK BBANK
EXTEND
ROR SUPERBNK # SAVE OLD SUPERBANK VALUE.
TS BANKSET
CS ZERO
JOBSLP2 TS BUF +1 # HOLDS -- HIGHEST PRIORITY.
TCF EJSCAN # SCAN FOR HIGHEST PRIORITY ALA ENDOFJOB.
NUCHANG2 INHINT # QUICK... DON'T LET NEWJOB CHANGE TO +0.
CCS NEWJOB
TCF +3 # NEWJOB STILL PNZ
RELINT # NEW JOB HAS CHANGED TO +0. WAKE UP JOB
TCF ADVAN +2 # VIA NUDIRECT. (VERY RARE CASE.)
CAF TWO
EXTEND
WOR DSALMOUT # TURN ON ACTIVITY LIGHT
DXCH LOC # AND SAVE ADDRESS INFO FOR BENEFIT OF
TCF CHANJOB +4 # POSSIBLE SLEEPING JOB.
# Page 1216
# TO WAKE UP A JOB, EACH CORE SET IS FOUND TO LOCATE ALL JOBS WHICH ARE ASLEEP. IF THE FCADR IN THE
# LOC REGISTER OF ANY SUCH JOB MATCHES THAT SUPPLIED BY THE CALLER, THAT JOB IS AWAKENED. IF NO JOB IS FOUND,
# LOCCTR IS SET TO -1 AND NO FURTHER ACTION TAKES PLACE.
JOBWAKE2 TS EXECTEM1
CAF ZERO # BEGIN CORE SET SCAN
TS LOCCTR
CAF NO.CORES
JOBWAKE4 TS EXECTEM2
INDEX LOCCTR
CCS PRIORITY
TCF JOBWAKE3 # ACTIVE JOB -- CHECK NEXT CORE SET.
COREINC DEC 12 # 12 REGISTERS PER CORE SET.
TCF WAKETEST # SLEEPING JOB -- SEE IF CADR MATCHES.
JOBWAKE3 CAF COREINC
ADS LOCCTR
CCS EXECTEM2
TCF JOBWAKE4
CS ONE # EXIT IF SLEEPIG JOB NOT FOUND.
TS LOCCTR
TCF ENDFIND
WAKETEST CS NEWLOC
INDEX LOCCTR
AD LOC
EXTEND
BZF +2 # IF MATCH.
TCF JOBWAKE3 # EXAMINE NEXT CORE SET IF NO MATCH.
INDEX LOCCTR # RE-COMPLEMENT PRIORITY TO SHOW JOB AWAKE
CS PRIORITY
TS NEWPRIO
INDEX LOCCTR
TS PRIORITY
CS FBANKMSK # MASK UP THE 2CADR OF THE WAKE ADDRESS
MASK NEWLOC # USING THE CADR IN NEWLOC AND THE EBANK
AD 2K # HALF OF BBANK SAVED IN BANKSET.
XCH NEWLOC
MASK FBANKMSK
INDEX LOCCTR
AD BANKSET
TS NEWLOC +1
CCS LOCCTR # SPECIAL TREATMENT IF THIS JOB WAS
TCF SETLOC # ALREADY IN THE RUN (0) POSITION.
TCF SPECTEST
# Page 1217
# PRIORITY CHANGE. CHANGE THE CONTENTS OF PRIORITY AND SCAN FOR THE JOB OF HIGHEST PRIORITY.
PRIOCH2 TS LOC
CAF ZERO # SET FLAG TO TELL ENDJOB SCANNER IF THIS
TS BUF # JOB IS STILL HIGHEST PRIORITY.
CAF LOW9
MASK PRIORITY
AD NEWPRIO
TS PRIORITY
COM
TCF JOBSLP2 # AND TO EJSCAN.
# Page 1218
# RELEASE THIS CORE SET AND VAC AREA AND SCAN FOR THE JOB OF HIGHEST ACTIVE PRIORITY.
ENDJOB1 INHINT
CS ZERO
TS BUF +1
XCH PRIORITY
MASK LOW9
TS L
CS FAKEPRET
AD L
EXTEND
BZMF EJSCAN # NOVAC ENDOFJOB
CCS L
INDEX A
TS 0
EJSCAN CCS PRIORITY +12D
TC EJ1
TC CCSHOLE
TCF +1
CCS PRIORITY +24D # EXAMINE EACH PRIORITY REGISTER TO FIND
TC EJ1 # THE JOB OF HIGHEST ACTIVE PRIORITY.
TC CCSHOLE
TCF +1
CCS PRIORITY +36D
TC EJ1
-CCSPR -CCS PRIORITY
TCF +1
CCS PRIORITY +48D
TC EJ1
TC CCSHOLE
TCF +1
CCS PRIORITY +60D
TC EJ1
TC CCSHOLE
TCF +1
CCS PRIORITY +72D
TC EJ1
TC CCSHOLE
TCF +1
# Page 1219
# EVALUATE THE RESULTS OF THE SCAN.
CCS BUF +1 # SEE IF THERE ARE ANY ACTIVE JOBS WAITING
TC CCSHOLE
TC CCSHOLE
TCF +2
TCF DUMMYJOB
CCS BUF # BUF IS ZERO IS THIS IS A PRIOCHNG AND
TCF +2 # CHANGED PRIORITY IS STILL HIGHEST.
TCF ENDPRCHG -1
INDEX A # OTHERWISE, SET NEWJOB TO THE RELATIVE
# Was CAF --- RSB 2004
CA 0 -1 # ADDRESS OF THE NEW JOB'S CORE SET.
AD -CCSPR
TS NEWJOB
TCF CHANJOB -2
EJ1 TS BUF +2
AD BUF +1 # - OLD HIGH PRIORITY.
CCS A
CS BUF +2
TCF EJ2 # NEW HIGH PRIORITY.
NOOP
INDEX Q
TC 2 # PROCEED WITH SEARCH.
EJ2 TS BUF +1
EXTEND
QXCH BUF # FOR LOCATING CCS PRIORITY + X INSTR.
INDEX BUF
TC 2
# Page 1220
# IDLING AND COMPUTER ACTIVITY (GREEN) LIGHT MAINTENANCE. THE IDLING ROUTIEN IS NOT A JOB IN ITSELF,
# BUT RATHER A SUBROUTINE OF THE EXECUTIVE.
EBANK= SELFRET # SELF-CHECK STORAGE IN EBANK.
DUMMYJOB CS ZERO # SET NEWJOB TO -0 FOR IDLING.
TS NEWJOB
RELINT
CS TWO # TURN OFF THE ACTIVITY LIGHT.
EXTEND
WAND DSALMOUT
ADVAN CCS NEWJOB # IS THE NEWJOB ACTIVE?
TCF NUCHANG2 # YES... ONE REQUIRING A CHANGE JOB.
CAF TWO # NEW JOB ALREADY IN POSITION FOR
TCF NUDIRECT # EXECUTION
CA SELFRET
TS L # PUT RETURN ADDRESS IN L.
CAF SELFBANK
TCF SUPDXCHZ +1 # AND DISPATCH JOB.
EBANK= SELFRET
SELFBANK BBCON SELFCHK
NUDIRECT EXTEND # TURN THE GREEN LIGHT BACK ON.
WOR DSALMOUT
DXCH LOC # JOBS STARTED IN THIS FASHION MUST BE
TCF SUPDXCHZ
BLOCK 2 # IN FIXED-FIXED SO OTHERS MAY USE.
COUNT 02/EXEC
# SUPDXCHZ -- ROUTINE TO TRANSFER TO SUPERBANK.
# CALLING SEQUENCE:
# TCF SUPDXCHZ # WITH 2CADR OF DESIRED LOCATION IN A + l.
SUPDXCHZ XCH L # BASIC.
+1 EXTEND
WRITE SUPERBNK
TS BBANK
TC L
NEG100 OCT 77677