-
Notifications
You must be signed in to change notification settings - Fork 343
/
SERVICE_ROUTINES.agc
280 lines (233 loc) · 6.65 KB
/
SERVICE_ROUTINES.agc
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
### FILE="Main.annotation"
## Copyright: Public domain.
## Filename: SERVICE_ROUTINES.agc
## Purpose: Part of the source code for Colossus, build 249.
## It is part of the source code for the Command Module's (CM)
## Apollo Guidance Computer (AGC), for Apollo 9.
## Assembler: yaYUL
## Reference: Starts on p. 1453
## Contact: Ron Burkey <info@sandroid.org>.
## Website: www.ibiblio.org/apollo.
## Mod history: 08/30/04 RSB. Adapted from corresponding Luminary131 file.
## 2017-01-06 RSB Page numbers now agree with those on the
## original harcopy, as opposed to the PDF page
## numbers in 1701.pdf.
## 2017-01-18 RSB Cross-diff'd comment text (not whitespace)
## vs the already-proofed corresponding Colossus
## 237 and Comanche 55 source-code files
## and corrected errors found.
##
## The contents of the "Colossus249" files, in general, are transcribed
## from a scanned copy of the program listing. Notations on this
## document read, in part:
##
## Assemble revision 249 of AGC program Colossus by NASA
## 2021111-041. October 28, 1968.
##
## This AGC program shall also be referred to as
## Colossus 1A
##
## Prepared by
## Massachusetts 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 (relative to the scanned pages) to info@sandroid.org.
##
## In some cases, where the source code for Luminary 131 overlaps that of
## Colossus 249, this code is instead copied from the corresponding Luminary 131
## source file, and then is proofed to incorporate any changes.
## Page 1453
BLOCK 3
SETLOC FFTAG6
BANK
COUNT 03/FLAG
UPENT2 TS L # WHICH FLAGWORD IS IT
MASK OCT7
XCH L # SAVE IN L FOR INDEXING
MASK OCT77770 # OBTAIN THE BIT INFORMATION
INHINT # PREVENT INTERUPTS
TS ITEMP1 # STORE THE BIT INFORMATION TEMPORARIALY
NDX L
CS FLAGWRD0
MASK ITEMP1
NDX L
ADS FLAGWRD0
RELINT # RELEASE INTERUPT INHIBIT
INCR Q # OBTAIN THE CORRECT RETURN ADDRESS
TC Q # RETURN
DOWNENT2 TS L # WHICH FLAGWORD IS IT
MASK OCT7
XCH L # SAVE IN L FOR INDEXING
MASK OCT77770 # OBTAIN THE BIT INFORMATION
COM # START TO PROCESS THE INFORMATION
INHINT # PREVENT INTERUPTS
NDX L
MASK FLAGWRD0
NDX L
TS FLAGWRD0
RELINT # RELEASE INTERUPT INHIBIT
INCR Q # OBTAIN THE CORRECT RETURN ADDRESS
TC Q # RETURN
OCT7 EQUALS SEVEN
BANK 10
## Page 1454
# UPFLAG AND DOWNFLAG ARE ENTIRELY GENERAL FLAG SETTING AND CLEARING SUBROUTINES. USING THEM, WHETHER OR
# NOT IN INTERRUPT, ONE MAY SET OR CLEAR ANY SINGLE, NAMED BIT IN ANY ERASABLE REGISTER, SUBJECT OF COURSE TO
# EBANK SETTING. A "NAMED" BIT, AS THE WORD IS USED HERE, IS ANY BIT WITH A NAME FORMALLY ASSIGNED BY THE YUL
# ASSEMBLER.
#
# AT PRESENT THE ONLY NAMED BITS ARE THOSE IN THE FLAGWORDS. ASSEMBLER CHANGES WILL MAKE IT POSSIBLE TO
# NAME ANY BIT IN ERASABLE MEMORY.
#
# CALLING SEQUENCES ARE AS FOLLOWS:-
# TC UPFLAG TC DOWNFLAG
# ADRES NAME OF FLAG ADRES NAME OF FLAG
#
# RETURN IS TO THE LOCATION FOLLOWING THE "ADRES" ABOUT .58 MS AFTER THE "TC".
# UPON RETURN A CONTAINS THE CURRENT FLAGWRD SETTING.
BLOCK 02
SETLOC FFTAG1
BANK
COUNT* $$/FLAG
UPFLAG CA Q
TC DEBIT
COM # +(15 - BIT)
EXTEND
ROR LCHAN # SET BIT
COMFLAG INDEX ITEMP1
TS FLAGWRD0
LXCH ITEMP3
RELINT
TC L
DOWNFLAG CA Q
TC DEBIT
MASK L # RESET BIT
TCF COMFLAG
DEBIT AD ONE # GET DE BITS
INHINT
TS ITEMP3
CA LOW4 # DEC15
TS ITEMP1
INDEX ITEMP3
CA 0 -1 # ADRES
TS L
CA ZERO
## Page 1455
EXTEND
DV ITEMP1 # A = FLAGWRD, L = (15 - BIT)
DXCH ITEMP1
INDEX ITEMP1
CA FLAGWRD0
TS L # CURRENT STATE
INDEX ITEMP2
CS BIT15 # -(15 - BIT)
TC Q
## Page 1456
# DELAYJOB- A GENERAL ROUTINE TO DELAY A JOB A SPECIFIC AMOUNT OF TIME BEFORE PICKING UP AGAIN.
#
# ENTRANCE REQUIREMENTS ...
# CAF DT DELAY JOB FOR DT CENTISECS
# TC BANKCALL
# CADR DELAYJOB
BANK 06
SETLOC DLAYJOB
BANK
# THIS MUST REMAIN IN BANK 0 *****************************************
COUNT 00/DELAY
DELAYJOB INHINT
TS Q # STORE DELAY DT IN Q FOR DLY -1 IN
CAF DELAYNUM # WAITLIST
DELLOOP TS RUPTREG1
INDEX A
CA DELAYLOC # IS THIS DELAYLOC AVAILABLE
EXTEND
BZF OK2DELAY # YES
CCS RUPTREG1 # NO, TRY NEXT DELAYLOC
TCF DELLOOP
TC BAILOUT # NO AVAILABLE LOCS AVAILABLE.
OCT 1104
OK2DELAY CA TCSLEEP # SET WAITLIST IMMEDIATE RETURN
TS WAITEXIT
CA FBANK
AD RUPTREG1 # STORE BBANK FOR TASK CALL
TS L
CAF WAKECAD # STORE CADR FOR TASK CALL
TCF DLY2 -1 # DLY IS IN WAITLIST ROUTINE
TCGETCAD TC MAKECADR # GET CALLERS FCADR
INDEX RUPTREG1
TS DELAYLOC # SAVE DELAY CADRS
TC JOBSLEEP
WAKER CAF ZERO
INDEX BBANK
XCH DELAYLOC # MAKE DELAYLOC AVAILABLE
## Page 1457
TC JOBWAKE
TC TASKOVER
TCSLEEP GENADR TCGETCAD -2
WAKECAD GENADR WAKER
## Page 1458
# GENTRAN, A BLOCK TRANSFER ROUTINE.
# WRITTEN BY D. EYLES
# MOD 1 BY KERNAN UTILITYM REV 17 11/18/67
# MOD 2 BY SCHULENBERG (REMOVE RELINT) SKIPPER REV 4 2/28/68
#
# THIS ROUTINE IS USEFULL FOR TRANSFERING N CONSECUTIVE ERASABLE OR FIXED QUANTITIES TO SOME OTHER N
# CONSECUTIVE ERASABLE LOCATIONS. IF BOTH BLOCKS OF DATA ARE IN SWITCHABLE EBANKS, THEY MUST BE IN THE SAME ONE.
#
# GENTRAN IS CALLABLE IN A JOB AS WELL AS A RUPT. THE CALLING SEQUENCE IS:
# I CA N-1 # OF QUANTITIES MINUS ONE.
# I +1 TC GENTRAN IN FIXED-FIXED.
# I +2 ADRES L STARTING ADRES OF DATA TO BE MOVED.
# I +3 ADRES M STARTING ADRES OF DUPLICATION BLOCK.
# I +4 RETURNS HERE.
#
# GENTRAN TAKES 25 MCT'S (300 MICROSECONDS) PER ITEM + 5 MCT'S (60 MICS) FOR ENTERING AND EXITING.
# A, L AND ITEMP1 ARE NOT PRESERVED.
BLOCK 02
SETLOC FFTAG4
BANK
EBANK= ITEMP1
COUNT* $$/TRAN
GENTRAN INHINT
TS ITEMP1 # SAVE N-1.
INDEX Q # C(Q) = ADRES L.
AD 0 # ADRES (L + N - 1).
INDEX A
CA 0 # C(ABOVE).
TS L # SAVE DATA.
CA ITEMP1
INDEX Q
AD 1 # ADRES (M + N - 1).
INDEX A
LXCH 0 # STUFF IT.
CCS ITEMP1 # LOOP UNTIL N-1 = 0.
TCF GENTRAN +1
TCF Q+2 # RETURN TO CALLER.
## Page 1459
# B5OFF ZERO BIT 5 OF EXTVBACT, WHICH IS SET BY TESTXACT.
# MAY BE USED AS NEEDED BY ANY EXTENDED VERB WHICH HAS DONE TESTXACT
COUNT* $$/EXTVB
B5OFF CS BIT5
MASK EXTVBACT
TS EXTVBACT
TC ENDOFJOB
## Page 1460
# SUBROUTINES TO TURNOFF AND TURN ON TRACKER FAIL LIGHT.
TRFAILOF INHINT
CS OCT40200 # TURN OFF TRACKER LIGHT
MASK DSPTAB +11D
AD BIT15
TS DSPTAB +11D
CS OPTMODES # TO INSURE THAT OCDU FAIL WILL GO ON
MASK BIT7 # AGAIN IF IT WAS ON IN ADDITION TO
ADS OPTMODES # TRACKER FAIL.
REQ RELINT
TC Q
TRFAILON INHINT
CS DSPTAB +11D # TURN ON
MASK OCT40200
ADS DSPTAB +11D
TCF REQ