-
Notifications
You must be signed in to change notification settings - Fork 0
/
decdmp.orig
277 lines (240 loc) · 7.54 KB
/
decdmp.orig
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
COMMENT ⊗ VALID 00004 PAGES
C REC PAGE DESCRIPTION
C00001 00001
C00002 00002 TITLE DECDMP
C00005 00003 LOC ABSLOC ABSOLUTE ASSEMBLY
C00007 00004 STRT: MOVEI R1,CGET RESTART ADDRESS.
C00016 ENDMK
C⊗;
TITLE DECDMP
SUBTTL FROM THE ANCIENT DECUSAUR
KL10==0
NORIM==1
KASIM==1
IFNDEF KL10,<KL10==1> ;KL10 VERSION BY DEFAULT
APR==0
PI==4
CTY==120
DTC==210 ;MICRO TAPE CONTROL REGISTER
DTS==214 ;MICRO TAPE STATUS REGISTER
IFE KL10,<DC==200>
IFN KASIM,<DC==204>
IFN KL10,< DC==204
DTE==200
CCA==14
KLPAG==10
SWEEPB==200000 ;SWEEP BUSY IN KL10 APR CONI.
DONG11==20000 ;RING 11'S DOORBELL
DTFLG==444 ;DTE20 OPERATION COMPLETE FLAG IN EPT
DTF11==450 ; 10 FROM 11 ARGUMENT
DTCMD==451 ; TO 11 COMMAND WORD
>;IFN KL10
R0=0
R1=1
R2=2
R3=3
R4=4
R5=5
R6=6
R7=7
R10=10
R11=11
ABSLOC==77600 ;32K DECDMP
LBLOCK==340
;ABSLOC==177600 ;64K DECDMP
;LBLOCK==700
;LBLOCK==1002 ;TRADITIONAL 63 7/8 K DECDMP
;ABSLOC==377600 ;128K DECDUMP
;IFN KL10,<ABSLOC==377000> ;KL10 NEEDS A PAGE FOR THE EPT
IFN KL10,<ABSLOC==177000> ;KL10 NEEDS A PAGE FOR THE EPT
;LBLOCK==1077 ;MAXIMUM LAST BLOCK TO WRITE 71.5K
FIRST==10 ;FIRST LOCATION TO DUMP-1
FBLOCK==4 ;FIRST BLOCK TO WRITE ON TAPE.
LDISPL==LBLOCK-FBLOCK
;MAXIMUM IS BLOCKS 4-1077 FOR USE = 1074 BLOCKS = 71.5K OF DATA
LAST=<<LDISPL+1>*200> ;LAST ADDRESS TO DUMP+1
IFG LAST-ABSLOC<
PRINTX "LOSER, YOU ARE GOING TO CLOBBER DECDUMP WITH DATA"
>
LOC ABSLOC ;ABSOLUTE ASSEMBLY
IFE KL10,<
IFE NORIM,<
RIM10B ;MAKE BINARY TAPE IN READIN MODE
>;IFE NORIM
>;IFE KL10
IFN KL10,<
BLOCK 500 ;ROOM FOR DTE COMM. AREA, ETC.
DTEXX: 0 ;JSR HERE
MOVEM R3,DTCMD+ABSLOC
SETZM DTFLG+ABSLOC ;CLEAR 11'S RESPONSE FLAG
CONO DTE,DONG11 ;RING FOR 11
SKIPN DTFLG+ABSLOC ;WAIT FOR RESPONSE
JRST .-1
MOVE R3,DTF11+ABSLOC ;GET 11'S RESPONSE WORD
JRST @DTEXX
SAVT: 0
KLTYI: MOVEI R3,3400
JSR DTEXX
JUMPE R3,KLTYI
CAIL R3,"A"+40
CAILE R3,"Z"+40
CAIA
SUBI R3,40
KLTYO: MOVEM R3,SAVT
ANDI R3,177
JSR DTEXX
MOVE R3,SAVT
JRST (R6)
IFG .-ABSLOC-600,<PRINTX LOSER. TOO MUCH KL10 CRUD.>
LOC ABSLOC+600
>;KL10. SAME OLD STARTING ADDRESS
STRT: MOVEI R1,CGET ;RESTART ADDRESS.
STRT1: CONO APR,200000 ;APR IO RESET
CONO PI,10400 ;CLEAR&DEACTIVATE PI
IFN KL10,<
CONO KLPAG,ABSLOC/1000
>;IFN KL10
IFE KL10,< CONO CTY,3600 ;CLEAR I/O BUSY&DONE >;IFE KL10
;HERE TO SCAN A FRESH COMMAND
CGET: CONO DTC,0 ;CLEAR DECTAPE CONTROL
MOVEI R3,15 ;PICKUP CR
JSP R6,TYO ;TYPE IT
MOVEI R3,12 ;PICKUP LF
JSP R6,TYO ;TYPE IT.
MOVEI R4,CDISP ;@ADDRESS OF COMMAND SCANNER
MOVEI R10,FBLOCK ;LOAD 10 NUMBER OF FIRST BLOCK TO WRITE
JSP R0,@(R4) ;READ COMMAND
ANDI R2,7 ;OCTAL NUMBER IN 2
LSH R2,3 ;SHIFT IT TO MAKE UNIT NUMBER FIELD
MOVE R7,R2 ;LOAD UNIT NUMBER FIELD
JSP R0,@(R4) ;PROCESS nD or nL COMMAND,
;CONTINUE CTY SCAN IF "," SEEN
JSP R0,@(R4) ;DISPATCH FOR n,D or n,L
;CONTINUE SCAN IF COMMA COMMA
;IF ,,nG THEN n WILL BE IN R2
;AND R4 WILL HAVE -1,,R11
HRRZM R2,R11 ;SAVE CONTENTS OF R2 IN R11
CGETX: JSP R0,@(4) ;DISPATCH @11 FOR G, OR HANG FIRE.
JRST CGETX ;HANG UNTIL D,L,G TYPED.
CMND: SETZI R2,0 ;CLEAR R2
CMND1:
IFE KL10,<
CONSO CTY,40 ;SKIP IF INPUT DONE
JRST .-1 ;NO INPUT. WAIT.
DATAI CTY,R3 ;READ CTY
JSP R6,TYO ;ECHO IT
>;IFE KL10
IFN KL10,< JSP R6,KLTYI >;IFN KL10 READ AND ECHO
ANDI R3,177 ;AND OUT ANY EXTRA BITS
CAIN R3,"L" ;LOAD FROM TAPE COMMAND?
HRROI R4,LOADGO ;SET UP DISPATCH ADDRESS
CAIN R3,"D" ;DUMP ON TAPE?
HRROI R4,DUMPGO ;SET DISPATCH
CAIN R3,"G" ;START COMMAND?
HRROI R4,R11 ;SET DISPATCH
JUMPL R4,@R0 ;IF DISPATCH SET, RETURN.
CAIN R3,"," ;COMMA?
JRST @R0 ;YES. RETURN
ROT R3,-3 ;SHIFT CHARACTER RIGHT 3
LSHC R2,3 ;DIGIT SHIFTS INTO 2.
CAIE R3,"0" ;IS THE DATA A NUMBER?
JRST CGET ;NO. FLUSH THIS COMMAND
JRST CMND1 ;YES. ACCUMULATE (OCTAL)
XX650: DATAI DC,R2 ;READ BLOCK NUMBER INTO 2
CAMN R2,R3 ;ARE WE AT THE RIGHT PLACE?
JRST @R0 ;YES. RETURN. WE ARE BLOCK 4 OR 1002
CAML R2,R10 ;ARE WE IN FRONT OF FIRST BLOCK?
CAIL R2,LDISPL(R10) ;NO. BEHIND LAST BLOCK?
JRST XX703 ;WE ARE GOING IN THE RIGHT DIRECTION.
;FALL THRU IF WE ARE IN THE MIDDLE OF TAPE.
;HERE TO LOCATE EITHER END OF THE TAPE.
;R7 IS SET UP WITH UNIT NUMBER AND POSSIBLY DIRECTION.
ENDGET: CONO DTC,223200(R7) ;SELECT, TURN ON UNIT. DELAY, READ BLOCK NUMS
CONO DC,4010 ;SET UP DC FOR READING
XX660: CONSZ DTS,6 ;ERROR BITS?
JRST XX672 ;YES. END OF TAPE OR ILL OP
CONSO DC,1000 ;DATA READY?
JRST XX660 ;NO DATA YET. WAIT FOR IT.
DATAI DC,R2 ;READ A BLOCK NUMBER
TRZ R7,10000 ;ASSUME WE WILL GO FORWARD TO END
CAIGE R2,<LDISPL/2>(R10) ;ARE WE CLOSE TO REAR END?
TRO R7,10000 ;NO. WELL GO REVERSE TO FRONT OF TAPE
CAIG R2,LDISPL(R10) ;ARE WE PAST REAR END OF TAPE?
CAMGE R2,R10 ;OR IN FRONT OF BEGINNING?
XX672: SKIPA R3,R10 ;YES. WE ARE IN SOME "END ZONE"
JRST ENDGET ;NOT AT EITHER END YET.
TRCN R7,10000 ;HERE WE ARE AT THE END. CHANGE DIRECTION
MOVEI R3,LDISPL(R10) ;IF WE WERE IN REVERSE, WE READ 1002
;OTHERWISE READ BLOCK 4. R3 SET WITH BLOCK
CONI DTC,R2 ;READ DTC CONDITIONS
XOR R2,R7 ;XOR WITH OUR DIRECTION
TRNE R2,10000 ;ARE WE GOING TO SWITCH DIRECTIONS?
CONO DTC,222200(R7) ;YES. SET FOR CHANGE AND DELAY.
TRNN R2,10000 ;ARE WE GOING IN SAME DIRECTION?
XX703: CONO DTC,220200(R7) ;SET CONDITIONS, NO DELAY NEEDED
MOVEI R6,XX650 ;SET RETURN ADDRESS
;FALL INTO ROUTINE TO WAIT FOR EVERYTHING
WAIT: CONSZ DC,1000 ;DATA READY YET?
JRST @R6 ;YES. RETURN
CONSO DTS,2000 ;SKIP IF DELAY IN PROGRESS
CONSO DTS,207 ;SKIP IF ERROR, DONE OR NULL
JRST WAIT ;NONE OF THESE. KEEP WAITING
CONSZ DC,1000 ;WE BETTER HAVE DATA NOW.
JRST @R6 ;OK. RETURN
MOVEI R3,7 ;OOPS. LOAD A BELL
MOVEI R6,STRT1 ;LOAD RESTART ADDRESS AND DO TYO
IFE KL10,<
TYO: DATAO CTY,R3 ;WRITE ON CTY
TYO1: CONSZ CTY,20 ;WAIT FOR CTY TO BE FREE
JRST TYO1 ;LOOP WAITING
JRST 0(R6) ;RETURN. CALLED BY JSP 6,
>;IFE KL10
IFN KL10,<
TYO: JRST KLTYO
>;IFN KL10
;HERE WITH JSP 5,
XFREAD: JSP R0,ENDGET ;LOCATE THE END OF THE TAPE.
CONO DTC,220300(R7) ;SET TAPE TO READ DATA
XFGO: TRNE R7,10000 ;SKIP IF WE ARE GOING FORWARD
JRST BAKSET ;GOING BACKWARDS
MOVEI R2,FIRST ;FIRST DATA ADDRESS-1
MOVEI R3,1 ;DATA ADDRESS INCREMENT
MOVEI R4,LAST ;LAST DATA ADDRESS+1
XX731: ADDM R3,R2 ;INCREMENT DATA ADDRESS
CAME R2,R4 ;DONE YET?
JRST XX743 ;NOT DONE YET
CONSO DC,400 ;SKIP IF OUTPUT
CONO DC,0 ;INPUT IS DONE. STOP DC.
CONSO DTS,1 ;TAPE JOB DONE YET?
JRST .-1 ;NO. WAIT.
JRST 2(R5) ;DOUBLE SKIP RETURN
XX741: MOVEI R2,LAST-1 ;IN REVERSE. FIRST WORD'S ADDRESS
MOVNI R3,1 ;ADDRESS INCREMENT IS -1
XX743: JSP R6,WAIT ;WAIT FOR DATA TO BE AVAILABLE
XCT 0(R5) ;XCT A DATA MOVING INSTRUCTION
XCT 1(R5) ;XCT NEXT INSTRU AFTER CALL
JUMPG R2,XX731 ;IF ADDRESS>0 LOOP
JUMPL R2,XX741 ;GO SET UP FOR TRANSFER IN REVERSE
DUMP: JSP R0,ENDGET ;LOOK FOR END OF TAPE
CONO DTC,220700(R7) ;SET UP TO WRITE DATA
CONO DC,3410 ;SET UP DC FOR WRITING DATA
JSP R5,XFGO ;ENTER TRANSFER ROUTINE
DATAO DC,0(R2)
CDISP: JFCL CMND ;JSP @ HERE.
JSP R5,XFREAD ;CALL TRANSFER ROUTINE TO READ AND CHECK
DATAI DC,R0
CAMN R0,(R2)
JSP R0,XX772
DUMPGO: JRST DUMP
BAKSET: MOVSI R2,377770 ;SET R2 TO IGNORE 10 WORDS!
MOVSI R3,1 ;SET INCREMENT
MOVEI R4,FIRST ;SET REAL STOPPING ADDRESS
JRST XX743 ;GO OFF AND WAIT FOR TRANSFERS
LOAD: JSP R5,XFREAD ;CALL TRANSFER-READ ROUTINE
DATAI DC,(R2) ;INSTRUCTION XCTED TO STORE DATA
LOADGO: MOVEI R0,LOAD ;MAKE SURE R0 GET ADDRESS IN CASE OF ERROR
XX772: CONSZ DTS,10 ;HERE WHEN LOAD IS FINISHED.
JRST @R0 ;HERE IF THERE'S A PARITY ERROR. DO IT AGAIN
CONO DTC,0 ;SHUT OFF THE DECTAPE
JRST 2,@R1 ;ZERO FLAGS. JUMP TO CGET
END STRT