-
Notifications
You must be signed in to change notification settings - Fork 0
/
k11deb.mac
373 lines (311 loc) · 8.17 KB
/
k11deb.mac
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
.title k11deb debugging support for kermit-11
.ident /1.0.01/
.psect
; 21-May-84 22:07:50 Brian Nelson
;
; Copyright (C) 1984 Change Software, Inc.
.if ndf, K11INC
.ift
.include /IN:K11MAC.MAC/
.endc
.psect $code
.enabl gbl
chr = 1
int = 2
.psect $addr ,ro,d,lcl,rel,con
texadr::
.psect $addr1 ,ro,d,lcl,rel,con
virtad:
.psect $type ,ro,d,lcl,rel,con
symtyp:
.psect $size ,ro,d,lcl,rel,con
symsiz:
.psect $code
.macro entry name,type,size
.save
.if b ,name
.ift
.psect $addr ,ro,d,lcl,rel,con
.word 0
.iff
.dsabl lc
.psect $name ,ro,d,lcl,rel,con
$$ = .
.asciz #name#
.psect $addr ,ro,d,lcl,rel,con
.word $$
.psect $addr1 ,ro,d,lcl,rel,con
.word name
.psect $type ,ro,d,lcl,rel,con
.word type
.psect $size ,ro,d,lcl,rel,con
.word size
.enabl lc
.endc
.restore
.endm entry
.sbttl define the symbol names
entry <$image>, int, 1
entry <albuff>, int, 1
entry <altcon>, int, 1
entry <argbuf>, int, 1
entry <argpnt>, int, 1
entry <at$acc>, int, 1
entry <at$are>, int, 1
entry <at$bil>, int, 1
entry <at$bsi>, int, 1
entry <at$cre>, int, 1
entry <at$dis>, int, 1
entry <at$enc>, int, 1
entry <at$fab>, int, 15
entry <at$for>, int, 1
entry <at$id>, int, 1
entry <at$len>, int, 1
entry <at$xle>, int, 1
entry <at$pas>, int, 1
entry <at$pr0>, int, 1
entry <at$pr1>, int, 1
entry <at$sys>, int, 2
entry <at$typ>, int, 1
entry <at$val>, int, 1
entry <atrctx>, int, 1
entry <binmod>, int, 1
entry <bintyp>, chr, 4*40
entry <cccnt>, int, 1
entry <chario>, int, 1
entry <chksiz>, int, 1
entry <chktyp>, int, 1
entry <cmdadr>, int, 1
entry <cmdbuf>, int, 1
entry <cmdlun>, int, 1
entry <cmdnum>, int, 1
entry <conesc>, int, 1
entry <conpar>, chr, 20
entry <consts>, int, 2
entry <do8bit>, int, 1
entry <dolong>, int, 1
entry <doattr>, int, 1
entry <debug>, int, 1
entry <defdir>, chr, filsiz+2
entry <doauto>, int, 1
entry <do8bit>, int, 1
entry <dorpt> , int, 1
entry <duplex>, int, 1
entry <en$siz>, int, 1
entry <errtxt>, chr, 102
entry <filnam>, chr, filsiz+2
entry <handch>, int, 1
entry <image>, int, 1
entry <index>, int, 1
entry <inopn>, int, 1
entry <inserv>, int, 1
entry <jobtyp>, int, 1
entry <kbiost>, int, 2
entry <linkst>, int, 1
entry <logfil>, chr, 40
entry <logstr>, chr, 40
entry <maxtry>, int, 1
entry <mcrcmd>, int, 1
entry <modem> , chr, 40
entry <numtry>, int, 1
entry <oldtry>, int, 1
entry <outlun>, int, 1
entry <outopn>, int, 1
entry <paknum>, int, 1
entry <parity>, int, 1
entry <pauset>, int, 1
entry <pcnt.r>, int, 34
entry <pcnt.s>, int, 34
entry <pnhead>, int, 1
entry <procty>, int, 1
entry <procom>, int, 1
entry <proflg>, int, 1
entry <prompt>, chr, 40
entry <ranerr>, int, 1
entry <rawfil>, int, 1
entry <reccnt>, int, 1
entry <recpar>, chr, 20
entry <reclng>, int, 1
entry <recwin>, int, 1
entry <remote>, int, 1
entry <rptquo>, int, 1
entry <rsx32> , int, 1
entry <rtwork>, int, 10
entry <rtflow>, int, 1
entry <rtvol> , int, 1
entry <sencnt>, int, 1
entry <sendat>, int, 1
entry <sendly>, int, 1
entry <senlng>, int, 1
entry <senwin>, int, 1
entry <senpar>, chr, 20
entry <sermod>, int, 1
entry <sertim>, int, 1
entry <serwai>, int, 1
entry <setrec>, chr, 20
entry <setsen>, chr, 20
entry <size>, int, 1
entry <skipfl>, int, 1
entry <recsop>, int, 1
entry <sensop>, int, 1
entry <sparsz>, int, 1
entry <srcnam>, chr, filsiz+2
entry <state>, int, 1
entry <sy.ini>, int, 1
entry <tcdlu>, int, 1
entry <testc>, int, 1
entry <times>, int, 4
entry <tists>, int, 2
entry <tmperr>, int, 1
entry <totp.r>, int, 34
entry <totp.s>, int, 34
entry <tsxflg>, int, 1
entry <trace>, int, 1
entry <ttcons>, chr, 20
entry <ttdial>, chr, 20
entry <ttname>, chr, 20
entry <umddef>, int, 1
entry <vttype>, int, 1
entry <xgottn>, int, 1
entry <xmode>, int, 1
entry
.sbttl the real work comes next
.enabl lsb
.psect $code
c$disp::mov argbuf ,r0 ; locate the symbol in directory
cmpb @r0 ,#'0 ; /45/ Numeric ?
blo 5$ ; /45/ no
cmpb @r0 ,#'7 ; /45/ Numeric ?
bhi 5$ ; /45/ No
calls octval ,<r0> ; /45/ Yes, get the address
octout @r1 ; /45/ Dump the data
message ; /45/ crlf
br 100$ ; /45/ Exit
5$: cmpb @r0 ,#'* ; dump everything today ?
bne 20$ ; no
clr r0 ; yes, start with first one
10$: tst texadr(r0) ; keep going until address of zero
beq 100$ ; exit
call prtsym ; print the symbol out
add #2 ,r0 ; next please
message ; a cr/lf
br 10$ ; next please
20$: call findsy ; find the symbol now
tst r0 ; found it ?
bmi 90$ ; no
call prtsym ; dump it please
br 100$ ; bye
90$: message <Can't find symbol in internal STB>,cr
100$: message
return
.dsabl lsb
.sbttl print the contents out
.enabl lsb
; input: r0 offset
prtsym: save <r0,r1,r2,r3,r4,r5> ; save this
sub #20 ,sp ; allocate a small text buffer
mov sp ,r3 ; and a pointer
mov r0 ,r5 ; insure we don't zap offset
print texadr(r5) ; print the symbol name
mov symtyp(r5),r4 ; get the class of symbol
asl r4 ; times 2 for word indexing
print 200$-2(r4) ; format it a bit
deccvt symsiz(r5),r3,#4 ; print the data item size
print r3 ,#4 ; print that out
message ; crlf
message ; crlf
jsr pc ,@190$-2(r4) ; call correct formatter routine
message ; extra crlf
add #20 ,sp
unsave <r5,r4,r3,r2,r1,r0>
return
.save
.psect $PDATA ,D
190$: .word pbyte,pint
200$: .word 210$,220$
210$: .asciz / Byte data, size /
220$: .asciz / Word data, size /
.even
.restore
.dsabl lsb
.sbttl format for byte and integer data
.enabl lsb
pbyte: sub #20 ,sp ; a buffer to use today
mov symsiz(r5),r1 ; format byte data please
beq 390$ ; exit
mov virtad(r5),r5 ; get the base address
310$: mov #20 ,r3 ; maximum of 16 items per line
320$: mov sp ,r2 ; pointer to local buffer
movb #40 ,(r2)+ ; a leading space
clr r4 ; get the next byte please
bisb (r5)+ ,r4 ; without sign extension
mov r4 ,r0 ; copy it
ash #-6 ,r0 ; get the high two bits now
bic #^C3 ,r0 ; mask the lower bits please
add #'0 ,r0 ; convert
movb r0 ,(r2)+ ; and copy
mov r4 ,r0 ; copy it
ash #-3 ,r0 ; get the high two bits now
bic #^C7 ,r0 ; mask the lower bits please
add #'0 ,r0 ; convert
movb r0 ,(r2)+ ; and copy
mov r4 ,r0 ; copy it
bic #^C7 ,r0 ; mask the lower bits please
add #'0 ,r0 ; convert
movb r0 ,(r2)+ ; and copy
clrb @r2 ; at last, .asciz
mov sp ,r2 ; restore buffer pointer and print
print r2 ; simple
dec r1 ; anything else to print
beq 330$ ; no
sob r3 ,320$ ; yes, next on the line please
message ; filled the line
br 310$ ; next line
330$: message ; a final cr/lf
390$: add #20 ,sp ; release the local buffer
return ; and exit
pint: mov symsiz(r5),r1 ; get the number of data elements
beq 490$ ; nothing to do at all
mov virtad(r5),r2 ; get the address of what to print
410$: mov #5 ,r3 ; number of items per line
420$: decout (r2) ; dump it
message <(>
octout (r2)+
message <)>
dec r1 ; all done yet ?
beq 430$ ; yes, exit
sob r3 ,420$ ; not done, print next item
message ; a cr/lf
br 410$ ; next line of printinh
430$: message ; last cr/lf
490$: return ; all done, exit
.dsabl lsb
.sbttl locate symbol offset in index
findsy: save <r1,r2,r3,r4,r5> ; save all the registers
sub #20 ,sp ; allocate a buffer for upcase cvt
mov sp ,r2 ; and allocate a pointer
copyz r0,r2,#10 ; and copy the data over
strlen r2 ; get the string length now
calls cvt$$ ,<r2,r0,#40> ; convert lower to upper case now
mov r0 ,r4 ; anything there ?
beq 90$ ; no
clr r5 ; initial index here
10$: mov texadr(r5),r1 ; point to the text now
beq 90$ ; if eq, we hit the end of it all
strlen r1 ; get the length of that text
cmp r0 ,r4 ; exact match on the length ?
bne 30$ ; no, try again please
mov r2 ,r3 ; saved pointer to text
20$: cmpb (r3)+ ,(r1)+ ; check for exact match on characters
bne 30$ ; no
sob r0 ,20$ ; yes, next please
br 40$ ; a match
30$: add #2 ,r5 ; no match, advance to the next address
br 10$ ; next please
40$: mov r5 ,r0 ; return index in r0
br 100$ ; bye
90$: mov #-1 ,r0 ; no match, return index of -1
100$: add #20 ,sp ; pop local buffer and exit
unsave <r5,r4,r3,r2,r1> ; pop all registers we used
return
.end