mirror of
https://github.com/open-simh/simtools.git
synced 2026-02-17 21:26:53 +00:00
Add 2.11BSD's m11 sources as regression tests.
This commit is contained in:
1294
tests/2.11BSD-m11-code.lst.ok
Normal file
1294
tests/2.11BSD-m11-code.lst.ok
Normal file
File diff suppressed because it is too large
Load Diff
659
tests/2.11BSD-m11-debug.lst.ok
Normal file
659
tests/2.11BSD-m11-debug.lst.ok
Normal file
@@ -0,0 +1,659 @@
|
||||
1 ;;;; Wrapper for 2.11BSD/m11/debug.m11
|
||||
2 .list
|
||||
3 .list
|
||||
4 .list
|
||||
5 .enabl lc
|
||||
6 000001 debug = 1
|
||||
7 .include "2.11BSD/m11/at.sml"
|
||||
1 .title at.sml - assembler/translator system macros
|
||||
2 ; @(#)at.sml 1.3 11/3/82
|
||||
3
|
||||
4 .ident /10may4/
|
||||
5
|
||||
6 .macro always ;all files of macro
|
||||
7
|
||||
8 .macro .data
|
||||
9 entsec .data
|
||||
10 .endm .data
|
||||
11
|
||||
12 .macro .text
|
||||
13 entsec .text
|
||||
14 .endm
|
||||
15
|
||||
16 .macro .bss
|
||||
17 entsec .bss
|
||||
18 .endm
|
||||
19
|
||||
20 mk.symbol=1 ;one to make symbols, 0 otherwise
|
||||
21 x40= 0
|
||||
22 pdpv45= 0 ; host machine has 'mul', 'div', sob' instrucs.
|
||||
23 ; if not you will have to write macros for them
|
||||
24 $timdf= 7 ; California Time Zone
|
||||
25 ; should really use ftime(2) for this and for
|
||||
26 ; DST.
|
||||
27 ;xfltg= 0 ;define to assmbl out floating hardware
|
||||
28 rsx11d = 0 ; rsx11d features
|
||||
29 debug = 0 ; <<< REEDS if non zero includes debug junk
|
||||
30
|
||||
31 ft.id= 1 ;have set i & d. set =0 if not
|
||||
32
|
||||
33 ft.unx = 1 ; this macro-11 is for UNIX. =0 if not.
|
||||
34
|
||||
35 .nlist bex
|
||||
36
|
||||
37 tab= 11
|
||||
38 lf= 12
|
||||
39 vt= 13
|
||||
40 ff= 14
|
||||
41 cr= 15
|
||||
42 space= 40
|
||||
43
|
||||
44 bpmb = 20 ;bytes per macro block
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50 .psect .text con, shr, gbl,ins
|
||||
51 .psect .data con, dat, prv, gbl
|
||||
52 .psect .bss con, bss, gbl
|
||||
53
|
||||
54 .psect dpure con, dat, prv, gbl
|
||||
55 .psect mixed con, prv, gbl
|
||||
56 .psect errmes con, dat, prv, gbl
|
||||
57 .psect impure con, bss, gbl
|
||||
58 .psect imppas con, bss, gbl
|
||||
59 .psect implin con, bss, gbl
|
||||
60 .psect swtsec con, dat, prv, gbl ; unix command line flags
|
||||
61 .psect cndsec con, dat, prv, gbl ; gt, le, equ, etc. for '.if'
|
||||
62 .psect crfsec con, dat, prv, gbl ; args for -cr flag
|
||||
63 .psect edtsec con, dat, prv, gbl ; args for .enabl
|
||||
64 .psect lctsec con, dat, prv, gbl ; args for .list
|
||||
65 .psect psasec con, dat, prv, gbl
|
||||
66 .psect pstsec con, dat, prv, gbl
|
||||
67 .psect rolbas con, dat, prv, gbl ; core allocation: starts of tables
|
||||
68 .psect rolsiz con, dat, prv, gbl ; sizes of table entries
|
||||
69 .psect roltop con, dat, prv, gbl ; tops of tables
|
||||
70 .psect xpcor con,bss , gbl ; this one MUST come last in core
|
||||
71
|
||||
72
|
||||
72
|
||||
73 .macro entsec name ;init a section
|
||||
74 .psect name con
|
||||
75 .endm entsec
|
||||
76
|
||||
77
|
||||
78
|
||||
79 .macro jeq x,?fred
|
||||
80 bne fred
|
||||
81 jmp x
|
||||
82 fred:
|
||||
83 .endm
|
||||
84 .macro jne x,?fred
|
||||
85 beq fred
|
||||
86 jmp x
|
||||
87 fred:
|
||||
88 .endm
|
||||
89 .macro xitsec
|
||||
90 entsec .text
|
||||
91 .endm xitsec
|
||||
92
|
||||
93
|
||||
94 .macro call address
|
||||
95 jsr pc,address
|
||||
96 .endm
|
||||
97
|
||||
98 .macro return
|
||||
99 rts pc
|
||||
100 .endm
|
||||
101
|
||||
102
|
||||
103 .macro always
|
||||
104 .nlist bex
|
||||
105 .endm always
|
||||
106 .endm always
|
||||
107
|
||||
108
|
||||
109 000001 .if ne debug
|
||||
110
|
||||
111 .macro ndebug n
|
||||
112 .globl ndebug,..z
|
||||
113 mov n,..z
|
||||
114 call ndebug
|
||||
115 .endm
|
||||
116
|
||||
117 .macro sdebug string
|
||||
118 .globl sdebug,..z,..zbuf
|
||||
119 x = 0
|
||||
120 .irpc t,<string>
|
||||
121 movb #''t,..zbuf+x
|
||||
122 x = x+1
|
||||
123 .endm
|
||||
124 movb #0,..zbuf+x
|
||||
125 mov #..zbuf,..z
|
||||
126 call sdebug
|
||||
127 .endm
|
||||
128
|
||||
129 .iff
|
||||
130
|
||||
131 .macro ndebug n
|
||||
132 .endm
|
||||
133
|
||||
134 .macro sdebug string
|
||||
135 .endm
|
||||
136
|
||||
137 .endc
|
||||
138
|
||||
139
|
||||
140 .macro param mne, value ;define default parameters
|
||||
141 .iif ndf mne, mne= value
|
||||
142 .list
|
||||
143 mne= mne
|
||||
144 .nlist
|
||||
145 .endm
|
||||
145
|
||||
146 .macro putkb addr ;list to kb
|
||||
147 .globl putkb
|
||||
148 mov addr,r0
|
||||
149 call putkb
|
||||
150 .endm
|
||||
151
|
||||
152 .macro putlp addr ;list to lp
|
||||
153 .globl putlp
|
||||
154 mov addr,r0
|
||||
155 call putlp
|
||||
156 .endm
|
||||
157
|
||||
158 .macro putkbl addr ;list to kb and lp
|
||||
159 .globl putkbl
|
||||
160 mov addr,r0
|
||||
161 call putkbl
|
||||
162 .endm
|
||||
163
|
||||
164
|
||||
165 .macro xmit wrdcnt ;move small # of words
|
||||
166 .globl xmit0
|
||||
167 call xmit0-<wrdcnt*2>
|
||||
168 .endm xmit
|
||||
169
|
||||
170
|
||||
171 ;the macro "genswt" is used to specify a command
|
||||
172 ;string switch (1st argument) and the address of
|
||||
173 ;the routine to be called when encountered (2nd arg).
|
||||
174 ; the switch is made upper-case.
|
||||
175
|
||||
176 .macro genswt mne,addr,?label
|
||||
177 entsec swtsec
|
||||
178 label: .irpc x,mne
|
||||
179 .if ge ''x-141
|
||||
180 .if le ''x-172
|
||||
181 .byte ''x-40
|
||||
182 .iff
|
||||
183 .byte ''x
|
||||
184 .endc
|
||||
185 .iff
|
||||
186 .byte ''x
|
||||
187 .endc
|
||||
188 .endm
|
||||
189 .iif ne <.-label&1>, .byte 0
|
||||
190 .word addr
|
||||
191 xitsec
|
||||
192 .endm
|
||||
192
|
||||
193 .macro zread chan
|
||||
194 .globl zread
|
||||
195 mov #chan'chn,r0
|
||||
196 call zread
|
||||
197 .endm zread
|
||||
198
|
||||
199 .macro zwrite chan
|
||||
200 .globl zwrite
|
||||
201 mov #chan'chn,r0
|
||||
202 call zwrite
|
||||
203 .endm zwrite
|
||||
203
|
||||
204 .macro genedt mne,subr ;gen enable/disable table
|
||||
205 entsec edtsec
|
||||
206 .rad50 /mne/
|
||||
207 .if nb subr
|
||||
208 .word subr
|
||||
209 .iff
|
||||
210 .word cpopj
|
||||
211 .endc
|
||||
212 .word ed.'mne
|
||||
213 xitsec
|
||||
214 .endm genedt
|
||||
215
|
||||
216
|
||||
217 ;the macro "gencnd" is used to specify conditional
|
||||
218 ;arguments. it takes two or three arguments:
|
||||
219
|
||||
220 ; 1- mnemonic
|
||||
221 ; 2- subroutine to be called
|
||||
222 ; 3- if non-blank, complement condition
|
||||
223
|
||||
224 .macro gencnd mne,subr,toggle ;generate conditional
|
||||
225 entsec cndsec
|
||||
226 .rad50 /mne/
|
||||
227 .if b <toggle>
|
||||
228 .word subr
|
||||
229 .iff
|
||||
230 .word subr+1
|
||||
231 .endc
|
||||
232 xitsec
|
||||
233 .endm
|
||||
233
|
||||
234 .macro ch.mne
|
||||
235
|
||||
236 ch.ior= '!
|
||||
237 ch.qtm= '"
|
||||
238 ch.hsh= '#
|
||||
239 ch.dol= '$
|
||||
240 ch.pct= '%
|
||||
241 ch.and= '&
|
||||
242 ch.xcl= ''
|
||||
243
|
||||
244 ch.lp= '(
|
||||
245 ch.rp= ')
|
||||
246 ch.mul= '*
|
||||
247 ch.add= '+
|
||||
248 ch.com= ',
|
||||
249 ch.sub= '-
|
||||
250 ch.dot= '.
|
||||
251 ch.div= '/
|
||||
252
|
||||
253 ch.col= ':
|
||||
254 ch.smc= ';
|
||||
255 ch.lab= '<
|
||||
256 ch.equ= '=
|
||||
257 ch.rab= '>
|
||||
258 ch.qm= '?
|
||||
259
|
||||
260 ch.ind= '@
|
||||
261 ch.bsl= '\
|
||||
262 ch.uar= '^
|
||||
263
|
||||
264 let.a= 'a&^c40
|
||||
265 let.b= 'b&^c40
|
||||
266 let.c= 'c&^c40
|
||||
267 let.d= 'd&^c40
|
||||
268 let.e= 'e&^c40
|
||||
269 let.f= 'f&^c40
|
||||
270 let.g= 'g&^c40
|
||||
271 let.o= 'o&^c40
|
||||
272 let.p= 'p&^c40
|
||||
273 let.r= 'r&^c40
|
||||
274 let.z= 'z&^c40
|
||||
275
|
||||
276 dig.0= '0
|
||||
277 dig.9= '9
|
||||
278 .macro ch.mne
|
||||
279 .endm ch.mne
|
||||
280 .endm ch.mne
|
||||
281
|
||||
282 .macro error num,arg, mess ,?x
|
||||
283 sdebug <num>
|
||||
284 .globl err.'arg,ern'num, errbts,errref
|
||||
285 .if b <mess>
|
||||
286 deliberate error mistake
|
||||
287 .endc
|
||||
288 .if dif 0,num
|
||||
289 .globl err.xx
|
||||
290 tst err.xx
|
||||
291 bne x
|
||||
292 mov #ern'num,err.xx
|
||||
293 x:
|
||||
294 .endc
|
||||
295 bis #err.'arg,errbts
|
||||
296 .endm
|
||||
297
|
||||
298
|
||||
299
|
||||
300 .macro setnz addr ;set addr to non-zero for t/f flags
|
||||
301 mov sp,addr
|
||||
302 .endm
|
||||
303
|
||||
304
|
||||
305 .macro bisbic arg ; used by .list/.nlist, .enabl/.dsabl
|
||||
306 .globl bisbic
|
||||
307 mov #arg,-(sp)
|
||||
308 call bisbic
|
||||
309 tst (sp)+
|
||||
310 .endm
|
||||
310
|
||||
311 ;roll handler calls
|
||||
312
|
||||
313 .macro search rolnum ;binary search
|
||||
314 mov #rolnum,r0
|
||||
315 .globl search
|
||||
316 call search
|
||||
317 .endm
|
||||
318
|
||||
319 .macro scan rolnum ;linear scan
|
||||
320 mov #rolnum,r0
|
||||
321 .globl scan
|
||||
322 call scan
|
||||
323 .endm
|
||||
324
|
||||
325 .macro scanw rolnum ;linear scan, one word
|
||||
326 mov #rolnum,r0
|
||||
327 .globl scanw
|
||||
328 call scanw
|
||||
329 .endm
|
||||
330
|
||||
331 .macro next rolnum ;fetch next entry
|
||||
332 mov #rolnum,r0
|
||||
333 .globl next
|
||||
334 call next
|
||||
335 .endm
|
||||
336
|
||||
337 .macro append rolnum ;append to end of roll
|
||||
338 mov #rolnum,r0
|
||||
339 .globl append
|
||||
340 call append
|
||||
341 .endm
|
||||
342
|
||||
343 .macro zap rolnum ;clear roll
|
||||
344 mov #rolnum,r0
|
||||
345 .globl zap
|
||||
346 call zap
|
||||
347 .endm
|
||||
348
|
||||
349 ; call insert ;insert (must be preceded by one
|
||||
350 ;of the above to set pointers)
|
||||
351 ; call setrol ;save and set regs for above
|
||||
351
|
||||
352 ;flags used in symbol table mode
|
||||
353
|
||||
354 .macro st.flg
|
||||
355
|
||||
356 .if le ft.unx
|
||||
357
|
||||
358 ovrflg= 000004 ;overlay (psect only)
|
||||
359 defflg= 000010 ;defined
|
||||
360 relflg= 000040 ;relocatable
|
||||
361 glbflg= 000100 ;global
|
||||
362 dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
363
|
||||
364
|
||||
365 .endc
|
||||
366
|
||||
367 .if gt ft.unx
|
||||
368
|
||||
369 ; ****** these should not be changed!! ******
|
||||
370 shrflg= 000001 ;shareable (psect only)
|
||||
371 .if gt ft.id
|
||||
372 insflg= shrflg*2 ;instruction space (psect only)
|
||||
373 bssflg= insflg*2 ;blank section (psect only)
|
||||
374 m.idf= shrflg!insflg!bssflg ;mask to turn them off
|
||||
375 .iff
|
||||
376 bssflg= shrflg*2
|
||||
377 m.idf= shrflg!bssflg
|
||||
378 .endc
|
||||
379 b.idf= 1 ;shift count to make above bits word offset
|
||||
380 ; ***********************************
|
||||
381 defflg= 000010 ;defined
|
||||
382 ovrflg= 000020 ;overlay (psect only)
|
||||
383 relflg= 000040 ;relocatable
|
||||
384 glbflg= 000100 ;global
|
||||
385 dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
386
|
||||
387 .endc
|
||||
388
|
||||
389 ;
|
||||
390 ; default psect attribs.
|
||||
391 ; can be changed, but make sure all customers know about
|
||||
392 ; it, including all the linkers.
|
||||
393 ;
|
||||
394 pattrs=relflg!defflg ; For .psects and blank .csects
|
||||
395 aattrs=glbflg!defflg!ovrflg ; For .asect
|
||||
396 cattrs=glbflg!relflg!defflg!ovrflg ; For named .csects
|
||||
397
|
||||
398 regflg= 000001 ;register
|
||||
399 lblflg= 000002 ;label
|
||||
400 mdfflg= 000004 ;multilpy defined
|
||||
401 .macro st.flg
|
||||
402 .endm
|
||||
403 .endm st.flg
|
||||
404
|
||||
405
|
||||
406
|
||||
407 .macro ct.mne
|
||||
408 .globl cttbl
|
||||
409 ct.eol = 000 ; eol
|
||||
410 ct.com = 001 ; comma
|
||||
411 ct.tab = 002 ; tab
|
||||
412 ct.sp = 004 ; space
|
||||
413 ct.pcx = 010 ; printing character
|
||||
414 ct.num = 020 ; numeric
|
||||
415 ct.alp = 040 ; alpha, dot, dollar
|
||||
416 ct.lc = 100 ; lower case alpha
|
||||
417 ct.smc = 200 ; semi-colon (sign bit)
|
||||
418
|
||||
419 ct.pc = ct.com!ct.smc!ct.pcx!ct.num!ct.alp
|
||||
420 .macro ct.mne
|
||||
421 .endm ct.mne
|
||||
422 .endm ct.mne
|
||||
423
|
||||
424
|
||||
425 .end
|
||||
425
|
||||
8 .include "2.11BSD/m11/debug.m11"
|
||||
1 .mcall (at) always
|
||||
2 .globl $write
|
||||
3
|
||||
4 .globl ndebug,sdebug, ..z,..zbuf
|
||||
5 .globl savreg,dnc
|
||||
6 .globl xx.flg
|
||||
7 000000 always
|
||||
1
|
||||
2 .macro .data
|
||||
3 entsec .data
|
||||
4 .endm .data
|
||||
5
|
||||
6 .macro .text
|
||||
7 entsec .text
|
||||
8 .endm
|
||||
9
|
||||
10 .macro .bss
|
||||
11 entsec .bss
|
||||
12 .endm
|
||||
13
|
||||
14 000001 mk.symbol=1 ;one to make symbols, 0 otherwise
|
||||
15 000000 x40= 0
|
||||
16 000000 pdpv45= 0 ; host machine has 'mul', 'div', sob' instrucs.
|
||||
17 ; if not you will have to write macros for them
|
||||
18 000007 $timdf= 7 ; California Time Zone
|
||||
19 ; should really use ftime(2) for this and for
|
||||
20 ; DST.
|
||||
21 ;xfltg= 0 ;define to assmbl out floating hardware
|
||||
22 000000 rsx11d = 0 ; rsx11d features
|
||||
23 000000 debug = 0 ; <<< REEDS if non zero includes debug junk
|
||||
24
|
||||
25 000001 ft.id= 1 ;have set i & d. set =0 if not
|
||||
26
|
||||
27 000001 ft.unx = 1 ; this macro-11 is for UNIX. =0 if not.
|
||||
28
|
||||
29 .nlist bex
|
||||
30
|
||||
31 000011 tab= 11
|
||||
32 000012 lf= 12
|
||||
33 000013 vt= 13
|
||||
34 000014 ff= 14
|
||||
35 000015 cr= 15
|
||||
36 000040 space= 40
|
||||
37
|
||||
38 000020 bpmb = 20 ;bytes per macro block
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:44: ***ERROR Unknown flag SHR given to .PSECT directive
|
||||
44 .psect .text con, shr, gbl,ins
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:45: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
45 .psect .data con, dat, prv, gbl
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:46: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
46 .psect .bss con, bss, gbl
|
||||
47
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:48: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
48 .psect dpure con, dat, prv, gbl
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:49: ***ERROR Unknown flag PRV given to .PSECT directive
|
||||
49 .psect mixed con, prv, gbl
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:50: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
50 .psect errmes con, dat, prv, gbl
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:51: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
51 .psect impure con, bss, gbl
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:52: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
52 .psect imppas con, bss, gbl
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:53: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
53 .psect implin con, bss, gbl
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:54: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
54 .psect swtsec con, dat, prv, gbl ; unix command line flags
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:55: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
55 .psect cndsec con, dat, prv, gbl ; gt, le, equ, etc. for '.if'
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:56: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
56 .psect crfsec con, dat, prv, gbl ; args for -cr flag
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:57: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
57 .psect edtsec con, dat, prv, gbl ; args for .enabl
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:58: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
58 .psect lctsec con, dat, prv, gbl ; args for .list
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:59: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
59 .psect psasec con, dat, prv, gbl
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:60: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
60 .psect pstsec con, dat, prv, gbl
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:61: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
61 .psect rolbas con, dat, prv, gbl ; core allocation: starts of tables
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:62: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
62 .psect rolsiz con, dat, prv, gbl ; sizes of table entries
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:63: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
63 .psect roltop con, dat, prv, gbl ; tops of tables
|
||||
./2.11BSD/m11/debug.m11:7->ALWAYS:64: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
64 .psect xpcor con,bss , gbl ; this one MUST come last in core
|
||||
65
|
||||
66
|
||||
67
|
||||
68 .macro entsec name ;init a section
|
||||
69 .psect name con
|
||||
70 .endm entsec
|
||||
71
|
||||
72
|
||||
73
|
||||
74 .macro jeq x,?fred
|
||||
75 bne fred
|
||||
76 jmp x
|
||||
77 fred:
|
||||
78 .endm
|
||||
79 .macro jne x,?fred
|
||||
80 beq fred
|
||||
81 jmp x
|
||||
82 fred:
|
||||
83 .endm
|
||||
84 .macro xitsec
|
||||
85 entsec .text
|
||||
86 .endm xitsec
|
||||
87
|
||||
88
|
||||
89 .macro call address
|
||||
90 jsr pc,address
|
||||
91 .endm
|
||||
92
|
||||
93 .macro return
|
||||
94 rts pc
|
||||
95 .endm
|
||||
96
|
||||
97
|
||||
98 .macro always
|
||||
99 .nlist bex
|
||||
100 .endm always
|
||||
8
|
||||
9 000000 xitsec
|
||||
1 000000 entsec .text
|
||||
1 000000 .psect .text con
|
||||
10 sdebug:
|
||||
11 000000 call savreg
|
||||
1 000000 004767 000000G jsr pc,savreg
|
||||
12 000004 010046 mov r0,-(sp)
|
||||
13
|
||||
14 000006 012702 000004' mov #..s,r2
|
||||
15 000012 016703 000002' mov ..z,r3
|
||||
16 000016 012700 000002 mov #2,r0
|
||||
17 000022 112322 1$: movb (r3)+,(r2)+
|
||||
18 000024 001402 beq 2$
|
||||
19 000026 005200 inc r0
|
||||
20 000030 000774 br 1$
|
||||
21 2$:
|
||||
22 000032 112712 000012 movb #12,(r2)
|
||||
23 000036 010067 000000' mov r0,..n
|
||||
24 ddd:
|
||||
25 000042 005767 000000G tst xx.flg
|
||||
26 000046 001412 beq 100$
|
||||
27 000050 016746 000000' mov ..n,-(sp) ;write(2, ..s, ..n)
|
||||
28 000054 012746 000004' mov #..s,-(sp)
|
||||
29 000060 012746 000002 mov #2,-(sp)
|
||||
30 000064 005746 tst -(sp) ;simulate return address stack spacing
|
||||
31 000066 000000G $write
|
||||
32 000070 062706 000010 add #8.,sp ;toss syscall cruft
|
||||
33 100$:
|
||||
34 000074 012600 mov (sp)+,r0
|
||||
35 000076 return
|
||||
1 000076 000207 rts pc
|
||||
36 ndebug:
|
||||
37 000100 call savreg
|
||||
1 000100 004767 000000G jsr pc,savreg
|
||||
38 000104 010046 mov r0,-(sp)
|
||||
39 000106 012702 000004' mov #..s,r2
|
||||
40 000112 016701 000002' mov ..z,r1
|
||||
41 000116 call dnc
|
||||
1 000116 004767 000000G jsr pc,dnc
|
||||
42 000122 112722 000012 movb #12,(r2)+
|
||||
43 000126 010267 000000' mov r2,..n
|
||||
44 000132 162767 000004' 000000' sub #..s,..n
|
||||
45 000140 000740 br ddd
|
||||
46
|
||||
47 000142 entsec mixed
|
||||
1 000000 .psect mixed con
|
||||
48 000000 ..n: .blkw
|
||||
49 000002 000000 ..z: .word
|
||||
50 000004 ..s: .blkw 100
|
||||
51 000204 ..zbuf: .blkw 100
|
||||
52
|
||||
53 .end
|
||||
53
|
||||
8
|
||||
|
||||
|
||||
Symbol table
|
||||
|
||||
$TIMDF=000007 ..ZBUF 000204RG 006 DDD 000042R 002 LF =000012 SDEBUG 000000RG 002
|
||||
$WRITE=****** G 1$0 000022R L 002 DEBUG =000000 MK.SYM=000001 SPACE =000040
|
||||
. ******R 006 100$1 000074R L 002 DNC =****** G NDEBUG 000100RG 002 TAB =000011
|
||||
..N 000000R 006 2$0 000032R L 002 FF =000014 PDPV45=000000 VT =000013
|
||||
..S 000004R 006 BPMB =000020 FT.ID =000001 RSX11D=000000 X40 =000000
|
||||
..Z 000002RG 006 CR =000015 FT.UNX=000001 SAVREG=****** G XX.FLG=****** G
|
||||
|
||||
|
||||
Program sections:
|
||||
|
||||
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
|
||||
000000 001 (RW,I,LCL,REL,CON,NOSAV)
|
||||
.TEXT 000142 002 (RW,I,LCL,REL,CON,NOSAV)
|
||||
.DATA 000000 003 (RW,I,LCL,REL,CON,NOSAV)
|
||||
.BSS 000000 004 (RW,I,LCL,REL,CON,NOSAV)
|
||||
DPURE 000000 005 (RW,I,LCL,REL,CON,NOSAV)
|
||||
MIXED 000404 006 (RW,I,LCL,REL,CON,NOSAV)
|
||||
ERRMES 000000 007 (RW,I,LCL,REL,CON,NOSAV)
|
||||
IMPURE 000000 008 (RW,I,LCL,REL,CON,NOSAV)
|
||||
IMPPAS 000000 009 (RW,I,LCL,REL,CON,NOSAV)
|
||||
IMPLIN 000000 010 (RW,I,LCL,REL,CON,NOSAV)
|
||||
SWTSEC 000000 011 (RW,I,LCL,REL,CON,NOSAV)
|
||||
CNDSEC 000000 012 (RW,I,LCL,REL,CON,NOSAV)
|
||||
CRFSEC 000000 013 (RW,I,LCL,REL,CON,NOSAV)
|
||||
EDTSEC 000000 014 (RW,I,LCL,REL,CON,NOSAV)
|
||||
LCTSEC 000000 015 (RW,I,LCL,REL,CON,NOSAV)
|
||||
PSASEC 000000 016 (RW,I,LCL,REL,CON,NOSAV)
|
||||
PSTSEC 000000 017 (RW,I,LCL,REL,CON,NOSAV)
|
||||
ROLBAS 000000 018 (RW,I,LCL,REL,CON,NOSAV)
|
||||
ROLSIZ 000000 019 (RW,I,LCL,REL,CON,NOSAV)
|
||||
ROLTOP 000000 020 (RW,I,LCL,REL,CON,NOSAV)
|
||||
XPCOR 000000 021 (RW,I,LCL,REL,CON,NOSAV)
|
||||
1247
tests/2.11BSD-m11-errs.lst.ok
Normal file
1247
tests/2.11BSD-m11-errs.lst.ok
Normal file
File diff suppressed because it is too large
Load Diff
4694
tests/2.11BSD-m11-exec.lst.ok
Normal file
4694
tests/2.11BSD-m11-exec.lst.ok
Normal file
File diff suppressed because it is too large
Load Diff
1779
tests/2.11BSD-m11-expr.lst.ok
Normal file
1779
tests/2.11BSD-m11-expr.lst.ok
Normal file
File diff suppressed because it is too large
Load Diff
1007
tests/2.11BSD-m11-fltg.lst.ok
Normal file
1007
tests/2.11BSD-m11-fltg.lst.ok
Normal file
File diff suppressed because it is too large
Load Diff
1620
tests/2.11BSD-m11-getl.lst.ok
Normal file
1620
tests/2.11BSD-m11-getl.lst.ok
Normal file
File diff suppressed because it is too large
Load Diff
2656
tests/2.11BSD-m11-lout.lst.ok
Normal file
2656
tests/2.11BSD-m11-lout.lst.ok
Normal file
File diff suppressed because it is too large
Load Diff
2314
tests/2.11BSD-m11-mac.lst.ok
Normal file
2314
tests/2.11BSD-m11-mac.lst.ok
Normal file
File diff suppressed because it is too large
Load Diff
1335
tests/2.11BSD-m11-macro.lst.ok
Normal file
1335
tests/2.11BSD-m11-macro.lst.ok
Normal file
File diff suppressed because it is too large
Load Diff
1244
tests/2.11BSD-m11-misc.lst.ok
Normal file
1244
tests/2.11BSD-m11-misc.lst.ok
Normal file
File diff suppressed because it is too large
Load Diff
737
tests/2.11BSD-m11-often.lst.ok
Normal file
737
tests/2.11BSD-m11-often.lst.ok
Normal file
@@ -0,0 +1,737 @@
|
||||
1 ;;;; Wrapper for 2.11BSD/m11/often.m11
|
||||
2 .list
|
||||
3 .list
|
||||
4 .list
|
||||
5 .enabl lc
|
||||
6 000001 debug = 1
|
||||
7 .include "2.11BSD/m11/at.sml"
|
||||
1 .title at.sml - assembler/translator system macros
|
||||
2 ; @(#)at.sml 1.3 11/3/82
|
||||
3
|
||||
4 .ident /10may4/
|
||||
5
|
||||
6 .macro always ;all files of macro
|
||||
7
|
||||
8 .macro .data
|
||||
9 entsec .data
|
||||
10 .endm .data
|
||||
11
|
||||
12 .macro .text
|
||||
13 entsec .text
|
||||
14 .endm
|
||||
15
|
||||
16 .macro .bss
|
||||
17 entsec .bss
|
||||
18 .endm
|
||||
19
|
||||
20 mk.symbol=1 ;one to make symbols, 0 otherwise
|
||||
21 x40= 0
|
||||
22 pdpv45= 0 ; host machine has 'mul', 'div', sob' instrucs.
|
||||
23 ; if not you will have to write macros for them
|
||||
24 $timdf= 7 ; California Time Zone
|
||||
25 ; should really use ftime(2) for this and for
|
||||
26 ; DST.
|
||||
27 ;xfltg= 0 ;define to assmbl out floating hardware
|
||||
28 rsx11d = 0 ; rsx11d features
|
||||
29 debug = 0 ; <<< REEDS if non zero includes debug junk
|
||||
30
|
||||
31 ft.id= 1 ;have set i & d. set =0 if not
|
||||
32
|
||||
33 ft.unx = 1 ; this macro-11 is for UNIX. =0 if not.
|
||||
34
|
||||
35 .nlist bex
|
||||
36
|
||||
37 tab= 11
|
||||
38 lf= 12
|
||||
39 vt= 13
|
||||
40 ff= 14
|
||||
41 cr= 15
|
||||
42 space= 40
|
||||
43
|
||||
44 bpmb = 20 ;bytes per macro block
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50 .psect .text con, shr, gbl,ins
|
||||
51 .psect .data con, dat, prv, gbl
|
||||
52 .psect .bss con, bss, gbl
|
||||
53
|
||||
54 .psect dpure con, dat, prv, gbl
|
||||
55 .psect mixed con, prv, gbl
|
||||
56 .psect errmes con, dat, prv, gbl
|
||||
57 .psect impure con, bss, gbl
|
||||
58 .psect imppas con, bss, gbl
|
||||
59 .psect implin con, bss, gbl
|
||||
60 .psect swtsec con, dat, prv, gbl ; unix command line flags
|
||||
61 .psect cndsec con, dat, prv, gbl ; gt, le, equ, etc. for '.if'
|
||||
62 .psect crfsec con, dat, prv, gbl ; args for -cr flag
|
||||
63 .psect edtsec con, dat, prv, gbl ; args for .enabl
|
||||
64 .psect lctsec con, dat, prv, gbl ; args for .list
|
||||
65 .psect psasec con, dat, prv, gbl
|
||||
66 .psect pstsec con, dat, prv, gbl
|
||||
67 .psect rolbas con, dat, prv, gbl ; core allocation: starts of tables
|
||||
68 .psect rolsiz con, dat, prv, gbl ; sizes of table entries
|
||||
69 .psect roltop con, dat, prv, gbl ; tops of tables
|
||||
70 .psect xpcor con,bss , gbl ; this one MUST come last in core
|
||||
71
|
||||
72
|
||||
72
|
||||
73 .macro entsec name ;init a section
|
||||
74 .psect name con
|
||||
75 .endm entsec
|
||||
76
|
||||
77
|
||||
78
|
||||
79 .macro jeq x,?fred
|
||||
80 bne fred
|
||||
81 jmp x
|
||||
82 fred:
|
||||
83 .endm
|
||||
84 .macro jne x,?fred
|
||||
85 beq fred
|
||||
86 jmp x
|
||||
87 fred:
|
||||
88 .endm
|
||||
89 .macro xitsec
|
||||
90 entsec .text
|
||||
91 .endm xitsec
|
||||
92
|
||||
93
|
||||
94 .macro call address
|
||||
95 jsr pc,address
|
||||
96 .endm
|
||||
97
|
||||
98 .macro return
|
||||
99 rts pc
|
||||
100 .endm
|
||||
101
|
||||
102
|
||||
103 .macro always
|
||||
104 .nlist bex
|
||||
105 .endm always
|
||||
106 .endm always
|
||||
107
|
||||
108
|
||||
109 000001 .if ne debug
|
||||
110
|
||||
111 .macro ndebug n
|
||||
112 .globl ndebug,..z
|
||||
113 mov n,..z
|
||||
114 call ndebug
|
||||
115 .endm
|
||||
116
|
||||
117 .macro sdebug string
|
||||
118 .globl sdebug,..z,..zbuf
|
||||
119 x = 0
|
||||
120 .irpc t,<string>
|
||||
121 movb #''t,..zbuf+x
|
||||
122 x = x+1
|
||||
123 .endm
|
||||
124 movb #0,..zbuf+x
|
||||
125 mov #..zbuf,..z
|
||||
126 call sdebug
|
||||
127 .endm
|
||||
128
|
||||
129 .iff
|
||||
130
|
||||
131 .macro ndebug n
|
||||
132 .endm
|
||||
133
|
||||
134 .macro sdebug string
|
||||
135 .endm
|
||||
136
|
||||
137 .endc
|
||||
138
|
||||
139
|
||||
140 .macro param mne, value ;define default parameters
|
||||
141 .iif ndf mne, mne= value
|
||||
142 .list
|
||||
143 mne= mne
|
||||
144 .nlist
|
||||
145 .endm
|
||||
145
|
||||
146 .macro putkb addr ;list to kb
|
||||
147 .globl putkb
|
||||
148 mov addr,r0
|
||||
149 call putkb
|
||||
150 .endm
|
||||
151
|
||||
152 .macro putlp addr ;list to lp
|
||||
153 .globl putlp
|
||||
154 mov addr,r0
|
||||
155 call putlp
|
||||
156 .endm
|
||||
157
|
||||
158 .macro putkbl addr ;list to kb and lp
|
||||
159 .globl putkbl
|
||||
160 mov addr,r0
|
||||
161 call putkbl
|
||||
162 .endm
|
||||
163
|
||||
164
|
||||
165 .macro xmit wrdcnt ;move small # of words
|
||||
166 .globl xmit0
|
||||
167 call xmit0-<wrdcnt*2>
|
||||
168 .endm xmit
|
||||
169
|
||||
170
|
||||
171 ;the macro "genswt" is used to specify a command
|
||||
172 ;string switch (1st argument) and the address of
|
||||
173 ;the routine to be called when encountered (2nd arg).
|
||||
174 ; the switch is made upper-case.
|
||||
175
|
||||
176 .macro genswt mne,addr,?label
|
||||
177 entsec swtsec
|
||||
178 label: .irpc x,mne
|
||||
179 .if ge ''x-141
|
||||
180 .if le ''x-172
|
||||
181 .byte ''x-40
|
||||
182 .iff
|
||||
183 .byte ''x
|
||||
184 .endc
|
||||
185 .iff
|
||||
186 .byte ''x
|
||||
187 .endc
|
||||
188 .endm
|
||||
189 .iif ne <.-label&1>, .byte 0
|
||||
190 .word addr
|
||||
191 xitsec
|
||||
192 .endm
|
||||
192
|
||||
193 .macro zread chan
|
||||
194 .globl zread
|
||||
195 mov #chan'chn,r0
|
||||
196 call zread
|
||||
197 .endm zread
|
||||
198
|
||||
199 .macro zwrite chan
|
||||
200 .globl zwrite
|
||||
201 mov #chan'chn,r0
|
||||
202 call zwrite
|
||||
203 .endm zwrite
|
||||
203
|
||||
204 .macro genedt mne,subr ;gen enable/disable table
|
||||
205 entsec edtsec
|
||||
206 .rad50 /mne/
|
||||
207 .if nb subr
|
||||
208 .word subr
|
||||
209 .iff
|
||||
210 .word cpopj
|
||||
211 .endc
|
||||
212 .word ed.'mne
|
||||
213 xitsec
|
||||
214 .endm genedt
|
||||
215
|
||||
216
|
||||
217 ;the macro "gencnd" is used to specify conditional
|
||||
218 ;arguments. it takes two or three arguments:
|
||||
219
|
||||
220 ; 1- mnemonic
|
||||
221 ; 2- subroutine to be called
|
||||
222 ; 3- if non-blank, complement condition
|
||||
223
|
||||
224 .macro gencnd mne,subr,toggle ;generate conditional
|
||||
225 entsec cndsec
|
||||
226 .rad50 /mne/
|
||||
227 .if b <toggle>
|
||||
228 .word subr
|
||||
229 .iff
|
||||
230 .word subr+1
|
||||
231 .endc
|
||||
232 xitsec
|
||||
233 .endm
|
||||
233
|
||||
234 .macro ch.mne
|
||||
235
|
||||
236 ch.ior= '!
|
||||
237 ch.qtm= '"
|
||||
238 ch.hsh= '#
|
||||
239 ch.dol= '$
|
||||
240 ch.pct= '%
|
||||
241 ch.and= '&
|
||||
242 ch.xcl= ''
|
||||
243
|
||||
244 ch.lp= '(
|
||||
245 ch.rp= ')
|
||||
246 ch.mul= '*
|
||||
247 ch.add= '+
|
||||
248 ch.com= ',
|
||||
249 ch.sub= '-
|
||||
250 ch.dot= '.
|
||||
251 ch.div= '/
|
||||
252
|
||||
253 ch.col= ':
|
||||
254 ch.smc= ';
|
||||
255 ch.lab= '<
|
||||
256 ch.equ= '=
|
||||
257 ch.rab= '>
|
||||
258 ch.qm= '?
|
||||
259
|
||||
260 ch.ind= '@
|
||||
261 ch.bsl= '\
|
||||
262 ch.uar= '^
|
||||
263
|
||||
264 let.a= 'a&^c40
|
||||
265 let.b= 'b&^c40
|
||||
266 let.c= 'c&^c40
|
||||
267 let.d= 'd&^c40
|
||||
268 let.e= 'e&^c40
|
||||
269 let.f= 'f&^c40
|
||||
270 let.g= 'g&^c40
|
||||
271 let.o= 'o&^c40
|
||||
272 let.p= 'p&^c40
|
||||
273 let.r= 'r&^c40
|
||||
274 let.z= 'z&^c40
|
||||
275
|
||||
276 dig.0= '0
|
||||
277 dig.9= '9
|
||||
278 .macro ch.mne
|
||||
279 .endm ch.mne
|
||||
280 .endm ch.mne
|
||||
281
|
||||
282 .macro error num,arg, mess ,?x
|
||||
283 sdebug <num>
|
||||
284 .globl err.'arg,ern'num, errbts,errref
|
||||
285 .if b <mess>
|
||||
286 deliberate error mistake
|
||||
287 .endc
|
||||
288 .if dif 0,num
|
||||
289 .globl err.xx
|
||||
290 tst err.xx
|
||||
291 bne x
|
||||
292 mov #ern'num,err.xx
|
||||
293 x:
|
||||
294 .endc
|
||||
295 bis #err.'arg,errbts
|
||||
296 .endm
|
||||
297
|
||||
298
|
||||
299
|
||||
300 .macro setnz addr ;set addr to non-zero for t/f flags
|
||||
301 mov sp,addr
|
||||
302 .endm
|
||||
303
|
||||
304
|
||||
305 .macro bisbic arg ; used by .list/.nlist, .enabl/.dsabl
|
||||
306 .globl bisbic
|
||||
307 mov #arg,-(sp)
|
||||
308 call bisbic
|
||||
309 tst (sp)+
|
||||
310 .endm
|
||||
310
|
||||
311 ;roll handler calls
|
||||
312
|
||||
313 .macro search rolnum ;binary search
|
||||
314 mov #rolnum,r0
|
||||
315 .globl search
|
||||
316 call search
|
||||
317 .endm
|
||||
318
|
||||
319 .macro scan rolnum ;linear scan
|
||||
320 mov #rolnum,r0
|
||||
321 .globl scan
|
||||
322 call scan
|
||||
323 .endm
|
||||
324
|
||||
325 .macro scanw rolnum ;linear scan, one word
|
||||
326 mov #rolnum,r0
|
||||
327 .globl scanw
|
||||
328 call scanw
|
||||
329 .endm
|
||||
330
|
||||
331 .macro next rolnum ;fetch next entry
|
||||
332 mov #rolnum,r0
|
||||
333 .globl next
|
||||
334 call next
|
||||
335 .endm
|
||||
336
|
||||
337 .macro append rolnum ;append to end of roll
|
||||
338 mov #rolnum,r0
|
||||
339 .globl append
|
||||
340 call append
|
||||
341 .endm
|
||||
342
|
||||
343 .macro zap rolnum ;clear roll
|
||||
344 mov #rolnum,r0
|
||||
345 .globl zap
|
||||
346 call zap
|
||||
347 .endm
|
||||
348
|
||||
349 ; call insert ;insert (must be preceded by one
|
||||
350 ;of the above to set pointers)
|
||||
351 ; call setrol ;save and set regs for above
|
||||
351
|
||||
352 ;flags used in symbol table mode
|
||||
353
|
||||
354 .macro st.flg
|
||||
355
|
||||
356 .if le ft.unx
|
||||
357
|
||||
358 ovrflg= 000004 ;overlay (psect only)
|
||||
359 defflg= 000010 ;defined
|
||||
360 relflg= 000040 ;relocatable
|
||||
361 glbflg= 000100 ;global
|
||||
362 dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
363
|
||||
364
|
||||
365 .endc
|
||||
366
|
||||
367 .if gt ft.unx
|
||||
368
|
||||
369 ; ****** these should not be changed!! ******
|
||||
370 shrflg= 000001 ;shareable (psect only)
|
||||
371 .if gt ft.id
|
||||
372 insflg= shrflg*2 ;instruction space (psect only)
|
||||
373 bssflg= insflg*2 ;blank section (psect only)
|
||||
374 m.idf= shrflg!insflg!bssflg ;mask to turn them off
|
||||
375 .iff
|
||||
376 bssflg= shrflg*2
|
||||
377 m.idf= shrflg!bssflg
|
||||
378 .endc
|
||||
379 b.idf= 1 ;shift count to make above bits word offset
|
||||
380 ; ***********************************
|
||||
381 defflg= 000010 ;defined
|
||||
382 ovrflg= 000020 ;overlay (psect only)
|
||||
383 relflg= 000040 ;relocatable
|
||||
384 glbflg= 000100 ;global
|
||||
385 dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
386
|
||||
387 .endc
|
||||
388
|
||||
389 ;
|
||||
390 ; default psect attribs.
|
||||
391 ; can be changed, but make sure all customers know about
|
||||
392 ; it, including all the linkers.
|
||||
393 ;
|
||||
394 pattrs=relflg!defflg ; For .psects and blank .csects
|
||||
395 aattrs=glbflg!defflg!ovrflg ; For .asect
|
||||
396 cattrs=glbflg!relflg!defflg!ovrflg ; For named .csects
|
||||
397
|
||||
398 regflg= 000001 ;register
|
||||
399 lblflg= 000002 ;label
|
||||
400 mdfflg= 000004 ;multilpy defined
|
||||
401 .macro st.flg
|
||||
402 .endm
|
||||
403 .endm st.flg
|
||||
404
|
||||
405
|
||||
406
|
||||
407 .macro ct.mne
|
||||
408 .globl cttbl
|
||||
409 ct.eol = 000 ; eol
|
||||
410 ct.com = 001 ; comma
|
||||
411 ct.tab = 002 ; tab
|
||||
412 ct.sp = 004 ; space
|
||||
413 ct.pcx = 010 ; printing character
|
||||
414 ct.num = 020 ; numeric
|
||||
415 ct.alp = 040 ; alpha, dot, dollar
|
||||
416 ct.lc = 100 ; lower case alpha
|
||||
417 ct.smc = 200 ; semi-colon (sign bit)
|
||||
418
|
||||
419 ct.pc = ct.com!ct.smc!ct.pcx!ct.num!ct.alp
|
||||
420 .macro ct.mne
|
||||
421 .endm ct.mne
|
||||
422 .endm ct.mne
|
||||
423
|
||||
424
|
||||
425 .end
|
||||
425
|
||||
8 .include "2.11BSD/m11/often.m11"
|
||||
1 .title often
|
||||
2
|
||||
3 ;
|
||||
4 ; these are routines which get called periodically:
|
||||
5 ;
|
||||
6 ; xctlin once per line
|
||||
7 ; xctpas once per pass
|
||||
8 ; xctprg once per program
|
||||
9 ;
|
||||
10
|
||||
11 .ident /sept81/
|
||||
12
|
||||
13 .mcall (at)always,st.flg
|
||||
14 000000 always
|
||||
1
|
||||
2 .macro .data
|
||||
3 entsec .data
|
||||
4 .endm .data
|
||||
5
|
||||
6 .macro .text
|
||||
7 entsec .text
|
||||
8 .endm
|
||||
9
|
||||
10 .macro .bss
|
||||
11 entsec .bss
|
||||
12 .endm
|
||||
13
|
||||
14 000001 mk.symbol=1 ;one to make symbols, 0 otherwise
|
||||
15 000000 x40= 0
|
||||
16 000000 pdpv45= 0 ; host machine has 'mul', 'div', sob' instrucs.
|
||||
17 ; if not you will have to write macros for them
|
||||
18 000007 $timdf= 7 ; California Time Zone
|
||||
19 ; should really use ftime(2) for this and for
|
||||
20 ; DST.
|
||||
21 ;xfltg= 0 ;define to assmbl out floating hardware
|
||||
22 000000 rsx11d = 0 ; rsx11d features
|
||||
23 000000 debug = 0 ; <<< REEDS if non zero includes debug junk
|
||||
24
|
||||
25 000001 ft.id= 1 ;have set i & d. set =0 if not
|
||||
26
|
||||
27 000001 ft.unx = 1 ; this macro-11 is for UNIX. =0 if not.
|
||||
28
|
||||
29 .nlist bex
|
||||
30
|
||||
31 000011 tab= 11
|
||||
32 000012 lf= 12
|
||||
33 000013 vt= 13
|
||||
34 000014 ff= 14
|
||||
35 000015 cr= 15
|
||||
36 000040 space= 40
|
||||
37
|
||||
38 000020 bpmb = 20 ;bytes per macro block
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:44: ***ERROR Unknown flag SHR given to .PSECT directive
|
||||
44 .psect .text con, shr, gbl,ins
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:45: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
45 .psect .data con, dat, prv, gbl
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:46: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
46 .psect .bss con, bss, gbl
|
||||
47
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:48: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
48 .psect dpure con, dat, prv, gbl
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:49: ***ERROR Unknown flag PRV given to .PSECT directive
|
||||
49 .psect mixed con, prv, gbl
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:50: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
50 .psect errmes con, dat, prv, gbl
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:51: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
51 .psect impure con, bss, gbl
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:52: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
52 .psect imppas con, bss, gbl
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:53: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
53 .psect implin con, bss, gbl
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:54: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
54 .psect swtsec con, dat, prv, gbl ; unix command line flags
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:55: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
55 .psect cndsec con, dat, prv, gbl ; gt, le, equ, etc. for '.if'
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:56: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
56 .psect crfsec con, dat, prv, gbl ; args for -cr flag
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:57: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
57 .psect edtsec con, dat, prv, gbl ; args for .enabl
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:58: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
58 .psect lctsec con, dat, prv, gbl ; args for .list
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:59: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
59 .psect psasec con, dat, prv, gbl
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:60: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
60 .psect pstsec con, dat, prv, gbl
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:61: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
61 .psect rolbas con, dat, prv, gbl ; core allocation: starts of tables
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:62: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
62 .psect rolsiz con, dat, prv, gbl ; sizes of table entries
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:63: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
63 .psect roltop con, dat, prv, gbl ; tops of tables
|
||||
./2.11BSD/m11/often.m11:14->ALWAYS:64: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
64 .psect xpcor con,bss , gbl ; this one MUST come last in core
|
||||
65
|
||||
66
|
||||
67
|
||||
68 .macro entsec name ;init a section
|
||||
69 .psect name con
|
||||
70 .endm entsec
|
||||
71
|
||||
72
|
||||
73
|
||||
74 .macro jeq x,?fred
|
||||
75 bne fred
|
||||
76 jmp x
|
||||
77 fred:
|
||||
78 .endm
|
||||
79 .macro jne x,?fred
|
||||
80 beq fred
|
||||
81 jmp x
|
||||
82 fred:
|
||||
83 .endm
|
||||
84 .macro xitsec
|
||||
85 entsec .text
|
||||
86 .endm xitsec
|
||||
87
|
||||
88
|
||||
89 .macro call address
|
||||
90 jsr pc,address
|
||||
91 .endm
|
||||
92
|
||||
93 .macro return
|
||||
94 rts pc
|
||||
95 .endm
|
||||
96
|
||||
97
|
||||
98 .macro always
|
||||
99 .nlist bex
|
||||
100 .endm always
|
||||
15 000000 st.flg
|
||||
1
|
||||
2 000001 .if le ft.unx
|
||||
3
|
||||
4 ovrflg= 000004 ;overlay (psect only)
|
||||
5 defflg= 000010 ;defined
|
||||
6 relflg= 000040 ;relocatable
|
||||
7 glbflg= 000100 ;global
|
||||
8 dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
9
|
||||
10
|
||||
11 .endc
|
||||
12
|
||||
13 000001 .if gt ft.unx
|
||||
14
|
||||
15 ; ****** these should not be changed!! ******
|
||||
16 000001 shrflg= 000001 ;shareable (psect only)
|
||||
17 000001 .if gt ft.id
|
||||
18 000002 insflg= shrflg*2 ;instruction space (psect only)
|
||||
19 000004 bssflg= insflg*2 ;blank section (psect only)
|
||||
20 000007 m.idf= shrflg!insflg!bssflg ;mask to turn them off
|
||||
21 .iff
|
||||
22 bssflg= shrflg*2
|
||||
23 m.idf= shrflg!bssflg
|
||||
24 .endc
|
||||
25 000001 b.idf= 1 ;shift count to make above bits word offset
|
||||
26 ; ***********************************
|
||||
27 000010 defflg= 000010 ;defined
|
||||
28 000020 ovrflg= 000020 ;overlay (psect only)
|
||||
29 000040 relflg= 000040 ;relocatable
|
||||
30 000100 glbflg= 000100 ;global
|
||||
31 000200 dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
32
|
||||
33 .endc
|
||||
34
|
||||
35 ;
|
||||
36 ; default psect attribs.
|
||||
37 ; can be changed, but make sure all customers know about
|
||||
38 ; it, including all the linkers.
|
||||
39 ;
|
||||
40 000050 pattrs=relflg!defflg ; For .psects and blank .csects
|
||||
41 000130 aattrs=glbflg!defflg!ovrflg ; For .asect
|
||||
42 000170 cattrs=glbflg!relflg!defflg!ovrflg ; For named .csects
|
||||
43
|
||||
44 000001 regflg= 000001 ;register
|
||||
45 000002 lblflg= 000002 ;label
|
||||
46 000004 mdfflg= 000004 ;multilpy defined
|
||||
47 .macro st.flg
|
||||
48 .endm
|
||||
16 .globl xctpas, xctlin, xctprg
|
||||
17 .globl objsec
|
||||
18 .globl macdfn
|
||||
19
|
||||
20 .globl lst.kb,ioftbl,lstchn, lst.lp
|
||||
21 .globl lstflg, u.flag
|
||||
22 .globl io.tty
|
||||
23 .globl lstdev
|
||||
24 .globl cradix,pcrcnt
|
||||
25
|
||||
26 .globl defttl,chrpnt, setchr,title,endvec
|
||||
27
|
||||
28 000000 .text
|
||||
1 000000 entsec .text
|
||||
1 000000 .psect .text con
|
||||
29 xctprg:
|
||||
30 000000 012700 000000' mov #^pl impure,r0
|
||||
31 000004 005020 1$: clr (r0)+
|
||||
32 000006 020027 000000' cmp r0,#^ph implin
|
||||
33 000012 103774 blo 1$
|
||||
34 000014 call fixtit
|
||||
1 000014 004767 000116 jsr pc,fixtit
|
||||
35 000020 005267 000006G inc endvec+6 ;default to no end vector
|
||||
36
|
||||
37 ; fall through to
|
||||
38
|
||||
39 xctpas:
|
||||
40 000024 012700 000000' mov #^pl imppas,r0
|
||||
41 000030 005020 1$: clr (r0)+
|
||||
42 000032 020027 000000' cmp r0,#^ph implin
|
||||
43 000036 103774 blo 1$
|
||||
44
|
||||
45 000040 105167 000000G comb objsec ;force sequence break
|
||||
46
|
||||
47 000044 012700 000000C mov #lst.kb*400,r0 ;set error slot
|
||||
48 000050 105767 000000C tstb ioftbl+lstchn ;listing device?
|
||||
49 000054 001410 beq 2$ ; no
|
||||
50 000056 052700 000000C bis #lst.kb!100200,r0 ;yes, assume teletype
|
||||
51 000062 032767 000000G 000000C bit #io.tty,ioftbl+lstchn ;true?
|
||||
52 000070 001002 bne 2$ ; yes
|
||||
53 000072 062700 000000C add #<lst.lp-lst.kb>*401,r0 ;no, upgrade to lp
|
||||
54 000076 010067 000000G 2$: mov r0,lstdev ;set flags
|
||||
55
|
||||
56 3$:
|
||||
57 000102 012767 000010 000000G mov #8.,cradix ;init to octal radix
|
||||
58
|
||||
59 000110 005067 000000G clr macdfn
|
||||
60 ; fall through to
|
||||
61
|
||||
62 xctlin:
|
||||
63 000114 012700 000000' mov #^pl implin,r0
|
||||
64 000120 005020 1$: clr (r0)+
|
||||
65 000122 020027 000000' cmp r0,#^ph implin
|
||||
66 000126 103774 blo 1$
|
||||
67
|
||||
68 000130 005367 000000G dec pcrcnt
|
||||
69 000134 return
|
||||
1 000134 000207 rts pc
|
||||
70
|
||||
71 .globl fixtit
|
||||
72 fixtit:
|
||||
73 000136 012767 000000G 000000G mov #defttl,chrpnt
|
||||
74 000144 call setchr
|
||||
1 000144 004767 000000G jsr pc,setchr
|
||||
75 000150 call title
|
||||
1 000150 004767 000000G jsr pc,title
|
||||
76 000154 return
|
||||
1 000154 000207 rts pc
|
||||
77 .end
|
||||
77
|
||||
8
|
||||
|
||||
|
||||
Symbol table
|
||||
|
||||
$TIMDF=000007 CHRPNT=****** G GLBFLG=000100 MACDFN=****** G SHRFLG=000001
|
||||
. ******R 002 CR =000015 INSFLG=000002 MDFFLG=000004 SPACE =000040
|
||||
1$0 000004R L 002 CRADIX=****** G IO.TTY=****** G MK.SYM=000001 TAB =000011
|
||||
1$1 000030R L 002 DEBUG =000000 IOFTBL=****** G OBJSEC=****** G TITLE =****** G
|
||||
1$2 000120R L 002 DEFFLG=000010 LBLFLG=000002 OVRFLG=000020 U.FLAG=****** G
|
||||
2$1 000076R L 002 DEFTTL=****** G LF =000012 PATTRS=000050 VT =000013
|
||||
3$1 000102R L 002 DFGFLG=000200 LST.KB=****** G PCRCNT=****** G X40 =000000
|
||||
AATTRS=000130 ENDVEC=****** G LST.LP=****** G PDPV45=000000 XCTLIN 000114RG 002
|
||||
B.IDF =000001 FF =000014 LSTCHN=****** G REGFLG=000001 XCTPAS 000024RG 002
|
||||
BPMB =000020 FIXTIT 000136RG 002 LSTDEV=****** G RELFLG=000040 XCTPRG 000000RG 002
|
||||
BSSFLG=000004 FT.ID =000001 LSTFLG=****** G RSX11D=000000
|
||||
CATTRS=000170 FT.UNX=000001 M.IDF =000007 SETCHR=****** G
|
||||
|
||||
|
||||
Program sections:
|
||||
|
||||
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
|
||||
000000 001 (RW,I,LCL,REL,CON,NOSAV)
|
||||
.TEXT 000156 002 (RW,I,LCL,REL,CON,NOSAV)
|
||||
.DATA 000000 003 (RW,I,LCL,REL,CON,NOSAV)
|
||||
.BSS 000000 004 (RW,I,LCL,REL,CON,NOSAV)
|
||||
DPURE 000000 005 (RW,I,LCL,REL,CON,NOSAV)
|
||||
MIXED 000000 006 (RW,I,LCL,REL,CON,NOSAV)
|
||||
ERRMES 000000 007 (RW,I,LCL,REL,CON,NOSAV)
|
||||
IMPURE 000000 008 (RW,I,LCL,REL,CON,NOSAV)
|
||||
IMPPAS 000000 009 (RW,I,LCL,REL,CON,NOSAV)
|
||||
IMPLIN 000000 010 (RW,I,LCL,REL,CON,NOSAV)
|
||||
SWTSEC 000000 011 (RW,I,LCL,REL,CON,NOSAV)
|
||||
CNDSEC 000000 012 (RW,I,LCL,REL,CON,NOSAV)
|
||||
CRFSEC 000000 013 (RW,I,LCL,REL,CON,NOSAV)
|
||||
EDTSEC 000000 014 (RW,I,LCL,REL,CON,NOSAV)
|
||||
LCTSEC 000000 015 (RW,I,LCL,REL,CON,NOSAV)
|
||||
PSASEC 000000 016 (RW,I,LCL,REL,CON,NOSAV)
|
||||
PSTSEC 000000 017 (RW,I,LCL,REL,CON,NOSAV)
|
||||
ROLBAS 000000 018 (RW,I,LCL,REL,CON,NOSAV)
|
||||
ROLSIZ 000000 019 (RW,I,LCL,REL,CON,NOSAV)
|
||||
ROLTOP 000000 020 (RW,I,LCL,REL,CON,NOSAV)
|
||||
XPCOR 000000 021 (RW,I,LCL,REL,CON,NOSAV)
|
||||
3071
tests/2.11BSD-m11-pst.lst.ok
Normal file
3071
tests/2.11BSD-m11-pst.lst.ok
Normal file
File diff suppressed because it is too large
Load Diff
989
tests/2.11BSD-m11-srch.lst.ok
Normal file
989
tests/2.11BSD-m11-srch.lst.ok
Normal file
@@ -0,0 +1,989 @@
|
||||
1 ;;;; Wrapper for 2.11BSD/m11/srch.m11
|
||||
2 .list
|
||||
3 .list
|
||||
4 .list
|
||||
5 .enabl lc
|
||||
6 000001 debug = 1
|
||||
7 .include "2.11BSD/m11/at.sml"
|
||||
1 .title at.sml - assembler/translator system macros
|
||||
2 ; @(#)at.sml 1.3 11/3/82
|
||||
3
|
||||
4 .ident /10may4/
|
||||
5
|
||||
6 .macro always ;all files of macro
|
||||
7
|
||||
8 .macro .data
|
||||
9 entsec .data
|
||||
10 .endm .data
|
||||
11
|
||||
12 .macro .text
|
||||
13 entsec .text
|
||||
14 .endm
|
||||
15
|
||||
16 .macro .bss
|
||||
17 entsec .bss
|
||||
18 .endm
|
||||
19
|
||||
20 mk.symbol=1 ;one to make symbols, 0 otherwise
|
||||
21 x40= 0
|
||||
22 pdpv45= 0 ; host machine has 'mul', 'div', sob' instrucs.
|
||||
23 ; if not you will have to write macros for them
|
||||
24 $timdf= 7 ; California Time Zone
|
||||
25 ; should really use ftime(2) for this and for
|
||||
26 ; DST.
|
||||
27 ;xfltg= 0 ;define to assmbl out floating hardware
|
||||
28 rsx11d = 0 ; rsx11d features
|
||||
29 debug = 0 ; <<< REEDS if non zero includes debug junk
|
||||
30
|
||||
31 ft.id= 1 ;have set i & d. set =0 if not
|
||||
32
|
||||
33 ft.unx = 1 ; this macro-11 is for UNIX. =0 if not.
|
||||
34
|
||||
35 .nlist bex
|
||||
36
|
||||
37 tab= 11
|
||||
38 lf= 12
|
||||
39 vt= 13
|
||||
40 ff= 14
|
||||
41 cr= 15
|
||||
42 space= 40
|
||||
43
|
||||
44 bpmb = 20 ;bytes per macro block
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50 .psect .text con, shr, gbl,ins
|
||||
51 .psect .data con, dat, prv, gbl
|
||||
52 .psect .bss con, bss, gbl
|
||||
53
|
||||
54 .psect dpure con, dat, prv, gbl
|
||||
55 .psect mixed con, prv, gbl
|
||||
56 .psect errmes con, dat, prv, gbl
|
||||
57 .psect impure con, bss, gbl
|
||||
58 .psect imppas con, bss, gbl
|
||||
59 .psect implin con, bss, gbl
|
||||
60 .psect swtsec con, dat, prv, gbl ; unix command line flags
|
||||
61 .psect cndsec con, dat, prv, gbl ; gt, le, equ, etc. for '.if'
|
||||
62 .psect crfsec con, dat, prv, gbl ; args for -cr flag
|
||||
63 .psect edtsec con, dat, prv, gbl ; args for .enabl
|
||||
64 .psect lctsec con, dat, prv, gbl ; args for .list
|
||||
65 .psect psasec con, dat, prv, gbl
|
||||
66 .psect pstsec con, dat, prv, gbl
|
||||
67 .psect rolbas con, dat, prv, gbl ; core allocation: starts of tables
|
||||
68 .psect rolsiz con, dat, prv, gbl ; sizes of table entries
|
||||
69 .psect roltop con, dat, prv, gbl ; tops of tables
|
||||
70 .psect xpcor con,bss , gbl ; this one MUST come last in core
|
||||
71
|
||||
72
|
||||
72
|
||||
73 .macro entsec name ;init a section
|
||||
74 .psect name con
|
||||
75 .endm entsec
|
||||
76
|
||||
77
|
||||
78
|
||||
79 .macro jeq x,?fred
|
||||
80 bne fred
|
||||
81 jmp x
|
||||
82 fred:
|
||||
83 .endm
|
||||
84 .macro jne x,?fred
|
||||
85 beq fred
|
||||
86 jmp x
|
||||
87 fred:
|
||||
88 .endm
|
||||
89 .macro xitsec
|
||||
90 entsec .text
|
||||
91 .endm xitsec
|
||||
92
|
||||
93
|
||||
94 .macro call address
|
||||
95 jsr pc,address
|
||||
96 .endm
|
||||
97
|
||||
98 .macro return
|
||||
99 rts pc
|
||||
100 .endm
|
||||
101
|
||||
102
|
||||
103 .macro always
|
||||
104 .nlist bex
|
||||
105 .endm always
|
||||
106 .endm always
|
||||
107
|
||||
108
|
||||
109 000001 .if ne debug
|
||||
110
|
||||
111 .macro ndebug n
|
||||
112 .globl ndebug,..z
|
||||
113 mov n,..z
|
||||
114 call ndebug
|
||||
115 .endm
|
||||
116
|
||||
117 .macro sdebug string
|
||||
118 .globl sdebug,..z,..zbuf
|
||||
119 x = 0
|
||||
120 .irpc t,<string>
|
||||
121 movb #''t,..zbuf+x
|
||||
122 x = x+1
|
||||
123 .endm
|
||||
124 movb #0,..zbuf+x
|
||||
125 mov #..zbuf,..z
|
||||
126 call sdebug
|
||||
127 .endm
|
||||
128
|
||||
129 .iff
|
||||
130
|
||||
131 .macro ndebug n
|
||||
132 .endm
|
||||
133
|
||||
134 .macro sdebug string
|
||||
135 .endm
|
||||
136
|
||||
137 .endc
|
||||
138
|
||||
139
|
||||
140 .macro param mne, value ;define default parameters
|
||||
141 .iif ndf mne, mne= value
|
||||
142 .list
|
||||
143 mne= mne
|
||||
144 .nlist
|
||||
145 .endm
|
||||
145
|
||||
146 .macro putkb addr ;list to kb
|
||||
147 .globl putkb
|
||||
148 mov addr,r0
|
||||
149 call putkb
|
||||
150 .endm
|
||||
151
|
||||
152 .macro putlp addr ;list to lp
|
||||
153 .globl putlp
|
||||
154 mov addr,r0
|
||||
155 call putlp
|
||||
156 .endm
|
||||
157
|
||||
158 .macro putkbl addr ;list to kb and lp
|
||||
159 .globl putkbl
|
||||
160 mov addr,r0
|
||||
161 call putkbl
|
||||
162 .endm
|
||||
163
|
||||
164
|
||||
165 .macro xmit wrdcnt ;move small # of words
|
||||
166 .globl xmit0
|
||||
167 call xmit0-<wrdcnt*2>
|
||||
168 .endm xmit
|
||||
169
|
||||
170
|
||||
171 ;the macro "genswt" is used to specify a command
|
||||
172 ;string switch (1st argument) and the address of
|
||||
173 ;the routine to be called when encountered (2nd arg).
|
||||
174 ; the switch is made upper-case.
|
||||
175
|
||||
176 .macro genswt mne,addr,?label
|
||||
177 entsec swtsec
|
||||
178 label: .irpc x,mne
|
||||
179 .if ge ''x-141
|
||||
180 .if le ''x-172
|
||||
181 .byte ''x-40
|
||||
182 .iff
|
||||
183 .byte ''x
|
||||
184 .endc
|
||||
185 .iff
|
||||
186 .byte ''x
|
||||
187 .endc
|
||||
188 .endm
|
||||
189 .iif ne <.-label&1>, .byte 0
|
||||
190 .word addr
|
||||
191 xitsec
|
||||
192 .endm
|
||||
192
|
||||
193 .macro zread chan
|
||||
194 .globl zread
|
||||
195 mov #chan'chn,r0
|
||||
196 call zread
|
||||
197 .endm zread
|
||||
198
|
||||
199 .macro zwrite chan
|
||||
200 .globl zwrite
|
||||
201 mov #chan'chn,r0
|
||||
202 call zwrite
|
||||
203 .endm zwrite
|
||||
203
|
||||
204 .macro genedt mne,subr ;gen enable/disable table
|
||||
205 entsec edtsec
|
||||
206 .rad50 /mne/
|
||||
207 .if nb subr
|
||||
208 .word subr
|
||||
209 .iff
|
||||
210 .word cpopj
|
||||
211 .endc
|
||||
212 .word ed.'mne
|
||||
213 xitsec
|
||||
214 .endm genedt
|
||||
215
|
||||
216
|
||||
217 ;the macro "gencnd" is used to specify conditional
|
||||
218 ;arguments. it takes two or three arguments:
|
||||
219
|
||||
220 ; 1- mnemonic
|
||||
221 ; 2- subroutine to be called
|
||||
222 ; 3- if non-blank, complement condition
|
||||
223
|
||||
224 .macro gencnd mne,subr,toggle ;generate conditional
|
||||
225 entsec cndsec
|
||||
226 .rad50 /mne/
|
||||
227 .if b <toggle>
|
||||
228 .word subr
|
||||
229 .iff
|
||||
230 .word subr+1
|
||||
231 .endc
|
||||
232 xitsec
|
||||
233 .endm
|
||||
233
|
||||
234 .macro ch.mne
|
||||
235
|
||||
236 ch.ior= '!
|
||||
237 ch.qtm= '"
|
||||
238 ch.hsh= '#
|
||||
239 ch.dol= '$
|
||||
240 ch.pct= '%
|
||||
241 ch.and= '&
|
||||
242 ch.xcl= ''
|
||||
243
|
||||
244 ch.lp= '(
|
||||
245 ch.rp= ')
|
||||
246 ch.mul= '*
|
||||
247 ch.add= '+
|
||||
248 ch.com= ',
|
||||
249 ch.sub= '-
|
||||
250 ch.dot= '.
|
||||
251 ch.div= '/
|
||||
252
|
||||
253 ch.col= ':
|
||||
254 ch.smc= ';
|
||||
255 ch.lab= '<
|
||||
256 ch.equ= '=
|
||||
257 ch.rab= '>
|
||||
258 ch.qm= '?
|
||||
259
|
||||
260 ch.ind= '@
|
||||
261 ch.bsl= '\
|
||||
262 ch.uar= '^
|
||||
263
|
||||
264 let.a= 'a&^c40
|
||||
265 let.b= 'b&^c40
|
||||
266 let.c= 'c&^c40
|
||||
267 let.d= 'd&^c40
|
||||
268 let.e= 'e&^c40
|
||||
269 let.f= 'f&^c40
|
||||
270 let.g= 'g&^c40
|
||||
271 let.o= 'o&^c40
|
||||
272 let.p= 'p&^c40
|
||||
273 let.r= 'r&^c40
|
||||
274 let.z= 'z&^c40
|
||||
275
|
||||
276 dig.0= '0
|
||||
277 dig.9= '9
|
||||
278 .macro ch.mne
|
||||
279 .endm ch.mne
|
||||
280 .endm ch.mne
|
||||
281
|
||||
282 .macro error num,arg, mess ,?x
|
||||
283 sdebug <num>
|
||||
284 .globl err.'arg,ern'num, errbts,errref
|
||||
285 .if b <mess>
|
||||
286 deliberate error mistake
|
||||
287 .endc
|
||||
288 .if dif 0,num
|
||||
289 .globl err.xx
|
||||
290 tst err.xx
|
||||
291 bne x
|
||||
292 mov #ern'num,err.xx
|
||||
293 x:
|
||||
294 .endc
|
||||
295 bis #err.'arg,errbts
|
||||
296 .endm
|
||||
297
|
||||
298
|
||||
299
|
||||
300 .macro setnz addr ;set addr to non-zero for t/f flags
|
||||
301 mov sp,addr
|
||||
302 .endm
|
||||
303
|
||||
304
|
||||
305 .macro bisbic arg ; used by .list/.nlist, .enabl/.dsabl
|
||||
306 .globl bisbic
|
||||
307 mov #arg,-(sp)
|
||||
308 call bisbic
|
||||
309 tst (sp)+
|
||||
310 .endm
|
||||
310
|
||||
311 ;roll handler calls
|
||||
312
|
||||
313 .macro search rolnum ;binary search
|
||||
314 mov #rolnum,r0
|
||||
315 .globl search
|
||||
316 call search
|
||||
317 .endm
|
||||
318
|
||||
319 .macro scan rolnum ;linear scan
|
||||
320 mov #rolnum,r0
|
||||
321 .globl scan
|
||||
322 call scan
|
||||
323 .endm
|
||||
324
|
||||
325 .macro scanw rolnum ;linear scan, one word
|
||||
326 mov #rolnum,r0
|
||||
327 .globl scanw
|
||||
328 call scanw
|
||||
329 .endm
|
||||
330
|
||||
331 .macro next rolnum ;fetch next entry
|
||||
332 mov #rolnum,r0
|
||||
333 .globl next
|
||||
334 call next
|
||||
335 .endm
|
||||
336
|
||||
337 .macro append rolnum ;append to end of roll
|
||||
338 mov #rolnum,r0
|
||||
339 .globl append
|
||||
340 call append
|
||||
341 .endm
|
||||
342
|
||||
343 .macro zap rolnum ;clear roll
|
||||
344 mov #rolnum,r0
|
||||
345 .globl zap
|
||||
346 call zap
|
||||
347 .endm
|
||||
348
|
||||
349 ; call insert ;insert (must be preceded by one
|
||||
350 ;of the above to set pointers)
|
||||
351 ; call setrol ;save and set regs for above
|
||||
351
|
||||
352 ;flags used in symbol table mode
|
||||
353
|
||||
354 .macro st.flg
|
||||
355
|
||||
356 .if le ft.unx
|
||||
357
|
||||
358 ovrflg= 000004 ;overlay (psect only)
|
||||
359 defflg= 000010 ;defined
|
||||
360 relflg= 000040 ;relocatable
|
||||
361 glbflg= 000100 ;global
|
||||
362 dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
363
|
||||
364
|
||||
365 .endc
|
||||
366
|
||||
367 .if gt ft.unx
|
||||
368
|
||||
369 ; ****** these should not be changed!! ******
|
||||
370 shrflg= 000001 ;shareable (psect only)
|
||||
371 .if gt ft.id
|
||||
372 insflg= shrflg*2 ;instruction space (psect only)
|
||||
373 bssflg= insflg*2 ;blank section (psect only)
|
||||
374 m.idf= shrflg!insflg!bssflg ;mask to turn them off
|
||||
375 .iff
|
||||
376 bssflg= shrflg*2
|
||||
377 m.idf= shrflg!bssflg
|
||||
378 .endc
|
||||
379 b.idf= 1 ;shift count to make above bits word offset
|
||||
380 ; ***********************************
|
||||
381 defflg= 000010 ;defined
|
||||
382 ovrflg= 000020 ;overlay (psect only)
|
||||
383 relflg= 000040 ;relocatable
|
||||
384 glbflg= 000100 ;global
|
||||
385 dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
386
|
||||
387 .endc
|
||||
388
|
||||
389 ;
|
||||
390 ; default psect attribs.
|
||||
391 ; can be changed, but make sure all customers know about
|
||||
392 ; it, including all the linkers.
|
||||
393 ;
|
||||
394 pattrs=relflg!defflg ; For .psects and blank .csects
|
||||
395 aattrs=glbflg!defflg!ovrflg ; For .asect
|
||||
396 cattrs=glbflg!relflg!defflg!ovrflg ; For named .csects
|
||||
397
|
||||
398 regflg= 000001 ;register
|
||||
399 lblflg= 000002 ;label
|
||||
400 mdfflg= 000004 ;multilpy defined
|
||||
401 .macro st.flg
|
||||
402 .endm
|
||||
403 .endm st.flg
|
||||
404
|
||||
405
|
||||
406
|
||||
407 .macro ct.mne
|
||||
408 .globl cttbl
|
||||
409 ct.eol = 000 ; eol
|
||||
410 ct.com = 001 ; comma
|
||||
411 ct.tab = 002 ; tab
|
||||
412 ct.sp = 004 ; space
|
||||
413 ct.pcx = 010 ; printing character
|
||||
414 ct.num = 020 ; numeric
|
||||
415 ct.alp = 040 ; alpha, dot, dollar
|
||||
416 ct.lc = 100 ; lower case alpha
|
||||
417 ct.smc = 200 ; semi-colon (sign bit)
|
||||
418
|
||||
419 ct.pc = ct.com!ct.smc!ct.pcx!ct.num!ct.alp
|
||||
420 .macro ct.mne
|
||||
421 .endm ct.mne
|
||||
422 .endm ct.mne
|
||||
423
|
||||
424
|
||||
425 .end
|
||||
425
|
||||
8 .include "2.11BSD/m11/srch.m11"
|
||||
1 .title srch
|
||||
2 .ident /03apr4/
|
||||
3
|
||||
4 .mcall (at)always,scan,genedt
|
||||
5 .mcall (at)sdebug,ndebug
|
||||
6 000000 always
|
||||
1
|
||||
2 .macro .data
|
||||
3 entsec .data
|
||||
4 .endm .data
|
||||
5
|
||||
6 .macro .text
|
||||
7 entsec .text
|
||||
8 .endm
|
||||
9
|
||||
10 .macro .bss
|
||||
11 entsec .bss
|
||||
12 .endm
|
||||
13
|
||||
14 000001 mk.symbol=1 ;one to make symbols, 0 otherwise
|
||||
15 000000 x40= 0
|
||||
16 000000 pdpv45= 0 ; host machine has 'mul', 'div', sob' instrucs.
|
||||
17 ; if not you will have to write macros for them
|
||||
18 000007 $timdf= 7 ; California Time Zone
|
||||
19 ; should really use ftime(2) for this and for
|
||||
20 ; DST.
|
||||
21 ;xfltg= 0 ;define to assmbl out floating hardware
|
||||
22 000000 rsx11d = 0 ; rsx11d features
|
||||
23 000000 debug = 0 ; <<< REEDS if non zero includes debug junk
|
||||
24
|
||||
25 000001 ft.id= 1 ;have set i & d. set =0 if not
|
||||
26
|
||||
27 000001 ft.unx = 1 ; this macro-11 is for UNIX. =0 if not.
|
||||
28
|
||||
29 .nlist bex
|
||||
30
|
||||
31 000011 tab= 11
|
||||
32 000012 lf= 12
|
||||
33 000013 vt= 13
|
||||
34 000014 ff= 14
|
||||
35 000015 cr= 15
|
||||
36 000040 space= 40
|
||||
37
|
||||
38 000020 bpmb = 20 ;bytes per macro block
|
||||
39
|
||||
40
|
||||
41
|
||||
42
|
||||
43
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:44: ***ERROR Unknown flag SHR given to .PSECT directive
|
||||
44 .psect .text con, shr, gbl,ins
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:45: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
45 .psect .data con, dat, prv, gbl
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:46: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
46 .psect .bss con, bss, gbl
|
||||
47
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:48: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
48 .psect dpure con, dat, prv, gbl
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:49: ***ERROR Unknown flag PRV given to .PSECT directive
|
||||
49 .psect mixed con, prv, gbl
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:50: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
50 .psect errmes con, dat, prv, gbl
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:51: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
51 .psect impure con, bss, gbl
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:52: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
52 .psect imppas con, bss, gbl
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:53: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
53 .psect implin con, bss, gbl
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:54: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
54 .psect swtsec con, dat, prv, gbl ; unix command line flags
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:55: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
55 .psect cndsec con, dat, prv, gbl ; gt, le, equ, etc. for '.if'
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:56: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
56 .psect crfsec con, dat, prv, gbl ; args for -cr flag
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:57: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
57 .psect edtsec con, dat, prv, gbl ; args for .enabl
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:58: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
58 .psect lctsec con, dat, prv, gbl ; args for .list
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:59: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
59 .psect psasec con, dat, prv, gbl
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:60: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
60 .psect pstsec con, dat, prv, gbl
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:61: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
61 .psect rolbas con, dat, prv, gbl ; core allocation: starts of tables
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:62: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
62 .psect rolsiz con, dat, prv, gbl ; sizes of table entries
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:63: ***ERROR Unknown flag DAT given to .PSECT directive
|
||||
63 .psect roltop con, dat, prv, gbl ; tops of tables
|
||||
./2.11BSD/m11/srch.m11:6->ALWAYS:64: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
64 .psect xpcor con,bss , gbl ; this one MUST come last in core
|
||||
65
|
||||
66
|
||||
67
|
||||
68 .macro entsec name ;init a section
|
||||
69 .psect name con
|
||||
70 .endm entsec
|
||||
71
|
||||
72
|
||||
73
|
||||
74 .macro jeq x,?fred
|
||||
75 bne fred
|
||||
76 jmp x
|
||||
77 fred:
|
||||
78 .endm
|
||||
79 .macro jne x,?fred
|
||||
80 beq fred
|
||||
81 jmp x
|
||||
82 fred:
|
||||
83 .endm
|
||||
84 .macro xitsec
|
||||
85 entsec .text
|
||||
86 .endm xitsec
|
||||
87
|
||||
88
|
||||
89 .macro call address
|
||||
90 jsr pc,address
|
||||
91 .endm
|
||||
92
|
||||
93 .macro return
|
||||
94 rts pc
|
||||
95 .endm
|
||||
96
|
||||
97
|
||||
98 .macro always
|
||||
99 .nlist bex
|
||||
100 .endm always
|
||||
7
|
||||
8 .globl srchi
|
||||
9 .globl search, next, scan, scanc, scanw
|
||||
10 .globl append, insert, zap
|
||||
11 .globl rolndx, rolupd, mactop , symbot
|
||||
12
|
||||
13 .globl symovf
|
||||
14
|
||||
15 .globl xmit0
|
||||
16 .globl symlp, symhp, dumrol
|
||||
17 .globl savreg, symbol
|
||||
18
|
||||
19 .if df rsx11d
|
||||
20 .globl ed.reg, edmask, symrol, regrol, cpopj
|
||||
21 .endc
|
||||
22
|
||||
23 000000 xitsec ;start in default sector
|
||||
1 000000 entsec .text
|
||||
1 000000 .psect .text con
|
||||
24
|
||||
25 srchi: ;search init
|
||||
26 000000 012700 000000G mov #dumrol,r0 ;end of variable rolls
|
||||
27 000004 016760 000000G 000000' 1$: mov symhp,<^pl rolbas>(r0) ;point all to top
|
||||
28 000012 016760 000000G 000000' mov symhp,<^pl roltop>(r0)
|
||||
29 000020 105060 000001' clrb <^pl rolsiz>+1(r0)
|
||||
30 000024 162700 000002 sub #2,r0 ;get next lower
|
||||
31 000030 002365 bge 1$
|
||||
32 000032 016767 000000G 000012' mov symlp,mactop ;bottom is start of macros
|
||||
33 000040 062767 000017 000012' add #bpmb-1,mactop ;must be even
|
||||
34 000046 042767 000017 000012' bic #bpmb-1,mactop
|
||||
35 000054 016767 000000G 000014' mov symhp,symbot ;for sake of 'uplift' <<< REEDS
|
||||
36 000062 016767 000000G 000000G mov symhp,symlp ;symlp should always == symbot [debug, REEDS]
|
||||
37 000070 return
|
||||
1 000070 000207 rts pc
|
||||
37
|
||||
38 .if ndf rsx11d
|
||||
39
|
||||
40 search: ;binary roll search
|
||||
41 call setrol ;set roll registers
|
||||
42 mov r3,-(sp)
|
||||
43 sub r3,r1 ;point one slot low
|
||||
44 mov r2,r3
|
||||
45 sub r1,r3 ;compute size
|
||||
46 clr r0 ;get set to compute search offset
|
||||
47 sec ; (r0 doubles as t/f flag)
|
||||
48 1$: rol r0 ;shift bit
|
||||
49 bic r0,r3 ;clear corresponding bit. last one?
|
||||
50 bne 1$ ; no
|
||||
51 2$: add r0,r1
|
||||
52 3$: asr r0 ;end of iteration, halve offset
|
||||
53 bic #2,r0 ;end?
|
||||
54 beq 7$ ; yes
|
||||
55 4$: cmp r2,r1 ;off in no-mans's land?
|
||||
56 blos 6$ ; yes
|
||||
57 cmp (r4),(r1) ;no, first words match?
|
||||
58 bne 5$ ; no
|
||||
59 cmp 2(r4),2(r1) ;yes, how about second?
|
||||
60 beq 8$ ; yes, found
|
||||
61 5$: bhi 2$ ;no, branch if too high
|
||||
62 6$: sub r0,r1 ;lower index
|
||||
63 br 3$
|
||||
64
|
||||
65 7$: cmp (r1)+,(r1)+ ;point to insertion slot
|
||||
66 8$: mov (sp)+,r3
|
||||
67 br scanx ;exit through scan
|
||||
67
|
||||
68 .iff
|
||||
69
|
||||
70 search:
|
||||
71 000072 call setrol
|
||||
1 000072 004767 001004 jsr pc,setrol
|
||||
72 000076 032767 000000G 000000G bit #ed.reg,edmask ;register definition enabled?
|
||||
73 000104 001017 bne 10$ ;if ne no
|
||||
74 000106 020527 000000G cmp r5,#symrol ;symbol roll?
|
||||
75 000112 001014 bne 10$ ;if ne no
|
||||
76 000114 032714 000007 bit #7,(r4) ;make ruff ruff test bypass 90%
|
||||
77 000120 001011 bne 10$ ;if ne don't check for register
|
||||
78 000122 scan regrol ;scan register roll
|
||||
1 000122 012700 000000G mov #regrol,r0
|
||||
2 .globl scan
|
||||
3 000126 call scan
|
||||
1 000126 004767 000202 jsr pc,scan
|
||||
79 000132 010567 000004' mov r5,rolndx ;restore roll index
|
||||
80 000136 005700 tst r0 ;find symbol?
|
||||
81 000140 001401 beq 10$ ;if eq no find em
|
||||
82 000142 return ;
|
||||
1 000142 000207 rts pc
|
||||
83 000144 010146 10$: mov r1,-(sp) ;save roll base
|
||||
84 000146 020102 cmp r1,r2 ;any in roll?
|
||||
85 000150 001434 beq 5$ ;if eq no
|
||||
86 000152 160302 sub r3,r2 ;calculate high and low bounds
|
||||
87 000154 010100 mov r1,r0 ;
|
||||
88 000156 042716 177770 bic #177770,(sp) ;
|
||||
89 000162 010001 1$: mov r0,r1 ;calculate trial index
|
||||
90 000164 060201 add r2,r1 ;
|
||||
91 000166 006001 ror r1 ;halve result
|
||||
92 000170 042701 000007 bic #7,r1 ;clear garbage bits
|
||||
93 000174 051601 bis (sp),r1 ;
|
||||
94 000176 021114 cmp (r1),(r4) ;compare high parts
|
||||
95 000200 101014 bhi 3$ ;if hi set new high limit
|
||||
96 000202 103405 blo 2$ ;if lo set new low limit
|
||||
97 000204 026164 000002 000002 cmp 2(r1),2(r4) ;compare low parts
|
||||
98 000212 001414 beq 6$ ;if eq hit
|
||||
99 000214 101006 bhi 3$ ;if hi set new high limit
|
||||
100 000216 010100 2$: mov r1,r0 ;set new low limit
|
||||
101 000220 060300 add r3,r0 ;reduce by one more
|
||||
102 000222 020002 cmp r0,r2 ;any more to search?
|
||||
103 000224 101756 blos 1$ ;if los yes
|
||||
104 000226 060301 add r3,r1 ;point to proper entry
|
||||
105 000230 000404 br 5$ ;exit
|
||||
106 000232 010102 3$: mov r1,r2 ;se new high limit
|
||||
107 000234 160302 sub r3,r2 ;reduce by one more
|
||||
108 000236 020002 cmp r0,r2 ;any more to search?
|
||||
109 000240 101750 blos 1$ ;if los yes
|
||||
110 000242 005000 5$: clr r0 ;set false flag
|
||||
111 000244 005726 6$: tst (sp)+ ;clean stack
|
||||
112 000246 000451 br scanx ;vammoosa
|
||||
113
|
||||
114 000250 genedt reg
|
||||
1 000250 entsec edtsec
|
||||
1 000000 .psect edtsec con
|
||||
2 000000 070517 .rad50 /reg/
|
||||
3 .if nb
|
||||
4 .word
|
||||
5 .iff
|
||||
6 000002 000000G .word cpopj
|
||||
7 .endc
|
||||
8 000004 000000G .word ed.reg
|
||||
9 000006 xitsec
|
||||
1 000006 entsec .text
|
||||
1 000250 .psect .text con
|
||||
115
|
||||
116 .endc
|
||||
116
|
||||
117 next: ;get the next entry
|
||||
118 000250 call setrol
|
||||
1 000250 004767 000626 jsr pc,setrol
|
||||
119 000254 016700 000010' mov rolupd,r0
|
||||
120 000260 060001 add r0,r1
|
||||
121 000262 060300 add r3,r0
|
||||
122 000264 020102 cmp r1,r2
|
||||
123 000266 103441 blo scanx
|
||||
124 000270 000437 br scanxf
|
||||
125
|
||||
126 scanw: ;scan one word
|
||||
127 000272 call setrol ;set registers
|
||||
1 000272 004767 000604 jsr pc,setrol
|
||||
128 000276 005000 clr r0 ;assume false
|
||||
129 000300 005200 1$: inc r0 ;tally entry count
|
||||
130 000302 021411 cmp (r4),(r1) ;match?
|
||||
131 000304 001437 beq scany ; yes
|
||||
132 000306 060301 add r3,r1 ;no, increment pointer
|
||||
133 000310 020102 cmp r1,r2 ;finished?
|
||||
134 000312 103772 blo 1$ ; no
|
||||
135 000314 005000 clr r0
|
||||
136 000316 return ;yes, exit false
|
||||
1 000316 000207 rts pc
|
||||
137
|
||||
138 scanc: ;scan continuation
|
||||
139 000320 call setrof ;set regs
|
||||
1 000320 004767 000562 jsr pc,setrof
|
||||
140 000324 016701 000006' mov rolpnt,r1 ;get current pointer
|
||||
141 000330 060301 add r3,r1 ;update
|
||||
142 000332 000402 br scanf ;jump into middle
|
||||
143
|
||||
144 scan: ;linear roll scan
|
||||
145 000334 call setrol ;set roll registers
|
||||
1 000334 004767 000542 jsr pc,setrol
|
||||
146 000340 005000 scanf: clr r0 ;assume false
|
||||
147 000342 020102 1$: cmp r1,r2 ;end?
|
||||
148 000344 103011 bhis scanxf ; yes, exit false
|
||||
149 000346 005200 inc r0
|
||||
150 000350 021411 cmp (r4),(r1) ;no, match on first words?
|
||||
151 000352 001004 bne 2$ ; yes
|
||||
152 000354 026461 000002 000002 cmp 2(r4),2(r1) ;no, how about second?
|
||||
153 000362 001403 beq scanx ; yes
|
||||
154 000364 060301 2$: add r3,r1 ;increment by size
|
||||
155 000366 000765 br 1$
|
||||
156
|
||||
157 .enabl lsb
|
||||
158 000370 005000 scanxf: clr r0 ;false exit
|
||||
159 000372 010167 000006' scanx: mov r1,rolpnt ;set entry pointer
|
||||
160 000376 010067 000010' mov r0,rolupd ;save flag
|
||||
161 000402 001404 beq 1$ ;branch if not found
|
||||
162 000404 010402 scany: mov r4,r2 ;pointer to "symbol"
|
||||
163 000406 005403 neg r3 ;negate entry size
|
||||
164 000410 000163 000000G jmp xmit0(r3) ;found, xfer arguments
|
||||
165
|
||||
166 000414 022424 1$: cmp (r4)+,(r4)+ ;bypass symbol itself
|
||||
167 000416 006203 asr r3 ;get word count
|
||||
168 000420 162703 000002 sub #2,r3 ;compensate for above cmp
|
||||
169 000424 003402 ble 3$ ;branch if end
|
||||
170 000426 005024 2$: clr (r4)+ ;clear word
|
||||
171 000430 077302 sob r3,2$
|
||||
172 000432 3$: return
|
||||
1 000432 000207 rts pc
|
||||
173 .dsabl lsb
|
||||
173
|
||||
174 append: ;append to end of roll
|
||||
175 000434 call setrol
|
||||
1 000434 004767 000442 jsr pc,setrol
|
||||
176 000440 010267 000006' mov r2,rolpnt ;set pointer
|
||||
177 000444 005067 000010' clr rolupd
|
||||
178 000450 000402 br inserf
|
||||
179
|
||||
180 insert: ;insert in roll
|
||||
181 000452 call setrof ;set roll registers (but no arg)
|
||||
1 000452 004767 000430 jsr pc,setrof
|
||||
182 000456 016700 000006' inserf: mov rolpnt,r0 ;points to proper slot
|
||||
183 000462 005767 000010' tst rolupd ;was search true?
|
||||
184 000466 001045 bne 5$ ; yes
|
||||
185 000470 105265 000001' incb <^pl rolsiz>+1(r5) ;update entry count
|
||||
186 000474 060365 000000' add r3,<^pl roltop>(r5) ;update top pointer
|
||||
187 000500 020265 000002' cmp r2,<^pl rolbas>+2(r5) ;gap between rolls?
|
||||
188 000504 001036 bne 5$ ; yes, just stuff it
|
||||
189 000506 016701 000000' mov <^pl rolbas>,r1 ;ditto for separate stack
|
||||
190 000512 010102 mov r1,r2
|
||||
191 000514 160302 sub r3,r2
|
||||
192 000516 010267 000014' mov r2,symbot
|
||||
193 ;cmp r2,mactop ;room?
|
||||
194 ;bhi 1$ ; yes
|
||||
195 ;jmp symovf ;no, error
|
||||
196 000522 012767 000000G 000002' mov #symovf,upbomb ; where to go on error
|
||||
197 000530 call uplift
|
||||
1 000530 004767 000072 jsr pc,uplift
|
||||
198 000534 066700 000000' add upgap,r0
|
||||
199 000540 066701 000000' add upgap,r1
|
||||
200 000544 066702 000000' add upgap,r2
|
||||
201
|
||||
202 ; fall through...
|
||||
203 000550 160100 1$: sub r1,r0 ;compute byte count
|
||||
204 000552 006200 asr r0 ; now word count
|
||||
205 000554 001402 beq 4$ ;branch if first time
|
||||
206
|
||||
207 000556 012122 2$: mov (r1)+,(r2)+ ;move an entry down
|
||||
208 000560 077002 sob r0,2$
|
||||
209 000562 160365 000000' 4$: sub r3,<^pl rolbas>(r5) ;decrement pointers
|
||||
210 000566 160365 000000' sub r3,<^pl roltop>(r5)
|
||||
211 000572 162705 000002 sub #2,r5 ;more rolls?
|
||||
212 000576 002371 bge 4$ ; yes
|
||||
213 000600 010200 mov r2,r0 ;point to insertion slot
|
||||
214 000602 006203 5$: asr r3 ;halve size count
|
||||
215 000604 012420 6$: mov (r4)+,(r0)+ ;move an entry into place
|
||||
216 000606 077302 sob r3,6$ ;loop if not end
|
||||
217 000610 016767 000000' 000014' mov <^pl rolbas>,symbot
|
||||
218 000616 016767 000000' 000000G mov <^pl rolbas>,symlp
|
||||
219 000624 return
|
||||
1 000624 000207 rts pc
|
||||
220
|
||||
221
|
||||
222 .globl $brkad, $brksy ; defined in exec.m11
|
||||
223
|
||||
224 .globl putn
|
||||
225 uplift:: ;<<< REEDS. move all the rolls up in core
|
||||
226 ; can be called from 'insert' above and also
|
||||
227 ; from 'getblk' in mac.m11. Thanks to Steve
|
||||
228 ; Ragle for showing the need for a call from
|
||||
229 ; otherwise growing macros can scribble.
|
||||
230 ; And to Joel Rubin for debugging help.
|
||||
231 .irpc xx,<0123>
|
||||
232 mov r'xx,-(sp)
|
||||
233 .endm
|
||||
1 000626 010046 mov r0,-(sp)
|
||||
2 000630 010146 mov r1,-(sp)
|
||||
3 000632 010246 mov r2,-(sp)
|
||||
4 000634 010346 mov r3,-(sp)
|
||||
234 000636 026767 000014' 000012' cmp symbot,mactop
|
||||
235 000644 101404 blos 10$
|
||||
236 000646 005067 000000' clr upgap
|
||||
237 000652 000167 000174 jmp 99$
|
||||
238 10$: ; go here if symbot <= mactop
|
||||
239
|
||||
240 000656 016767 000000G 000000' mov symhp,upgap ; stash old highest in-space address
|
||||
241 000664 062767 010102 000000G add #10102,symhp
|
||||
242 000672 042767 000077 000000G bic #77,symhp ; click bic rounds to next highest mult of 64
|
||||
243
|
||||
244 000700 016767 000000G 000000G mov symhp,$brkad
|
||||
245 000706 016746 000000G mov $brkad,-(sp)
|
||||
246 000712 005746 tst -(sp)
|
||||
247 000714 000000G $sbrk
|
||||
248 000716 103402 bcs 98$
|
||||
249 000720 022626 cmp (sp)+,(sp)+
|
||||
250 000722 000403 br 1$
|
||||
251 98$:
|
||||
252 000724 022626 cmp (sp)+,(sp)+
|
||||
253 000726 000177 000002' jmp @upbomb ; error bail-out: symovf or macovf
|
||||
254 1$:
|
||||
255 000732 162767 000002 000000G sub #2,symhp ; new highest in-space address
|
||||
256 000740 016700 000000G mov symhp,r0
|
||||
257 000744 016701 000000' mov upgap,r1 ; recall old highest address
|
||||
258 000750 010003 mov r0,r3
|
||||
259 000752 160103 sub r1,r3 ; r3 has the distance syms were shifted
|
||||
260 000754 016702 000000G mov symlp,r2 ; symlp is OLD bottom of symbols.
|
||||
261 000760 005742 tst -(r2) ; r2 ==> word before old bottom
|
||||
262 2$:
|
||||
263 000762 011110 mov (r1),(r0)
|
||||
264 000764 005741 tst -(r1)
|
||||
265 000766 005740 tst -(r0)
|
||||
266 000770 020102 cmp r1,r2
|
||||
267 000772 001373 bne 2$
|
||||
268
|
||||
269 000774 010367 000000' 9$: mov r3,upgap ; how much the syms were lifted
|
||||
270 001000 012700 000000G mov #dumrol,r0 ; swiped from srchi
|
||||
271 001004 060360 000000' 3$: add r3,<^pl rolbas>(r0)
|
||||
272 001010 060360 000000' add r3,<^pl roltop>(r0)
|
||||
273 001014 162700 000002 sub #2,r0
|
||||
274 001020 002371 bge 3$
|
||||
275
|
||||
276 001022 060367 000006' add r3,rolpnt
|
||||
277 001026 060367 000000G add r3,symlp
|
||||
278 001032 016767 000000G 000014' mov symlp,symbot
|
||||
279 001040 005767 000010' tst rolupd
|
||||
280 001044 001402 beq 30$
|
||||
281 001046 060367 000010' add r3,rolupd
|
||||
282 30$:
|
||||
283 99$:
|
||||
284 .irpc xx,<3210>
|
||||
285 mov (sp)+,r'xx
|
||||
286 .endm
|
||||
1 001052 012603 mov (sp)+,r3
|
||||
2 001054 012602 mov (sp)+,r2
|
||||
3 001056 012601 mov (sp)+,r1
|
||||
4 001060 012600 mov (sp)+,r0
|
||||
287 001062 return
|
||||
1 001062 000207 rts pc
|
||||
288
|
||||
289 001064 entsect mixed
|
||||
1 000000 .psect mixed con
|
||||
290 000000 upgap: .blkw
|
||||
291 000002 upbomb:: .blkw ; contains address of error handler
|
||||
292 000004 xitsec
|
||||
1 000004 entsec .text
|
||||
1 001064 .psect .text con
|
||||
292
|
||||
293 zap: ;empty a roll
|
||||
294 001064 call setrol
|
||||
1 001064 004767 000012 jsr pc,setrol
|
||||
295 001070 010165 000000' mov r1,<^pl roltop>(r5) ;make top = bottom
|
||||
296 001074 105065 000001' clrb <^pl rolsiz>+1(r5) ;clear entry count
|
||||
297 001100 return
|
||||
1 001100 000207 rts pc
|
||||
298
|
||||
299
|
||||
300 setrol: ;set roll registers
|
||||
301 001102 010067 000004' mov r0,rolndx ;set argument
|
||||
302 001106 012600 setrof: mov (sp)+,r0 ;save return address
|
||||
303 001110 call savreg ;save registers
|
||||
1 001110 004767 000000G jsr pc,savreg
|
||||
304 001114 010546 mov r5,-(sp) ; and current character
|
||||
305 001116 016705 000004' mov rolndx,r5 ;set index
|
||||
306 001122 016501 000000' mov <^pl rolbas>(r5),r1 ;current base
|
||||
307 001126 016502 000000' mov <^pl roltop>(r5),r2 ;current top
|
||||
308 001132 116503 000000' movb <^pl rolsiz>(r5),r3 ;entry size
|
||||
309 001136 012704 000000G mov #symbol,r4 ;pointer to symbol
|
||||
310 001142 call (r0) ;call proper routine
|
||||
1 001142 004710 jsr pc,(r0)
|
||||
311 001144 012605 mov (sp)+,r5 ;restore current character
|
||||
312 001146 return ; and rest of regs
|
||||
1 001146 000207 rts pc
|
||||
313
|
||||
314 001150 entsec mixed
|
||||
1 000004 .psect mixed con
|
||||
315 000004 rolndx: .blkw ;roll index
|
||||
316 000006 rolpnt: .blkw ;roll pointer
|
||||
317 000010 rolupd: .blkw ;roll update
|
||||
318 000012 mactop: .blkw ;current top of macro storage
|
||||
319 000014 symbot: .blkw ;current bottom of dynamic rolls.
|
||||
320 ; @mactop<=@symbot or uplift will fix it
|
||||
321 000016 xitsec
|
||||
1 000016 entsec .text
|
||||
1 001150 .psect .text con
|
||||
322
|
||||
323 .end
|
||||
323
|
||||
8
|
||||
|
||||
|
||||
Symbol table
|
||||
|
||||
$BRKAD=****** G 2$5 000556R L 002 CR =000015 ROLNDX 000004RG 006 SYMBOL=****** G
|
||||
$BRKSY=****** G 2$6 000762R L 002 DEBUG =000000 ROLPNT 000006R 006 SYMBOT 000014RG 006
|
||||
$SBRK =****** GX 3$1 000232R L 002 DUMROL=****** G ROLUPD 000010RG 006 SYMHP =****** G
|
||||
$TIMDF=000007 3$4 000432R L 002 ED.REG=****** G RSX11D=000000 SYMLP =****** G
|
||||
. ******R 002 3$6 001004R L 002 EDMASK=****** G SAVREG=****** G SYMOVF=****** G
|
||||
1$0 000004R L 002 30$6 001052R L 002 FF =000014 SCAN 000334RG 002 SYMROL=****** G
|
||||
1$1 000162R L 002 4$5 000562R L 002 FT.ID =000001 SCANC 000320RG 002 TAB =000011
|
||||
1$2 000300R L 002 5$1 000242R L 002 FT.UNX=000001 SCANF 000340R 002 UPBOMB 000002RG 006
|
||||
1$3 000342R L 002 5$5 000602R L 002 INSERF 000456R 002 SCANW 000272RG 002 UPGAP 000000R 006
|
||||
1$4 000414R L 002 6$1 000244R L 002 INSERT 000452RG 002 SCANX 000372R 002 UPLIFT 000626RG 002
|
||||
1$5 000550R L 002 6$5 000604R L 002 LF =000012 SCANXF 000370R 002 VT =000013
|
||||
1$6 000732R L 002 9$6 000774R L 002 MACTOP 000012RG 006 SCANY 000404R 002 X40 =000000
|
||||
10$1 000144R L 002 98$6 000724R L 002 MK.SYM=000001 SEARCH 000072RG 002 XMIT0 =****** G
|
||||
10$6 000656R L 002 99$6 001052R L 002 NEXT 000250RG 002 SETROF 001106R 002 ZAP 001064RG 002
|
||||
2$1 000216R L 002 APPEND 000434RG 002 PDPV45=000000 SETROL 001102R 002
|
||||
2$3 000364R L 002 BPMB =000020 PUTN =****** G SPACE =000040
|
||||
2$4 000426R L 002 CPOPJ =****** G REGROL=****** G SRCHI 000000RG 002
|
||||
|
||||
|
||||
Program sections:
|
||||
|
||||
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
|
||||
000000 001 (RW,I,LCL,REL,CON,NOSAV)
|
||||
.TEXT 001150 002 (RW,I,LCL,REL,CON,NOSAV)
|
||||
.DATA 000000 003 (RW,I,LCL,REL,CON,NOSAV)
|
||||
.BSS 000000 004 (RW,I,LCL,REL,CON,NOSAV)
|
||||
DPURE 000000 005 (RW,I,LCL,REL,CON,NOSAV)
|
||||
MIXED 000016 006 (RW,I,LCL,REL,CON,NOSAV)
|
||||
ERRMES 000000 007 (RW,I,LCL,REL,CON,NOSAV)
|
||||
IMPURE 000000 008 (RW,I,LCL,REL,CON,NOSAV)
|
||||
IMPPAS 000000 009 (RW,I,LCL,REL,CON,NOSAV)
|
||||
IMPLIN 000000 010 (RW,I,LCL,REL,CON,NOSAV)
|
||||
SWTSEC 000000 011 (RW,I,LCL,REL,CON,NOSAV)
|
||||
CNDSEC 000000 012 (RW,I,LCL,REL,CON,NOSAV)
|
||||
CRFSEC 000000 013 (RW,I,LCL,REL,CON,NOSAV)
|
||||
EDTSEC 000006 014 (RW,I,LCL,REL,CON,NOSAV)
|
||||
LCTSEC 000000 015 (RW,I,LCL,REL,CON,NOSAV)
|
||||
PSASEC 000000 016 (RW,I,LCL,REL,CON,NOSAV)
|
||||
PSTSEC 000000 017 (RW,I,LCL,REL,CON,NOSAV)
|
||||
ROLBAS 000000 018 (RW,I,LCL,REL,CON,NOSAV)
|
||||
ROLSIZ 000000 019 (RW,I,LCL,REL,CON,NOSAV)
|
||||
ROLTOP 000000 020 (RW,I,LCL,REL,CON,NOSAV)
|
||||
XPCOR 000000 021 (RW,I,LCL,REL,CON,NOSAV)
|
||||
473
tests/2.11BSD-m11-syscalls.lst.ok
Normal file
473
tests/2.11BSD-m11-syscalls.lst.ok
Normal file
@@ -0,0 +1,473 @@
|
||||
1 ;;;; Wrapper for 2.11BSD/m11/syscalls.m11
|
||||
2 .list
|
||||
3 .list
|
||||
4 .list
|
||||
5 .enabl lc
|
||||
6 000001 debug = 1
|
||||
7 .include "2.11BSD/m11/at.sml"
|
||||
1 .title at.sml - assembler/translator system macros
|
||||
2 ; @(#)at.sml 1.3 11/3/82
|
||||
3
|
||||
4 .ident /10may4/
|
||||
5
|
||||
6 .macro always ;all files of macro
|
||||
7
|
||||
8 .macro .data
|
||||
9 entsec .data
|
||||
10 .endm .data
|
||||
11
|
||||
12 .macro .text
|
||||
13 entsec .text
|
||||
14 .endm
|
||||
15
|
||||
16 .macro .bss
|
||||
17 entsec .bss
|
||||
18 .endm
|
||||
19
|
||||
20 mk.symbol=1 ;one to make symbols, 0 otherwise
|
||||
21 x40= 0
|
||||
22 pdpv45= 0 ; host machine has 'mul', 'div', sob' instrucs.
|
||||
23 ; if not you will have to write macros for them
|
||||
24 $timdf= 7 ; California Time Zone
|
||||
25 ; should really use ftime(2) for this and for
|
||||
26 ; DST.
|
||||
27 ;xfltg= 0 ;define to assmbl out floating hardware
|
||||
28 rsx11d = 0 ; rsx11d features
|
||||
29 debug = 0 ; <<< REEDS if non zero includes debug junk
|
||||
30
|
||||
31 ft.id= 1 ;have set i & d. set =0 if not
|
||||
32
|
||||
33 ft.unx = 1 ; this macro-11 is for UNIX. =0 if not.
|
||||
34
|
||||
35 .nlist bex
|
||||
36
|
||||
37 tab= 11
|
||||
38 lf= 12
|
||||
39 vt= 13
|
||||
40 ff= 14
|
||||
41 cr= 15
|
||||
42 space= 40
|
||||
43
|
||||
44 bpmb = 20 ;bytes per macro block
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50 .psect .text con, shr, gbl,ins
|
||||
51 .psect .data con, dat, prv, gbl
|
||||
52 .psect .bss con, bss, gbl
|
||||
53
|
||||
54 .psect dpure con, dat, prv, gbl
|
||||
55 .psect mixed con, prv, gbl
|
||||
56 .psect errmes con, dat, prv, gbl
|
||||
57 .psect impure con, bss, gbl
|
||||
58 .psect imppas con, bss, gbl
|
||||
59 .psect implin con, bss, gbl
|
||||
60 .psect swtsec con, dat, prv, gbl ; unix command line flags
|
||||
61 .psect cndsec con, dat, prv, gbl ; gt, le, equ, etc. for '.if'
|
||||
62 .psect crfsec con, dat, prv, gbl ; args for -cr flag
|
||||
63 .psect edtsec con, dat, prv, gbl ; args for .enabl
|
||||
64 .psect lctsec con, dat, prv, gbl ; args for .list
|
||||
65 .psect psasec con, dat, prv, gbl
|
||||
66 .psect pstsec con, dat, prv, gbl
|
||||
67 .psect rolbas con, dat, prv, gbl ; core allocation: starts of tables
|
||||
68 .psect rolsiz con, dat, prv, gbl ; sizes of table entries
|
||||
69 .psect roltop con, dat, prv, gbl ; tops of tables
|
||||
70 .psect xpcor con,bss , gbl ; this one MUST come last in core
|
||||
71
|
||||
72
|
||||
72
|
||||
73 .macro entsec name ;init a section
|
||||
74 .psect name con
|
||||
75 .endm entsec
|
||||
76
|
||||
77
|
||||
78
|
||||
79 .macro jeq x,?fred
|
||||
80 bne fred
|
||||
81 jmp x
|
||||
82 fred:
|
||||
83 .endm
|
||||
84 .macro jne x,?fred
|
||||
85 beq fred
|
||||
86 jmp x
|
||||
87 fred:
|
||||
88 .endm
|
||||
89 .macro xitsec
|
||||
90 entsec .text
|
||||
91 .endm xitsec
|
||||
92
|
||||
93
|
||||
94 .macro call address
|
||||
95 jsr pc,address
|
||||
96 .endm
|
||||
97
|
||||
98 .macro return
|
||||
99 rts pc
|
||||
100 .endm
|
||||
101
|
||||
102
|
||||
103 .macro always
|
||||
104 .nlist bex
|
||||
105 .endm always
|
||||
106 .endm always
|
||||
107
|
||||
108
|
||||
109 000001 .if ne debug
|
||||
110
|
||||
111 .macro ndebug n
|
||||
112 .globl ndebug,..z
|
||||
113 mov n,..z
|
||||
114 call ndebug
|
||||
115 .endm
|
||||
116
|
||||
117 .macro sdebug string
|
||||
118 .globl sdebug,..z,..zbuf
|
||||
119 x = 0
|
||||
120 .irpc t,<string>
|
||||
121 movb #''t,..zbuf+x
|
||||
122 x = x+1
|
||||
123 .endm
|
||||
124 movb #0,..zbuf+x
|
||||
125 mov #..zbuf,..z
|
||||
126 call sdebug
|
||||
127 .endm
|
||||
128
|
||||
129 .iff
|
||||
130
|
||||
131 .macro ndebug n
|
||||
132 .endm
|
||||
133
|
||||
134 .macro sdebug string
|
||||
135 .endm
|
||||
136
|
||||
137 .endc
|
||||
138
|
||||
139
|
||||
140 .macro param mne, value ;define default parameters
|
||||
141 .iif ndf mne, mne= value
|
||||
142 .list
|
||||
143 mne= mne
|
||||
144 .nlist
|
||||
145 .endm
|
||||
145
|
||||
146 .macro putkb addr ;list to kb
|
||||
147 .globl putkb
|
||||
148 mov addr,r0
|
||||
149 call putkb
|
||||
150 .endm
|
||||
151
|
||||
152 .macro putlp addr ;list to lp
|
||||
153 .globl putlp
|
||||
154 mov addr,r0
|
||||
155 call putlp
|
||||
156 .endm
|
||||
157
|
||||
158 .macro putkbl addr ;list to kb and lp
|
||||
159 .globl putkbl
|
||||
160 mov addr,r0
|
||||
161 call putkbl
|
||||
162 .endm
|
||||
163
|
||||
164
|
||||
165 .macro xmit wrdcnt ;move small # of words
|
||||
166 .globl xmit0
|
||||
167 call xmit0-<wrdcnt*2>
|
||||
168 .endm xmit
|
||||
169
|
||||
170
|
||||
171 ;the macro "genswt" is used to specify a command
|
||||
172 ;string switch (1st argument) and the address of
|
||||
173 ;the routine to be called when encountered (2nd arg).
|
||||
174 ; the switch is made upper-case.
|
||||
175
|
||||
176 .macro genswt mne,addr,?label
|
||||
177 entsec swtsec
|
||||
178 label: .irpc x,mne
|
||||
179 .if ge ''x-141
|
||||
180 .if le ''x-172
|
||||
181 .byte ''x-40
|
||||
182 .iff
|
||||
183 .byte ''x
|
||||
184 .endc
|
||||
185 .iff
|
||||
186 .byte ''x
|
||||
187 .endc
|
||||
188 .endm
|
||||
189 .iif ne <.-label&1>, .byte 0
|
||||
190 .word addr
|
||||
191 xitsec
|
||||
192 .endm
|
||||
192
|
||||
193 .macro zread chan
|
||||
194 .globl zread
|
||||
195 mov #chan'chn,r0
|
||||
196 call zread
|
||||
197 .endm zread
|
||||
198
|
||||
199 .macro zwrite chan
|
||||
200 .globl zwrite
|
||||
201 mov #chan'chn,r0
|
||||
202 call zwrite
|
||||
203 .endm zwrite
|
||||
203
|
||||
204 .macro genedt mne,subr ;gen enable/disable table
|
||||
205 entsec edtsec
|
||||
206 .rad50 /mne/
|
||||
207 .if nb subr
|
||||
208 .word subr
|
||||
209 .iff
|
||||
210 .word cpopj
|
||||
211 .endc
|
||||
212 .word ed.'mne
|
||||
213 xitsec
|
||||
214 .endm genedt
|
||||
215
|
||||
216
|
||||
217 ;the macro "gencnd" is used to specify conditional
|
||||
218 ;arguments. it takes two or three arguments:
|
||||
219
|
||||
220 ; 1- mnemonic
|
||||
221 ; 2- subroutine to be called
|
||||
222 ; 3- if non-blank, complement condition
|
||||
223
|
||||
224 .macro gencnd mne,subr,toggle ;generate conditional
|
||||
225 entsec cndsec
|
||||
226 .rad50 /mne/
|
||||
227 .if b <toggle>
|
||||
228 .word subr
|
||||
229 .iff
|
||||
230 .word subr+1
|
||||
231 .endc
|
||||
232 xitsec
|
||||
233 .endm
|
||||
233
|
||||
234 .macro ch.mne
|
||||
235
|
||||
236 ch.ior= '!
|
||||
237 ch.qtm= '"
|
||||
238 ch.hsh= '#
|
||||
239 ch.dol= '$
|
||||
240 ch.pct= '%
|
||||
241 ch.and= '&
|
||||
242 ch.xcl= ''
|
||||
243
|
||||
244 ch.lp= '(
|
||||
245 ch.rp= ')
|
||||
246 ch.mul= '*
|
||||
247 ch.add= '+
|
||||
248 ch.com= ',
|
||||
249 ch.sub= '-
|
||||
250 ch.dot= '.
|
||||
251 ch.div= '/
|
||||
252
|
||||
253 ch.col= ':
|
||||
254 ch.smc= ';
|
||||
255 ch.lab= '<
|
||||
256 ch.equ= '=
|
||||
257 ch.rab= '>
|
||||
258 ch.qm= '?
|
||||
259
|
||||
260 ch.ind= '@
|
||||
261 ch.bsl= '\
|
||||
262 ch.uar= '^
|
||||
263
|
||||
264 let.a= 'a&^c40
|
||||
265 let.b= 'b&^c40
|
||||
266 let.c= 'c&^c40
|
||||
267 let.d= 'd&^c40
|
||||
268 let.e= 'e&^c40
|
||||
269 let.f= 'f&^c40
|
||||
270 let.g= 'g&^c40
|
||||
271 let.o= 'o&^c40
|
||||
272 let.p= 'p&^c40
|
||||
273 let.r= 'r&^c40
|
||||
274 let.z= 'z&^c40
|
||||
275
|
||||
276 dig.0= '0
|
||||
277 dig.9= '9
|
||||
278 .macro ch.mne
|
||||
279 .endm ch.mne
|
||||
280 .endm ch.mne
|
||||
281
|
||||
282 .macro error num,arg, mess ,?x
|
||||
283 sdebug <num>
|
||||
284 .globl err.'arg,ern'num, errbts,errref
|
||||
285 .if b <mess>
|
||||
286 deliberate error mistake
|
||||
287 .endc
|
||||
288 .if dif 0,num
|
||||
289 .globl err.xx
|
||||
290 tst err.xx
|
||||
291 bne x
|
||||
292 mov #ern'num,err.xx
|
||||
293 x:
|
||||
294 .endc
|
||||
295 bis #err.'arg,errbts
|
||||
296 .endm
|
||||
297
|
||||
298
|
||||
299
|
||||
300 .macro setnz addr ;set addr to non-zero for t/f flags
|
||||
301 mov sp,addr
|
||||
302 .endm
|
||||
303
|
||||
304
|
||||
305 .macro bisbic arg ; used by .list/.nlist, .enabl/.dsabl
|
||||
306 .globl bisbic
|
||||
307 mov #arg,-(sp)
|
||||
308 call bisbic
|
||||
309 tst (sp)+
|
||||
310 .endm
|
||||
310
|
||||
311 ;roll handler calls
|
||||
312
|
||||
313 .macro search rolnum ;binary search
|
||||
314 mov #rolnum,r0
|
||||
315 .globl search
|
||||
316 call search
|
||||
317 .endm
|
||||
318
|
||||
319 .macro scan rolnum ;linear scan
|
||||
320 mov #rolnum,r0
|
||||
321 .globl scan
|
||||
322 call scan
|
||||
323 .endm
|
||||
324
|
||||
325 .macro scanw rolnum ;linear scan, one word
|
||||
326 mov #rolnum,r0
|
||||
327 .globl scanw
|
||||
328 call scanw
|
||||
329 .endm
|
||||
330
|
||||
331 .macro next rolnum ;fetch next entry
|
||||
332 mov #rolnum,r0
|
||||
333 .globl next
|
||||
334 call next
|
||||
335 .endm
|
||||
336
|
||||
337 .macro append rolnum ;append to end of roll
|
||||
338 mov #rolnum,r0
|
||||
339 .globl append
|
||||
340 call append
|
||||
341 .endm
|
||||
342
|
||||
343 .macro zap rolnum ;clear roll
|
||||
344 mov #rolnum,r0
|
||||
345 .globl zap
|
||||
346 call zap
|
||||
347 .endm
|
||||
348
|
||||
349 ; call insert ;insert (must be preceded by one
|
||||
350 ;of the above to set pointers)
|
||||
351 ; call setrol ;save and set regs for above
|
||||
351
|
||||
352 ;flags used in symbol table mode
|
||||
353
|
||||
354 .macro st.flg
|
||||
355
|
||||
356 .if le ft.unx
|
||||
357
|
||||
358 ovrflg= 000004 ;overlay (psect only)
|
||||
359 defflg= 000010 ;defined
|
||||
360 relflg= 000040 ;relocatable
|
||||
361 glbflg= 000100 ;global
|
||||
362 dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
363
|
||||
364
|
||||
365 .endc
|
||||
366
|
||||
367 .if gt ft.unx
|
||||
368
|
||||
369 ; ****** these should not be changed!! ******
|
||||
370 shrflg= 000001 ;shareable (psect only)
|
||||
371 .if gt ft.id
|
||||
372 insflg= shrflg*2 ;instruction space (psect only)
|
||||
373 bssflg= insflg*2 ;blank section (psect only)
|
||||
374 m.idf= shrflg!insflg!bssflg ;mask to turn them off
|
||||
375 .iff
|
||||
376 bssflg= shrflg*2
|
||||
377 m.idf= shrflg!bssflg
|
||||
378 .endc
|
||||
379 b.idf= 1 ;shift count to make above bits word offset
|
||||
380 ; ***********************************
|
||||
381 defflg= 000010 ;defined
|
||||
382 ovrflg= 000020 ;overlay (psect only)
|
||||
383 relflg= 000040 ;relocatable
|
||||
384 glbflg= 000100 ;global
|
||||
385 dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
386
|
||||
387 .endc
|
||||
388
|
||||
389 ;
|
||||
390 ; default psect attribs.
|
||||
391 ; can be changed, but make sure all customers know about
|
||||
392 ; it, including all the linkers.
|
||||
393 ;
|
||||
394 pattrs=relflg!defflg ; For .psects and blank .csects
|
||||
395 aattrs=glbflg!defflg!ovrflg ; For .asect
|
||||
396 cattrs=glbflg!relflg!defflg!ovrflg ; For named .csects
|
||||
397
|
||||
398 regflg= 000001 ;register
|
||||
399 lblflg= 000002 ;label
|
||||
400 mdfflg= 000004 ;multilpy defined
|
||||
401 .macro st.flg
|
||||
402 .endm
|
||||
403 .endm st.flg
|
||||
404
|
||||
405
|
||||
406
|
||||
407 .macro ct.mne
|
||||
408 .globl cttbl
|
||||
409 ct.eol = 000 ; eol
|
||||
410 ct.com = 001 ; comma
|
||||
411 ct.tab = 002 ; tab
|
||||
412 ct.sp = 004 ; space
|
||||
413 ct.pcx = 010 ; printing character
|
||||
414 ct.num = 020 ; numeric
|
||||
415 ct.alp = 040 ; alpha, dot, dollar
|
||||
416 ct.lc = 100 ; lower case alpha
|
||||
417 ct.smc = 200 ; semi-colon (sign bit)
|
||||
418
|
||||
419 ct.pc = ct.com!ct.smc!ct.pcx!ct.num!ct.alp
|
||||
420 .macro ct.mne
|
||||
421 .endm ct.mne
|
||||
422 .endm ct.mne
|
||||
423
|
||||
424
|
||||
425 .end
|
||||
425
|
||||
8 .include "2.11BSD/m11/syscalls.m11"
|
||||
1 .globl $creat, $open, $close, $exit, $read, $write, $sbrk
|
||||
2 .globl $seek, $gettod, $fork, $wait, $execv
|
||||
3
|
||||
4 104401 $exit = ^O104401
|
||||
5 104402 $fork = ^O104402
|
||||
6 104403 $read = ^O104403
|
||||
7 104404 $write = ^O104404
|
||||
8 104405 $open = ^O104405
|
||||
9 104406 $close = ^O104406
|
||||
10 104524 $wait = ^O104524
|
||||
11 104410 $creat = ^O104410
|
||||
12 104413 $execv = ^O104413
|
||||
13 104564 $gettod = ^O104564
|
||||
14 104505 $sbrk = ^O104505
|
||||
15 104423 $seek = ^O104423
|
||||
16
|
||||
17 .end
|
||||
17
|
||||
8
|
||||
|
||||
|
||||
Symbol table
|
||||
|
||||
$CLOSE=104406 G $EXIT =104401 G $OPEN =104405 G $SEEK =104423 G . ******R 001
|
||||
$CREAT=104410 G $FORK =104402 G $READ =104403 G $WAIT =104524 G DEBUG =000001
|
||||
$EXECV=104413 G $GETTO=104564 G $SBRK =104505 G $WRITE=104404 G
|
||||
|
||||
|
||||
Program sections:
|
||||
|
||||
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
|
||||
000000 001 (RW,I,LCL,REL,CON,NOSAV)
|
||||
3089
tests/2.11BSD-m11-xlat.lst.ok
Normal file
3089
tests/2.11BSD-m11-xlat.lst.ok
Normal file
File diff suppressed because it is too large
Load Diff
472
tests/2.11BSD-m11-xpcor.lst.ok
Normal file
472
tests/2.11BSD-m11-xpcor.lst.ok
Normal file
@@ -0,0 +1,472 @@
|
||||
1 ;;;; Wrapper for 2.11BSD/m11/xpcor.m11
|
||||
2 .list
|
||||
3 .list
|
||||
4 .list
|
||||
5 .enabl lc
|
||||
6 000001 debug = 1
|
||||
7 .include "2.11BSD/m11/at.sml"
|
||||
1 .title at.sml - assembler/translator system macros
|
||||
2 ; @(#)at.sml 1.3 11/3/82
|
||||
3
|
||||
4 .ident /10may4/
|
||||
5
|
||||
6 .macro always ;all files of macro
|
||||
7
|
||||
8 .macro .data
|
||||
9 entsec .data
|
||||
10 .endm .data
|
||||
11
|
||||
12 .macro .text
|
||||
13 entsec .text
|
||||
14 .endm
|
||||
15
|
||||
16 .macro .bss
|
||||
17 entsec .bss
|
||||
18 .endm
|
||||
19
|
||||
20 mk.symbol=1 ;one to make symbols, 0 otherwise
|
||||
21 x40= 0
|
||||
22 pdpv45= 0 ; host machine has 'mul', 'div', sob' instrucs.
|
||||
23 ; if not you will have to write macros for them
|
||||
24 $timdf= 7 ; California Time Zone
|
||||
25 ; should really use ftime(2) for this and for
|
||||
26 ; DST.
|
||||
27 ;xfltg= 0 ;define to assmbl out floating hardware
|
||||
28 rsx11d = 0 ; rsx11d features
|
||||
29 debug = 0 ; <<< REEDS if non zero includes debug junk
|
||||
30
|
||||
31 ft.id= 1 ;have set i & d. set =0 if not
|
||||
32
|
||||
33 ft.unx = 1 ; this macro-11 is for UNIX. =0 if not.
|
||||
34
|
||||
35 .nlist bex
|
||||
36
|
||||
37 tab= 11
|
||||
38 lf= 12
|
||||
39 vt= 13
|
||||
40 ff= 14
|
||||
41 cr= 15
|
||||
42 space= 40
|
||||
43
|
||||
44 bpmb = 20 ;bytes per macro block
|
||||
45
|
||||
46
|
||||
47
|
||||
48
|
||||
49
|
||||
50 .psect .text con, shr, gbl,ins
|
||||
51 .psect .data con, dat, prv, gbl
|
||||
52 .psect .bss con, bss, gbl
|
||||
53
|
||||
54 .psect dpure con, dat, prv, gbl
|
||||
55 .psect mixed con, prv, gbl
|
||||
56 .psect errmes con, dat, prv, gbl
|
||||
57 .psect impure con, bss, gbl
|
||||
58 .psect imppas con, bss, gbl
|
||||
59 .psect implin con, bss, gbl
|
||||
60 .psect swtsec con, dat, prv, gbl ; unix command line flags
|
||||
61 .psect cndsec con, dat, prv, gbl ; gt, le, equ, etc. for '.if'
|
||||
62 .psect crfsec con, dat, prv, gbl ; args for -cr flag
|
||||
63 .psect edtsec con, dat, prv, gbl ; args for .enabl
|
||||
64 .psect lctsec con, dat, prv, gbl ; args for .list
|
||||
65 .psect psasec con, dat, prv, gbl
|
||||
66 .psect pstsec con, dat, prv, gbl
|
||||
67 .psect rolbas con, dat, prv, gbl ; core allocation: starts of tables
|
||||
68 .psect rolsiz con, dat, prv, gbl ; sizes of table entries
|
||||
69 .psect roltop con, dat, prv, gbl ; tops of tables
|
||||
70 .psect xpcor con,bss , gbl ; this one MUST come last in core
|
||||
71
|
||||
72
|
||||
72
|
||||
73 .macro entsec name ;init a section
|
||||
74 .psect name con
|
||||
75 .endm entsec
|
||||
76
|
||||
77
|
||||
78
|
||||
79 .macro jeq x,?fred
|
||||
80 bne fred
|
||||
81 jmp x
|
||||
82 fred:
|
||||
83 .endm
|
||||
84 .macro jne x,?fred
|
||||
85 beq fred
|
||||
86 jmp x
|
||||
87 fred:
|
||||
88 .endm
|
||||
89 .macro xitsec
|
||||
90 entsec .text
|
||||
91 .endm xitsec
|
||||
92
|
||||
93
|
||||
94 .macro call address
|
||||
95 jsr pc,address
|
||||
96 .endm
|
||||
97
|
||||
98 .macro return
|
||||
99 rts pc
|
||||
100 .endm
|
||||
101
|
||||
102
|
||||
103 .macro always
|
||||
104 .nlist bex
|
||||
105 .endm always
|
||||
106 .endm always
|
||||
107
|
||||
108
|
||||
109 000001 .if ne debug
|
||||
110
|
||||
111 .macro ndebug n
|
||||
112 .globl ndebug,..z
|
||||
113 mov n,..z
|
||||
114 call ndebug
|
||||
115 .endm
|
||||
116
|
||||
117 .macro sdebug string
|
||||
118 .globl sdebug,..z,..zbuf
|
||||
119 x = 0
|
||||
120 .irpc t,<string>
|
||||
121 movb #''t,..zbuf+x
|
||||
122 x = x+1
|
||||
123 .endm
|
||||
124 movb #0,..zbuf+x
|
||||
125 mov #..zbuf,..z
|
||||
126 call sdebug
|
||||
127 .endm
|
||||
128
|
||||
129 .iff
|
||||
130
|
||||
131 .macro ndebug n
|
||||
132 .endm
|
||||
133
|
||||
134 .macro sdebug string
|
||||
135 .endm
|
||||
136
|
||||
137 .endc
|
||||
138
|
||||
139
|
||||
140 .macro param mne, value ;define default parameters
|
||||
141 .iif ndf mne, mne= value
|
||||
142 .list
|
||||
143 mne= mne
|
||||
144 .nlist
|
||||
145 .endm
|
||||
145
|
||||
146 .macro putkb addr ;list to kb
|
||||
147 .globl putkb
|
||||
148 mov addr,r0
|
||||
149 call putkb
|
||||
150 .endm
|
||||
151
|
||||
152 .macro putlp addr ;list to lp
|
||||
153 .globl putlp
|
||||
154 mov addr,r0
|
||||
155 call putlp
|
||||
156 .endm
|
||||
157
|
||||
158 .macro putkbl addr ;list to kb and lp
|
||||
159 .globl putkbl
|
||||
160 mov addr,r0
|
||||
161 call putkbl
|
||||
162 .endm
|
||||
163
|
||||
164
|
||||
165 .macro xmit wrdcnt ;move small # of words
|
||||
166 .globl xmit0
|
||||
167 call xmit0-<wrdcnt*2>
|
||||
168 .endm xmit
|
||||
169
|
||||
170
|
||||
171 ;the macro "genswt" is used to specify a command
|
||||
172 ;string switch (1st argument) and the address of
|
||||
173 ;the routine to be called when encountered (2nd arg).
|
||||
174 ; the switch is made upper-case.
|
||||
175
|
||||
176 .macro genswt mne,addr,?label
|
||||
177 entsec swtsec
|
||||
178 label: .irpc x,mne
|
||||
179 .if ge ''x-141
|
||||
180 .if le ''x-172
|
||||
181 .byte ''x-40
|
||||
182 .iff
|
||||
183 .byte ''x
|
||||
184 .endc
|
||||
185 .iff
|
||||
186 .byte ''x
|
||||
187 .endc
|
||||
188 .endm
|
||||
189 .iif ne <.-label&1>, .byte 0
|
||||
190 .word addr
|
||||
191 xitsec
|
||||
192 .endm
|
||||
192
|
||||
193 .macro zread chan
|
||||
194 .globl zread
|
||||
195 mov #chan'chn,r0
|
||||
196 call zread
|
||||
197 .endm zread
|
||||
198
|
||||
199 .macro zwrite chan
|
||||
200 .globl zwrite
|
||||
201 mov #chan'chn,r0
|
||||
202 call zwrite
|
||||
203 .endm zwrite
|
||||
203
|
||||
204 .macro genedt mne,subr ;gen enable/disable table
|
||||
205 entsec edtsec
|
||||
206 .rad50 /mne/
|
||||
207 .if nb subr
|
||||
208 .word subr
|
||||
209 .iff
|
||||
210 .word cpopj
|
||||
211 .endc
|
||||
212 .word ed.'mne
|
||||
213 xitsec
|
||||
214 .endm genedt
|
||||
215
|
||||
216
|
||||
217 ;the macro "gencnd" is used to specify conditional
|
||||
218 ;arguments. it takes two or three arguments:
|
||||
219
|
||||
220 ; 1- mnemonic
|
||||
221 ; 2- subroutine to be called
|
||||
222 ; 3- if non-blank, complement condition
|
||||
223
|
||||
224 .macro gencnd mne,subr,toggle ;generate conditional
|
||||
225 entsec cndsec
|
||||
226 .rad50 /mne/
|
||||
227 .if b <toggle>
|
||||
228 .word subr
|
||||
229 .iff
|
||||
230 .word subr+1
|
||||
231 .endc
|
||||
232 xitsec
|
||||
233 .endm
|
||||
233
|
||||
234 .macro ch.mne
|
||||
235
|
||||
236 ch.ior= '!
|
||||
237 ch.qtm= '"
|
||||
238 ch.hsh= '#
|
||||
239 ch.dol= '$
|
||||
240 ch.pct= '%
|
||||
241 ch.and= '&
|
||||
242 ch.xcl= ''
|
||||
243
|
||||
244 ch.lp= '(
|
||||
245 ch.rp= ')
|
||||
246 ch.mul= '*
|
||||
247 ch.add= '+
|
||||
248 ch.com= ',
|
||||
249 ch.sub= '-
|
||||
250 ch.dot= '.
|
||||
251 ch.div= '/
|
||||
252
|
||||
253 ch.col= ':
|
||||
254 ch.smc= ';
|
||||
255 ch.lab= '<
|
||||
256 ch.equ= '=
|
||||
257 ch.rab= '>
|
||||
258 ch.qm= '?
|
||||
259
|
||||
260 ch.ind= '@
|
||||
261 ch.bsl= '\
|
||||
262 ch.uar= '^
|
||||
263
|
||||
264 let.a= 'a&^c40
|
||||
265 let.b= 'b&^c40
|
||||
266 let.c= 'c&^c40
|
||||
267 let.d= 'd&^c40
|
||||
268 let.e= 'e&^c40
|
||||
269 let.f= 'f&^c40
|
||||
270 let.g= 'g&^c40
|
||||
271 let.o= 'o&^c40
|
||||
272 let.p= 'p&^c40
|
||||
273 let.r= 'r&^c40
|
||||
274 let.z= 'z&^c40
|
||||
275
|
||||
276 dig.0= '0
|
||||
277 dig.9= '9
|
||||
278 .macro ch.mne
|
||||
279 .endm ch.mne
|
||||
280 .endm ch.mne
|
||||
281
|
||||
282 .macro error num,arg, mess ,?x
|
||||
283 sdebug <num>
|
||||
284 .globl err.'arg,ern'num, errbts,errref
|
||||
285 .if b <mess>
|
||||
286 deliberate error mistake
|
||||
287 .endc
|
||||
288 .if dif 0,num
|
||||
289 .globl err.xx
|
||||
290 tst err.xx
|
||||
291 bne x
|
||||
292 mov #ern'num,err.xx
|
||||
293 x:
|
||||
294 .endc
|
||||
295 bis #err.'arg,errbts
|
||||
296 .endm
|
||||
297
|
||||
298
|
||||
299
|
||||
300 .macro setnz addr ;set addr to non-zero for t/f flags
|
||||
301 mov sp,addr
|
||||
302 .endm
|
||||
303
|
||||
304
|
||||
305 .macro bisbic arg ; used by .list/.nlist, .enabl/.dsabl
|
||||
306 .globl bisbic
|
||||
307 mov #arg,-(sp)
|
||||
308 call bisbic
|
||||
309 tst (sp)+
|
||||
310 .endm
|
||||
310
|
||||
311 ;roll handler calls
|
||||
312
|
||||
313 .macro search rolnum ;binary search
|
||||
314 mov #rolnum,r0
|
||||
315 .globl search
|
||||
316 call search
|
||||
317 .endm
|
||||
318
|
||||
319 .macro scan rolnum ;linear scan
|
||||
320 mov #rolnum,r0
|
||||
321 .globl scan
|
||||
322 call scan
|
||||
323 .endm
|
||||
324
|
||||
325 .macro scanw rolnum ;linear scan, one word
|
||||
326 mov #rolnum,r0
|
||||
327 .globl scanw
|
||||
328 call scanw
|
||||
329 .endm
|
||||
330
|
||||
331 .macro next rolnum ;fetch next entry
|
||||
332 mov #rolnum,r0
|
||||
333 .globl next
|
||||
334 call next
|
||||
335 .endm
|
||||
336
|
||||
337 .macro append rolnum ;append to end of roll
|
||||
338 mov #rolnum,r0
|
||||
339 .globl append
|
||||
340 call append
|
||||
341 .endm
|
||||
342
|
||||
343 .macro zap rolnum ;clear roll
|
||||
344 mov #rolnum,r0
|
||||
345 .globl zap
|
||||
346 call zap
|
||||
347 .endm
|
||||
348
|
||||
349 ; call insert ;insert (must be preceded by one
|
||||
350 ;of the above to set pointers)
|
||||
351 ; call setrol ;save and set regs for above
|
||||
351
|
||||
352 ;flags used in symbol table mode
|
||||
353
|
||||
354 .macro st.flg
|
||||
355
|
||||
356 .if le ft.unx
|
||||
357
|
||||
358 ovrflg= 000004 ;overlay (psect only)
|
||||
359 defflg= 000010 ;defined
|
||||
360 relflg= 000040 ;relocatable
|
||||
361 glbflg= 000100 ;global
|
||||
362 dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
363
|
||||
364
|
||||
365 .endc
|
||||
366
|
||||
367 .if gt ft.unx
|
||||
368
|
||||
369 ; ****** these should not be changed!! ******
|
||||
370 shrflg= 000001 ;shareable (psect only)
|
||||
371 .if gt ft.id
|
||||
372 insflg= shrflg*2 ;instruction space (psect only)
|
||||
373 bssflg= insflg*2 ;blank section (psect only)
|
||||
374 m.idf= shrflg!insflg!bssflg ;mask to turn them off
|
||||
375 .iff
|
||||
376 bssflg= shrflg*2
|
||||
377 m.idf= shrflg!bssflg
|
||||
378 .endc
|
||||
379 b.idf= 1 ;shift count to make above bits word offset
|
||||
380 ; ***********************************
|
||||
381 defflg= 000010 ;defined
|
||||
382 ovrflg= 000020 ;overlay (psect only)
|
||||
383 relflg= 000040 ;relocatable
|
||||
384 glbflg= 000100 ;global
|
||||
385 dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
386
|
||||
387 .endc
|
||||
388
|
||||
389 ;
|
||||
390 ; default psect attribs.
|
||||
391 ; can be changed, but make sure all customers know about
|
||||
392 ; it, including all the linkers.
|
||||
393 ;
|
||||
394 pattrs=relflg!defflg ; For .psects and blank .csects
|
||||
395 aattrs=glbflg!defflg!ovrflg ; For .asect
|
||||
396 cattrs=glbflg!relflg!defflg!ovrflg ; For named .csects
|
||||
397
|
||||
398 regflg= 000001 ;register
|
||||
399 lblflg= 000002 ;label
|
||||
400 mdfflg= 000004 ;multilpy defined
|
||||
401 .macro st.flg
|
||||
402 .endm
|
||||
403 .endm st.flg
|
||||
404
|
||||
405
|
||||
406
|
||||
407 .macro ct.mne
|
||||
408 .globl cttbl
|
||||
409 ct.eol = 000 ; eol
|
||||
410 ct.com = 001 ; comma
|
||||
411 ct.tab = 002 ; tab
|
||||
412 ct.sp = 004 ; space
|
||||
413 ct.pcx = 010 ; printing character
|
||||
414 ct.num = 020 ; numeric
|
||||
415 ct.alp = 040 ; alpha, dot, dollar
|
||||
416 ct.lc = 100 ; lower case alpha
|
||||
417 ct.smc = 200 ; semi-colon (sign bit)
|
||||
418
|
||||
419 ct.pc = ct.com!ct.smc!ct.pcx!ct.num!ct.alp
|
||||
420 .macro ct.mne
|
||||
421 .endm ct.mne
|
||||
422 .endm ct.mne
|
||||
423
|
||||
424
|
||||
425 .end
|
||||
425
|
||||
8 .include "2.11BSD/m11/xpcor.m11"
|
||||
1 .title xpcor
|
||||
2
|
||||
3 ;this file must be linked last to ensure that it is the last
|
||||
4 ;sector in the BSS area.
|
||||
5
|
||||
6
|
||||
7 .globl inicor
|
||||
8
|
||||
9 005670 inicor= 3000. ;initial minimum # words for symbol table, etc.
|
||||
10
|
||||
./2.11BSD/m11/xpcor.m11:11: ***ERROR Unknown flag BSS given to .PSECT directive
|
||||
11 .psect xpcor, con, bss, gbl
|
||||
12
|
||||
13
|
||||
14 000000 .blkw inicor
|
||||
15
|
||||
16 .end
|
||||
16
|
||||
8
|
||||
|
||||
|
||||
Symbol table
|
||||
|
||||
. ******R 001 DEBUG =000001 INICOR=005670 G
|
||||
|
||||
|
||||
Program sections:
|
||||
|
||||
. ABS. 000000 000 (RW,I,GBL,ABS,OVR,NOSAV)
|
||||
013560 001 (RW,I,LCL,REL,CON,NOSAV)
|
||||
XPCOR 000000 002 (RW,I,LCL,REL,CON,NOSAV)
|
||||
7
tests/2.11BSD/00SOURCE
Normal file
7
tests/2.11BSD/00SOURCE
Normal file
@@ -0,0 +1,7 @@
|
||||
2.11BSD is patch level 431, dated April 2000.
|
||||
|
||||
ftp://minnie.tuhs.org/UnixArchive/PDP-11/Trees/2.11BSD/usr/src/new/
|
||||
or
|
||||
http://minnie.tuhs.org/Archive/PDP-11/Trees/2.11BSD/usr/src/new/
|
||||
or
|
||||
http://minnie.tuhs.org/cgi-bin/utree.pl?file=2.11BSD/src/new
|
||||
287
tests/2.11BSD/m11/Document
Normal file
287
tests/2.11BSD/m11/Document
Normal file
@@ -0,0 +1,287 @@
|
||||
.RP
|
||||
.TL
|
||||
New UCB
|
||||
.UX
|
||||
Edition of
|
||||
.I m11
|
||||
Assembler
|
||||
.AU
|
||||
Jim Reeds
|
||||
.AI
|
||||
Statistics Department
|
||||
Univerity of California
|
||||
Berkeley
|
||||
.AB
|
||||
A new edition of the old Harvard
|
||||
.UX
|
||||
implementation of the
|
||||
.I Macro-11
|
||||
assembler for PDP-11 computers is now available.
|
||||
This document gives, in terse form, a list of features in the new
|
||||
assembler.
|
||||
The reader is assumed to have some prior knowledge of Macro-11,
|
||||
for instance by having previously read the DEC Macro-11 manual.
|
||||
.AE
|
||||
.SH
|
||||
History
|
||||
.PP
|
||||
Harvard modified
|
||||
an old (circa 1974) DEC implementation of Macro-11
|
||||
to run on
|
||||
.UX
|
||||
in the mid 1970's.
|
||||
They called it
|
||||
.I macro,
|
||||
but at Berkeley this program has been known as
|
||||
.I m11.
|
||||
I modified it further, borrowing features supported in current DEC
|
||||
assemblers.
|
||||
In the course of this work I found many bugs in the original
|
||||
.I m11
|
||||
and many cases of disagreement between the DEC Macro-11 manuals and the
|
||||
.I m11
|
||||
program.
|
||||
I have tried to fix as many of these as I could.
|
||||
.SH
|
||||
Assembler Directives
|
||||
.PP
|
||||
The following is a list of all the directives supported by
|
||||
.I m11.
|
||||
Most work as described in the DEC manuals.
|
||||
One directive implemented in all DEC assemblers but not documented
|
||||
is the
|
||||
.I .rem
|
||||
directive.
|
||||
Its use is illustrated by the following example:
|
||||
.DS
|
||||
call sub1
|
||||
call sub2
|
||||
\\.rem &
|
||||
mov #message,-(sp)
|
||||
call errpr
|
||||
tst (sp)+
|
||||
&
|
||||
call sub3
|
||||
.DE
|
||||
Here the text following the
|
||||
.I rem
|
||||
directive up through the second & sign is a comment.
|
||||
Any character may play the role of &.
|
||||
Another undocumented fact about all DEC Macro-11 assemblers
|
||||
is the fact that the
|
||||
.I .endm
|
||||
and
|
||||
.I .endr
|
||||
directives are complete synonyms and may be used interchangeably, as in
|
||||
.DS
|
||||
\\.macro call1 func, arg
|
||||
mov arg,-(sp)
|
||||
call func
|
||||
tst (sp)+
|
||||
\\.endr
|
||||
.DE
|
||||
in violation of the rules given in the DEC manuals.
|
||||
The directives are:
|
||||
.DS
|
||||
ascii asciz asect blkb
|
||||
blkw byte csect dsabl
|
||||
enabl end endc endm
|
||||
endr eot error even
|
||||
flt2 flt4 globl ident
|
||||
if ifdf ifeq iff
|
||||
ifg ifge ifgt ifl
|
||||
ifle iflt ifndf ifne
|
||||
ifnz ift iftf ifz
|
||||
iif irp irpc limit
|
||||
list macr macro mcall
|
||||
mexit narg nchr nlist
|
||||
ntype odd page print
|
||||
psect radix rad50 rem
|
||||
rept sbttl title word
|
||||
.DE
|
||||
.SH
|
||||
Op Codes
|
||||
.PP
|
||||
The following is a list of op codes supported by
|
||||
.I m11.
|
||||
Consult the PDP Procssor Handbook for details.
|
||||
One new feature of recent DEC assemblers and of the new version
|
||||
of
|
||||
.I m11
|
||||
is the use of the short-hand opcodes
|
||||
.I call
|
||||
and
|
||||
.I return,
|
||||
which are simply the
|
||||
.I jsr
|
||||
and
|
||||
.I rts
|
||||
opcodes with use of the
|
||||
.I pc
|
||||
enforced.
|
||||
.DS
|
||||
absd absf adc adcb add addd addf ash
|
||||
ashc asl aslb asr asrb bcc bcs beq
|
||||
bge bgt bhi bhis bic bicb bis bisb
|
||||
bit bitb ble blo blos blt bmi bne
|
||||
bpl bpt br bvc bvs call ccc cfcc
|
||||
clc cln clr clrb clrd clrf clv clz
|
||||
cmp cmpb cmpd cmpf cnz com comb dec
|
||||
decb div divd divf emt fadd fdiv fmul
|
||||
fsub halt inc incb iot jmp jsr ldcdf
|
||||
ldcfd ldcid ldcif ldcld ldclf ldd ldexp ldf
|
||||
ldfps ldsc ldub mark mfpd mfpi modd modf
|
||||
mov movb mtpd mtpi mul muld mulf neg
|
||||
negb negd negf nop reset return rol rolb
|
||||
ror rorb rti rts rtt sbc sbcb scc
|
||||
sec sen setd setf seti setl sev sez
|
||||
sob spl sta0 stb0 stcdf stcdi stcdl stcfd
|
||||
stcfi stcfl std stexp stf stfps stq0 stst
|
||||
sub subd subf swab sxt trap tst tstb
|
||||
tstd tstf wait xor
|
||||
.DE
|
||||
.SH
|
||||
.UX
|
||||
Command Line Arguments
|
||||
.PP
|
||||
.DS
|
||||
.DE
|
||||
.PP
|
||||
The list of valid arguments to the
|
||||
.I -cr
|
||||
flag is
|
||||
.DS
|
||||
s sy sym
|
||||
r re reg
|
||||
m ma mac
|
||||
p pe per pst
|
||||
c cs cse sec pse
|
||||
e er err
|
||||
.DE
|
||||
.SH
|
||||
Psect Attributes
|
||||
.PP
|
||||
Psect attributes are coded by bits in a byte.
|
||||
The various attribute arguments turn selected bits on and selected
|
||||
bits off.
|
||||
This attribute byte is interpreted by the loader.
|
||||
The following three kinds of program sections each have their own
|
||||
default attributes.
|
||||
These defaults can be changed by the system manager.
|
||||
The user can override them by using the
|
||||
.I -dp,
|
||||
.I -dc,
|
||||
and
|
||||
.I -da
|
||||
command line flags.
|
||||
.IP
|
||||
Blank
|
||||
.I csects
|
||||
and all
|
||||
.I .psects
|
||||
have the default attribute
|
||||
.I relocatable.
|
||||
.IP
|
||||
Named
|
||||
.I .csects
|
||||
have the default attributes
|
||||
.I overlaid,
|
||||
.I global,
|
||||
and
|
||||
.I relocatable.
|
||||
.IP
|
||||
The absolute
|
||||
.I .asect
|
||||
has the attributes
|
||||
.I overlaid
|
||||
and
|
||||
.I global.
|
||||
.PP
|
||||
The meaning of the bits is (in octal):
|
||||
.DS
|
||||
shareable 1
|
||||
instructions 2
|
||||
bss 4
|
||||
defined 10
|
||||
overlaid 20
|
||||
relocatable 40
|
||||
global 100
|
||||
.DE
|
||||
.PP
|
||||
Each of the attribute key words turns some of these bits on
|
||||
and some off.
|
||||
The list is:
|
||||
.DS
|
||||
Keyword Synonym Turns On Turns Off
|
||||
|
||||
rel 40
|
||||
abs 40
|
||||
gbl 100
|
||||
lcl 100
|
||||
ovr 20
|
||||
con 20
|
||||
shr ro 1 4
|
||||
prv rw 5
|
||||
bss b 4 3
|
||||
ins i 2 4
|
||||
dat d 6
|
||||
hgh low
|
||||
.DE
|
||||
.PP
|
||||
The
|
||||
.I hgh
|
||||
and
|
||||
.I low
|
||||
attribute keywords are for compatability with DEC
|
||||
assemblers.
|
||||
They have no UNIX function.
|
||||
.SH
|
||||
Listing control arguments
|
||||
.DS
|
||||
seq loc bin src com
|
||||
bex md mc me meb
|
||||
cnd ld ttm toc sym
|
||||
.DE
|
||||
.SH
|
||||
Arguments to the
|
||||
.I .enabl
|
||||
and
|
||||
.I .dsabl
|
||||
directives
|
||||
.PP
|
||||
These args are:
|
||||
.DS
|
||||
pnc crf gbl fpt lc lsb
|
||||
cdr reg ama pic abs
|
||||
.DE
|
||||
.SH
|
||||
Arguments to Condtional Statements
|
||||
.PP
|
||||
The conditional directives
|
||||
.I .if,
|
||||
etc, take the following arguments:
|
||||
.DS
|
||||
eq ne z nz
|
||||
gt le g lt
|
||||
ge l df ndf
|
||||
b nb idn dif
|
||||
.DE
|
||||
.I
|
||||
.SH
|
||||
Differences Between Old Harvard Assembler and New Assembler
|
||||
.PP
|
||||
The new assembler does not convert macro definition text to upper case.
|
||||
This feature can be disabled by using the
|
||||
.I -um
|
||||
switch.
|
||||
.SH
|
||||
Differences Between DEC Macro-11 Assemblers and the New Assembler
|
||||
.PP
|
||||
The new assembler does not have keyword arguments to macros, as described in
|
||||
section 7.3.6 in the DEC Macro 11 manual.
|
||||
.PP
|
||||
The new assembler starts out with lower case enabled and it does not convert
|
||||
macro definition text to upper case. Both of these features can be turned
|
||||
off by specifying the
|
||||
.I -uc
|
||||
switch.
|
||||
49
tests/2.11BSD/m11/Makefile
Normal file
49
tests/2.11BSD/m11/Makefile
Normal file
@@ -0,0 +1,49 @@
|
||||
# m11 Makefile. Revised 1996/1/28
|
||||
#
|
||||
# Note that the pathname for macxrf is wired into exec.m11 ...
|
||||
|
||||
DESTDIR=
|
||||
|
||||
M11= ./m11.x
|
||||
L11= ./l11.x
|
||||
|
||||
SEPFLAG=-i
|
||||
MFLAGS=
|
||||
|
||||
.SUFFIXES: .m11 .obj
|
||||
|
||||
.m11.obj:
|
||||
${M11} ${MFLAGS} $<
|
||||
|
||||
.SUFFIXES: .1 .0
|
||||
|
||||
.1.0:
|
||||
/usr/man/manroff $*.1 > $*.0
|
||||
|
||||
SRCS= exec.m11 macro.m11 code.m11 expr.m11 fltg.m11 getl.m11 \
|
||||
lout.m11 mac.m11 srch.m11 xlat.m11 misc.m11 pst.m11 \
|
||||
errs.m11 debug.m11 often.m11 xpcor.m11 syscalls.m11 at.sml
|
||||
OBJS= exec.obj macro.obj code.obj expr.obj fltg.obj getl.obj \
|
||||
lout.obj mac.obj srch.obj xlat.obj misc.obj pst.obj \
|
||||
errs.obj debug.obj often.obj xpcor.obj syscalls.obj
|
||||
|
||||
all: m11 macxrf m11.0
|
||||
|
||||
m11: ${OBJS}
|
||||
${L11} -ls ${SEPFLAG} ${OBJS}
|
||||
mv exec.out m11
|
||||
|
||||
macxrf: macxrf.c
|
||||
cc ${SEPFLAG} -O -w -o macxrf macxrf.c
|
||||
|
||||
install: all m11.0
|
||||
install -s m11 ${DESTDIR}/usr/new/m11
|
||||
install -s macxrf ${DESTDIR}/usr/new/macxrf
|
||||
install -c -m 444 -o bin -g bin m11.0 ${DESTDIR}/usr/new/man/cat1/m11.0
|
||||
|
||||
cmp: all
|
||||
cmp m11 ${DESTDIR}/usr/new/m11
|
||||
cmp macxrf ${DESTDIR}/usr/new/macxrf
|
||||
|
||||
clean:
|
||||
rm -f *.obj *.lst *.map m11 macxrf *.0
|
||||
38
tests/2.11BSD/m11/READme
Normal file
38
tests/2.11BSD/m11/READme
Normal file
@@ -0,0 +1,38 @@
|
||||
This is the Jim Reeds version of the Harvard m11.
|
||||
|
||||
Here is code for 2 programs:
|
||||
|
||||
m11 the assembler itself many .m11 source files
|
||||
and the include file 'at.sml'
|
||||
macxrf crossreference generator macxrf.c
|
||||
|
||||
There are two documentation files:
|
||||
|
||||
m11.1 nroff -man'able version of a manual page
|
||||
Document nroff -ms'able version of a DRAFT of a windy document
|
||||
|
||||
To install:
|
||||
|
||||
You must put macxrf into /usr/ucb/macxrf. This path name is
|
||||
buried in the m11 source file exec.m11 if you want to change it. The assembler
|
||||
itself can live anywhere. /usr/new/m11 and /usr/ucb/m11 are two
|
||||
likely places to put it.
|
||||
|
||||
You might need a copy of the Jim Reeds souped up l11 to link this
|
||||
program. Source is in ../l11. The changes involved with l11 are minor.
|
||||
|
||||
Hints about using m11: This version works differently from older
|
||||
versions. Many of the defaults are changed. The most suprising is that
|
||||
undefined sysmbols are automatically treated as external. This is the
|
||||
default .enabl gbl attribute. Users can either do .dsabl gbl or use one of the
|
||||
retrofit flags. Here are the two retrofit flags:
|
||||
|
||||
m11 -de args
|
||||
m11 -ha args
|
||||
|
||||
-de stands for DEC, -ha stands for Harvard. Code written for DEC macro-11
|
||||
should probably be assembled with the -de flag for DEC-like treatment of
|
||||
case conversion, etc. This includes the Johns Hopkins basic+ interpreter.
|
||||
Code written for earlier versions of the Harvard Unixification of macro-11
|
||||
should be assembled with the -ha flag. This includes Harvard's absurd .psect
|
||||
default attributes. Use it when recreating Harvard lisp.
|
||||
425
tests/2.11BSD/m11/at.sml
Normal file
425
tests/2.11BSD/m11/at.sml
Normal file
@@ -0,0 +1,425 @@
|
||||
.title at.sml - assembler/translator system macros
|
||||
; @(#)at.sml 1.3 11/3/82
|
||||
|
||||
.ident /10may4/
|
||||
|
||||
.macro always ;all files of macro
|
||||
|
||||
.macro .data
|
||||
entsec .data
|
||||
.endm .data
|
||||
|
||||
.macro .text
|
||||
entsec .text
|
||||
.endm
|
||||
|
||||
.macro .bss
|
||||
entsec .bss
|
||||
.endm
|
||||
|
||||
mk.symbol=1 ;one to make symbols, 0 otherwise
|
||||
x40= 0
|
||||
pdpv45= 0 ; host machine has 'mul', 'div', sob' instrucs.
|
||||
; if not you will have to write macros for them
|
||||
$timdf= 7 ; California Time Zone
|
||||
; should really use ftime(2) for this and for
|
||||
; DST.
|
||||
;xfltg= 0 ;define to assmbl out floating hardware
|
||||
rsx11d = 0 ; rsx11d features
|
||||
debug = 0 ; <<< REEDS if non zero includes debug junk
|
||||
|
||||
ft.id= 1 ;have set i & d. set =0 if not
|
||||
|
||||
ft.unx = 1 ; this macro-11 is for UNIX. =0 if not.
|
||||
|
||||
.nlist bex
|
||||
|
||||
tab= 11
|
||||
lf= 12
|
||||
vt= 13
|
||||
ff= 14
|
||||
cr= 15
|
||||
space= 40
|
||||
|
||||
bpmb = 20 ;bytes per macro block
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.psect .text con, shr, gbl,ins
|
||||
.psect .data con, dat, prv, gbl
|
||||
.psect .bss con, bss, gbl
|
||||
|
||||
.psect dpure con, dat, prv, gbl
|
||||
.psect mixed con, prv, gbl
|
||||
.psect errmes con, dat, prv, gbl
|
||||
.psect impure con, bss, gbl
|
||||
.psect imppas con, bss, gbl
|
||||
.psect implin con, bss, gbl
|
||||
.psect swtsec con, dat, prv, gbl ; unix command line flags
|
||||
.psect cndsec con, dat, prv, gbl ; gt, le, equ, etc. for '.if'
|
||||
.psect crfsec con, dat, prv, gbl ; args for -cr flag
|
||||
.psect edtsec con, dat, prv, gbl ; args for .enabl
|
||||
.psect lctsec con, dat, prv, gbl ; args for .list
|
||||
.psect psasec con, dat, prv, gbl
|
||||
.psect pstsec con, dat, prv, gbl
|
||||
.psect rolbas con, dat, prv, gbl ; core allocation: starts of tables
|
||||
.psect rolsiz con, dat, prv, gbl ; sizes of table entries
|
||||
.psect roltop con, dat, prv, gbl ; tops of tables
|
||||
.psect xpcor con,bss , gbl ; this one MUST come last in core
|
||||
|
||||
|
||||
.macro entsec name ;init a section
|
||||
.psect name con
|
||||
.endm entsec
|
||||
|
||||
|
||||
|
||||
.macro jeq x,?fred
|
||||
bne fred
|
||||
jmp x
|
||||
fred:
|
||||
.endm
|
||||
.macro jne x,?fred
|
||||
beq fred
|
||||
jmp x
|
||||
fred:
|
||||
.endm
|
||||
.macro xitsec
|
||||
entsec .text
|
||||
.endm xitsec
|
||||
|
||||
|
||||
.macro call address
|
||||
jsr pc,address
|
||||
.endm
|
||||
|
||||
.macro return
|
||||
rts pc
|
||||
.endm
|
||||
|
||||
|
||||
.macro always
|
||||
.nlist bex
|
||||
.endm always
|
||||
.endm always
|
||||
|
||||
|
||||
.if ne debug
|
||||
|
||||
.macro ndebug n
|
||||
.globl ndebug,..z
|
||||
mov n,..z
|
||||
call ndebug
|
||||
.endm
|
||||
|
||||
.macro sdebug string
|
||||
.globl sdebug,..z,..zbuf
|
||||
x = 0
|
||||
.irpc t,<string>
|
||||
movb #''t,..zbuf+x
|
||||
x = x+1
|
||||
.endm
|
||||
movb #0,..zbuf+x
|
||||
mov #..zbuf,..z
|
||||
call sdebug
|
||||
.endm
|
||||
|
||||
.iff
|
||||
|
||||
.macro ndebug n
|
||||
.endm
|
||||
|
||||
.macro sdebug string
|
||||
.endm
|
||||
|
||||
.endc
|
||||
|
||||
|
||||
.macro param mne, value ;define default parameters
|
||||
.iif ndf mne, mne= value
|
||||
.list
|
||||
mne= mne
|
||||
.nlist
|
||||
.endm
|
||||
.macro putkb addr ;list to kb
|
||||
.globl putkb
|
||||
mov addr,r0
|
||||
call putkb
|
||||
.endm
|
||||
|
||||
.macro putlp addr ;list to lp
|
||||
.globl putlp
|
||||
mov addr,r0
|
||||
call putlp
|
||||
.endm
|
||||
|
||||
.macro putkbl addr ;list to kb and lp
|
||||
.globl putkbl
|
||||
mov addr,r0
|
||||
call putkbl
|
||||
.endm
|
||||
|
||||
|
||||
.macro xmit wrdcnt ;move small # of words
|
||||
.globl xmit0
|
||||
call xmit0-<wrdcnt*2>
|
||||
.endm xmit
|
||||
|
||||
|
||||
;the macro "genswt" is used to specify a command
|
||||
;string switch (1st argument) and the address of
|
||||
;the routine to be called when encountered (2nd arg).
|
||||
; the switch is made upper-case.
|
||||
|
||||
.macro genswt mne,addr,?label
|
||||
entsec swtsec
|
||||
label: .irpc x,mne
|
||||
.if ge ''x-141
|
||||
.if le ''x-172
|
||||
.byte ''x-40
|
||||
.iff
|
||||
.byte ''x
|
||||
.endc
|
||||
.iff
|
||||
.byte ''x
|
||||
.endc
|
||||
.endm
|
||||
.iif ne <.-label&1>, .byte 0
|
||||
.word addr
|
||||
xitsec
|
||||
.endm
|
||||
.macro zread chan
|
||||
.globl zread
|
||||
mov #chan'chn,r0
|
||||
call zread
|
||||
.endm zread
|
||||
|
||||
.macro zwrite chan
|
||||
.globl zwrite
|
||||
mov #chan'chn,r0
|
||||
call zwrite
|
||||
.endm zwrite
|
||||
.macro genedt mne,subr ;gen enable/disable table
|
||||
entsec edtsec
|
||||
.rad50 /mne/
|
||||
.if nb subr
|
||||
.word subr
|
||||
.iff
|
||||
.word cpopj
|
||||
.endc
|
||||
.word ed.'mne
|
||||
xitsec
|
||||
.endm genedt
|
||||
|
||||
|
||||
;the macro "gencnd" is used to specify conditional
|
||||
;arguments. it takes two or three arguments:
|
||||
|
||||
; 1- mnemonic
|
||||
; 2- subroutine to be called
|
||||
; 3- if non-blank, complement condition
|
||||
|
||||
.macro gencnd mne,subr,toggle ;generate conditional
|
||||
entsec cndsec
|
||||
.rad50 /mne/
|
||||
.if b <toggle>
|
||||
.word subr
|
||||
.iff
|
||||
.word subr+1
|
||||
.endc
|
||||
xitsec
|
||||
.endm
|
||||
.macro ch.mne
|
||||
|
||||
ch.ior= '!
|
||||
ch.qtm= '"
|
||||
ch.hsh= '#
|
||||
ch.dol= '$
|
||||
ch.pct= '%
|
||||
ch.and= '&
|
||||
ch.xcl= ''
|
||||
|
||||
ch.lp= '(
|
||||
ch.rp= ')
|
||||
ch.mul= '*
|
||||
ch.add= '+
|
||||
ch.com= ',
|
||||
ch.sub= '-
|
||||
ch.dot= '.
|
||||
ch.div= '/
|
||||
|
||||
ch.col= ':
|
||||
ch.smc= ';
|
||||
ch.lab= '<
|
||||
ch.equ= '=
|
||||
ch.rab= '>
|
||||
ch.qm= '?
|
||||
|
||||
ch.ind= '@
|
||||
ch.bsl= '\
|
||||
ch.uar= '^
|
||||
|
||||
let.a= 'a&^c40
|
||||
let.b= 'b&^c40
|
||||
let.c= 'c&^c40
|
||||
let.d= 'd&^c40
|
||||
let.e= 'e&^c40
|
||||
let.f= 'f&^c40
|
||||
let.g= 'g&^c40
|
||||
let.o= 'o&^c40
|
||||
let.p= 'p&^c40
|
||||
let.r= 'r&^c40
|
||||
let.z= 'z&^c40
|
||||
|
||||
dig.0= '0
|
||||
dig.9= '9
|
||||
.macro ch.mne
|
||||
.endm ch.mne
|
||||
.endm ch.mne
|
||||
|
||||
.macro error num,arg, mess ,?x
|
||||
sdebug <num>
|
||||
.globl err.'arg,ern'num, errbts,errref
|
||||
.if b <mess>
|
||||
deliberate error mistake
|
||||
.endc
|
||||
.if dif 0,num
|
||||
.globl err.xx
|
||||
tst err.xx
|
||||
bne x
|
||||
mov #ern'num,err.xx
|
||||
x:
|
||||
.endc
|
||||
bis #err.'arg,errbts
|
||||
.endm
|
||||
|
||||
|
||||
|
||||
.macro setnz addr ;set addr to non-zero for t/f flags
|
||||
mov sp,addr
|
||||
.endm
|
||||
|
||||
|
||||
.macro bisbic arg ; used by .list/.nlist, .enabl/.dsabl
|
||||
.globl bisbic
|
||||
mov #arg,-(sp)
|
||||
call bisbic
|
||||
tst (sp)+
|
||||
.endm
|
||||
;roll handler calls
|
||||
|
||||
.macro search rolnum ;binary search
|
||||
mov #rolnum,r0
|
||||
.globl search
|
||||
call search
|
||||
.endm
|
||||
|
||||
.macro scan rolnum ;linear scan
|
||||
mov #rolnum,r0
|
||||
.globl scan
|
||||
call scan
|
||||
.endm
|
||||
|
||||
.macro scanw rolnum ;linear scan, one word
|
||||
mov #rolnum,r0
|
||||
.globl scanw
|
||||
call scanw
|
||||
.endm
|
||||
|
||||
.macro next rolnum ;fetch next entry
|
||||
mov #rolnum,r0
|
||||
.globl next
|
||||
call next
|
||||
.endm
|
||||
|
||||
.macro append rolnum ;append to end of roll
|
||||
mov #rolnum,r0
|
||||
.globl append
|
||||
call append
|
||||
.endm
|
||||
|
||||
.macro zap rolnum ;clear roll
|
||||
mov #rolnum,r0
|
||||
.globl zap
|
||||
call zap
|
||||
.endm
|
||||
|
||||
; call insert ;insert (must be preceded by one
|
||||
;of the above to set pointers)
|
||||
; call setrol ;save and set regs for above
|
||||
;flags used in symbol table mode
|
||||
|
||||
.macro st.flg
|
||||
|
||||
.if le ft.unx
|
||||
|
||||
ovrflg= 000004 ;overlay (psect only)
|
||||
defflg= 000010 ;defined
|
||||
relflg= 000040 ;relocatable
|
||||
glbflg= 000100 ;global
|
||||
dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
|
||||
|
||||
.endc
|
||||
|
||||
.if gt ft.unx
|
||||
|
||||
; ****** these should not be changed!! ******
|
||||
shrflg= 000001 ;shareable (psect only)
|
||||
.if gt ft.id
|
||||
insflg= shrflg*2 ;instruction space (psect only)
|
||||
bssflg= insflg*2 ;blank section (psect only)
|
||||
m.idf= shrflg!insflg!bssflg ;mask to turn them off
|
||||
.iff
|
||||
bssflg= shrflg*2
|
||||
m.idf= shrflg!bssflg
|
||||
.endc
|
||||
b.idf= 1 ;shift count to make above bits word offset
|
||||
; ***********************************
|
||||
defflg= 000010 ;defined
|
||||
ovrflg= 000020 ;overlay (psect only)
|
||||
relflg= 000040 ;relocatable
|
||||
glbflg= 000100 ;global
|
||||
dfgflg= 000200 ; default global <rsx11d>... reeds's guess
|
||||
|
||||
.endc
|
||||
|
||||
;
|
||||
; default psect attribs.
|
||||
; can be changed, but make sure all customers know about
|
||||
; it, including all the linkers.
|
||||
;
|
||||
pattrs=relflg!defflg ; For .psects and blank .csects
|
||||
aattrs=glbflg!defflg!ovrflg ; For .asect
|
||||
cattrs=glbflg!relflg!defflg!ovrflg ; For named .csects
|
||||
|
||||
regflg= 000001 ;register
|
||||
lblflg= 000002 ;label
|
||||
mdfflg= 000004 ;multilpy defined
|
||||
.macro st.flg
|
||||
.endm
|
||||
.endm st.flg
|
||||
|
||||
|
||||
|
||||
.macro ct.mne
|
||||
.globl cttbl
|
||||
ct.eol = 000 ; eol
|
||||
ct.com = 001 ; comma
|
||||
ct.tab = 002 ; tab
|
||||
ct.sp = 004 ; space
|
||||
ct.pcx = 010 ; printing character
|
||||
ct.num = 020 ; numeric
|
||||
ct.alp = 040 ; alpha, dot, dollar
|
||||
ct.lc = 100 ; lower case alpha
|
||||
ct.smc = 200 ; semi-colon (sign bit)
|
||||
|
||||
ct.pc = ct.com!ct.smc!ct.pcx!ct.num!ct.alp
|
||||
.macro ct.mne
|
||||
.endm ct.mne
|
||||
.endm ct.mne
|
||||
|
||||
|
||||
.end
|
||||
473
tests/2.11BSD/m11/code.m11
Normal file
473
tests/2.11BSD/m11/code.m11
Normal file
@@ -0,0 +1,473 @@
|
||||
.title code
|
||||
|
||||
.ident /10may4/
|
||||
|
||||
.mcall (at)always,st.flg,xmit,zwrite
|
||||
always
|
||||
st.flg
|
||||
|
||||
.mcall (at)genedt,setnz,next,append,zap,error
|
||||
|
||||
.globl objchn, objlen
|
||||
.globl savreg, ioftbl, buftbl, cnttbl
|
||||
|
||||
.globl dmprld, endp1c, endp2c, pcroll, prgttl
|
||||
.globl setdsp, setimm, setrld, stcode
|
||||
|
||||
.globl abserr, clcloc, clcnam, clcsec
|
||||
.globl codrol, endvec, mode, objsec
|
||||
;.globl pass, psaflg, rolupd, secrol
|
||||
.globl pass, rolupd, secrol
|
||||
.globl sector, setpf0, setpf1, setsec, setxpr
|
||||
.globl symbol, symrol, value
|
||||
.globl edmask, ed.abs, ed.pnc
|
||||
.globl dflgbm, opclas
|
||||
cc.opr = 040
|
||||
cc.nam = 020
|
||||
cc.sec = 010
|
||||
cc.val = 004
|
||||
cc.dsp = 002
|
||||
|
||||
|
||||
gsdt00= 00*400 ; object module name
|
||||
gsdt01= 01*400 ; program section name
|
||||
gsdt02= 02*400 ; internal symbol table
|
||||
gsdt03= 03*400 ; transfer address
|
||||
gsdt04= 04*400 ; symbol declaration
|
||||
gsdt05= 05*400 ; local section name
|
||||
gsdt06= 06*400 ; version identification
|
||||
|
||||
blkt01= 01 ; gsd
|
||||
blkt02= 02 ; gsd end
|
||||
blkt03= 03 ; text block
|
||||
blkt04= 04 ; rld block
|
||||
blkt05= 05 ; isd
|
||||
blkt06= 06 ; module end
|
||||
blkt17= 17
|
||||
.sbttl expression to code-roll conversions
|
||||
|
||||
xitsec ;start in default psect
|
||||
|
||||
setimm: ;
|
||||
call savreg
|
||||
call setxpr
|
||||
clr -(sp)
|
||||
bitb #glbflg,(r3)
|
||||
bne setds3
|
||||
bit #relflg,(r3)
|
||||
beq setdsx
|
||||
cmpb (r2),clcsec
|
||||
bne setds1
|
||||
bis #cc.sec,(sp)
|
||||
br setdsx
|
||||
|
||||
setdsp:
|
||||
call savreg
|
||||
call setxpr
|
||||
mov #cc.dsp,-(sp)
|
||||
bit #glbflg,(r3)
|
||||
bne setds3
|
||||
cmpb (r2),clcsec
|
||||
beq setds2
|
||||
bit #relflg,(r3)
|
||||
beq setdsx
|
||||
setds1: call setsec
|
||||
bis #cc.sec!cc.nam,(sp)
|
||||
br setdsx
|
||||
|
||||
setds2: clr (r3)
|
||||
clr (sp)
|
||||
movb <^pl rolsiz>+codrol+1,r0
|
||||
;movb @(pc)+,r0
|
||||
; .word <^pl rolsiz>+codrol+1
|
||||
inc r0
|
||||
asl r0
|
||||
add clcloc,r0
|
||||
sub r0,(r4)
|
||||
br setdsx
|
||||
|
||||
setds3: bis #cc.nam,(sp)
|
||||
setdsx: bit #dflgbm,opclas
|
||||
beq 4$
|
||||
tstb (r4)+
|
||||
movb (r4),r0
|
||||
beq 1$
|
||||
inc r0
|
||||
bne 2$
|
||||
1$: bit #cc.sec,(sp)
|
||||
beq 3$
|
||||
2$: call abserr
|
||||
3$: clrb (r4)
|
||||
bis #200,(sp)
|
||||
4$: movb (sp)+,(r2)
|
||||
return
|
||||
.globl limit
|
||||
|
||||
limit:
|
||||
call setrld
|
||||
1$: inc r3
|
||||
movb #cc.opr,(r2)+
|
||||
movb r3,(r2)+
|
||||
movb r3,(r2)+
|
||||
call dmprld
|
||||
mov #symbol,r0
|
||||
clr (r0)+
|
||||
mov r3,(r0)+
|
||||
mov #cc.nam*400,(r0)+
|
||||
clr (r0)+
|
||||
call stcode
|
||||
cmp r3,#2
|
||||
blo 1$
|
||||
return
|
||||
|
||||
.globl ident, rad50
|
||||
ident: ;"ident" directive
|
||||
call rad50 ;treat as rad 50
|
||||
clr rolupd ;point to start of code roll
|
||||
mov #prgidn,r2 ; and to ident block
|
||||
1$: next codrol ;get the next entry
|
||||
mov value,(r2)+ ;stuff it
|
||||
cmp r2,#prgidn+4 ;two words?
|
||||
blo 1$ ; no
|
||||
mov #gsdt06,(r2)+ ;yes, set gsd type
|
||||
zap codrol ;clear code
|
||||
return
|
||||
|
||||
|
||||
entsec impure
|
||||
prgttl: .blkw 4 ;title block
|
||||
prgidn: .blkw 4 ;ident "
|
||||
xitsec
|
||||
.sbttl object code handlers
|
||||
|
||||
endp1c: ;end pass1 code init
|
||||
tstb ioftbl+objchn ;any obj file?
|
||||
beq 9$ ; no
|
||||
call objini ;init output
|
||||
mov #blkt01,@buftbl+objchn ;set block type 1
|
||||
mov #prgttl,r1 ;set "from" index
|
||||
call gsddmp ;output gsd block
|
||||
mov #prgidn,r1 ;point to sub-ttl buffer
|
||||
tst 4(r1) ;set?
|
||||
beq 1$ ; no
|
||||
call gsddmp ;yes, stuff it
|
||||
1$: clr -(sp) ;init for sector scan
|
||||
2$: mov (sp)+,rolupd ;set scan marker
|
||||
next secrol ;get the next sector
|
||||
beq 6$ ;branch if through
|
||||
mov rolupd,-(sp) ;save marker
|
||||
mov #value+2,r1
|
||||
mov (r1),-(r1)
|
||||
clr r5
|
||||
bisb -(r1),r5
|
||||
movb #gsdt05/400,(r1)
|
||||
;tst psaflg ; who cares? a .csect is a
|
||||
;bne 3$ ;special kind of .psect
|
||||
;movb #gsdt01/400,(r1) ; so dont need this code
|
||||
;bicb #^c<defflg!relflg>,-(r1) ; j reeds sept 81.
|
||||
3$: clr rolupd ;set for inner scan
|
||||
4$: mov #symbol,r1
|
||||
call gsddmp ;output this block
|
||||
5$: next symrol ;fetch the next symbol
|
||||
beq 2$ ; finished with this guy
|
||||
bit #glbflg,mode ;global?
|
||||
beq 5$ ; no
|
||||
bit #regflg,mode ;is register (prevent god's wrath)
|
||||
bne 5$ ;no global registers with ==*
|
||||
cmpb sector,r5 ;yes, proper sector?
|
||||
bne 5$ ; no
|
||||
bic #^c<defflg!200!relflg!glbflg>,mode ;clear most (leave hk up)
|
||||
bis #gsdt04,mode ;set type 4
|
||||
br 4$ ;output it
|
||||
|
||||
|
||||
6$: bic #^c<relflg>,endvec+4 ;clear all but rel flag
|
||||
bis #gsdt03+defflg,endvec+4
|
||||
mov #endvec,r1
|
||||
call gsddmp ;output end block
|
||||
call objdmp ;dump it
|
||||
mov #blkt02,@buftbl+objchn ;set "end of gsd"
|
||||
call objdmf
|
||||
mov #blkt17,@buftbl+objchn ;init for text blocks
|
||||
9$:
|
||||
inc pass ;set for pass 2
|
||||
return
|
||||
|
||||
|
||||
gsddmp: ;dump a gsd block
|
||||
call setrld
|
||||
xmit 4
|
||||
jmp dmprld
|
||||
endp2c:
|
||||
tst objpnt ;any object output?
|
||||
beq 1$ ; no
|
||||
call objdmp ;yes, dump it
|
||||
.if ne,mk.symbol
|
||||
tst out$ym
|
||||
beq 22$
|
||||
.endc
|
||||
32$: mov #blkt06,@buftbl+objchn ;set end
|
||||
call objdmf ;dump it
|
||||
.if ndf xedabs
|
||||
bit #ed.abs,edmask ;abs output?
|
||||
bne 1$ ; no
|
||||
mov objpnt,r0
|
||||
mov endvec+6,(r0)+ ;set end vector
|
||||
mov r0,objpnt
|
||||
call objdmp
|
||||
.endc
|
||||
1$: return
|
||||
|
||||
.if ne,mk.symbol
|
||||
22$: mov #blkssym,@buftbl+objchn
|
||||
clr rolupd
|
||||
3$: next symrol
|
||||
beq 31$
|
||||
bit #glbflg,mode
|
||||
bne 3$
|
||||
mov #symbol,r1
|
||||
call gsddmp
|
||||
br 3$
|
||||
|
||||
31$: tst objpnt
|
||||
beq 30$
|
||||
call objdmp
|
||||
30$:
|
||||
call locdmp
|
||||
mov #blksye,@buftbl+objchn
|
||||
tst objpnt
|
||||
beq 32$
|
||||
call objdmf
|
||||
br 32$
|
||||
|
||||
entsec impure
|
||||
out$ym: .blkw 1
|
||||
xitsec
|
||||
|
||||
blksye=21
|
||||
blkssys=22
|
||||
|
||||
.globl out$ym
|
||||
.endc
|
||||
|
||||
.sbttl code roll handlers
|
||||
|
||||
stcode: append codrol ;append to codrol
|
||||
return
|
||||
|
||||
.globl pcrcnt
|
||||
pcroll: ;
|
||||
next codrol
|
||||
beq 9$
|
||||
call savreg
|
||||
movb sector,r4
|
||||
tst pass
|
||||
beq 7$
|
||||
inc pcrcnt
|
||||
bne 1$
|
||||
call setpf0
|
||||
1$: call setpf1
|
||||
tst objpnt
|
||||
beq 7$
|
||||
.if ndf xedpnc
|
||||
bit #ed.pnc,edmask
|
||||
bne 7$
|
||||
.endc
|
||||
call setrld
|
||||
mov r4,-(sp)
|
||||
mov #cc.sec!cc.nam!cc.opr,r4
|
||||
cmpb clcsec,objsec
|
||||
bne 2$
|
||||
cmp clcloc,objloc
|
||||
beq 3$
|
||||
bic #cc.nam,r4
|
||||
2$: mov #clcnam,r1
|
||||
call pcrolx
|
||||
clrb (r2)+
|
||||
call dmprld
|
||||
3$: mov (sp)+,r4
|
||||
mov #symbol,r1
|
||||
call pcrolx
|
||||
call dmprld
|
||||
7$: inc clcloc
|
||||
tstb r4
|
||||
bmi 8$
|
||||
inc clcloc
|
||||
8$: movb clcsec,objsec
|
||||
mov clcloc,objloc
|
||||
setnz r0
|
||||
9$: return
|
||||
pcrolx:
|
||||
movb r4,(r2)+
|
||||
bit #cc.nam,r4
|
||||
beq 3$
|
||||
.rept 4
|
||||
movb (r1)+,(r2)+
|
||||
.endm
|
||||
cmp -(r1),-(r1)
|
||||
3$: add #6,r1
|
||||
tst (r1)
|
||||
beq 4$
|
||||
movb (r1)+,(r2)+
|
||||
bisb #cc.val,rldtmp
|
||||
tstb r4
|
||||
bmi 4$
|
||||
movb (r1)+,(r2)+
|
||||
4$: return
|
||||
|
||||
entsec implin
|
||||
pcrcnt: .blkw ;extension line flag
|
||||
entsec imppas
|
||||
.odd
|
||||
objsec: .blkb 1 ;object file sector
|
||||
objloc: .blkw 1 ;object file location
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
.if ndf xedpnc
|
||||
genedt pnc,pncset ;punch control
|
||||
|
||||
pncset: movb #377,objsec ;force sequence break
|
||||
return
|
||||
.endc
|
||||
objdmp: ;dump the object buffer
|
||||
tst objpnt
|
||||
beq objinx ;exit if not pre-set
|
||||
mov buftbl+objchn,r0
|
||||
tst (r0)+ ;ignore first word
|
||||
cmp objpnt,r0 ;anything in rld?
|
||||
blos objini ; no, just init
|
||||
objdmf:
|
||||
mov objpnt,@cnttbl+objchn
|
||||
sub buftbl+objchn,@cnttbl+objchn ;compute byte count
|
||||
zwrite obj
|
||||
|
||||
objini: mov buftbl+objchn,objpnt
|
||||
add #2,objpnt ;reserve word for block type
|
||||
objinx: return
|
||||
|
||||
dmprld: tst objpnt
|
||||
beq setrld
|
||||
mov r1,-(sp) ;save byte count
|
||||
mov #rldtmp,r1
|
||||
mov r2,r0
|
||||
sub r1,r0
|
||||
beq 9$
|
||||
add objpnt,r0
|
||||
sub buftbl+objchn,r0
|
||||
cmp r0,#objlen ;room to store?
|
||||
blos 1$ ; yes
|
||||
call objdmp ;no, dump current
|
||||
1$: mov objpnt,r0 ;return with pointer in r2
|
||||
2$: movb (r1)+,(r0)+
|
||||
cmp r1,r2
|
||||
blo 2$
|
||||
mov r0,objpnt
|
||||
9$: mov (sp)+,r1
|
||||
setrld: mov #rldtmp,r2
|
||||
return
|
||||
|
||||
entsec impure
|
||||
objpnt: .blkw
|
||||
rldtmp: .blkb 100.
|
||||
xitsec
|
||||
|
||||
|
||||
xitsec
|
||||
.globl sx.flg ,lsyrol
|
||||
locdmp:
|
||||
call savreg
|
||||
mov r0,-(sp)
|
||||
tst sx.flg
|
||||
beq 9$
|
||||
clr rolupd
|
||||
1$:
|
||||
next lsyrol
|
||||
beq 2$
|
||||
bit #glbflg,mode
|
||||
bne 1$
|
||||
call unlocl
|
||||
mov #symbol,r1
|
||||
call gsddmp
|
||||
br 1$
|
||||
2$:
|
||||
tst objpnt
|
||||
beq 9$
|
||||
call objdmp
|
||||
9$:
|
||||
mov (sp)+,r0
|
||||
return
|
||||
|
||||
.globl dnc ,chrpnt, getsym,..z
|
||||
unlocl:
|
||||
call savreg
|
||||
mov r0,-(sp)
|
||||
mov #work.x,r2
|
||||
mov symbol+2,r1
|
||||
call dnc
|
||||
movb #'$,(r2)+
|
||||
movb #0,(r2)+
|
||||
call tor50
|
||||
mov (sp)+,r0
|
||||
return
|
||||
entsec mixed
|
||||
work.x: .blkw 5
|
||||
xitsec
|
||||
tor50:
|
||||
call savreg
|
||||
mov #work.x,r4
|
||||
call 1$
|
||||
mov r0,symbol
|
||||
mov #3+work.x,r4
|
||||
call 1$
|
||||
mov r0,2+symbol
|
||||
return
|
||||
1$:
|
||||
clr r3
|
||||
tstb (r4)
|
||||
beq 10$
|
||||
movb (r4)+,r0
|
||||
br 20$
|
||||
10$: movb (r4),r0
|
||||
20$: mov r0,r2
|
||||
call 40$
|
||||
mov r0,r3
|
||||
mov r3,r1
|
||||
mul #50,r1
|
||||
mov r1,r3
|
||||
tstb (r4)
|
||||
beq 12$
|
||||
movb (r4)+,r0
|
||||
br 21$
|
||||
12$: movb (r4),r0
|
||||
21$: mov r0,r2
|
||||
call 40$
|
||||
add r0,r3
|
||||
mov r3,r1
|
||||
mul #50,r1
|
||||
mov r1,r3
|
||||
movb (r4),r0
|
||||
mov r0,r2
|
||||
call 40$
|
||||
add r0,r3
|
||||
mov r3,r0
|
||||
return
|
||||
40$:
|
||||
cmpb #44,r2
|
||||
bne 30$
|
||||
mov #33,r0
|
||||
br 9$
|
||||
14$: clr r0
|
||||
9$: return
|
||||
30$: tstb r2
|
||||
beq 14$
|
||||
cmpb #40,r2
|
||||
beq 14$
|
||||
movb r2,r0
|
||||
add #-22,r0
|
||||
br 9$
|
||||
.end
|
||||
|
||||
.end
|
||||
53
tests/2.11BSD/m11/debug.m11
Normal file
53
tests/2.11BSD/m11/debug.m11
Normal file
@@ -0,0 +1,53 @@
|
||||
.mcall (at) always
|
||||
.globl $write
|
||||
|
||||
.globl ndebug,sdebug, ..z,..zbuf
|
||||
.globl savreg,dnc
|
||||
.globl xx.flg
|
||||
always
|
||||
|
||||
xitsec
|
||||
sdebug:
|
||||
call savreg
|
||||
mov r0,-(sp)
|
||||
|
||||
mov #..s,r2
|
||||
mov ..z,r3
|
||||
mov #2,r0
|
||||
1$: movb (r3)+,(r2)+
|
||||
beq 2$
|
||||
inc r0
|
||||
br 1$
|
||||
2$:
|
||||
movb #12,(r2)
|
||||
mov r0,..n
|
||||
ddd:
|
||||
tst xx.flg
|
||||
beq 100$
|
||||
mov ..n,-(sp) ;write(2, ..s, ..n)
|
||||
mov #..s,-(sp)
|
||||
mov #2,-(sp)
|
||||
tst -(sp) ;simulate return address stack spacing
|
||||
$write
|
||||
add #8.,sp ;toss syscall cruft
|
||||
100$:
|
||||
mov (sp)+,r0
|
||||
return
|
||||
ndebug:
|
||||
call savreg
|
||||
mov r0,-(sp)
|
||||
mov #..s,r2
|
||||
mov ..z,r1
|
||||
call dnc
|
||||
movb #12,(r2)+
|
||||
mov r2,..n
|
||||
sub #..s,..n
|
||||
br ddd
|
||||
|
||||
entsec mixed
|
||||
..n: .blkw
|
||||
..z: .word
|
||||
..s: .blkw 100
|
||||
..zbuf: .blkw 100
|
||||
|
||||
.end
|
||||
83
tests/2.11BSD/m11/errs.m11
Normal file
83
tests/2.11BSD/m11/errs.m11
Normal file
@@ -0,0 +1,83 @@
|
||||
;
|
||||
; m11 error messages
|
||||
; jim reeds 4 july 1981
|
||||
;
|
||||
.mcall (at)always
|
||||
always
|
||||
|
||||
.data
|
||||
.dsabl lc
|
||||
.list md,me,mc
|
||||
|
||||
.macro errgen num,code,text
|
||||
ern'num:: .asciz \text\
|
||||
.endm
|
||||
errgen 1,r,<cannot relocate a register>
|
||||
errgen 2,a,<improper relocation>
|
||||
errgen 3,a,<bad expression>
|
||||
errgen 4,u,<undefined symbol>
|
||||
errgen 5,m,<multiply defined>
|
||||
errgen 6,n,<digit illegal in current radix>
|
||||
errgen 7,t,<number too big>
|
||||
errgen 8,u,<local symbol not defined>
|
||||
errgen 9,a,<empty floating point number>
|
||||
errgen 10,n,<floating point overflow>
|
||||
errgen 11,t,<trunctation error>
|
||||
errgen 12,l,<line too long>
|
||||
errgen 13,i,<illegal character>
|
||||
errgen 14,e,<.end not found>
|
||||
errgen 140,e,<end of input with unterminated macro or repeat>
|
||||
errgen 15,o,<conditional not in progress>
|
||||
errgen 16,o,<too many nested conditionals>
|
||||
errgen 17,a,<conditional argument not specified>
|
||||
errgen 18,t,<illegal local symbol>
|
||||
errgen 19,q,<random junk at end of statement ignored>
|
||||
errgen 20,a,<missing title>
|
||||
errgen 0,<>,<user generated error>
|
||||
errgen 22,a,<missing delimiting character>
|
||||
errgen 23,a,<unknown .list/.nlist argument>
|
||||
errgen 24,o,<opcode out of context>
|
||||
errgen 25,o,<missing macro name>
|
||||
errgen 26,a,<.endm name doesn't match .macro name>
|
||||
errgen 27,a,<illegal arguments>
|
||||
errgen 28,a,<no symbol to assign to>
|
||||
errgen 29,o,<unbalanced .endm>
|
||||
errgen 30,a,<missing argument in 'if' construction>
|
||||
errgen 31,a,<missing argument>
|
||||
errgen 70,a,<local offset out of range>
|
||||
errgen 71,a,<illegal register number>
|
||||
errgen 32,p,<phase error in label definition>
|
||||
errgen 33,q,<illegal label>
|
||||
errgen 34,m,<label multiply defined>
|
||||
errgen 35,z,<op code not in standard set>
|
||||
errgen 36,b,<odd addressing error>
|
||||
errgen 37,z,<unpredictable instruction>
|
||||
errgen 38,r,<no such register number>
|
||||
errgen 39,t,<low order byte only>
|
||||
errgen 40,q,<questionable expression syntax>
|
||||
errgen 41,r,<illegal use of register>
|
||||
errgen 42,q,<missing right ')'>
|
||||
errgen 43,a,<missing expression>
|
||||
errgen 44,r,<illegal register usage>
|
||||
errgen 45,a,<illegal .psect attribute>
|
||||
errgen 90,a,<conflicts with .enabl abs>
|
||||
errgen 46,a,<illegal radix>
|
||||
errgen 47,a,<premature end of line>
|
||||
errgen 48,t,<illegal rad50 character>
|
||||
errgen 49,a,<illegal .enabl/.dsabl argument>
|
||||
errgen 50,a,<illegal use of '.'>
|
||||
errgen 51,a,<comma required>
|
||||
errgen 52,a,<separator required>
|
||||
errgen 53,p,<user generated error>
|
||||
errgen 54,t,<no generated symbols after 127$>
|
||||
errgen 55,a,<no such cref argument>
|
||||
errgen 56,o,<.endm out of context>
|
||||
errgen 57,o,<.endr out of context>
|
||||
errgen 59,a,<not a symbol>
|
||||
errgen 60,u,<.mcall error>
|
||||
errgen 61,u,<macro not defined by .mcall>
|
||||
errgen 62,u,<cannot open .mcall file>
|
||||
errgen 63,u,<illegal .macro syntax in .mcall>
|
||||
errgen 80,a,<branch out of current psect>
|
||||
errgen 81,a,<too far to branch>
|
||||
.end
|
||||
1473
tests/2.11BSD/m11/exec.m11
Normal file
1473
tests/2.11BSD/m11/exec.m11
Normal file
File diff suppressed because it is too large
Load Diff
567
tests/2.11BSD/m11/expr.m11
Normal file
567
tests/2.11BSD/m11/expr.m11
Normal file
@@ -0,0 +1,567 @@
|
||||
.title expr - expression evaluator
|
||||
|
||||
.ident /16jan4/
|
||||
|
||||
.mcall (at)always,st.flg,ch.mne,xmit,genedt
|
||||
.mcall (at)sdebug
|
||||
.mcall (at)jne,jeq
|
||||
always
|
||||
st.flg
|
||||
ch.mne
|
||||
.mcall (at)setnz,error,search
|
||||
|
||||
.globl abserr, absexp, abstrm, abstst, expr
|
||||
.globl exprg, relexp, reltst
|
||||
|
||||
|
||||
.if df rsx11d
|
||||
.globl ed.gbl, edmask, cpopj
|
||||
.endc
|
||||
|
||||
.globl chrpnt, clcnam, clcsec, cradix, mode
|
||||
.globl cvtnum, dmprld, expflg, flags, lsrch
|
||||
.globl getchr, getnb, getsym, insert
|
||||
.globl pass, rellvl, rolndx, r50dot, savreg
|
||||
.globl setnb, setrld, setsec, setsym, setxpr
|
||||
.globl symbeg, symbol, symrol, pstrol, value
|
||||
.globl secrol, objsec
|
||||
|
||||
.globl crfref
|
||||
.if ndf oldcod
|
||||
cc.opr= 040
|
||||
cc.nam= 020
|
||||
cc.sec= 010
|
||||
cc.val= 004
|
||||
cc.dsp= 002
|
||||
.endc
|
||||
|
||||
|
||||
.macro chscan table ;character scan
|
||||
mov #table,r0
|
||||
call chscan
|
||||
.endm
|
||||
|
||||
.macro gchtbl char, addr ;gen char scan table
|
||||
.word addr, char
|
||||
.endm
|
||||
xitsec ;start in default sector
|
||||
|
||||
exprg: ;external expression
|
||||
.if ndf oldcod
|
||||
decb oprflg+1 ;flag "ok for external expression"
|
||||
call expr ;process
|
||||
incb oprflg+1 ;restore
|
||||
tst r0 ;reset r0 flags
|
||||
return
|
||||
.endc
|
||||
|
||||
expr: ;expression evaluation
|
||||
call savreg ;save registers
|
||||
call term ;try for a term
|
||||
beq 5$ ;exit if null
|
||||
clr -(sp) ;non-null, set register flag storage
|
||||
1$: call setxpr ;set expression registers
|
||||
bis (r3),(sp) ;save register flag
|
||||
chscan boptbl ;scan the binary operator table
|
||||
beq 2$ ; branch if not found
|
||||
call 10$ ;found, call handler
|
||||
br 1$ ;test for more
|
||||
|
||||
2$: bic #-1-regflg,(sp) ;mask all but register flag
|
||||
beq 6$ ;branch if not register
|
||||
bit #177770,(r4) ;in bounds?
|
||||
beq 6$
|
||||
error 70,r,<pdp-11 only has 8 registers>
|
||||
br 77$
|
||||
6$: asr rellvl ;test relocaton level
|
||||
bne 3$ ;branch if not 0 or 1
|
||||
bcc 4$ ;branch if 0
|
||||
tst (sp) ;relocatable, test register flag
|
||||
beq 4$ ;branch if not set
|
||||
7$: error 1,r,<cannot relocate a register>
|
||||
77$: clr (sp) ;clear register bit
|
||||
br 4$
|
||||
|
||||
3$: error 2,a,<improper relocation>
|
||||
4$: bis (sp)+,(r3) ;merge register bit
|
||||
setnz r0 ;set true
|
||||
5$: return
|
||||
10$:
|
||||
mov r0,-(sp) ;stack operator address
|
||||
mov r1,r3 ;leave pointer to "symbol" in r3
|
||||
mov (r1)+,-(sp) ;stack symbol
|
||||
mov (r1)+,-(sp)
|
||||
mov (r1)+,-(sp) ; mode,
|
||||
mov (r1)+,-(sp) ; value,
|
||||
mov (r1)+,-(sp) ; and rel level
|
||||
call glbtrm ;evaluate next tern
|
||||
mov #expbak+^d10,r1 ;set to unstack previous
|
||||
mov (sp)+,-(r1) ;rel level
|
||||
mov (sp)+,-(r1) ;value
|
||||
mov r1,r2 ;r2 points to previous value
|
||||
mov (sp)+,-(r1) ;mode
|
||||
mov (sp)+,-(r1)
|
||||
mov (sp)+,-(r1) ;r1 points to previous symbol
|
||||
.if ndf oldcod
|
||||
tst oprflg
|
||||
bpl 11$
|
||||
tst pass
|
||||
beq 11$
|
||||
bit #glbflg!relflg,mode
|
||||
bne expxxx
|
||||
bit #glbflg!relflg,expbak+4
|
||||
bne expxxx
|
||||
11$:
|
||||
.endc
|
||||
mov @(sp)+,-(sp)
|
||||
asr (sp) ;absolute only?
|
||||
bcs 12$ ; no
|
||||
bis -(r2),-(r4) ;yes, merge flags
|
||||
call abstst ;test for absolute
|
||||
cmp (r2)+,(r4)+ ;restore registers
|
||||
12$: asl (sp) ;even out address
|
||||
jmp @(sp)+ ;exit through handler
|
||||
.if ndf oldcod
|
||||
expxxx: inc oprflg
|
||||
mov #200,r0
|
||||
mov #expbak,r1
|
||||
call expyyy
|
||||
mov (sp)+,r0
|
||||
sub #boptbl,r0
|
||||
asr r0
|
||||
asr r0
|
||||
add #201,r0
|
||||
mov #symbol,r1
|
||||
call expyyy
|
||||
mov #symbol,r1
|
||||
clr (r1)+
|
||||
movb oprflg,(r1)+
|
||||
clrb (r1)+
|
||||
mov #glbflg,(r1)+
|
||||
clr (r1)+
|
||||
return
|
||||
|
||||
expyyy: mov r0,-(sp)
|
||||
call setrld
|
||||
mov r2,-(sp)
|
||||
movb #cc.opr,(r2)+
|
||||
clr -(sp)
|
||||
bit #glbflg!relflg,4(r1)
|
||||
beq 2$
|
||||
bit #glbflg,4(r1)
|
||||
bne 1$
|
||||
mov #cc.sec,(sp)
|
||||
cmpb 5(r1),objsec
|
||||
beq 2$
|
||||
1$: bis #cc.nam,(sp)
|
||||
.rept 4
|
||||
movb (r1)+,(r2)+
|
||||
.endm
|
||||
cmp -(r1),-(r1)
|
||||
2$: add #6,r1
|
||||
tst (r1)
|
||||
beq 3$
|
||||
bis #cc.val,(sp)
|
||||
movb (r1)+,(r2)+
|
||||
movb (r1)+,(r2)+
|
||||
3$: bisb (sp)+,@(sp)+
|
||||
movb (sp)+,(r2)+
|
||||
movb oprflg,(r2)+
|
||||
jmp dmprld
|
||||
|
||||
entsec implin
|
||||
oprflg: .blkw
|
||||
xitsec
|
||||
.endc
|
||||
|
||||
entsec impure
|
||||
expbak: .blkw 5 ;previous term storage
|
||||
xitsec
|
||||
entsec dpure
|
||||
boptbl: ;binary op table
|
||||
gchtbl ch.add, bopadd+1 ; "+"
|
||||
gchtbl ch.sub, bopsub+1 ; "-"
|
||||
gchtbl ch.mul, bopmul ; "*"
|
||||
gchtbl ch.div, bopdiv ; "/"
|
||||
gchtbl ch.and, bopand ; "&"
|
||||
gchtbl ch.ior, bopior ; "!"
|
||||
.word 0
|
||||
xitsec
|
||||
|
||||
bopsub: call reltst ;make sure no globals
|
||||
neg (r4) ; -, negate value
|
||||
neg rellvl ; and rellvl
|
||||
|
||||
bopadd: add (r2)+,(r4)+ ; +, add values
|
||||
add (r2),(r4) ; and relocation levels
|
||||
cmp -(r2),-(r4) ;point back to values
|
||||
bit #glbflg!relflg,-(r2) ;abs * xxx?
|
||||
beq 3$ ; yes, all set
|
||||
bit #glbflg!relflg,-(r4) ;xxx * abs?
|
||||
beq 4$ ; yes, old flags
|
||||
bitb #glbflg,(r2)+ ;error if either global
|
||||
bne 5$
|
||||
bitb #glbflg,(r4)+
|
||||
bne 5$
|
||||
cmpb (r4),(r2) ;rel +- rel, same sector?
|
||||
bne 5$ ; no, error
|
||||
bisb #relflg,-(r4)
|
||||
tst rellvl
|
||||
bne 3$
|
||||
bic #177400!relflg,(r4)
|
||||
3$: return
|
||||
|
||||
4$: mov (r1)+,(r3)+
|
||||
mov (r1)+,(r3)+
|
||||
bis (r1)+,(r3)+
|
||||
return
|
||||
|
||||
5$: jmp abserr
|
||||
|
||||
|
||||
bopand: com (r2)
|
||||
bic (r2),(r4)
|
||||
return
|
||||
|
||||
bopior: bis (r2),(r4)
|
||||
return
|
||||
bopmul: ; *
|
||||
mov (r2),r0 ;fetch first arg
|
||||
mov r0,-(sp) ;save a copy
|
||||
bpl 1$ ;positive?
|
||||
neg r0 ; no, make it so
|
||||
1$: mov (r4),r3 ;set second arg
|
||||
bpl 2$ ;branch if positive
|
||||
neg r3 ;negative, make it +
|
||||
com (sp) ;toggle result sign
|
||||
2$: mul r3,r0 ;multiply
|
||||
mov r1,r0 ;set for exit
|
||||
br bopdvx ;exit through divide
|
||||
|
||||
bopdiv: ; /
|
||||
mov (r4),r3 ;set divisor
|
||||
mov r3,-(sp) ;save a copy
|
||||
bpl 1$ ;branch if plus
|
||||
neg r3 ;make it thus
|
||||
1$: mov (r2),r1 ;set quotient
|
||||
bpl 2$ ;again!!!
|
||||
neg r1
|
||||
com (sp)
|
||||
2$: clr r0 ;operate
|
||||
div r3,r0
|
||||
|
||||
bopdvx: tst (sp)+ ;test result
|
||||
bpl 1$ ; ok as is
|
||||
neg r0 ;no, negate it
|
||||
1$: mov r0,(r4) ;set result
|
||||
return
|
||||
|
||||
;special entry point to expr
|
||||
;null field causes error
|
||||
;r0 set to value
|
||||
|
||||
glbtrm: call term
|
||||
beq abserr
|
||||
br abserx
|
||||
|
||||
glbexp: ;non-null expression
|
||||
call expr
|
||||
beq abserr
|
||||
br abserx
|
||||
|
||||
reltrm: call glbtrm
|
||||
br reltst
|
||||
|
||||
relexp:
|
||||
call glbexp
|
||||
reltst: bit #glbflg,flags
|
||||
beq abserx
|
||||
br abserr
|
||||
|
||||
abstrm: call glbtrm
|
||||
br abstst
|
||||
|
||||
absexp:
|
||||
call glbexp
|
||||
abstst: bit #glbflg!relflg,flags
|
||||
beq abserx
|
||||
abserr: clr mode
|
||||
clr rellvl
|
||||
abserf: error 3,a,<bad expression>
|
||||
abserx: mov value,r0 ;return with value in r0
|
||||
return
|
||||
.sbttl term evaluator
|
||||
|
||||
term: ;term evaluator
|
||||
call savreg ;save registers
|
||||
call setxpr ; and set "expression" type
|
||||
clr (r3) ;clear mode
|
||||
clr (r4) ; and value
|
||||
call term10 ;process
|
||||
bic #defflg!lblflg!mdfflg,(r3) ;clear extraneous
|
||||
clr rellvl ;assume absolute
|
||||
bit #relflg,(r3) ;true?
|
||||
beq 1$
|
||||
inc rellvl ; no, relocatable
|
||||
1$: inc expflg ;mark as expression
|
||||
jmp setnb ;exit with non-blank and r0 set
|
||||
|
||||
term10: call getsym ;try for a symbol
|
||||
jeq term20 ;branch if not a symbol
|
||||
.if ndf xcref
|
||||
mov #symrol,rolndx
|
||||
call crfref
|
||||
.endc
|
||||
cmp symbol,r50dot ;location counter?
|
||||
beq 14$ ; yes, treat special
|
||||
search symrol ;search the symbol table
|
||||
beq 16$ ;branch if not found
|
||||
bit #mdfflg,(r3) ;multiply defined?
|
||||
beq 11$ ; no
|
||||
error 5,m,<multiply defined>
|
||||
11$: bit #defflg,(r3) ;defined?
|
||||
beq 13$ ; no
|
||||
call setsec ;refer by sector name
|
||||
br 12$
|
||||
|
||||
13$: bit #glbflg,(r3) ;no, global?
|
||||
jne term28 ; yes
|
||||
error 4,u,<undefined symbol>
|
||||
sdebug <undef 1>
|
||||
12$: bic #glbflg,(r3) ;clear internal global flag
|
||||
jmp term28
|
||||
|
||||
14$: mov #clcnam,r1 ;dot, move to working area
|
||||
mov #symbol,r2
|
||||
xmit 4
|
||||
bicb #^c<relflg>,(r3) ;clear all but rel flag
|
||||
jmp term28
|
||||
|
||||
16$: search pstrol ;not user defined, perhaps an op-code?
|
||||
tst (r3) ;op code?
|
||||
bmi 17$ ;yes
|
||||
search symrol ;set search pointers
|
||||
.if df rsx11d
|
||||
bis #dfgflg!glbflg,(r3)
|
||||
bit #ed.gbl,edmask
|
||||
beq 20$
|
||||
bic #dfgflg!glbflg,(r3)
|
||||
.endc
|
||||
error 4,u,<undefined symbol>
|
||||
sdebug <undef 2>
|
||||
20$: call insert ;not in table, insert as undefined
|
||||
17$: clr (r3) ;be sure mode is zero
|
||||
jmp term28
|
||||
|
||||
.iif df rsx11d, genedt gbl
|
||||
|
||||
term20:
|
||||
mov cradix,r2 ;assume number, current radix
|
||||
21$: mov chrpnt,symbeg ;in case of re-scan
|
||||
call cvtnum ;convert
|
||||
beq term30 ; nope, missed again
|
||||
bpl 22$ ;number, any overflow?
|
||||
error 7,t,<number too big>
|
||||
22$: cmp r5,#ch.dot ;number, decimal?
|
||||
beq 24$ ; yes
|
||||
.if ndf xedlsb
|
||||
cmp r5,#ch.dol ;no, local symbol?
|
||||
beq 24$ ; yes
|
||||
.endc
|
||||
tstb r0 ;no, any numbers out of range?
|
||||
jeq term28 ; no
|
||||
error 6,n,<digit illegal in current radix>
|
||||
br 23$
|
||||
|
||||
24$: cmp r2,#10. ;"." or "$", were we decimal?
|
||||
beq 25$ ; yes
|
||||
23$: call setsym ;no,
|
||||
mov #10.,r2 ; try again with decimal radix
|
||||
br 21$
|
||||
|
||||
25$: cmp r5,#ch.dot ;decimal?
|
||||
beq term27 ; yes
|
||||
.if ndf xedlsb
|
||||
call lsrch ;no, local symbol
|
||||
bne term27 ;branch if found
|
||||
.endc
|
||||
term26: error 8,u,<local symbol not defined> ; no, flag as undefined
|
||||
term27: call getchr ;bypass dot or dollar
|
||||
term28: call setnb ;return pointing to non-blank
|
||||
setnz r0 ;flag as found
|
||||
term29: return
|
||||
term30:
|
||||
chscan uoptbl ;scan unary operator table
|
||||
beq term29 ; not there
|
||||
clr r2 ;clear for future use
|
||||
call @(r0)+ ;found, go and process
|
||||
jmp term28 ;exit true
|
||||
|
||||
|
||||
entsec dpure
|
||||
uoptbl:
|
||||
gchtbl ch.add, glbtrm ; "+"
|
||||
gchtbl ch.sub, term42 ; "-"
|
||||
gchtbl ch.qtm, term44 ; """
|
||||
gchtbl ch.xcl, term45 ; "'"
|
||||
gchtbl ch.pct, term46 ; "%"
|
||||
gchtbl ch.lab, term47 ; "<"
|
||||
gchtbl ch.uar, term50 ; "^"
|
||||
.word 0
|
||||
xitsec
|
||||
|
||||
term42: call abstrm ;evaluate absolute
|
||||
neg (r4) ;negate value
|
||||
return
|
||||
|
||||
term44: inc r2 ; """, mark it
|
||||
term45: mov r4,r1 ; "'", set temp store register
|
||||
call setsym ;point back to operator
|
||||
1$: call getchr ;get the next character
|
||||
beq term48 ;error if eol
|
||||
.if ndf xedlc
|
||||
movb @chrpnt,(r1) ;store absolute char
|
||||
bicb #200,(r1)+ ;clear possible sign bit and index
|
||||
.iff
|
||||
movb r5,(r1)+
|
||||
.endc
|
||||
dec r2 ;another character
|
||||
beq 1$ ; yes
|
||||
br term27 ;bypass last char
|
||||
|
||||
term46: call abstrm ;register expression
|
||||
bis #regflg,(r3) ;flag it
|
||||
return
|
||||
|
||||
term47: ; "<"
|
||||
call glbexp ;process non-null expression
|
||||
cmp r5,#ch.rab ;">"?
|
||||
beq term27 ; yes, bypass and exit
|
||||
term48: jmp abserf ;error, flag it
|
||||
term50: ; "^"
|
||||
chscan uartbl ;scan on next character
|
||||
beq term48 ; invalid, error
|
||||
jmp @(r0)+ ;call routine
|
||||
|
||||
entsec dpure
|
||||
uartbl: ;up arrow table
|
||||
gchtbl let.c, term51 ; ^c
|
||||
gchtbl let.d, term52 ; ^d
|
||||
gchtbl let.o, term53 ; ^o
|
||||
gchtbl let.b term54 ; ^b
|
||||
gchtbl let.r, trmr50 ; ^r
|
||||
.if ndf xfltg
|
||||
gchtbl let.f, term55 ; ^f
|
||||
.endc
|
||||
.if ndf oldcod
|
||||
gchtbl let.p, term56 ; ^p
|
||||
.endc
|
||||
.word 0
|
||||
xitsec
|
||||
|
||||
term51: call abstrm ;process absolute
|
||||
com (r4) ;complement value
|
||||
return
|
||||
|
||||
term52: add #2.,r2
|
||||
term53: add #6.,r2
|
||||
term54: add #2.,r2
|
||||
mov cradix,-(sp) ;stack current radix
|
||||
mov r2,cradix ;replace with local
|
||||
call glbtrm ;evaluate term
|
||||
mov (sp)+,cradix ;restore radix
|
||||
return
|
||||
|
||||
.globl setr50,mulr50
|
||||
r50gch: call getchr ;get next character
|
||||
cmp r2,#3 ;filled word?
|
||||
beq r50xit ; yes
|
||||
trmr50: call setr50 ;test radix 50
|
||||
call r50prc ;process the character
|
||||
bcc r50gch ;if cc no terminator seen
|
||||
|
||||
1$: cmp r2,#3 ;filled word?
|
||||
beq r50xit ; yes
|
||||
clr r0 ; no - pad with blanks
|
||||
call r50prc
|
||||
br 1$
|
||||
|
||||
r50xit: return ;done with argument
|
||||
|
||||
r50prc: cmp r0,#50 ;rad50?
|
||||
bhis 1$ ; no
|
||||
mov r0,-(sp) ;save current char
|
||||
mov (r4),r0 ;get partial
|
||||
call mulr50 ;multiply
|
||||
add (sp)+,r0 ;add in current
|
||||
mov r0,(r4) ;save
|
||||
inc r2 ;bump count
|
||||
clc ;no terminator seen
|
||||
return
|
||||
|
||||
1$: sec ;terminator seen
|
||||
return
|
||||
|
||||
.if ndf xfltg
|
||||
.globl fltg1w
|
||||
term55: call fltg1w ;process one word floating
|
||||
beq term48 ;error if null
|
||||
return
|
||||
.endc
|
||||
.if ndf oldcod
|
||||
term56: ; ^p
|
||||
call mk.upp ;make upper case
|
||||
cmp r5,#'l&^c40 ;low limit?
|
||||
beq 1$ ; yes
|
||||
cmp r5,#'h&^c40 ; high?
|
||||
bne term48 ; no, error
|
||||
inc r2 ;yes, reflect high
|
||||
1$: add #3,r2 ;make 3 or 4
|
||||
mov r2,-(sp) ;save operator
|
||||
call setrld ;set up rld
|
||||
movb #cc.opr,(r2)+ ;flag operator
|
||||
movb (sp)+,(r2)+ ;unary type
|
||||
call getnb ;bypass char
|
||||
call getsym ;get the argument
|
||||
mov #secrol,rolndx
|
||||
call crfref ;cref into proper roll
|
||||
mov #symbol,r1
|
||||
.rept 4 ;move into code buffer
|
||||
movb (r1)+,(r2)+
|
||||
.endm
|
||||
inc oprflg ;get unique number
|
||||
movb oprflg,(r2)+ ;stuff it
|
||||
call dmprld ;dump it
|
||||
mov #symbol,r1
|
||||
clr (r1)+ ;symbol is zero
|
||||
movb oprflg,(r1)+ ; followed by unique numbwr
|
||||
clrb (r1)+
|
||||
mov #glbflg,(r1)+
|
||||
clr (r1)+
|
||||
return
|
||||
|
||||
.endc
|
||||
chscan: ;character scan routine
|
||||
call mk.upp ;make char. upper-case
|
||||
1$: tst (r0)+ ;end (zero)?
|
||||
beq 2$ ; yes
|
||||
cmp (r0)+,r5 ;this the one?
|
||||
bne 1$ ; no
|
||||
tst -(r0) ;yes, move pointer back
|
||||
mov chrpnt,symbeg ;save current pointer
|
||||
call getnb ;get next non-blank
|
||||
tst -(r0) ;move addr or zero into r0
|
||||
return
|
||||
|
||||
2$: clr r0
|
||||
return
|
||||
|
||||
|
||||
mk.upp: cmp r5,#141 ; between a - z ?
|
||||
blt 1$ ;no
|
||||
cmp r5,#172
|
||||
bgt 1$ ;no
|
||||
sub #40,r5 ;yes, make it upper-case
|
||||
1$: return
|
||||
|
||||
.end
|
||||
250
tests/2.11BSD/m11/fltg.m11
Normal file
250
tests/2.11BSD/m11/fltg.m11
Normal file
@@ -0,0 +1,250 @@
|
||||
.title fltg
|
||||
|
||||
.ident /27dec3/
|
||||
|
||||
.mcall (at)always,xmit,genedt,error
|
||||
.mcall (at)sdebug,ndebug
|
||||
always
|
||||
|
||||
.globl savreg, abstrm, chrpnt, cpopj, cradix
|
||||
.globl getchr, getnb, mode
|
||||
.globl setnb, stcode, tstarg, value
|
||||
.globl edmask, ed.fpt
|
||||
|
||||
|
||||
.if ndf xfltg
|
||||
|
||||
.globl flt2, flt4, fltg1w
|
||||
|
||||
xitsec ;start in default sector
|
||||
|
||||
|
||||
flt4: inc r3
|
||||
flt2:
|
||||
inc r3 ;make it 1 or 2
|
||||
asl r3 ;now 2 or 4
|
||||
fp.1: call tstarg
|
||||
beq fp.9
|
||||
mov fltpnt-2(r3),-(sp) ;evaluate number
|
||||
call @(sp)+
|
||||
bne fp.2 ;branch if non-null
|
||||
error 9,a,<empty floating point number> ; null, flag error
|
||||
fp.2: mov r3,r2 ;get a working count
|
||||
mov #fltbuf,r1 ;point to floating point buffer
|
||||
3$: mov (r1)+,(r4) ;move in next number
|
||||
call stcode ;place on code roll
|
||||
sob r2,3$ ;loop on word count
|
||||
br fp.1 ;continue
|
||||
|
||||
fp.9: return
|
||||
|
||||
entsec dpure
|
||||
fltpnt: .word fltg2w, fltg4w
|
||||
xitsec
|
||||
|
||||
.if ndf xedfpt
|
||||
genedt fpt ;floating point truncation
|
||||
.endc
|
||||
|
||||
fltg4w: inc fltwdc ;floating point number evaluator
|
||||
fltg2w: inc fltwdc
|
||||
fltg1w:
|
||||
call savreg ;save registers
|
||||
mov chrpnt,-(sp) ;stack current character pointer
|
||||
mov #fltbuf,r3 ;convenient copy of pointers
|
||||
mov #fltsav,r4 ; to buffer and save area
|
||||
mov r4,r1
|
||||
1$: clr -(r1) ;init variables
|
||||
cmp r1,#fltbeg
|
||||
bhi 1$ ;loop until done
|
||||
mov #65.,fltbex ;init binary exponent
|
||||
cmp #'+,r5 ; "+"?
|
||||
beq 10$ ; yes, bypass and ignore
|
||||
cmp #'-,r5 ; "-"?
|
||||
bne 11$ ; no
|
||||
mov #100000,fltsgn ;yes, set sign and bypass char
|
||||
10$: call getchr ;get the next character
|
||||
11$: cmp r5,#'0 ;numeric?
|
||||
blo 20$
|
||||
cmp r5,#'9
|
||||
bhi 20$ ; no
|
||||
bit #174000,(r3) ;numeric, room for multiplication?
|
||||
beq 12$ ; yes
|
||||
inc fltexp ;no, compensate for the snub
|
||||
br 13$
|
||||
|
||||
12$: call fltm50 ;multiply by 5
|
||||
call fltgls ;correction, make that *10
|
||||
sub #'0,r5 ;make absolute
|
||||
mov r4,r2 ;point to end of buffer
|
||||
add r5,-(r2) ;add in
|
||||
adc -(r2) ;ripple carry
|
||||
adc -(r2)
|
||||
adc -(r2)
|
||||
13$: add fltdot,fltexp ;decrement if processing fraction
|
||||
clr (sp) ;clear initial char pointer (we're good)
|
||||
br 10$ ;try for more
|
||||
|
||||
20$: cmp #'.,r5 ;decimal point?
|
||||
bne 21$ ; no
|
||||
com fltdot ;yes, mark it
|
||||
bmi 10$ ;loop if first time around
|
||||
21$: cmp #105,r5 ;exponent?(routine is passed upper case)
|
||||
bne fltg3 ; no
|
||||
call getnb ;yes, bypass "e" and blanks
|
||||
mov cradix,-(sp) ;stack current radix
|
||||
mov #10.,cradix ;set to decimal
|
||||
call abstrm ;absolute term
|
||||
mov (sp)+,cradix ;restore radix
|
||||
add r0,fltexp ;update exponent
|
||||
; br fltg3 ;fall through
|
||||
fltg3: mov r3,r1
|
||||
mov (r1)+,r0 ;test for zero
|
||||
bis (r1)+,r0
|
||||
bis (r1)+,r0
|
||||
bis (r1)+,r0
|
||||
jeq fltgex ;exit if so
|
||||
31$: tst fltexp ;time to scale
|
||||
beq fltg5 ;fini if zero
|
||||
blt 41$ ;divide if .lt. zero
|
||||
cmp (r3),#031426 ;multiply, can we *5?
|
||||
bhi 32$ ; no
|
||||
call fltm50 ;yes, multiply by 5
|
||||
inc fltbex ; and by two
|
||||
br 33$
|
||||
|
||||
32$: call fltm54 ;multiply by 5/4
|
||||
add #3.,fltbex ; and by 8
|
||||
33$: dec fltexp ; over 10
|
||||
br 31$
|
||||
|
||||
40$: dec fltbex ;division, left justify bits
|
||||
call fltgls
|
||||
41$: tst (r3) ;sign bit set?
|
||||
bpl 40$ ; no, loop
|
||||
mov #16.*2,-(sp) ;16 outer, 2 inner
|
||||
call fltgrs ;shift right
|
||||
call fltgsv ;place in save buffer
|
||||
42$: bit #1,(sp) ;odd lap?
|
||||
bne 43$ ; yes
|
||||
call fltgrs ;move a couple of bits right
|
||||
call fltgrs
|
||||
43$: call fltgrs ;once more to the right
|
||||
call fltgad ;add in save buffer
|
||||
dec (sp) ;end of loop?
|
||||
bgt 42$ ; no
|
||||
tst (sp)+ ;yes, prune stack
|
||||
sub #3.,fltbex
|
||||
inc fltexp
|
||||
br 31$
|
||||
fltg5: dec fltbex ;left justift
|
||||
call fltgls
|
||||
bcc fltg5 ;lose one bit
|
||||
add #200,fltbex ;set excess 128.
|
||||
ble 2$ ;branch if under-flow
|
||||
tstb fltbex+1 ;high order zero?
|
||||
beq fg53$ ; yes
|
||||
2$: error 10,n,<floating point overflow> ;no, error
|
||||
fg53$: mov r4,r2 ;set to shift eight bits
|
||||
mov r2,r1
|
||||
tst -(r1) ;r1 is one lower than r2
|
||||
4$: cmp -(r1),-(r2) ;down one word
|
||||
movb (r1),(r2) ;move up a byte
|
||||
swab (r2) ;beware of the inside-out pc!!
|
||||
cmp r2,r3 ;end?
|
||||
bne 4$
|
||||
call fltgrs ;shift one place right
|
||||
ror (r4) ;set high carry
|
||||
.if ndf xedfpt
|
||||
bit #ed.fpt,edmask ;truncation?
|
||||
beq fp57$ ; yes
|
||||
.endc
|
||||
mov fltwdc,r2 ;get size count
|
||||
asl r2 ;double
|
||||
bne 8$ ;preset type
|
||||
inc r2 ;single word
|
||||
8$: asl r2 ;convert to bytes
|
||||
bis #077777,fltbuf(r2)
|
||||
sec
|
||||
5$: adc fltbuf(r2)
|
||||
dec r2
|
||||
dec r2
|
||||
bge 5$
|
||||
tst (r3) ;test sign position
|
||||
bpl fp57$ ;ok if positive
|
||||
6$: error 11,t,<trunctation error>
|
||||
fp57$: add fltsgn,(r3) ;set sign, if any
|
||||
fltgex: clr mode ;make absolute
|
||||
clr fltwdc ;clear count
|
||||
mov (r3),value ;place first guy in value
|
||||
mov (sp)+,r0 ;origional char pointer
|
||||
beq 1$ ;zero (good) if any digits processed
|
||||
mov r0,chrpnt ;none, reset to where we came in
|
||||
clr r3 ;flag as false
|
||||
1$: mov r3,r0 ;set flag in r0
|
||||
jmp setnb ;return with non-blank
|
||||
fltm54: ;*5/4
|
||||
cmp (r3),#146314 ;room?
|
||||
blo 1$
|
||||
call fltgrs
|
||||
inc fltbex
|
||||
1$: call fltgsv ;save in backup
|
||||
call fltgrs ;scale right
|
||||
call fltgrs
|
||||
br fltgad
|
||||
|
||||
fltm50: ;*5
|
||||
call fltgsv
|
||||
call fltgls
|
||||
call fltgls
|
||||
|
||||
fltgad: ;add save buffer to fltbuf
|
||||
mov r4,r2 ;point to save area
|
||||
1$: add 6(r2),-(r2) ;add in word
|
||||
mov r2,r1 ;set for carries
|
||||
2$: adc -(r1) ;add in
|
||||
bcs 2$ ;continue ripple, if necessary
|
||||
cmp r2,r3 ;through?
|
||||
bne 1$ ; no
|
||||
return
|
||||
fltgrs: clc ;right shift
|
||||
mov r3,r1 ;right rotate
|
||||
ror (r1)+
|
||||
ror (r1)+
|
||||
ror (r1)+
|
||||
ror (r1)+
|
||||
return
|
||||
|
||||
fltgls: ;left shift
|
||||
mov r4,r2
|
||||
asl -(r2)
|
||||
rol -(r2)
|
||||
rol -(r2)
|
||||
rol -(r2)
|
||||
return
|
||||
|
||||
fltgsv: mov r3,r1 ;move fltbuf to fltsav
|
||||
mov r4,r2
|
||||
xmit 4
|
||||
return
|
||||
|
||||
|
||||
entsec impure
|
||||
fltbeg: ;start of floating point impure
|
||||
fltsgn: .blkw ;sign bit
|
||||
fltdot: .blkw ;decimal point flag
|
||||
fltexp: .blkw ;decimal exponent
|
||||
fltbex: .blkw 1 ;binary exponent (must preceed fltbuf)
|
||||
fltbuf: .blkw 4 ;main ac
|
||||
fltsav: .blkw 4
|
||||
|
||||
entsec implin
|
||||
fltwdc: .blkw ;word count
|
||||
|
||||
xitsec
|
||||
|
||||
|
||||
.endc
|
||||
|
||||
.end
|
||||
|
||||
453
tests/2.11BSD/m11/getl.m11
Normal file
453
tests/2.11BSD/m11/getl.m11
Normal file
@@ -0,0 +1,453 @@
|
||||
.title getl
|
||||
.list me
|
||||
|
||||
.ident /03apr4/
|
||||
|
||||
|
||||
.mcall (at)always,ch.mne,st.flg
|
||||
.globl ..z, sdebug
|
||||
.mcall (at)zap
|
||||
always
|
||||
ch.mne
|
||||
st.flg
|
||||
|
||||
.mcall (at)sdebug,ndebug
|
||||
.mcall (at)xmit,param,error
|
||||
.mcall (at)genedt,gencnd,setnz
|
||||
.mcall (at)search,scanw
|
||||
|
||||
|
||||
.globl lcbegl, linend, lcendl
|
||||
.globl cdrsav
|
||||
|
||||
.globl linnum, seqend, pagnum, pagext, ffcnt
|
||||
.globl lppcnt
|
||||
|
||||
.globl stmnt
|
||||
|
||||
.globl cndwrd, lsybas, lc.cnd, lsbset
|
||||
.globl xctlin
|
||||
.globl secrol, cndrol, lsyrol, symrol
|
||||
|
||||
.globl srcchn, smlchn
|
||||
.globl crfdef, crfref
|
||||
|
||||
.globl clcfgs, clcloc, clcmax
|
||||
.globl clcnam, clcsec, cpopj
|
||||
.globl flags, getchr, getnb, getsym
|
||||
.globl lsrch, mode
|
||||
.globl sector, setnb
|
||||
.globl setsec, setxpr
|
||||
.globl symbol, tstarg, value
|
||||
.globl smllvl, msbmrp, getmch
|
||||
.globl edmask, ed.cdr, ed.lc, ed.lsb
|
||||
|
||||
;globals defined in assembler
|
||||
|
||||
.if ndf xswit
|
||||
.globl absexp, chrpnt, pass
|
||||
.endc
|
||||
|
||||
.globl savreg, xmit0
|
||||
.globl linbuf
|
||||
.globl gsarg
|
||||
|
||||
;globals defined in mcexec
|
||||
|
||||
.globl getic, io.eof, io.eoi, io.err
|
||||
.globl argcnt, cndmex
|
||||
.globl endflg
|
||||
.globl getlin, lblend, lcendl, lcflag
|
||||
.globl lcmask, lsgbas
|
||||
.globl u.flag , mac.er, macdfn
|
||||
|
||||
xitsec ;start in default sector
|
||||
|
||||
getlin: ;get an input line
|
||||
call savreg
|
||||
getl01: call xctlin ;init line-oriented variables
|
||||
mov ffcnt,r0 ;any reserved ff's?
|
||||
beq 2$ ; no
|
||||
add r0,pagnum ;yes, update page number
|
||||
mov #-1,pagext
|
||||
clr ffcnt
|
||||
.if ndf xlcseq
|
||||
clr linnum ;init new cref sequence
|
||||
clr seqend
|
||||
.endc
|
||||
tst pass
|
||||
beq 2$
|
||||
clr lppcnt
|
||||
2$: .if ndf xsml
|
||||
mov #-1,r4 ;assume in sysmac
|
||||
mov #smlchn,r0
|
||||
tst smllvl ;true?
|
||||
bne 4$ ; yes
|
||||
.endc
|
||||
clr r4 ;no, assume physical input
|
||||
mov #srcchn,r0
|
||||
.if ndf xmacro
|
||||
mov msbmrp,r1 ;fetch pointer
|
||||
beq 4$ ;zero means not in macro
|
||||
inc r4 ;make it a one
|
||||
4$: asl r4 ;double for indexing
|
||||
.endc
|
||||
mov #linbuf,r2
|
||||
mov r2,lcbegl ;set up beginning
|
||||
mov r2,chrpnt
|
||||
mov #linend,lcendl ; and end of line markers
|
||||
;fall through
|
||||
|
||||
getl10: ;char loop
|
||||
call @getltb(r4) ;call proper routine
|
||||
bic #200,r5 ;clear sign bit
|
||||
beq getl10 ;ignore if null
|
||||
bmi 25$ ;special if sign bit set
|
||||
cmp r5,#40 ;less than space?
|
||||
blo 20$ ; yes
|
||||
cmp r5,#140 ;good guy as is?
|
||||
blo 14$ ; yes
|
||||
beq 22$ ;illegal
|
||||
cmp r5,#172 ;lower case?
|
||||
bhi 22$ ; no, probably illegal
|
||||
.if ndf xedlc
|
||||
bit #ed.lc,edmask ;lower case enabled?
|
||||
beq 14$ ; yes, leave alone
|
||||
.endc
|
||||
sub #40,r5 ;convert lower to upper case
|
||||
14$: movb r5,(r2)+ ;store in linbuf
|
||||
cmp r2,#linend ;overflow?
|
||||
blo getl10 ; no
|
||||
tstb -(r2) ;yes, move back one
|
||||
16$: ;flag line error
|
||||
error 12,l,<line too long>
|
||||
br getl10
|
||||
|
||||
20$: cmp r5,#tab ;<40, check specials
|
||||
beq 14$ ;ok as is
|
||||
cmp r5,#lf
|
||||
beq getl40 ;eol
|
||||
cmp r5,#vt ;vertical tab?
|
||||
beq 32$ ; yes (special)
|
||||
cmp r5,#ff
|
||||
bne 23$
|
||||
tst u.flag
|
||||
beq 30$ ; -u flag not in effect: pay heed to form feeds
|
||||
mov #40,r5 ; flag in effect: convert ^L into space
|
||||
br 14$
|
||||
23$:
|
||||
cmp r5,#cr
|
||||
beq getl10 ;ignore carriage returns
|
||||
22$: cmp r5,#177 ;rubout?
|
||||
beq getl10 ; yes, ignore
|
||||
24$:
|
||||
; error 13,i,<illegal character>
|
||||
bis #200,r5 ;flag for qm on listing
|
||||
br 14$
|
||||
|
||||
25$: bit r5,#io.eoi ;end of input?
|
||||
bne 34$ ; yes
|
||||
bit r5,#io.err ;error?
|
||||
bne 16$ ; yes
|
||||
;no, assume eof and fall through
|
||||
30$: .if ndf xmacro
|
||||
tst r4 ;reading from source?
|
||||
bne 32$ ; no
|
||||
inc ffcnt ;yes, bump page count
|
||||
add pagnum,ffcnt+2
|
||||
.endc
|
||||
32$: cmp r2,#linbuf ;first char?
|
||||
bne getl40 ; no
|
||||
jmp getl01 ;yes, reprocess line
|
||||
|
||||
34$: tst macdfn
|
||||
bne 35$
|
||||
error 14,e,<.end not found> ;end of input,
|
||||
br 36$
|
||||
35$: error 140,e,<end of input while macro or repeat in progress>
|
||||
36$:
|
||||
inc endflg ; missed .end statement
|
||||
|
||||
getl40: clrb (r2)
|
||||
mov #linbuf,..z
|
||||
call sdebug
|
||||
.if ndf xmacro
|
||||
tst r4
|
||||
bne 41$
|
||||
.endc
|
||||
.if ndf xlcseq
|
||||
inc linnum ;bump line number
|
||||
.globl fileln
|
||||
inc fileln ;bump true line number
|
||||
.endc
|
||||
41$: .if ndf xedcdr
|
||||
movb linbuf+72.,cdrsav ;save column 73
|
||||
bit #ed.cdr,edmask ;card reader type?
|
||||
bne 42$ ; no
|
||||
clrb linbuf+72. ;yes, force eol
|
||||
42$: .endc
|
||||
mov endflg,r0 ;return with "endflg" as argument
|
||||
jmp setnb ;return pointing at first non-blank
|
||||
|
||||
entsec dpure ;input mode jump table
|
||||
.if ndf xsml
|
||||
.word getic ;sysmac same as regular source
|
||||
.endc
|
||||
getltb: .word getic ;get input character
|
||||
.if ndf xmacro
|
||||
.word getmch ;get macro character
|
||||
.endc
|
||||
|
||||
entsec imppas
|
||||
endflg: .blkw ;set non-zero on end
|
||||
lppcnt: .blkw 1 ;force new page when negative
|
||||
ffcnt: .blkw 2 ;unprocessed ff count
|
||||
pagext: .blkw 1 ;page number extension
|
||||
.if ndf xlcseq
|
||||
seqend: .blkw 1
|
||||
.endc
|
||||
|
||||
xitsec
|
||||
|
||||
.iif ndf xedlc, genedt lc ;lower case
|
||||
setsec:
|
||||
clr r0
|
||||
bisb sector,r0
|
||||
; imuli rs.sec*2,r0 ;multiply by bytes/block
|
||||
mov r0,-(sp)
|
||||
asl r0
|
||||
asl r0
|
||||
add (sp)+,r0
|
||||
asl r0
|
||||
add <^pl rolbas>+secrol,r0 ;compute base of sector roll
|
||||
mov (r0)+,symbol ;xfer sector name to symbol
|
||||
mov (r0)+,symbol+2
|
||||
return
|
||||
.sbttl conditionals
|
||||
|
||||
.globl iif
|
||||
|
||||
|
||||
|
||||
|
||||
iif: ;immediate handlers
|
||||
call tcon ;test argument
|
||||
tst r3
|
||||
bmi 3$ ; branch if unsatisfied
|
||||
cmp #ch.com,r5 ;comma?
|
||||
bne 1$ ; no
|
||||
call getchr ;yes, bypass
|
||||
1$: mov chrpnt,r1 ;save current location
|
||||
|
||||
|
||||
call setnb ;set to nom-blank
|
||||
bit #lc.cnd,lcmask ;conditional suppression?
|
||||
beq 2$ ; no
|
||||
mov r1,lcbegl ;yes, suppress all up to comma
|
||||
2$: clr argcnt
|
||||
jmp stmnt ;back to statement
|
||||
|
||||
3$: clr r5 ;false, but no "q" error
|
||||
br endcx
|
||||
|
||||
|
||||
;concatenated conditionals
|
||||
.irp arg, <eq,ge,gt,le,lt,ne,g,l,nz,z,df,ndf>
|
||||
.globl if'arg
|
||||
if'arg:
|
||||
.endm
|
||||
|
||||
mov symbol+2,symbol ;treat second half as argument
|
||||
call tconf ;examine it
|
||||
br if1 ;into the main stream
|
||||
|
||||
|
||||
.globl if, ift, iff, iftf, endc
|
||||
|
||||
if: ;micro-programmmed conditional
|
||||
call tcon ;test argument
|
||||
if1: mov #cndlvl,r1 ;point to level
|
||||
cmp (r1),#15. ;room for another?
|
||||
bgt ifoer1 ; no, error
|
||||
inc (r1) ;yes, bump level
|
||||
asl r3 ;set carry to true (0) or false (1)
|
||||
ror -(r1) ;rotate into cndmsk
|
||||
asl r3
|
||||
ror -(r1) ;ditto for cndwrd
|
||||
br endcx
|
||||
ift: ;if true sub-conditional
|
||||
mov cndmsk,r3 ;get current
|
||||
br iftf ; and branch
|
||||
|
||||
iff: ;if false sub-conditional
|
||||
mov cndmsk,r3 ;get current condition
|
||||
com r3 ;use complement and fall through
|
||||
|
||||
iftf: ;unconditional sub-conditional
|
||||
;(r3=0 when called directly)
|
||||
tst cndlvl ;conditional in progress?
|
||||
ble ifoerr ; no, error
|
||||
asl cndwrd ;move off current flag
|
||||
asl r3 ;set carry
|
||||
ror cndwrd ;mov on
|
||||
br endcx
|
||||
|
||||
endc: ;end of conditional
|
||||
mov #cndlvl,r1 ;point to level
|
||||
tst (r1) ;in conditional?
|
||||
ble ifoerr ; no, error
|
||||
dec (r1) ;yes, decrement
|
||||
asl -(r1) ;reduce mask
|
||||
asl -(r1) ; and test word
|
||||
endcx:
|
||||
bit #lc.cnd,lcmask ;suppression requested?
|
||||
beq 2$ ; no
|
||||
mov lblend,r0 ;yes, any label?
|
||||
beq 1$ ; no, suppress whole line
|
||||
mov r0,lcendl ;yes, list only label
|
||||
br 2$
|
||||
|
||||
1$: bis #lc.cnd,lcflag ;mark conditional
|
||||
2$: return
|
||||
|
||||
ifoerr: error 15,o,<conditional not in progress> ;condition error
|
||||
return
|
||||
ifoer1: error 16,o,<too many nested conditionals>
|
||||
return
|
||||
tcon: ;test condition
|
||||
call gsarg ;get a symbol
|
||||
tconf: scanw cndrol ;scan for argument
|
||||
beq 7$ ; error if not found
|
||||
mov symbol+2,r1 ;get address
|
||||
asr r1 ;low bit used for toggle flag
|
||||
sbc r3 ;r3 goes to -1 if odd
|
||||
asl r1 ;back to normal (and even)
|
||||
tst cndwrd ;already unsat?
|
||||
bne tcon8 ; yes, just exit
|
||||
call tstarg ;bypass comma
|
||||
jmp @r1 ;jump to handler
|
||||
|
||||
7$: error 17,a,<conditional argument not specified>
|
||||
tcon8: clr r5 ;no "q" error
|
||||
return
|
||||
|
||||
|
||||
|
||||
gencnd eq, tconeq
|
||||
gencnd ne, tconeq, f
|
||||
gencnd z, tconeq
|
||||
gencnd nz, tconeq, f
|
||||
gencnd gt, tcongt
|
||||
gencnd le, tcongt, f
|
||||
gencnd g, tcongt
|
||||
gencnd lt, tconlt
|
||||
gencnd ge, tconlt, f
|
||||
gencnd l, tconlt
|
||||
gencnd df, tcondf
|
||||
gencnd ndf, tcondf, f
|
||||
|
||||
|
||||
tconeq: call absexp ;eq/ne, test expression
|
||||
beq tcontr ;branch if sat
|
||||
tconfa: com r3 ; false, toggle
|
||||
tcontr: return ;true, just exit
|
||||
|
||||
tcongt: call absexp
|
||||
bgt tcontr
|
||||
br tconfa
|
||||
|
||||
tconlt: call absexp
|
||||
blt tcontr
|
||||
br tconfa
|
||||
|
||||
tcondf: ;if/idf
|
||||
mov r3,r1 ;save initial condition
|
||||
clr r2 ;set "&"
|
||||
clr r3 ;start off true
|
||||
1$: call getsym ;get a symbol
|
||||
beq 8$ ; undefined if not a sym
|
||||
search symrol ;search user symbol table
|
||||
call crfref
|
||||
clr r0 ;assume defined
|
||||
bit #defflg,mode ;good guess?
|
||||
bne 2$ ; yes
|
||||
8$: com r0 ;no, toggle
|
||||
2$: cmp r0,r3 ;yes, match?
|
||||
beq 3$ ; yes, all set
|
||||
mov r2,r3 ; no
|
||||
com r3
|
||||
3$: mov r1,r2 ;assume "&"
|
||||
cmp r5,#ch.and ; "&"
|
||||
beq 4$ ; branch if good guess
|
||||
cmp r5,#ch.ior ;perhaps or?
|
||||
bne 5$ ; no
|
||||
com r2 ;yes, toggle mode
|
||||
4$: call getnb ;bypass op
|
||||
br 1$ ;try again
|
||||
|
||||
5$: tst r1 ;ifdf?
|
||||
beq 6$ ; yes
|
||||
com r3 ;no, toggle
|
||||
6$: return
|
||||
|
||||
entsec imppas
|
||||
;conditional storage (must be ordered)
|
||||
cndwrd: .blkw ;test word
|
||||
cndmsk: .blkw ;condition mask
|
||||
cndlvl: .blkw ;nesting level
|
||||
cndmex: .blkw ;mexit flag
|
||||
xitsec
|
||||
|
||||
.sbttl roll handlers
|
||||
|
||||
.if ndf xedlsb
|
||||
lsrch: ;local symbol search
|
||||
tst lsyflg ;flag set?
|
||||
beq 1$ ; no
|
||||
clr lsyflg ;yes, clear it
|
||||
inc lsybkn ;bump block number
|
||||
1$: mov #symbol,r0
|
||||
mov lsybkn,(r0)+ ;move into "symbol"
|
||||
mov value,(r0)
|
||||
.if ndf rsx11d
|
||||
beq 2$ ;error if zero
|
||||
cmp (r0),#^d127
|
||||
blos lsrch3
|
||||
.iff
|
||||
bne lsrch3
|
||||
.endc
|
||||
2$: error 18,t,<illegal local symbol> ;yes, flag error
|
||||
lsrch3: search lsyrol ;search the roll
|
||||
return
|
||||
entsec imppas
|
||||
lsyflg: .blkw ;bumped at "label:"
|
||||
lsybkn: .blkw ;block number
|
||||
lsybas: .blkw ;section base
|
||||
lsgbas: .blkw ;base for generated symbols
|
||||
xitsec
|
||||
genedt lsb,lsbtst ;local symbol block
|
||||
|
||||
.enabl lsb
|
||||
lsbtst: bne 2$ ;bypass if /ds
|
||||
br 1$
|
||||
|
||||
lsbset: bit #ed.lsb,edmask ;in lsb over-ride?
|
||||
beq 2$ ; yes
|
||||
1$: inc lsyflg ;flag new block
|
||||
mov clcloc,lsybas ;set new base
|
||||
bic #1,lsybas ;be sure its even
|
||||
clr lsgbas ;clear generated symbol base
|
||||
2$: return
|
||||
|
||||
.dsabl lsb
|
||||
|
||||
.endc
|
||||
.sbttl utilities
|
||||
|
||||
setxpr: ;set expression registers
|
||||
mov #symbol,r1
|
||||
mov #sector,r2
|
||||
mov #mode,r3
|
||||
mov #value,r4
|
||||
return
|
||||
.end
|
||||
BIN
tests/2.11BSD/m11/l11.x
Normal file
BIN
tests/2.11BSD/m11/l11.x
Normal file
Binary file not shown.
958
tests/2.11BSD/m11/lout.m11
Normal file
958
tests/2.11BSD/m11/lout.m11
Normal file
@@ -0,0 +1,958 @@
|
||||
.title lout
|
||||
|
||||
|
||||
.ident /10may4/
|
||||
|
||||
.mcall (at)always,ch.mne,st.flg,ct.mne
|
||||
.mcall (at)bisbic
|
||||
always
|
||||
ch.mne
|
||||
st.flg
|
||||
ct.mne
|
||||
|
||||
.mcall (at)xmit,param,putlp
|
||||
.macro putlin addr ;use listing flags
|
||||
.if dif <addr><r0>
|
||||
mov addr,r0
|
||||
.endc
|
||||
call putlin
|
||||
.endm
|
||||
.mcall (at)genswt,error
|
||||
.mcall (at)zwrite
|
||||
.mcall (at)genedt,setnz
|
||||
.mcall (at)scanw,next,zap
|
||||
.mcall (at)sdebug,ndebug
|
||||
|
||||
|
||||
param lpp, 60. ;
|
||||
param ttllen, 32.
|
||||
param stllen, 64.
|
||||
|
||||
.globl codrol, errrol, lcdrol, symrol, secrol
|
||||
.globl lcbegl, linend, lcendl
|
||||
.globl linbuf, cdrsav, endp2l
|
||||
|
||||
.globl linnum, seqend, pagnum, pagext
|
||||
.globl ffcnt, lppcnt
|
||||
.globl dflgbm, opclas
|
||||
|
||||
|
||||
.globl edmask, ed.cdr, ed.lc
|
||||
|
||||
|
||||
srclen = 204 ;*********************
|
||||
octlen = 60 ;*********************
|
||||
|
||||
mx.on =lc.md!lc.mc!lc.ld!lc.toc!lc.sym!lc.cnd!lc.bin!lc.loc!lc.seq
|
||||
|
||||
|
||||
|
||||
.globl lc.cnd
|
||||
.globl exmflg
|
||||
.globl lstchn, cmochn, lstflg, putoc
|
||||
.globl mx.flg, my.flg
|
||||
.globl crfref
|
||||
|
||||
.globl clcfgs, clcloc, clcmax
|
||||
.globl clcnam, clcsec, cpopj
|
||||
.globl errbts
|
||||
.globl flags, getchr, getnb, getsym
|
||||
.globl mode
|
||||
.globl rolndx, rolupd
|
||||
.globl sector, setpf0, setpf1
|
||||
.globl setsym
|
||||
.globl symbol, tstarg, value
|
||||
|
||||
.globl expr, pcroll, prgttl
|
||||
.globl setwrd, setbyt, tstr50, mulr50
|
||||
.globl r50unp
|
||||
|
||||
.globl setchr
|
||||
|
||||
;globals defined in assembler
|
||||
|
||||
.globl setlc
|
||||
|
||||
.globl chrpnt, getr50, pass
|
||||
.globl putkb, putkbl, putlp
|
||||
|
||||
.globl dnc, movbyt, savreg, xmit0
|
||||
.globl linbuf, errcnt
|
||||
|
||||
;globals defined in mcexec
|
||||
|
||||
.globl dattim
|
||||
.globl hdrttl
|
||||
.globl io.eof, io.tty, io.err
|
||||
|
||||
.globl ioftbl, cnttbl, buftbl
|
||||
|
||||
|
||||
|
||||
.globl argcnt, cttbl
|
||||
.globl endlin
|
||||
.globl getlin, lblend, lcendl, lcflag
|
||||
.globl lcmask, lc.mc, lc.md, lc.me
|
||||
.globl lst.kb, lst.lp, lstdev
|
||||
xitsec ;start in default sector
|
||||
|
||||
endlin: ;end of line processor
|
||||
call savreg
|
||||
clr rolupd ;set to fetch from code roll
|
||||
tstb cttbl(r5) ;eol or semi-colon?
|
||||
ble lout1 ; yes
|
||||
error 19,q,<random junk at end of statement ignored>
|
||||
|
||||
lout1: .if ndf xedcdr
|
||||
movb cdrsav,linbuf+72. ;replace borrowed char
|
||||
.endc
|
||||
mov pass,-(sp) ;pass 1?
|
||||
beq 9$ ; yes
|
||||
call mx.mx ; <<< REEDS june 81
|
||||
mov lstdev,(sp) ;init listing flag
|
||||
|
||||
tst errbts ;any errors?
|
||||
bne 7$ ; yes, go directly, do not collect, etc.
|
||||
tstb (sp) ;any listing device?
|
||||
beq 9$ ; no
|
||||
bit #lc.ld,lcflag ;listing directive?
|
||||
bne 5$ ; yes
|
||||
tst mx.flg ; <<< REEDS june 81
|
||||
bne 80$ ; <<< REEDS june 81: in mx mode we ignore .list
|
||||
tst lclvl ;test over-under ride
|
||||
blt 5$ ;if <0, list only if errors
|
||||
bgt 8$ ;if >0, list unconditionally
|
||||
80$: bit #lc.com,lcmask ;comment suppression?
|
||||
beq 2$ ; no
|
||||
mov chrpnt,lcendl ;yes, assume we're sitting at comment
|
||||
2$: bit #lc.src,lcmask ;line suppression?
|
||||
beq 3$ ; no
|
||||
mov #linbuf,lcendl ;yes, point to start of buffer
|
||||
3$:
|
||||
.if ndf xmacro
|
||||
tstb <^pl rolsiz>+codrol+1 ;anything in code roll?
|
||||
beq 4$ ; no
|
||||
bit #lc.meb,lcmask ;macro binary expansion?
|
||||
bne 4$ ; no
|
||||
bic #lc.me,lcflag ;yes, ignore me flag
|
||||
.endc
|
||||
4$: bit lcmask,lcflag ;anything suppressed?
|
||||
beq 9$ ; no, use current flags
|
||||
5$: clr (sp) ;yes, clear listing mode
|
||||
br 9$
|
||||
7$: swab (sp) ;error, set to error flags
|
||||
8$: mov #linbuf,lcbegl ;list entire line
|
||||
mov #linend,lcendl
|
||||
9$: call pcroll ;process entry on code roll
|
||||
endl10: movb (sp),lstreq ;anything requested?
|
||||
beq endl20 ; no
|
||||
clrb @lcendl ;set asciz terminator
|
||||
mov #octbuf,r2
|
||||
11$: mov #space*400+space,(r2)+ ;blank fill
|
||||
cmp #linbuf,r2 ;test for end (beginning of line buffer)
|
||||
bne 11$
|
||||
|
||||
endl50: mov #octbuf,r2 ;point to start of buffer
|
||||
call tsterr ;set error flags
|
||||
mov #linnum,r0
|
||||
mov (r0)+,r1
|
||||
cmp r1,(r0)
|
||||
beq 2$
|
||||
mov r1,(r0)
|
||||
bit #lc.seq,lcmask
|
||||
bne 2$
|
||||
mov r2,r4
|
||||
call dnc
|
||||
mov #octbuf+7,r0
|
||||
1$: movb -(r2),-(r0)
|
||||
movb #space,(r2)
|
||||
cmp r2,r4
|
||||
bhi 1$
|
||||
mov #octbuf+7,r2
|
||||
2$: movb #tab,(r2)+
|
||||
21$: mov #pf0,r1
|
||||
bit #lc.loc,lcmask
|
||||
bne 4$
|
||||
tst (r1)
|
||||
beq 3$
|
||||
call setwrd
|
||||
3$: movb #tab,(r2)+
|
||||
4$: clr (r1)
|
||||
mov #pf1,r1
|
||||
bit #lc.bin,lcmask
|
||||
bne endl19
|
||||
mov #1,r4
|
||||
bit #lc.ttm,lcmask
|
||||
beq 41$
|
||||
cmpb (r4)+,(r4)+ ; cheap increment by 2
|
||||
41$: tst (r1)
|
||||
beq 6$
|
||||
5$: call setwdb
|
||||
6$: movb #tab,(r2)+
|
||||
clr (r1)
|
||||
dec r4
|
||||
beq endl19
|
||||
tst rolupd
|
||||
beq 6$
|
||||
call pcroll
|
||||
br 5$
|
||||
endl19: mov lcbegl,r1 ;point to start of listing line
|
||||
call movbyt ;move over
|
||||
putlin #octbuf ; test for header and list
|
||||
call err.pr
|
||||
endl20:
|
||||
clrb @lcbegl ;don't dupe line
|
||||
tst rolupd ;finished?
|
||||
beq endl30 ; yes, don't loop
|
||||
call pcroll
|
||||
beq endl30 ;exit if empty
|
||||
bit #lc.bex!lc.bin,lcmask ;binary extension suppressed?
|
||||
beq endl10 ; no
|
||||
br endl20 ;yes, don't list
|
||||
|
||||
endl30: tst (sp)+ ;prune listing flag
|
||||
zap codrol ;clear the code roll
|
||||
mov clcloc,r0
|
||||
cmp r0,clcmax ;new high for sector?
|
||||
blos 31$ ; no
|
||||
mov r0,clcmax ;yes, set it
|
||||
31$: return
|
||||
|
||||
setwdb: ;list word or byte
|
||||
tst (r1) ;anything for second field?
|
||||
beq 9$ ; no
|
||||
mov #setwrd,-(sp) ;assume word
|
||||
bit #dflgbm,opclas ;true?
|
||||
beq 1$ ; yes
|
||||
mov #setbyt,(sp) ;no, byte
|
||||
1$: call @(sp)+ ;call routine
|
||||
bit #77*400,(r1) ;test for linker modification
|
||||
beq 9$
|
||||
|
||||
bit #5100,(r1) ;if one of these isnt set I dont know
|
||||
bne 12$ ;what is going on, so lets mark it ?
|
||||
movb #'?,(r2)
|
||||
br 9$
|
||||
12$:
|
||||
movb #ch.xcl,(r2) ; ' marks psect relocation
|
||||
bit #4000,(r1)
|
||||
bne 10$
|
||||
movb #'",(r2) ; " location counter relocation
|
||||
10$:
|
||||
bit #glbflg,(r1)
|
||||
beq 2$
|
||||
movb #'G,(r2)
|
||||
tst symbol ; harvard m11 uses global syms with funny
|
||||
bne 2$ ; names for complex relocation
|
||||
movb #'C,(r2)
|
||||
2$: tstb (r2)+
|
||||
9$: return
|
||||
|
||||
tsterr: ;test and process errors
|
||||
mov errbts,r0 ;any errors?
|
||||
beq 9$ ; no
|
||||
bic #err.,r0 ;yes, ".print"?
|
||||
beq 4$ ; yes
|
||||
inc errcnt ;bump error count
|
||||
call err.sh
|
||||
4$: mov #errmne-1,r1
|
||||
1$: tstb (r1)+ ;move char pntr and clear carry
|
||||
ror errbts ;rotate error bits
|
||||
bcc 2$
|
||||
movb (r1),(r2)+
|
||||
.if ndf xcref
|
||||
movb (r1),r0 ;fetch character
|
||||
call tstr50 ;convert to rad50
|
||||
call mulr50 ;left justify
|
||||
call mulr50
|
||||
mov r0,symbol ;store
|
||||
clr symbol+2
|
||||
mov #errrol,rolndx ;prepare to cref
|
||||
call crfref ;do so
|
||||
.endc
|
||||
br 1$
|
||||
|
||||
2$: bne 1$
|
||||
9$: return
|
||||
|
||||
|
||||
.globl fileln
|
||||
.globl putli2
|
||||
err.sh::
|
||||
call savreg
|
||||
tst lstflg
|
||||
bne 9$
|
||||
|
||||
; printf("%s: line %d: %s\n", infile, fileln, errmess)
|
||||
|
||||
mov #err.bx,r2
|
||||
tstb err.by
|
||||
beq 1$
|
||||
mov #err.by,r1
|
||||
call movbyt
|
||||
mov #err.s1,r1
|
||||
call movbyt
|
||||
mov fileln,r1
|
||||
call dnc
|
||||
tst err.xx
|
||||
beq 2$
|
||||
mov #err.s2,r1
|
||||
call movbyt
|
||||
1$: mov err.xx,r1
|
||||
call movbyt
|
||||
clr err.xx
|
||||
2$:
|
||||
clrb (r2)
|
||||
mov #err.bx,r2
|
||||
mov #lst.kb,r4
|
||||
call putli2
|
||||
9$:
|
||||
return
|
||||
|
||||
.data
|
||||
err.s1: .asciz /: line /
|
||||
.even
|
||||
err.s2: .asciz /: /
|
||||
|
||||
.bss
|
||||
err.bx: .blkw 60
|
||||
err.by:: .blkw 60
|
||||
|
||||
entsec impure
|
||||
errcnt: .blkw ;error counter
|
||||
entsec implin
|
||||
errbts: .blkw ;error flags
|
||||
err.xx:: .blkw ;error message
|
||||
xitsec
|
||||
.if ndf xedcdr
|
||||
genedt cdr
|
||||
entsec impure
|
||||
cdrsav: .blkw ;saved char from card format
|
||||
.endc
|
||||
entsec impure
|
||||
octbuf:
|
||||
octerp: .blkb 0
|
||||
octseq: .blkb 2
|
||||
octpf0: .blkb 7
|
||||
octpf1: .blkb octlen-<.-octbuf>
|
||||
linbuf: .blkw srclen/2
|
||||
linend: .blkw 1
|
||||
|
||||
.data
|
||||
tmpcnt = 1
|
||||
errmne: .irpc char,< abeilmnopqrtuz>
|
||||
.ascii /char/
|
||||
.globl err.'char
|
||||
err.'char= tmpcnt
|
||||
tmpcnt = tmpcnt+tmpcnt
|
||||
.endm
|
||||
|
||||
xitsec
|
||||
.globl title, sbttl
|
||||
|
||||
title:
|
||||
call getsym ;get a symbol
|
||||
bne title1 ; error if null
|
||||
error 20,a,<missing title>
|
||||
return
|
||||
|
||||
title1: mov r0,prgttl ;move into storage
|
||||
mov symbol+2,prgttl+2
|
||||
call setsym ;point to start of title
|
||||
mov #ttlbuf,r2 ;point to buffer
|
||||
movb #ff,(r2)+ ;store page eject
|
||||
clr r3 ;clear position conter
|
||||
2$: .if ndf xedlc ;>>>gh 7/20/78 to not automatically upper-case
|
||||
bit #ed.lc,edmask ;lower case enabled?
|
||||
bne 6$ ; no, leave as upper case
|
||||
mov chrpnt,r5 ;fake for ovlay pic
|
||||
movb (r5),r5 ;fetch original character
|
||||
6$: .endc
|
||||
movb r5,(r2) ;plunk the next char in the buffer
|
||||
beq 5$ ;branch if end
|
||||
cmp r5,#tab ;a tab?
|
||||
bne 3$ ; no
|
||||
bis #7,r3 ;yes, compensate
|
||||
3$: inc r3 ;update position counter
|
||||
cmp r3,#ttllen ;within bounds?
|
||||
bhis 4$ ; no
|
||||
tstb (r2)+ ;yes, move pointer
|
||||
4$: call getchr ;get the next character
|
||||
bne 2$ ;loop if not end
|
||||
5$: movb #tab,(r2)+ ;set separator
|
||||
.globl vernam
|
||||
mov vernam,r1
|
||||
call movbyt ;set version number, etc.
|
||||
mov #dattim,r1
|
||||
call movbyt ;date and time
|
||||
mov r2,ttlbrk ;remember break point
|
||||
clrb (r2)
|
||||
return
|
||||
|
||||
.data
|
||||
defttl:: .asciz /.main./ ;default title
|
||||
|
||||
entsec impure
|
||||
ttlbrk: .blkw ;break location
|
||||
ttlbuf: .blkb ttllen-1!7+1+1 ;modulo tab + ff
|
||||
.blkb 20. ;intro msg
|
||||
.iif ndf xtime, .blkb 20. ;time & date
|
||||
.blkb 20. ;page number
|
||||
.even
|
||||
xitsec
|
||||
|
||||
|
||||
|
||||
sbttl: ;sub-title directive
|
||||
mov #stlbuf,r2 ;point to sub-title buffer
|
||||
tst pass ;pass one?
|
||||
beq 2$ ; yes
|
||||
1$: .if ndf xedlc ;>>>gh 7/20/78 to not automatically upper-case
|
||||
bit #ed.lc,edmask ;lower case enabled?
|
||||
bne 4$ ; no, leave as upper case
|
||||
mov chrpnt,r5 ;fake for ovlay pic
|
||||
movb (r5),r5 ;fetch original character
|
||||
4$: .endc
|
||||
movb r5,(r2)+ ;move character in
|
||||
beq 13$ ; branch if end
|
||||
call getchr ;get the next character
|
||||
cmp r2,#stlbuf+stllen-1 ;test for end
|
||||
blo 1$
|
||||
tstb -(r2) ;polish off line
|
||||
br 1$
|
||||
|
||||
2$: bit #lc.toc,lcmask
|
||||
bne 13$
|
||||
tstb lstdev ;any listing device?
|
||||
beq 13$ ; no, exit
|
||||
tst mx.flg ; <<< REEDS june 81
|
||||
bne 13$ ; <<<
|
||||
mov #toctxt,r1
|
||||
call movbyt ;set table of contents
|
||||
call setsym ;point to ".sbttl"
|
||||
3$: call getr50 ;get radix-50 char
|
||||
bgt 3$ ;stop at first terminator
|
||||
mov chrpnt,r2 ;set pointer
|
||||
.if ndf xlcseq
|
||||
mov linnum,r0
|
||||
call 10$
|
||||
movb #ch.sub,-(r2)
|
||||
.iff
|
||||
movb #tab,-(r2)
|
||||
.endc
|
||||
mov pagnum,r0
|
||||
call 10$
|
||||
movb #space,-(r2)
|
||||
|
||||
tst lstflg
|
||||
beq 15$
|
||||
bisb lstdev,lstreq
|
||||
15$: putlin r2 ;output
|
||||
return
|
||||
|
||||
10$: mov #4,r4 ; << REEDS. changed to 4 digit field from 3
|
||||
11$: movb #space,-(r2)
|
||||
mov r0,r1
|
||||
beq 12$
|
||||
clr r0
|
||||
div #^d10,r0
|
||||
add #dig.0,r1
|
||||
movb r1,(r2)
|
||||
12$: sob r4,11$
|
||||
13$: return
|
||||
|
||||
.data
|
||||
toctxt: .asciz /table of contents/
|
||||
|
||||
entsec imppas
|
||||
stlbuf: .blkw <stllen+2>/2 ;sub-title buffer
|
||||
|
||||
xitsec
|
||||
.globl print, error
|
||||
|
||||
|
||||
.enabl lsb
|
||||
|
||||
print:
|
||||
error 0,<>,<user generated error> ; null error (dont count)
|
||||
br error1
|
||||
|
||||
error: error 53,p,<user generated error>
|
||||
error1: call setpf0 ;print location field
|
||||
call expr ;evaluate expression
|
||||
beq 2$ ;branch if null
|
||||
call setpf1 ;non-null, list value
|
||||
2$: return
|
||||
|
||||
.dsabl lsb
|
||||
|
||||
|
||||
.globl rem
|
||||
|
||||
rem: ; ".rem" directive
|
||||
mov r5,r3 ;set terminating character
|
||||
bne rem1 ;branch if non-null
|
||||
error 22,a,<missing delimiting character>
|
||||
;error, no delimiting character
|
||||
return
|
||||
|
||||
rem1: call getchr ;get the next character
|
||||
2$: tst r5 ;end of line?
|
||||
bne 3$ ; no
|
||||
call endlin ;yes, polish off line
|
||||
call getlin ;get next line
|
||||
beq 2$ ;loop if no eof
|
||||
return ;eof, exit
|
||||
|
||||
3$: cmp r5,r3 ;is this the terminator?
|
||||
bne rem1 ; no
|
||||
jmp getnb ;yes, bypass and exit
|
||||
|
||||
.sbttl listing control
|
||||
|
||||
.globl nlist, list
|
||||
|
||||
nlist: com r3 ;make r3 -1
|
||||
list:
|
||||
asl r3 ;make r3 0/-2
|
||||
inc r3 ;now 1/-1
|
||||
1$: call tstarg ;test for another argument
|
||||
bne 2$ ; valid
|
||||
tst argcnt ;null, first?
|
||||
bne list7 ; no, we're through
|
||||
inc argcnt ;yes, mark it
|
||||
2$: call getsym ;try for a symbol
|
||||
scanw lcdrol ;look it up in the table
|
||||
beq 6$ ; error if not found
|
||||
clr r2
|
||||
sec
|
||||
3$: rol r2
|
||||
sob r0,3$
|
||||
tst exmflg ;called from command string?
|
||||
beq 11$ ; no
|
||||
bis r2,lcmcsi ;yes, set disable bits
|
||||
bisbic lcdeft ;change the default values
|
||||
br 12$ ; and skip test
|
||||
|
||||
11$: bit r2,lcmcsi ;this flag off limits?
|
||||
bne 5$ ; yes
|
||||
12$: bic r2,lcmask
|
||||
bit r2,#lc. ;null?
|
||||
beq 4$ ; no
|
||||
call pagex ;set listing control
|
||||
add r3,lclvl ;yes, update level count
|
||||
beq 5$ ;don't set flag if back to zero
|
||||
4$: tst r3
|
||||
bpl 5$ ;.list, branch
|
||||
bis r2,lcmask
|
||||
5$: br 1$ ;try for more
|
||||
|
||||
6$: error 23,a,<unknown .list/.nlist argument>
|
||||
list7: return
|
||||
|
||||
genswt li,list ;generate /li
|
||||
genswt nl,nlist ; and /nl switch entries
|
||||
|
||||
.globl page
|
||||
page: inc ffcnt ;simulate ff after this line
|
||||
pagex: bis #lc.ld,lcflag ;flag as listing directive
|
||||
return
|
||||
|
||||
.macro genlct mne,init ;generate listing control table
|
||||
lc.'mne= 1
|
||||
.rept <.-lctbas>/2
|
||||
lc.'mne= lc.'mne+lc.'mne
|
||||
.endm
|
||||
.rad50 /mne/
|
||||
.if nb <init>
|
||||
lcinit= lcinit+lc.'mne
|
||||
.endc
|
||||
.endm
|
||||
|
||||
lcinit= 0
|
||||
|
||||
entsec lctsec
|
||||
lctbas = .
|
||||
genlct seq
|
||||
genlct loc
|
||||
genlct bin
|
||||
genlct src
|
||||
genlct com
|
||||
genlct bex
|
||||
genlct md
|
||||
genlct mc
|
||||
genlct me ,1
|
||||
genlct meb,1
|
||||
genlct cnd
|
||||
genlct ld ,1
|
||||
genlct ttm,1
|
||||
genlct toc
|
||||
genlct sym
|
||||
genlct < > ;null
|
||||
|
||||
xitsec
|
||||
|
||||
genswt fl,profl
|
||||
flsbts= lc.seq!lc.loc!lc.bin!lc.bex!lc.me!lc.meb!lc.toc!lc.sym
|
||||
profl:
|
||||
mov #flsbts,lcmcsi
|
||||
mov #flsbts,lcmask
|
||||
return
|
||||
|
||||
.globl eddflt,ucflag
|
||||
uc.set::
|
||||
bis #ed.lc,eddflt
|
||||
um.set::
|
||||
inc ucflag
|
||||
return
|
||||
|
||||
.data
|
||||
.even
|
||||
ucflag:: .word ; if set, dont do case trnslation in macros
|
||||
entsec dpure
|
||||
lcdeft: .word lcinit ; default value for lcmask
|
||||
xitsec
|
||||
entsec impure
|
||||
lcmask: .blkw ;mask bits
|
||||
lclvl: .blkw ;level count
|
||||
lcmcsi: .blkw ;command string storage
|
||||
|
||||
entsec implin
|
||||
lcflag: .blkw ;flag bits
|
||||
lcbegl: .blkw ;pointer to start of line
|
||||
lcendl: .blkw ;pointer to end of line
|
||||
lblend: .blkw ;end of label (for parsing)
|
||||
|
||||
xitsec
|
||||
|
||||
setlc:
|
||||
mov lcdeft,lcmask ;default flags
|
||||
clr lclvl
|
||||
clr lcmcsi
|
||||
return
|
||||
|
||||
.sbttl listing stuff
|
||||
|
||||
setpf0: ;set print field zero
|
||||
sdebug <setpf0>
|
||||
mov clcfgs,pf0 ;set current location flags
|
||||
bisb #100,pf0+1 ;assume word
|
||||
mov clcloc,pf0+2 ;set location
|
||||
return
|
||||
|
||||
setpf1: ;set print field one
|
||||
mov mode,pf1 ;set mode of current value
|
||||
bisb #100,pf1+1 ;assume word
|
||||
mov value,pf1+2
|
||||
return
|
||||
|
||||
entsec implin
|
||||
pf0: .blkw 2
|
||||
pf1: .blkw 2
|
||||
xitsec
|
||||
endp2l: ;end pass2 listing
|
||||
call err.pr ; flush out last error message
|
||||
mov #symtxt,r1
|
||||
mov #stlbuf,r2
|
||||
call movbyt ;set "symbol table" sub-title
|
||||
tstb lstdev ;any listing output?
|
||||
beq endp2d ; no
|
||||
bit #lc.sym,lcmask ;symbol table suppression?
|
||||
bne endp2d ; yes
|
||||
inc ffcnt ;force new page
|
||||
clr lppcnt ;force new page
|
||||
inc pagnum
|
||||
mov #-1,pagext
|
||||
clr rolupd ;set for symbol table scan
|
||||
2$: mov #linbuf,r2 ;point to storage
|
||||
3$: next symrol ;get the next symbol
|
||||
beq endp2a ; no more
|
||||
bit #regflg,mode ;register?
|
||||
bne 3$ ; yes, don't list
|
||||
call r50unp ;unpack the symbol
|
||||
mov #endp2t,r3
|
||||
call endp2p
|
||||
mov #mode,r1 ;point to mode bits
|
||||
bit #defflg,(r1) ;defined?
|
||||
beq 4$ ; no
|
||||
call setwrd
|
||||
br 6$
|
||||
|
||||
4$: mov #stars,r1
|
||||
call movbyt ;undefined, substitute ******
|
||||
6$: call endp2p
|
||||
.iif df rsx11d, call endp2x
|
||||
mov #sector,r1
|
||||
cmpb #1,(r1)
|
||||
bge 10$
|
||||
cmpb -(r1),-(r1)
|
||||
call setbyt
|
||||
10$: movb #tab,(r2)+ ;separator
|
||||
cmp r2,#linbuf+50. ;enough for one line?
|
||||
blo 3$ ; no
|
||||
call endp2b ;output line
|
||||
br 2$ ;next line
|
||||
|
||||
|
||||
endp2a: ; print .psect list
|
||||
|
||||
.if ndf xrel
|
||||
clr rolupd ;set for sector scan
|
||||
21$: call endp2b ;output line
|
||||
next secrol ;get the next entry
|
||||
beq endp2d ; exit if end of roll
|
||||
movb #'<,(r2)+
|
||||
call r50unp ;print the name,
|
||||
movb #'>,(r2)+
|
||||
movb #tab,(r2)+
|
||||
mov #value,r1
|
||||
call setwrd ; the value,
|
||||
movb #tab,(r2)+
|
||||
mov #sector-2,r1
|
||||
call setbyt ; and the entry number
|
||||
movb #tab,(r2)+
|
||||
mov #flags-2,r1
|
||||
call setbyt ; and the attributes
|
||||
br 21$
|
||||
.endc
|
||||
|
||||
endp2b: clrb (r2)
|
||||
mov lstdev,lstreq ; we want output
|
||||
putlin #linbuf
|
||||
mov #linbuf,r2 ;reset to start of buffer
|
||||
endp2d: return
|
||||
|
||||
endp2p: call endp2x
|
||||
endp2x: mov (r3)+,r0
|
||||
bit (r3)+,mode
|
||||
bne 32$
|
||||
swab r0
|
||||
32$: movb r0,(r2)+
|
||||
return
|
||||
|
||||
entsec dpure
|
||||
endp2t:
|
||||
.ascii / =/
|
||||
.word lblflg
|
||||
.ascii /% /
|
||||
.word regflg
|
||||
.ascii /r /
|
||||
.word relflg
|
||||
.ascii /g /
|
||||
.word glbflg
|
||||
.if df rsx11d
|
||||
.ascii /x /
|
||||
.word dfgflg
|
||||
.endc
|
||||
|
||||
.data
|
||||
stars: .asciz /******/
|
||||
symtxt: .asciz /symbol table/
|
||||
xitsec
|
||||
lst.kb= 1 ;teletype listing
|
||||
lst.lp= 2 ;lpt listing
|
||||
|
||||
|
||||
xitsec
|
||||
|
||||
;
|
||||
; These routines are high level. They make output go to
|
||||
; more than one device, they add page headers. The dogsbody
|
||||
; low guy is 'putli2', who in turn calls on 'o.kblp', which
|
||||
; interfaces with the file buffering guys directly.
|
||||
;
|
||||
|
||||
putkb: mov #lst.kb,lstreq ;set request
|
||||
br putlix
|
||||
|
||||
putkbl: mov #lst.kb,lstreq ;set for tty
|
||||
putlp: tst lstflg ;doing a listing?
|
||||
beq putlix ;no
|
||||
bisb lstdev,lstreq ;lpt
|
||||
;
|
||||
; output a line plain & simple
|
||||
;
|
||||
putlix:
|
||||
call savreg
|
||||
mov r0,r2
|
||||
movb lstreq,r4
|
||||
call putli2
|
||||
return
|
||||
|
||||
putlin: ;output a line with page heading if needed
|
||||
call savreg ;stack registers
|
||||
mov r0,r2 ;arg to r2
|
||||
movb lstreq,r4 ;get request
|
||||
clr lstreq ;clear it
|
||||
tst r4
|
||||
beq 9$ ;just exit if empty
|
||||
bgt 2$ ;omit header if not listing
|
||||
dec lppcnt ;yes, decrement count
|
||||
bgt 2$ ;skip if not time
|
||||
call putpag
|
||||
2$:
|
||||
call err.pr
|
||||
call putli2 ;print out the line
|
||||
9$: return
|
||||
|
||||
|
||||
putli2:
|
||||
movb (r2)+,r1 ;get a char.
|
||||
beq 21$ ;end on null
|
||||
call o.kblp ;transmit appropriately
|
||||
br putli2 ;till null
|
||||
21$:
|
||||
movb #lf,r1 ; used to be cr/lf
|
||||
call o.kblp
|
||||
bit #lst.kb,r4 ;if sending to cmochn,
|
||||
beq 9$ ;no
|
||||
zwrite cmo ;yes, send it now
|
||||
9$: return
|
||||
|
||||
o.kblp: bic #177600,r1 ;just 7 bits, please.
|
||||
bit #lst.kb,r4 ;cmo on?
|
||||
beq 1$ ;no
|
||||
mov #cmochn,r0 ;yes
|
||||
call putoc
|
||||
1$: bit #lst.lp,r4 ;lst on?
|
||||
beq 2$ ;no
|
||||
mov #lstchn,r0 ;yes
|
||||
call putoc
|
||||
2$: return
|
||||
; put out a page heading
|
||||
putpag:
|
||||
;mov #lpp,lppcnt ;reset count
|
||||
mov #lpp-4,lppcnt ;reset count, compensate for bug introduced
|
||||
;by rearranging pagination logic
|
||||
mov r2,-(sp) ;stack current pointer
|
||||
mov ttlbrk,r2 ;end of pre-set title
|
||||
tst pass
|
||||
beq 11$
|
||||
mov #pagmne,r1
|
||||
call movbyt ;move "page" into position
|
||||
mov pagnum,r1
|
||||
call dnc ;convert to decimal
|
||||
inc pagext
|
||||
beq 11$
|
||||
movb #'-,(r2)+
|
||||
mov pagext,r1
|
||||
inc r1
|
||||
call dnc
|
||||
11$: clrb (r2)
|
||||
tst mx.flg ; <<< REEDS june 81
|
||||
bne 100$
|
||||
putlp #ttlbuf ;print title
|
||||
putlp #stlbuf ; sub-title,
|
||||
100$:
|
||||
putlp #crlf ; and a blank line
|
||||
mov (sp)+,r2
|
||||
return
|
||||
entsec impure
|
||||
lstreq: .blkw ;list request flags
|
||||
lstdev: .blkb 2 ;error(lh), listing(rh)
|
||||
|
||||
.data
|
||||
pagmne: .ascii / page /
|
||||
crlf: .asciz //
|
||||
xitsec
|
||||
|
||||
|
||||
|
||||
.macro putl x ; printf("%s\n", mx.lin)
|
||||
mov x,mx.tmp
|
||||
call putl
|
||||
.endm
|
||||
putl:
|
||||
.irpc xx,<012345>
|
||||
mov r'xx,-(sp)
|
||||
.endm
|
||||
mov mx.tmp,r2
|
||||
mov #lst.lp,r4
|
||||
call putli2
|
||||
.irpc xx,<543210>
|
||||
mov (sp)+,r'xx
|
||||
.endm
|
||||
return
|
||||
|
||||
putsc:
|
||||
call savreg
|
||||
mov mdepth,r4
|
||||
1$:
|
||||
movb #';,r1
|
||||
call mx.put
|
||||
dec r4
|
||||
bpl 1$
|
||||
movb #tab,r1
|
||||
call mx.put
|
||||
return
|
||||
mx.put:
|
||||
call savreg
|
||||
mov #lst.lp,r4
|
||||
bic #177600,r1
|
||||
mov #lstchn,r0
|
||||
call putoc
|
||||
return
|
||||
mx.mx:
|
||||
call savreg
|
||||
tst mx.flg
|
||||
beq 1$
|
||||
mov #mx.on,lcmask
|
||||
tst errbts
|
||||
beq 3$
|
||||
putl #mxstar
|
||||
call err.pr
|
||||
3$:
|
||||
tst mx.2 ; is it a .narg, etc. directive?
|
||||
beq 2$
|
||||
clr mx.2
|
||||
tst my.flg
|
||||
bne 20$
|
||||
call putsc ; ;.narg frodo
|
||||
putl #linbuf
|
||||
20$:
|
||||
putl #mx.gen ; ; generates:
|
||||
putl #mx.pxx ; frodo = 5280
|
||||
br 1$
|
||||
2$:
|
||||
tst my.flg ; is it otherwise suppressed & are
|
||||
bne 1$ ; we listing such?
|
||||
bit lcmask,lcflag ; anything supppressed?
|
||||
beq 1$
|
||||
call putsc
|
||||
putl #linbuf
|
||||
1$:
|
||||
return
|
||||
|
||||
err.pr:
|
||||
call savreg
|
||||
mov r0,-(sp)
|
||||
mov r5,-(sp)
|
||||
tst err.xx
|
||||
beq 1$
|
||||
mov #lst.kb,r4
|
||||
tst lstflg
|
||||
beq 2$
|
||||
mov #lst.lp,r4
|
||||
2$:
|
||||
mov err.xx,r2
|
||||
call putli2
|
||||
clr err.xx
|
||||
1$:
|
||||
mov (sp)+,r5
|
||||
mov (sp)+,r0
|
||||
return
|
||||
|
||||
.bss
|
||||
mdepth:: .blkw 1
|
||||
xitsec
|
||||
entsec mixed
|
||||
mx.gen:: .asciz /;*** generates:/
|
||||
mxstar:: .asciz /*** error ***/
|
||||
mx.pxx: .ascii <tab>
|
||||
mx.sym:: .ascii /symbol = /
|
||||
mx.num:: .ascii /65000/
|
||||
.even
|
||||
mx.2:: .blkw
|
||||
mx.tmp: .blkw ; space for putl(arg)
|
||||
|
||||
.end
|
||||
292
tests/2.11BSD/m11/m11.1
Normal file
292
tests/2.11BSD/m11/m11.1
Normal file
@@ -0,0 +1,292 @@
|
||||
.TH M11 1
|
||||
.UC
|
||||
.SH NAME
|
||||
m11 \- Macro-11 assembler for UNIX
|
||||
.SH SYNOPSIS
|
||||
.B m11
|
||||
[
|
||||
option1
|
||||
option2
|
||||
\&...
|
||||
]
|
||||
file1
|
||||
file2
|
||||
\&...
|
||||
filen
|
||||
.SH DESCRIPTION
|
||||
.I M11
|
||||
assembles the concatenation of the specified files (\fIfile1\fP, etc.)
|
||||
and terminates when an ``.end'' statement is encountered. The
|
||||
resulting object file is usually named \fIfilen.obj\fP (see
|
||||
below). If a file argument, \fIfilei\fP does
|
||||
not contain a ``.'' in its name, the file \fIfilei.m11\fP
|
||||
will be sought before \fIfilei\fP itself.
|
||||
.sp 2
|
||||
Options, if desired, may appear anywhere in the command,
|
||||
and are chosen from the following list.
|
||||
All options are interpreted before any files are read.
|
||||
.sp
|
||||
.TP
|
||||
.B \-\^ls
|
||||
Produce an assembly listing and place in
|
||||
.IR filen .lst
|
||||
.TP
|
||||
.B \-\^lt
|
||||
Produce an assembly listing on the standard output.
|
||||
.TP
|
||||
.B \-\^fl
|
||||
If coupled with the
|
||||
.I \-ls
|
||||
or
|
||||
.I \-lt
|
||||
directives, makes the listing have a shortened format.
|
||||
It is shorthand for
|
||||
.IR \-nl:seq:loc:bin:bex:me:meb:ttm:toc:sym .
|
||||
.TP
|
||||
.B \-\^uc
|
||||
Simulate an initial
|
||||
.I ".dsabl lc"
|
||||
directive.
|
||||
Force all characters in macro definitions to be upper case.
|
||||
This flag makes lower-case handling in
|
||||
.I m11
|
||||
compatable with the DEC Macro-11 assemblers.
|
||||
.TP
|
||||
.B \-\^um
|
||||
Force all characters in macro definitions to be upper case.
|
||||
This flag makes lower-case handling in
|
||||
this release of
|
||||
.I m11
|
||||
compatable with previous versions of
|
||||
.IR m11 .
|
||||
.TP
|
||||
.B \-\^de
|
||||
Make all option choices needed to make assembly mimic DEC
|
||||
Macro-11. Implies
|
||||
.I "(inter alia)"
|
||||
the
|
||||
.I \-uc
|
||||
flag.
|
||||
This includes the Johns Hopkins
|
||||
.I asm
|
||||
assembler.
|
||||
.TP
|
||||
.B \-\^ha
|
||||
Make all option choices needed to make assembly mimic earlier
|
||||
(Harvard) releases of m11.
|
||||
This implies the
|
||||
.I \-um
|
||||
flag.
|
||||
Default .psect and .csect attributes are set up in the funny Harvard way.
|
||||
.TP
|
||||
.B \-\^mx
|
||||
Produce a listing of the source program as it appears
|
||||
.I after
|
||||
macro expansion.
|
||||
Macro calls, conditional directives and so on appear in the listing as comments.
|
||||
Listing appears on standard output.
|
||||
No machine code is generated or listed.
|
||||
This option is meant to correspond to the \-E or \-P
|
||||
options of the C compiler
|
||||
.I cc(1).
|
||||
.TP
|
||||
.B \-\^my
|
||||
Like
|
||||
.IR \-mx ,
|
||||
except that macro calls and conditional directives do
|
||||
not show up in the listing.
|
||||
.TP
|
||||
.B \-\^10
|
||||
Generate an error whenever op codes not in the
|
||||
PDP-11 ``standard instruction set''
|
||||
are encountered.
|
||||
Programmers writing for a PDP 11/10 can catch instructions illegal for
|
||||
that machine by using this argument.
|
||||
.TP
|
||||
.B \-\^dp:args
|
||||
The default attributes for a
|
||||
.I .psect
|
||||
or unnamed
|
||||
.I .csect
|
||||
are redefined, using the colon-separated list
|
||||
.I args
|
||||
of valid .psect attributes.
|
||||
.TP
|
||||
.B \-\^da:args
|
||||
The default attributes for an
|
||||
.I .asect
|
||||
are redefined.
|
||||
.TP
|
||||
.B \-\^dp:c
|
||||
The default attributes for a named
|
||||
.I .csect
|
||||
are redefined.
|
||||
.TP
|
||||
.B \-\^li:arglist
|
||||
Simulate an initial
|
||||
.I ".list arglist"
|
||||
directive.
|
||||
All
|
||||
.I .list
|
||||
and
|
||||
.I .nlist
|
||||
directives in the program text which attempt to change the settings established
|
||||
with the
|
||||
.I \-li
|
||||
flag will be ignored.
|
||||
.TP
|
||||
.B \-\^nl:arglist
|
||||
Like
|
||||
.I \-li:arglist,
|
||||
but for the
|
||||
.I .nlist
|
||||
directive.
|
||||
.TP
|
||||
.B \-\^en:arglist
|
||||
Similarly, for the
|
||||
.I .enabl
|
||||
directive.
|
||||
.TP
|
||||
.B \-\^ds:arglist
|
||||
Similarly, but for the
|
||||
.I .dsabl
|
||||
directive.
|
||||
.TP
|
||||
.B \-\^cr:arglist
|
||||
Produces a cross-reference listing.
|
||||
If the
|
||||
.I \-ls
|
||||
option is also included, the cross-reference listing will follow the
|
||||
assembly listing in
|
||||
.IR filen .lst.
|
||||
References which are tagged with the symbol # are definitions.
|
||||
References tagged with * are destuctive references: the value of the
|
||||
symbol or variable in question is changed.
|
||||
.I Arglist
|
||||
consists of colon-separated keywords from the following set.
|
||||
The keywords may be prefix abbreviated:
|
||||
.RS
|
||||
.TP
|
||||
sym
|
||||
All user-defined symbols are indexed.
|
||||
.TP
|
||||
mac
|
||||
All macro names are indexed.
|
||||
.TP
|
||||
per
|
||||
All uses of permanent symbols \- op codes, directives, etc \-
|
||||
are indexed.
|
||||
.TP
|
||||
pse
|
||||
All psect names are indexed.
|
||||
For compatability with the RT-11
|
||||
.I CREF
|
||||
program, the argument
|
||||
.I cse
|
||||
is synonymous with
|
||||
.I pse.
|
||||
.TP
|
||||
err
|
||||
All errors are indexed.
|
||||
.TP
|
||||
reg
|
||||
All register uses are indexed.
|
||||
.PP
|
||||
If no
|
||||
.I arglist
|
||||
is specified the default
|
||||
.I "sym:mac:err"
|
||||
is used.
|
||||
In the listing page and line numbers for uses of symbols
|
||||
are followed by a # sign if the symbol is defined and by a * sign
|
||||
if the symbol is modified.
|
||||
.RE
|
||||
.TP
|
||||
.B \-\^lp
|
||||
Same as \-ls, but also spools
|
||||
.IR filen .lst
|
||||
for printing upon completion.
|
||||
.TP
|
||||
.B \-\^no
|
||||
No object file is produced. This is useful for
|
||||
syntax checking or list producing.
|
||||
.TP
|
||||
.B \-\^xs:n
|
||||
Allots nK words of extra space for
|
||||
symbol table and macro storage.
|
||||
NOTE:
|
||||
This option is currently inoperative:
|
||||
.I m11
|
||||
automatically allots core for its tables as needed.
|
||||
.TP
|
||||
.B \-\^xx
|
||||
Debug flag: generate all kinds of wierd hack flack.
|
||||
.TP
|
||||
.B \-\^ns
|
||||
No symbol table is included in the object file
|
||||
(thus ddt knows of no symbols from this assembly).
|
||||
.TP
|
||||
.B \-\^sx
|
||||
Make the symbol table contain ``local symbols'' as well as
|
||||
ordinary symbols.
|
||||
.TP
|
||||
.B \-\^u
|
||||
Treat form feed characters as spaces. This will make
|
||||
.IR m11 's
|
||||
idea of line numbers coincide with the UNIX text editors.
|
||||
Macro-11 statements containing imbedded form feed characters will
|
||||
be parsed differently when the
|
||||
.I \-u
|
||||
flag is in effect.
|
||||
.TP
|
||||
.B \-\^na:file
|
||||
Override the convention of using last name
|
||||
as file name.
|
||||
Instead, use names
|
||||
.I file.obj
|
||||
and
|
||||
.I file.lst
|
||||
for object and listing files.
|
||||
.SH NOTES
|
||||
This implementation of Macro-11 is a distant hand-me down from
|
||||
an old DEC Macro-11 modified at Harvard University in the early
|
||||
1970's.
|
||||
It is grubby with smudges by Brent Byer, F. J. Howard,
|
||||
Bob Bowering, and Jim Reeds.
|
||||
It does not implement keyword arguments such as are described in
|
||||
section 7.3.6 of the DEC manual.
|
||||
The .enabl abs option does not work.
|
||||
Listing control is by default .list ttm.
|
||||
Unlike earlier editions of m11 at UCB and at Harvard, it does
|
||||
treat immediate constants of floating point operations correctly:
|
||||
see the last paragraph of section 6.4.2 on the middle of page 6-27 of
|
||||
the DEC manual.
|
||||
M11 has several directives not described in the DEC manual.
|
||||
See the
|
||||
.I "New UCB M11 Manual."
|
||||
The default attributes for
|
||||
.I .psects
|
||||
are different from those described in the DEC manual, but may be changed
|
||||
by the
|
||||
.I \-dp
|
||||
flag.
|
||||
The
|
||||
.I ".enabl glb"
|
||||
feature is implemented:
|
||||
undefined symbols are taken as undefined global externals.
|
||||
.SH FILES
|
||||
.ta 2i
|
||||
/usr/share/misc/sysmac.sml system macro library (for .mcall directive)
|
||||
.br
|
||||
filen.xrf intermediate cross-reference temporary file
|
||||
.br
|
||||
lpr(1) spooler
|
||||
.br
|
||||
/usr/ucb/macxrf cross-reference post-processor
|
||||
.SH SEE ALSO
|
||||
.I "PDP-11 MACRO-11 Language Reference Manual",
|
||||
Digital Equipment Corp. Order No. AA-5075A-TC,
|
||||
August 1977.
|
||||
.br
|
||||
.I "New UCB M11 Manual",
|
||||
notional document by Jim Reeds.
|
||||
BIN
tests/2.11BSD/m11/m11.x
Normal file
BIN
tests/2.11BSD/m11/m11.x
Normal file
Binary file not shown.
886
tests/2.11BSD/m11/mac.m11
Normal file
886
tests/2.11BSD/m11/mac.m11
Normal file
@@ -0,0 +1,886 @@
|
||||
.title mac ;macro handlers
|
||||
|
||||
.ident /03apr4/
|
||||
|
||||
.mcall (at)always,ch.mne,ct.mne
|
||||
.mcall (at)putkb
|
||||
.mcall (at)sdebug ,ndebug
|
||||
always
|
||||
ch.mne
|
||||
ct.mne
|
||||
|
||||
.if ndf xmacro
|
||||
|
||||
.mcall (at)append,gencnd,error,scan,search
|
||||
.mcall (at)setnz,xmit,zap
|
||||
|
||||
.globl mx.flg ; defined in lout.m11
|
||||
|
||||
.globl smllvl, msbmrp, getmch, mactst
|
||||
|
||||
.globl absexp, aexp, argcnt, asgmtf, chrpnt, cndmex
|
||||
.globl codrol, cradix
|
||||
.globl dflmac, dflsmc, dmarol, endflg
|
||||
.globl ed.lc, edmask
|
||||
.globl endlin, finsml, getchr, getlin, getnb
|
||||
.globl mdepth
|
||||
.globl getr50, getsym, gsarg, gsargf, inisml
|
||||
.globl insert, lblend, lcendl, lcflag, lcmask
|
||||
.globl lc.mc, lc.me, linbuf, lsgbas
|
||||
.globl mactop, macrol, mode, pass, symbot,macovf,uplift,upbomb
|
||||
.globl r50unp, rolupd, savreg
|
||||
.globl setchr, setcli, setnb, setpf0, setpf1
|
||||
.globl setsym, smlnam, smlfil, tstarg, value
|
||||
.globl symbol, lc.md, xmit0
|
||||
.globl ucflag
|
||||
|
||||
|
||||
.globl crfdef, crfref
|
||||
xitsec ;start in default sector
|
||||
|
||||
getmch: ;get a macro character
|
||||
tst getmcs ;working on argument?
|
||||
bne 18$ ; yes
|
||||
call getmc2 ;move a character
|
||||
bgt 4$ ;all set if .gt. zero
|
||||
beq 2$ ;end if zero
|
||||
cmp r5,#mt.max ;end of type?
|
||||
bhi 10$ ; no
|
||||
mov #vt,r5 ;yes, fudge return
|
||||
call savreg
|
||||
jmp endmac ;close out expansion
|
||||
|
||||
2$: mov r1,msbmrp ;eol, store new pointer
|
||||
bis #lc.me,lcflag ;flag as macro expansion
|
||||
mov #lf,r5 ;mark end
|
||||
4$: return
|
||||
|
||||
10$: mov r1,getmcs ;remember read pointer
|
||||
mov msbarg,r1
|
||||
tst (r1)+
|
||||
mov r5,r3 ;count
|
||||
neg r3 ;assume macro
|
||||
cmp msbtyp,#mt.mac ;true?
|
||||
beq 12$ ; yes, use it
|
||||
mov msbcnt,r3 ;get arg number
|
||||
12$: dec r3 ;move to proper arg
|
||||
ble 18$ ;found
|
||||
14$: call getmc2 ;get next char
|
||||
bgt 14$ ;loop if pnz
|
||||
beq 12$ ;new arg if zero
|
||||
16$: mov getmcs,r1 ;reset read pointer
|
||||
clr getmcs ;clear (used as flag)
|
||||
br getmch ;null arg
|
||||
|
||||
18$: call getmc2 ;get next character
|
||||
ble 16$ ;finished if .le. zero
|
||||
return
|
||||
|
||||
getmc2: bit #bpmb-1,r1 ;macro, end of block?
|
||||
bne 22$ ; no
|
||||
mov -bpmb(r1),r1 ;yes, point to next block
|
||||
tst (r1)+ ;move past link
|
||||
22$: movb (r1)+,r5 ;set in r5
|
||||
return
|
||||
|
||||
entsec impure
|
||||
getmcs: .blkw ;macro pntr save while
|
||||
;processing args
|
||||
xitsec
|
||||
|
||||
.endc
|
||||
.if ndf xmacro
|
||||
|
||||
mt.rpt= 177601
|
||||
mt.irp= 177602
|
||||
mt.mac= 177603
|
||||
mt.max= mt.mac
|
||||
|
||||
.globl rept, endr, endm
|
||||
|
||||
rept: ;repeat handler
|
||||
call absexp ;evaluate count
|
||||
mov r0,-(sp) ;save count
|
||||
call setpf1 ;mark the listing
|
||||
call getblk ;get a storage block
|
||||
clr (r2)+ ;start in third word
|
||||
clr -(sp) ;no arguments
|
||||
mov r0,-(sp) ; and start of block
|
||||
tst mx.flg ; <<<
|
||||
beq 1$ ; <<< REEDS june 81
|
||||
bis #lc.mc,lcflag ; <<<
|
||||
1$: ; <<<
|
||||
call endlin ;polish off line
|
||||
zap dmarol ;no dummy args for repeat
|
||||
call promt ;use macro stuff
|
||||
|
||||
mov #mt.rpt,r5 ;fudge an "end of repeat"
|
||||
reptf: call wcimt
|
||||
call mpush ;push previous macro block
|
||||
mov (sp)+,(r2)+ ;store text pointer
|
||||
mov (sp)+,(r2)+ ;store arg pointer
|
||||
clr (r2)+ ;counter
|
||||
mov (sp)+,(r2)+ ;max
|
||||
call setchr ;restore character
|
||||
|
||||
endmac: mov #msbcnt,r0 ;set pointer to count
|
||||
inc (r0) ;bump it
|
||||
cmp (r0)+,(r0)+ ;through?
|
||||
bgt 1$ ; yes
|
||||
mov msbtxt,(r0) ;no, set read pointer
|
||||
add #4,(r0) ;bypass link
|
||||
return
|
||||
|
||||
1$: clr cndmex ;clear mexit flag
|
||||
jmp mpop
|
||||
|
||||
endm:
|
||||
error 56,o,<.endm out of context>
|
||||
return
|
||||
endr:
|
||||
error 57,o,<.endr out of context>
|
||||
return
|
||||
.iftf
|
||||
.globl opcerr
|
||||
opcerr: error 24,o,<opcode out of context>
|
||||
return
|
||||
opcer1: error 25,o,<missing macro name>
|
||||
return
|
||||
.ift
|
||||
.globl macro, macr
|
||||
|
||||
macro:
|
||||
macr: ;macro definition
|
||||
call gsarg ;get the name
|
||||
beq opcer1 ; error if null
|
||||
macrof:
|
||||
call tstarg ;bypass possible comma
|
||||
mov symbol,macnam
|
||||
mov symbol+2,macnam+2
|
||||
call msrch ;search the table
|
||||
beq 1$ ;branch if null
|
||||
call decmac ;decrement the reference
|
||||
1$:
|
||||
call getblk ;get a storage block
|
||||
mov r0,-(sp) ;save pointer
|
||||
call msrch ;getblk might have moved things
|
||||
mov (sp)+,(r4) ;set pointer
|
||||
call insert ;insert in table
|
||||
call crfdef
|
||||
call proma ;process dummy args
|
||||
clr (r2)+ ;clear level count
|
||||
mov argcnt,(r2)+ ;keep number of args
|
||||
mov macgsb,(r2)+ ; and generated symbol bits
|
||||
bis #lc.md,lcflag
|
||||
call endlin ;polish off line
|
||||
call promt ;process the text
|
||||
call getsym
|
||||
beq mac3
|
||||
cmp r0,macnam
|
||||
bne 2$
|
||||
cmp symbol+2,macnam+2
|
||||
beq mac3
|
||||
2$: error 26,a,<.endm name doesn't match .macro name>
|
||||
mac3: mov #mt.mac,r5
|
||||
call wcimt ;set end marker
|
||||
call setchr
|
||||
return
|
||||
mactst: ;test for macro call
|
||||
call msrch ;search for macro
|
||||
beq 9$ ; exit with zero if not found
|
||||
call setpf0 ;mark location
|
||||
mov r0,-(sp) ;save text pointer
|
||||
call incmac ;increment reference
|
||||
cmp (r0)+,(r0)+ ;move up a couple of slots
|
||||
mov (r0)+,argmax ;set number of args
|
||||
mov (r0)+,macgsb ; and generated symbol bits
|
||||
mov r0,-(sp) ;save pointer
|
||||
call crfref ;cref it
|
||||
call promc ;process call arguments
|
||||
mov r0,r3 ;save block pointer
|
||||
mov #mt.mac,r5
|
||||
call mpush ;push nesting level
|
||||
mov (sp)+,msbmrp
|
||||
mov (sp)+,(r2)+ ;set text pointer
|
||||
mov r3,(r2)+ ; and argument pointer
|
||||
mov argcnt,(r2) ;fill in argument count
|
||||
mov (r2)+,(r2)+ ; and replecate
|
||||
call setchr
|
||||
setnz r0 ;return non-zero
|
||||
9$: return
|
||||
|
||||
|
||||
msrch: search macrol ;search macro roll
|
||||
mov value,r0 ;doesn't count if no pointer
|
||||
return
|
||||
.globl irp, irpc
|
||||
|
||||
irpc: inc r3
|
||||
irp:
|
||||
call gmarg
|
||||
beq 1$
|
||||
call proma
|
||||
call rmarg
|
||||
call gmarg
|
||||
beq 1$
|
||||
mov #177777,argmax ;any number of arguments
|
||||
call promcf
|
||||
mov r0,r3
|
||||
call rmarg
|
||||
call getblk
|
||||
clr (r2)+
|
||||
mov argcnt,-(sp)
|
||||
mov r3,-(sp)
|
||||
mov r0,-(sp)
|
||||
tst mx.flg ;
|
||||
beq 111$; ; <<< REEDS june 81
|
||||
bis #lc.mc,lcflag ;
|
||||
111$: call endlin
|
||||
call promt
|
||||
mov #mt.irp,r5
|
||||
jmp reptf
|
||||
|
||||
1$: error 27,a,<illegal arguments>
|
||||
return
|
||||
|
||||
proma: ;process macro args
|
||||
zap dmarol ;clear dummy argument roll
|
||||
clr argcnt ;get a fresh start with arguments
|
||||
clr macgsb ;clear generated bit pattern
|
||||
mov #100000,-(sp) ;stack first generated symbol bit
|
||||
1$: call tstarg ;any more args?
|
||||
beq 3$ ; no, quit and go home
|
||||
cmp #ch.qm,r5 ;yes, generated type?
|
||||
bne 2$ ; no
|
||||
bis (sp),macgsb ;yes, set proper bit
|
||||
call getnb ;bypass it
|
||||
2$: call gsargf ;get symbolic argument
|
||||
append dmarol ;append to dma roll
|
||||
clc
|
||||
ror (sp) ;shift generated sym bit
|
||||
br 1$
|
||||
|
||||
3$: tst (sp)+ ;prune stack
|
||||
return
|
||||
|
||||
|
||||
promc: clr r3
|
||||
promcf:
|
||||
clr argcnt
|
||||
call getblk
|
||||
mov r0,-(sp)
|
||||
tst r3
|
||||
bne prmc7
|
||||
prmc1: cmp argmax,argcnt
|
||||
blos prmc10
|
||||
call tstarg ;bypass any comma
|
||||
bne 9$ ;ok if non-null
|
||||
tst macgsb ;null, any generated stuff left?
|
||||
beq prmc10 ; no, through
|
||||
9$: cmp #ch.bsl,r5 ; "\"?
|
||||
beq prmc20 ; yes
|
||||
call gmargf ;get argument
|
||||
.if ndf xedlsb
|
||||
tst r5 ;any arguments?
|
||||
bne 2$ ; yes
|
||||
tst macgsb ;no, generation requested?
|
||||
bmi prmc30 ; yes
|
||||
.endc
|
||||
2$: .if ndf xedlc ;>>>gh 5/15/78 to not automatically upper-case
|
||||
bit #ed.lc,edmask ;lower case enabled?
|
||||
bne 3$ ; no, leave as upper case
|
||||
tst ucflag
|
||||
bne 3$
|
||||
mov chrpnt,r5 ;fake for ovlay pic
|
||||
movb (r5),r5 ;fetch original character
|
||||
.endc
|
||||
|
||||
3$: call wcimt
|
||||
beq prmc4
|
||||
call getchr
|
||||
br 2$
|
||||
|
||||
prmc4: call rmarg
|
||||
prmc5: asl macgsb ;move generation bit over one
|
||||
br prmc1
|
||||
|
||||
prmc6: inc argcnt
|
||||
call getchr
|
||||
prmc7: .if ndf xedlc ;>>>gh 5/15/78 to not automatically upper-case
|
||||
bit #ed.lc,edmask ;lower case enabled?
|
||||
bne 8$ ; no, leave as upper case
|
||||
tst ucflag
|
||||
bne 8$
|
||||
mov chrpnt,r5 ;fake for ovlay pic
|
||||
movb (r5),r5 ;fetch original character
|
||||
.endc
|
||||
8$: call wcimt
|
||||
beq prmc10
|
||||
clr r5
|
||||
call wcimt
|
||||
br prmc6
|
||||
|
||||
prmc10: com r5
|
||||
call wcimt
|
||||
com r5
|
||||
bit #lc.mc,lcmask ;macro call suppression?
|
||||
beq 12$ ; no
|
||||
mov lblend,r0 ;yes, have we a label?
|
||||
beq 11$ ; no, suppress entire line
|
||||
mov r0,lcendl ;yes, list only label
|
||||
br 12$
|
||||
|
||||
11$: bis #lc.mc,lcflag
|
||||
12$: mov (sp)+,r0
|
||||
return
|
||||
prmc20: call getnb ; "\", bypass
|
||||
call absexp ;evaluate expression, abs
|
||||
mov r5,-(sp) ;stack character
|
||||
mov r3,-(sp)
|
||||
mov cradix,r3 ;break out in current radix
|
||||
mov r0,r1 ;value to r1
|
||||
call prmc40 ;convert to ascii
|
||||
clr r5
|
||||
call wcimt
|
||||
mov (sp)+,r3 ;restore regs
|
||||
mov (sp)+,r5
|
||||
br prmc5
|
||||
|
||||
.if ndf xedlsb
|
||||
prmc30: inc lsgbas ;generated symbol, bump count
|
||||
mov lsgbas,r1 ;fetch it
|
||||
add #^d<64-1>,r1 ;start at 64.
|
||||
bit #177600,r1 ;gen symbols in range 64-127 only
|
||||
beq 1$
|
||||
error 54,t,<no generated symbols after 127$>
|
||||
1$:
|
||||
mov r5,-(sp) ;stack current char
|
||||
mov r3,-(sp) ;and r3
|
||||
mov #10.,r3 ;make it decimal
|
||||
call prmc40 ;convert to ascii
|
||||
mov #ch.dol,r5
|
||||
call wcimt ;write "$"
|
||||
clr r5
|
||||
call wcimt
|
||||
mov (sp)+,r3 ;restore regs
|
||||
mov (sp)+,r5
|
||||
br prmc4 ;return
|
||||
.endc
|
||||
|
||||
prmc40: ;macro number converter
|
||||
clr r0
|
||||
div r3,r0
|
||||
mov r1,-(sp) ;stack remainder
|
||||
mov r0,r1 ;set new number
|
||||
beq 41$ ;down to zero?
|
||||
call prmc40 ; no, recurse
|
||||
41$: mov (sp)+,r5 ;get number
|
||||
add #dig.0,r5 ;convert to ascii
|
||||
jmp wcimt ;write in tree and exit
|
||||
.globl lst.kb,linbuf,putil2
|
||||
promt:
|
||||
clr r3
|
||||
1$: call getlin
|
||||
bne 2$
|
||||
inc macdfn
|
||||
bis #lc.md,lcflag
|
||||
call setcli
|
||||
bit #dflmac,r0
|
||||
beq 63$
|
||||
inc r3
|
||||
cmp #endm,value ; what a crock: .endm & .endr are synonyms
|
||||
beq 10$ ; in spite of what the manual says
|
||||
cmp #endr,value
|
||||
bne 3$
|
||||
10$: dec r3
|
||||
dec r3
|
||||
bpl 3$
|
||||
2$:
|
||||
clr macdfn
|
||||
return
|
||||
63$:
|
||||
.if ndf xsml
|
||||
tst smllvl ;in system macro?
|
||||
beq 3$ ; no
|
||||
bit #dflsmc,r0 ;yes, nested?
|
||||
beq 3$ ; no
|
||||
cmp r5,#'( ;check for prefix, crudely
|
||||
bne 64$
|
||||
call getnb
|
||||
call getsym
|
||||
cmp r5,#')
|
||||
bne 64$
|
||||
call getnb
|
||||
64$: call smltst ;yes, test for more
|
||||
.endc
|
||||
3$: mov #linbuf,chrpnt
|
||||
call setchr
|
||||
4$: call getsym
|
||||
beq 7$
|
||||
scan dmarol
|
||||
mov r0,r4
|
||||
beq 5$
|
||||
mov rolupd,r5
|
||||
neg r5
|
||||
dec concnt
|
||||
call wcimt
|
||||
dec concnt
|
||||
5$: call setsym
|
||||
6$: tst r4
|
||||
bne 61$
|
||||
.if ndf xedlc ;>>>gh 5/16/78 to not automatically upper-case
|
||||
bit #ed.lc,edmask ;lower case enabled?
|
||||
bne 21$ ; no, leave as upper case
|
||||
tst ucflag
|
||||
bne 21$
|
||||
mov chrpnt,r5 ;fake for ovlay pic
|
||||
movb (r5),r5 ;fetch original character
|
||||
21$: .endc
|
||||
call wcimt
|
||||
61$: call getr50
|
||||
bgt 6$
|
||||
7$: cmp r5,#ch.xcl
|
||||
beq 8$
|
||||
.if ndf xedlc ;>>>gh 5/16/78 to not automatically upper-case
|
||||
bit #ed.lc,edmask ;lower case enabled?
|
||||
bne 22$ ; no, leave as upper case
|
||||
tst ucflag
|
||||
bne 22$
|
||||
mov chrpnt,r5 ;fake for ovlay pic
|
||||
movb (r5),r5 ;fetch original character
|
||||
22$: .endc
|
||||
call wcimt
|
||||
bne 9$
|
||||
call endlin
|
||||
jmp 1$
|
||||
|
||||
8$: inc concnt
|
||||
9$: call getchr
|
||||
br 4$
|
||||
|
||||
.globl narg, nchr, ntype, mexit
|
||||
.globl mx.2,mx.sym,mx.num ,dnc
|
||||
|
||||
narg: ;number of arguments
|
||||
call gsarg ;get a symbol
|
||||
beq ntyper ;error if missing
|
||||
mov msbcnt+2,r3 ;set number
|
||||
br ntypex
|
||||
|
||||
nchr: ;number of characters
|
||||
call gsarg
|
||||
beq ntyper ; error id no symbol
|
||||
call gmarg ;isolate argument
|
||||
beq ntypex ; zero if null
|
||||
tst r5 ;quick test for completion
|
||||
beq 2$ ; yes
|
||||
1$: inc r3 ;bump count
|
||||
call getchr ;get the next character
|
||||
bne 1$ ;loop if not end
|
||||
2$: call rmarg ;remove arg delimiters
|
||||
br ntypex
|
||||
|
||||
ntype: ;test expression mode
|
||||
call gsarg ;get the symbol
|
||||
beq ntyper ; error
|
||||
call tstarg ;bypass any commas
|
||||
mov #symbol,r1
|
||||
mov (r1)+,-(sp) ;preserve symbol
|
||||
mov (r1)+,-(sp)
|
||||
call aexp ;evaluate
|
||||
mov r0,r3 ;set result
|
||||
zap codrol ;clear any generated code
|
||||
mov (sp)+,-(r1) ;restore symbol
|
||||
mov (sp)+,-(r1)
|
||||
ntypex: clr mode ;clear mode
|
||||
mov r3,value ; and set value
|
||||
tst mx.flg ; <<< REEDS june 81
|
||||
beq 100$ ; <<<
|
||||
bis #lc.mc,lcflag ; <<<
|
||||
mov #1,mx.2 ; <<<
|
||||
.irpc xx,<012345> ; <<<
|
||||
mov r'xx,-(sp) ; <<<
|
||||
.endm ; <<<
|
||||
mov #mx.sym,r2 ; <<<
|
||||
call r50unp ; <<<
|
||||
mov #mx.num,r2 ; <<<
|
||||
mov value,r1 ; <<<
|
||||
call dnc ; <<<
|
||||
movb #0,(r2) ; <<<
|
||||
.irpc xx,<543210> ; <<<
|
||||
mov (sp)+,r'xx ; <<<
|
||||
.endm ; <<<
|
||||
100$: ; <<<
|
||||
jmp asgmtf ;exit through assignment
|
||||
|
||||
;
|
||||
; there are mxpand problems here.
|
||||
;
|
||||
;
|
||||
;
|
||||
ntyper: error 28,a,<no symbol to assign to>
|
||||
br ntypex
|
||||
|
||||
mexit: ;macro/repeat exit
|
||||
mov maclvl,cndmex ;in macro?
|
||||
bne mex1 ; yes, pop
|
||||
error 29,o,<unbalanced .endm> ; no, error
|
||||
mex1: return
|
||||
|
||||
gencnd b, tcb
|
||||
gencnd nb, tcb, f
|
||||
gencnd idn, tcid
|
||||
gencnd dif, tcid, f
|
||||
|
||||
|
||||
tcb: ; "ifb" conditional
|
||||
beq tcberx ;ok if null
|
||||
call gmargf ;isolate argument
|
||||
call setnb ;bypass any blanks
|
||||
beq tcidt ;true if pointing at delimiter
|
||||
br tcidf ;else false
|
||||
|
||||
tcberr: error 30,a,<missing argument in 'if' construction>
|
||||
;naughty
|
||||
tcberx: return
|
||||
|
||||
tcid: ; "ifidn" conditional
|
||||
beq tcberr ;error if null arg
|
||||
call gmargf ;isolate first arg
|
||||
mov chrpnt,r1 ;save character pointer
|
||||
tst -(r0)
|
||||
mov -(r0),r2 ;pointer to terminator
|
||||
call rmarg ;return this arg
|
||||
call gmarg ;get the next
|
||||
beq tcberr
|
||||
1$: movb (r1),r0 ;set character from first field
|
||||
cmp r1,r2 ;is it the last?
|
||||
bne 2$ ; no
|
||||
clr r0 ;yes, clear it
|
||||
2$: .if ndf xedlc ;>>>gh 5/17/78 to properly compare upper and lower case
|
||||
bit #ed.lc,edmask ;lower case enabled?
|
||||
bne 3$ ; no, leave as upper case
|
||||
tst ucflag
|
||||
bne 3$
|
||||
mov chrpnt,r5 ;fake for ovlay pic
|
||||
movb (r5),r5 ;fetch original character
|
||||
.endc
|
||||
3$: cmp r0,r5 ;match?
|
||||
bne tcidf ; no
|
||||
tst r5 ;yes, finished?
|
||||
beq tcidt ; yes, good show
|
||||
call getchr ;no, get the next character
|
||||
inc r1 ;advance first arg pointer
|
||||
br 1$ ;try again
|
||||
|
||||
tcidf: com r3 ;false, toggle condition
|
||||
tcidt: jmp rmarg ;ok, restore argument
|
||||
|
||||
gmarg: ;get macro argument
|
||||
call tstarg ;test for null
|
||||
beq gmargx ; yes, just exit
|
||||
gmargf: call savreg ;stash registers
|
||||
clr r1 ;clear count
|
||||
mov #chrpnt,r2
|
||||
mov (r2),-(sp) ;save initial character pointer
|
||||
mov #ch.lab,r3 ;assume "<>"
|
||||
mov #ch.rab,r4
|
||||
cmp r5,r3 ;true?
|
||||
beq 11$ ; yes
|
||||
cmp r5,#ch.uar ;up-arrow?
|
||||
beq 10$ ; yes
|
||||
1$: bitb #ct.pc-ct.com-ct.smc,cttbl(r5) ;printing character?
|
||||
beq gm21 ; no
|
||||
call getchr ;yes, move on
|
||||
br 1$
|
||||
|
||||
10$: call getnb ; "^", bypass it
|
||||
beq 20$ ;error if null
|
||||
mov (r2),(sp) ;set new pointer
|
||||
com r3 ;no "<" equivalent
|
||||
.if ndf xedlc ;>>>gh 5/17/78 to not automatically upper-case
|
||||
bit #ed.lc,edmask ;lower case enabled?
|
||||
bne 3$ ; no, leave as upper case
|
||||
tst ucflag
|
||||
bne 3$
|
||||
mov chrpnt,r5 ;fake for ovlay pic
|
||||
movb (r5),r5 ;fetch original character
|
||||
3$: .endc
|
||||
mov r5,r4 ;">" equivalent
|
||||
11$: call getchr
|
||||
beq 20$ ; error if eol
|
||||
.if ndf xedlc ;>>>gh 5/17/78 to not automatically upper-case
|
||||
bit #ed.lc,edmask ;lower case enabled?
|
||||
bne 4$ ; no, leave as upper case
|
||||
tst ucflag
|
||||
bne 4$ ; no, leave as upper case
|
||||
mov chrpnt,r5 ;fake for ovlay pic
|
||||
movb (r5),r5 ;fetch original character
|
||||
4$: .endc
|
||||
cmp r5,r3 ; "<"?
|
||||
beq 12$ ; yes
|
||||
cmp r5,r4 ;no, ">"?
|
||||
bne 11$ ; no, try again
|
||||
dec r1 ;yes, decrement level count
|
||||
dec r1
|
||||
12$: inc r1
|
||||
bpl 11$ ;loop if not through
|
||||
inc (sp) ;point past "<"
|
||||
bis #100000,r5 ;must move past in rmarg
|
||||
br gm21
|
||||
|
||||
20$: error 31,a,<missing argument>
|
||||
gm21: mov gmapnt,r0 ;get current arg save pointer
|
||||
bne 22$ ;branch if initialized
|
||||
mov #gmablk,r0 ;do so
|
||||
22$: mov (r2),(r0)+ ;save pointer
|
||||
mov r5,(r0)+ ; and character
|
||||
clrb @(r2) ;set null terminator
|
||||
mov (sp)+,(r2) ;point to start of arg
|
||||
call setchr ;set register 5
|
||||
mov r0,gmapnt ;save new buffer pointer
|
||||
gmargx: return
|
||||
rmarg: ;remove macro argument
|
||||
mov gmapnt,r0 ;set pointer to saved items
|
||||
mov -(r0),r5 ;set character
|
||||
tst -(r0)
|
||||
movb r5,@(r0) ;restore virgin character
|
||||
asl r5
|
||||
adc (r0)
|
||||
mov (r0),chrpnt
|
||||
call setnb
|
||||
mov r0,gmapnt
|
||||
return
|
||||
|
||||
entsec imppas
|
||||
gmapnt: .blkw 1 ;pointer to following buffer
|
||||
gmablk: .blkw 1 ;pointer to "borrowed" character
|
||||
.blkw 1 ;character itself
|
||||
.blkw 3*2 ;room for more pairs
|
||||
xitsec
|
||||
wcimt: ;write character in macro tree
|
||||
dec concnt ;any concatenation chars pending?
|
||||
bmi 1$ ; no
|
||||
mov r5,-(sp) ;yes, stack current character
|
||||
mov #ch.xcl,r5
|
||||
call 2$
|
||||
mov (sp)+,r5
|
||||
br wcimt
|
||||
|
||||
1$: clr concnt
|
||||
2$: bit #bpmb-1,r2 ;room in this block?
|
||||
bne 3$ ; yes
|
||||
sub #bpmb,r2 ;no, point to link
|
||||
mov r2,-(sp)
|
||||
call getblk
|
||||
mov r0,@(sp)+ ;set new link
|
||||
3$: movb r5,(r2)+ ;write, leaving flags set
|
||||
return
|
||||
|
||||
getblk: ;get a macro block
|
||||
mov r3,-(sp)
|
||||
mov macnxt,r0 ;test for block in garbage
|
||||
bne 1$ ; yes, use it
|
||||
mov mactop,r0 ;no, get a new one
|
||||
add #bpmb,mactop ;set new pointer
|
||||
mov #macovf,upbomb ; on error, print message & die
|
||||
call uplift ; check if overran dynamic tables
|
||||
; if so, buy more core & shuffle
|
||||
; (on error, uplift won't return)
|
||||
br 2$
|
||||
|
||||
1$: mov (r0),macnxt ;set new chain
|
||||
2$: mov r0,r2
|
||||
clr (r2)+ ;clear link cell, point past it
|
||||
mov (sp)+,r3
|
||||
return
|
||||
|
||||
|
||||
|
||||
incmac: inc 2(r0) ;increment macro reference
|
||||
return
|
||||
|
||||
decmac: dec 2(r0) ;decrement macro storage
|
||||
bpl remmax ;just exit if non-negative
|
||||
|
||||
remmac: mov r0,-(sp) ;save pointer
|
||||
1$: tst (r0) ;end of chain?
|
||||
beq 2$ ; yes
|
||||
mov (r0),r0 ;no, link
|
||||
br 1$
|
||||
|
||||
2$: mov macnxt,(r0)
|
||||
mov (sp)+,macnxt
|
||||
remmax: return
|
||||
mpush: ;push macro nesting level
|
||||
inc mdepth
|
||||
call getblk ;get a storage block
|
||||
tst -(r2) ;point to start
|
||||
mov #msbblk,r1 ;pointer to start of prototype
|
||||
mov r2,-(sp) ;save destination
|
||||
mov r1,-(sp) ; and core pointers
|
||||
1$: mov (r1),(r2)+ ;xfer an item
|
||||
clr (r1)+ ;clear core slot
|
||||
cmp #msbend,r1 ;through?
|
||||
bne 1$ ; no
|
||||
mov (sp)+,r2 ;yes, make core destination
|
||||
mov r5,(r2)+ ;save type
|
||||
mov (sp)+,(r2)+ ; and previous block pointer
|
||||
inc maclvl ;bump level count
|
||||
return ;return with r2 pointing at msbtxt
|
||||
|
||||
mpop: ;pop macro nesting level
|
||||
dec mdepth ;for lout.m11
|
||||
mov #msbarg+2,r2 ;point one slot past arg
|
||||
mov -(r2),r0 ;get pointer to arg block
|
||||
beq 1$ ;branch if null
|
||||
call remmac ;remove it
|
||||
1$: mov -(r2),r0 ;point to text block
|
||||
beq 2$ ;branch if null
|
||||
call decmac ;decrement level
|
||||
2$: mov -(r2),r1 ;get previous block
|
||||
tst -(r2) ;point to start
|
||||
mov r1,r0 ;save block pointer
|
||||
call xmit0-<msbend-msbblk> ;xfer block
|
||||
clr (r0) ;clear link
|
||||
call remmac ;return block for deposit
|
||||
dec maclvl ;decrement level count
|
||||
return
|
||||
|
||||
|
||||
entsec impure
|
||||
msbblk: ;pushable block (must be ordered)
|
||||
msbtyp: .blkw ;block type
|
||||
msbpbp: .blkw ;previous block pointer
|
||||
msbtxt: .blkw ;pointer to basic text block
|
||||
msbarg: .blkw ;pointer to arg block
|
||||
msbcnt: .blkw 2 ;repeat count, etc.
|
||||
msbmrp: .blkw ;macro read pointer
|
||||
msbend: ;end of ordered storage
|
||||
|
||||
macnxt: .blkw
|
||||
maclvl: .blkw ;macro level count
|
||||
concnt: .blkw
|
||||
argmax: .blkw
|
||||
macnam: .blkw 2
|
||||
macgsb: .blkw ;macro generated symbol bits
|
||||
xitsec
|
||||
.if ndf xsml
|
||||
|
||||
.globl mcall ;.mcall
|
||||
|
||||
mcall: bis #lc.md,lcflag ;for listing control
|
||||
mov #sysmac,-(sp) ;assume system mcall
|
||||
cmp r5,#'( ;named file?
|
||||
bne 14$ ; no, use system
|
||||
mov #smlfil,r1 ;yes, point to dest. for specified pathname.
|
||||
mov r1,(sp) ;store as adr. of pathname being gathered
|
||||
11$: cmp r1,#smlfil+34 ;any more room?
|
||||
blo 12$ ;yes
|
||||
dec r1 ;no, cause truncation.
|
||||
12$: call getnb ;get next char. (ignoring blanks)
|
||||
.if ndf xedlc
|
||||
movb @chrpnt,(r1) ;store char.
|
||||
bicb #200,(r1) ;turn off sign bit
|
||||
.iff
|
||||
movb r5,(r1) ;store char.
|
||||
.endc
|
||||
cmpb (r1)+,#')
|
||||
bne 11$ ;continue till ")"
|
||||
clrb -(r1) ;end, make null
|
||||
call getnb ;yes, bypass it
|
||||
14$: mov (sp)+,smlnam ;store pointer to asciz name
|
||||
call smltst ;test for undefined arguments
|
||||
jeq 5$ ; branch if none
|
||||
tst pass ;found some, pass one?
|
||||
bne 41$ ; no, error
|
||||
1$: call inisml ;get another file
|
||||
beq 42$ ; error if none
|
||||
2$: clr r3 ;set count to zero
|
||||
3$: call getlin ;get a new line
|
||||
bne 1$ ;try another file if eof
|
||||
call setcli ;test for directive
|
||||
bit #dflmac,r0 ;macro/endm?
|
||||
beq 3$ ; no
|
||||
mov #value,r4 ;set for local and macrof
|
||||
dec r3 ;yes, assume .endm
|
||||
cmp #endm,(r4) ;good guess?
|
||||
beq 3$ ; yes
|
||||
cmp #endr,(r4) ;a synonym for .endm
|
||||
beq 3$ ; yes
|
||||
inc r3 ;no, bump count
|
||||
inc r3
|
||||
cmp #1,r3 ;outer level?
|
||||
bne 3$ ; no
|
||||
call gsarg ;yes, get name
|
||||
beq 44$ ; error if null
|
||||
search macrol ;search table
|
||||
beq 3$ ; ignore if not found
|
||||
tst (r4) ;has it a value?
|
||||
bne 3$ ; no, not interested
|
||||
call macrof ;good, define it
|
||||
dec smllvl ;decrement count
|
||||
bgt 2$ ;loop if more to go
|
||||
br 5$ ;ok, clean up
|
||||
|
||||
4$: error 60,u ,<.mcall error>
|
||||
br 5$
|
||||
41$: tst err.xx ; dont want this message to mask the others
|
||||
bne 5$
|
||||
error 61,u ,<macro not defined by .mcall>
|
||||
br 5$
|
||||
42$: error 62,u ,<cannot open .mcall file>
|
||||
br 5$
|
||||
44$: error 63,u ,<illegal .macro statement in .mcall>
|
||||
5$: clr smllvl ;make sure count is zapped
|
||||
clr endflg ;ditto for end flag
|
||||
jmp finsml ;be sure files are closed
|
||||
|
||||
entsec dpure
|
||||
sysmac: ;kludged to lower-case
|
||||
.enabl lc
|
||||
.asciz +/usr/share/misc/sysmac+
|
||||
|
||||
xitsec
|
||||
smltst: ;test mcall arguments
|
||||
1$: call gsarg ;fetch next argument
|
||||
beq 3$ ; exit if through
|
||||
call msrch ;ok, test for macros
|
||||
bne 2$ ; found, not interested
|
||||
call insert ;insert with zero pointer
|
||||
inc smllvl ;bump count
|
||||
2$: call crfdef ;cref it
|
||||
br 1$
|
||||
|
||||
3$: mov smllvl,r0 ;finished, count to r0
|
||||
return
|
||||
|
||||
entsec imppas
|
||||
smllvl: .blkw ;mcall hit count
|
||||
xitsec
|
||||
|
||||
.endc ;xsml
|
||||
|
||||
.endc ;xmacro
|
||||
;
|
||||
; mac.er is called on reaching end of prog w/o .end file or when
|
||||
; running out of core.
|
||||
;
|
||||
.globl lst.kb,putli2, mac.er, macdfn
|
||||
.text
|
||||
mac.er:
|
||||
call savreg
|
||||
tst macdfn
|
||||
beq 9$
|
||||
tst pass
|
||||
beq 9$
|
||||
mov #mac.xx,r2
|
||||
mov #lst.kb,r4
|
||||
call putli2
|
||||
9$: return
|
||||
.data
|
||||
mac.xx: .asciz /possibly unterminated .macro, .rept, .irp, or .irpc/
|
||||
.even
|
||||
.bss
|
||||
macdfn: .blkw
|
||||
.end
|
||||
221
tests/2.11BSD/m11/macro.m11
Normal file
221
tests/2.11BSD/m11/macro.m11
Normal file
@@ -0,0 +1,221 @@
|
||||
.title main
|
||||
|
||||
.ident /03apr4/
|
||||
|
||||
.mcall (at)always,ch.mne,st.flg
|
||||
always
|
||||
ch.mne
|
||||
st.flg
|
||||
|
||||
.mcall (at)xmit,param
|
||||
.mcall (at)genedt,gencnd,setnz
|
||||
.mcall (at)search,scanw,next
|
||||
.if df rsx11d
|
||||
.mcall (at)scan
|
||||
.endc
|
||||
|
||||
|
||||
.globl endp2l
|
||||
.globl secini, stmnt
|
||||
.globl setmax, propc
|
||||
.globl exmflg, xctpas, xctlin
|
||||
.globl objchn, openo
|
||||
|
||||
|
||||
;
|
||||
.globl clcfgs, clcloc, clcmax
|
||||
.globl clcnam, clcsec, cpopj
|
||||
.globl errbts
|
||||
.globl flags, insert
|
||||
.globl mode, rellvl
|
||||
.globl rolupd
|
||||
.globl sector, setnb
|
||||
.globl setxpr
|
||||
.globl symbol, value
|
||||
.globl endp1c, endp2c
|
||||
.globl prop1, endp1, prop2, endp2
|
||||
.globl bksiz
|
||||
|
||||
.if ndf xswit
|
||||
.globl pass, prosw
|
||||
.endc
|
||||
|
||||
.globl savreg, xmit0
|
||||
|
||||
.globl endflg, endlin
|
||||
.globl getlin
|
||||
.sbttl roll definitions
|
||||
|
||||
entsec rolbas
|
||||
rolbas = .
|
||||
entsec roltop
|
||||
entsec rolsiz
|
||||
xitsec
|
||||
|
||||
.macro genrol name, limits, size
|
||||
entsec rolbas
|
||||
.globl name'rol
|
||||
name'rol= .-rolbas
|
||||
.if nb <limits>
|
||||
.word <^pl limits>
|
||||
.iff
|
||||
.word 0
|
||||
.endc
|
||||
entsec roltop
|
||||
.if nb <limits>
|
||||
.word <^ph limits>
|
||||
.iff
|
||||
.word 0
|
||||
.endc
|
||||
entsec rolsiz
|
||||
.word size*2
|
||||
xitsec
|
||||
.iif gt size-maxxmt, maxxmt=size
|
||||
.endm genrol
|
||||
|
||||
.iif ndf maxxmt, maxxmt= 0
|
||||
|
||||
.if df rsx11d
|
||||
genrol reg, ,4 ;register symbols
|
||||
.endc
|
||||
genrol sym, ,4 ;symbol table
|
||||
.if ndf xmacro
|
||||
genrol mac, ,4 ;macro roll
|
||||
genrol dma, ,2 ;dummy argument roll
|
||||
.endc
|
||||
.if ndf xedlsb
|
||||
genrol lsy, ,4 ;local symbol roll
|
||||
.endc
|
||||
genrol sec, ,5 ;section roll
|
||||
genrol cod, ,4 ;code roll
|
||||
|
||||
genrol dum, ,0 ;dummy (separates variable from fixed)
|
||||
|
||||
genrol cnd,cndsec,2 ;conditional arguments
|
||||
genrol swt,swtsec,2 ;command string switches
|
||||
genrol edt,edtsec,3 ;enabl/dsabl
|
||||
genrol lcd,lctsec,1 ;listing control
|
||||
genrol psa,psasec,2 ;psect attributes
|
||||
genrol pst,pstsec,4 ;permanent symbol table
|
||||
genrol crf,crfsec,3 ;cref options
|
||||
.sbttl assembler proper
|
||||
|
||||
entsec impure
|
||||
|
||||
pass: .blkw
|
||||
|
||||
bksiz: .blkw 2
|
||||
;next group must stay together
|
||||
entsec imppas
|
||||
|
||||
symbol: .blkw 2 ;symbol accumulator
|
||||
mode:
|
||||
flags: .blkb 1 ;flag bits
|
||||
sector: .blkb 1 ;symbol/expression type
|
||||
value: .blkw 1 ;expression value
|
||||
rellvl: .blkw 1
|
||||
.rept maxxmt-<<.-symbol>/2> ;end of grouped data
|
||||
.blkw
|
||||
.endm
|
||||
|
||||
clcnam: .blkw 2 ;current location counter symbol
|
||||
clcfgs: .blkb 1
|
||||
clcsec: .blkb 1
|
||||
clcloc: .blkw 1
|
||||
clcmax: .blkw 1
|
||||
|
||||
xitsec ;return to normal
|
||||
prop1: ;process pass 1
|
||||
mov #regtbl,r1 ;set to init regs
|
||||
clr r2
|
||||
2$: mov #symbol,r4
|
||||
mov (r1)+,(r4)+ ;set mnemonic
|
||||
clr (r4)+
|
||||
.if df rsx11d
|
||||
scan regrol ;set indices
|
||||
.iff
|
||||
search symrol ;set indices
|
||||
.endc
|
||||
mov #defflg!regflg,(r4)+
|
||||
mov r2,(r4)
|
||||
call insert
|
||||
inc r2
|
||||
cmp r2,#10 ;end?
|
||||
blo 2$ ; no
|
||||
br prop2 ; yes, exit through pass 2
|
||||
|
||||
entsec dpure
|
||||
regtbl: .rad50 /r0 r1 r2 r3 r4 r5 sp pc /
|
||||
xitsec
|
||||
prop2: ;macro pass 2
|
||||
call xctpas
|
||||
call secini ;init the sector roll
|
||||
3$: call getlin ;get the next input line
|
||||
bne 4$ ; branch if eof
|
||||
call stmnt ;process the statement
|
||||
4$: call endlin ;polish off line
|
||||
tst endflg ;end seen?
|
||||
beq 3$ ; no, continue
|
||||
return
|
||||
|
||||
|
||||
|
||||
endp1: ;end of pass handler
|
||||
.if ndf xrel
|
||||
call setmax ;set max location
|
||||
.iftf
|
||||
mov #objchn,r0
|
||||
call openo ;open output file
|
||||
call endp1c ;init binary
|
||||
clr rolupd ;set for re-init scan
|
||||
31$: next secrol ;get the next entry
|
||||
beq 32$ ; branch if finished
|
||||
clr value ;found, reset pc
|
||||
call insert ;put back in table
|
||||
br 31$
|
||||
|
||||
32$:
|
||||
.endc
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
||||
endp2: ;end of pass 2
|
||||
.if ndf xrel
|
||||
call setmax ;set max location
|
||||
.endc
|
||||
call endp2c ;clean up binary
|
||||
jmp endp2l ;output listing of table
|
||||
.if ndf xswit
|
||||
|
||||
prosw: ;process switch
|
||||
;in - ascii in r0
|
||||
;out- .ne. 0 if ok
|
||||
call savreg
|
||||
call setnb
|
||||
call setxpr ;set expression-type registers
|
||||
mov r0,(r1)+ ;set "symbol"
|
||||
call xctlin ;zero line-oriented flags
|
||||
scanw swtrol ;scan for switch
|
||||
beq 9$ ; not found, exit zero
|
||||
clr (r3) ;clear "mode"
|
||||
mov (r1),(r4) ;address to "value"
|
||||
inc exmflg ;flag exec mode
|
||||
call propc ;process as op-code
|
||||
clr r0 ;assume error
|
||||
bis errbts,r5 ;error or not terminator?
|
||||
bne 9$ ; yes, error
|
||||
com r0 ;ok, set .ne. zero
|
||||
9$: return
|
||||
|
||||
|
||||
.endc
|
||||
|
||||
|
||||
entsec implin
|
||||
exmflg: .blkw ;exec mode flag
|
||||
xitsec
|
||||
|
||||
|
||||
.end
|
||||
352
tests/2.11BSD/m11/macxrf.c
Normal file
352
tests/2.11BSD/m11/macxrf.c
Normal file
@@ -0,0 +1,352 @@
|
||||
/*
|
||||
* macro-11 cross reference generator
|
||||
* Jim Reeds for use with Harvard m11.
|
||||
*
|
||||
* Usage:
|
||||
* macxrf -[olsmpcer] infile [outfile]
|
||||
*
|
||||
* -l spool output to lpr
|
||||
* -o if specified, send output to stdout. else to av[2]
|
||||
* -s make a user-defined symbol cross reference
|
||||
* -m make a macro cross reference
|
||||
* -p make a permanent symbol cross reference
|
||||
* -c make a .pcsect cross reference. ['c' is holdover from rt-11,
|
||||
* where the only .psects are .csects]
|
||||
* -e make an error cross reference. [keyed by one-letter codes]
|
||||
* -r make a register use cross reference
|
||||
*
|
||||
* If none of [smpcer] are specified the default of "sme" is used.
|
||||
*
|
||||
* Effciency bug: should take input ('infile') from a pipe.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#define LPR "/usr/ucb/bin/lpr"
|
||||
#define NCOLS 8
|
||||
|
||||
/*
|
||||
* Codes emitted by m11
|
||||
*/
|
||||
|
||||
#define PAGE 02
|
||||
#define LINE 03
|
||||
|
||||
#include <ctype.h>
|
||||
char *lets = "smpcer";
|
||||
int want[6];
|
||||
|
||||
char *desire;
|
||||
int outflag;
|
||||
int lprflag;
|
||||
int debug;
|
||||
char *Roll[] = {
|
||||
"Symbols",
|
||||
"Macros",
|
||||
"Permanent symbols",
|
||||
"Psects",
|
||||
"Errors",
|
||||
"Registers"
|
||||
};
|
||||
/*
|
||||
* # means a definition reference
|
||||
* * means a destructive reference
|
||||
*/
|
||||
char *Code[] = {" ", "# ", "* ", "#*"};
|
||||
long tcount[6]; /* keep track of how many of each type */
|
||||
int tany = 0;
|
||||
|
||||
/*
|
||||
* Structure to store a reference.
|
||||
*/
|
||||
|
||||
struct item {
|
||||
char *i_name;
|
||||
int i_code;
|
||||
int i_page;
|
||||
int i_line;
|
||||
struct item *i_left, *i_right;
|
||||
} *ihead = NULL;
|
||||
|
||||
/*
|
||||
* Text strings are stored in a tree. This way
|
||||
* duplicate references to the same string use the same core.
|
||||
* This whole scheme is of doubtful cost-effectiveness.
|
||||
*/
|
||||
struct string {
|
||||
char *s_data;
|
||||
struct string *s_left, *s_right;
|
||||
} *shead = NULL;
|
||||
|
||||
int Maxpage;
|
||||
char *symnam;
|
||||
|
||||
main(ac, av)
|
||||
char **av;
|
||||
{
|
||||
char *s;
|
||||
int i;
|
||||
char symbol[7];
|
||||
int code;
|
||||
int page, line, c;
|
||||
FILE *x = fopen(av[2], "r");
|
||||
int Type;
|
||||
if(x == NULL)
|
||||
perror(av[2]),exit(1);
|
||||
lprflag = any('l', av[1]);
|
||||
outflag = any('o', av[1]);
|
||||
debug = any('x', av[1]);
|
||||
if(join(lets, av[1]))
|
||||
desire = av[1];
|
||||
else
|
||||
desire = "sme"; /* default cref request */
|
||||
|
||||
for(i=0;i<6;i++)
|
||||
want[i] = any(lets[i], desire);
|
||||
|
||||
if(!outflag)
|
||||
freopen(av[3], "a", stdout), fseek(stdout, 0L, 2);
|
||||
|
||||
unlink(av[2]);
|
||||
line = 0;
|
||||
page = 0;
|
||||
while((c = getc(x)) != EOF)
|
||||
{
|
||||
if (c==0)
|
||||
break;
|
||||
else if(c == PAGE)
|
||||
line = 0, page++;
|
||||
else if(c == LINE)
|
||||
line++;
|
||||
else if (c<040 && (c >= 020))
|
||||
{
|
||||
Type = c - 020;
|
||||
if(Type>5)
|
||||
fprintf(stderr, "*** CREF TYPE %o ***\n", c);
|
||||
}
|
||||
else if (c >= 040)
|
||||
{
|
||||
ungetc(c, x);
|
||||
s = symbol;
|
||||
while( (c = getc(x)) >= 040)
|
||||
{
|
||||
if(isupper(c))
|
||||
c =tolower(c);
|
||||
*s++ = c;
|
||||
}
|
||||
*s = 0;
|
||||
|
||||
if(c <020 || c > 023 )
|
||||
fprintf(stderr, "*** CREF CODE %o ***\n", c);
|
||||
process(Type, symbol, c & 3, page, line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(debug)
|
||||
dump(ihead);
|
||||
if(debug)
|
||||
{
|
||||
fprintf(stderr, "tany=%d\n", tany);
|
||||
for(i=0; i<ac; i++)fprintf(stderr, "%s\n", av[i]);
|
||||
for(i=0; i<6; i++) fprintf(stderr, "want = %d, tcount = %D\n",
|
||||
want[i], tcount[i]);
|
||||
}
|
||||
if(tany) {
|
||||
printf("\nMacro-11 Cross Reference Listing.\n");
|
||||
for(i=0; i<6; i++) {
|
||||
if(tcount[i] == 0L) continue;
|
||||
if(want[i] == 0) continue;
|
||||
printf("\n%s:\n", Roll[i]);
|
||||
symnam = 0;
|
||||
crprint(ihead, i);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
if(lprflag && outflag) {
|
||||
execl(LPR, LPR, av[3], 0);
|
||||
perror(LPR);
|
||||
exit(1);
|
||||
}
|
||||
exit(0);
|
||||
}
|
||||
|
||||
char *__s;
|
||||
|
||||
int nocore = 0;
|
||||
process(t, s, c, page, l)
|
||||
char *s;
|
||||
{
|
||||
register struct item *p;
|
||||
struct item *addtree();
|
||||
char *calloc(), *stash();
|
||||
|
||||
if(page>Maxpage)
|
||||
Maxpage = page;
|
||||
if(debug)
|
||||
fprintf(stderr, "process(%o, %s, %o, %d, %d)\n",
|
||||
t, s, c, page,l);
|
||||
if(nocore)
|
||||
return;
|
||||
if(want[t] == 0) return;
|
||||
p = (struct item *) calloc(1, sizeof (struct item));
|
||||
if(p == NULL)
|
||||
{
|
||||
fprintf(stderr, "Cref: Ran out of core, page %d, line %d\n",p, l);
|
||||
nocore++;
|
||||
return;
|
||||
}
|
||||
tcount[t]++;
|
||||
tany |= 1;
|
||||
p->i_code = t | (c<<8);
|
||||
p->i_name = stash(s);
|
||||
p->i_page = page;
|
||||
p->i_line = l;
|
||||
|
||||
ihead = addtree(ihead, p);
|
||||
}
|
||||
|
||||
comp(p, q)
|
||||
register struct item *p, *q;
|
||||
{
|
||||
register x;
|
||||
|
||||
if(p->i_name != q->i_name)
|
||||
x = strcmp(p->i_name, q->i_name);
|
||||
else
|
||||
x = 0;
|
||||
if(x == 0) {
|
||||
x = p->i_page - q->i_page;
|
||||
if(x == 0)
|
||||
x = p->i_line - q->i_line;
|
||||
if(x == 0)
|
||||
x= p->i_code - q->i_code;
|
||||
}
|
||||
return(x);
|
||||
}
|
||||
|
||||
struct item *
|
||||
addtree(b, p)
|
||||
struct item *b, *p;
|
||||
{
|
||||
register c;
|
||||
|
||||
if(b == NULL)
|
||||
return(b = p);
|
||||
c = comp(b, p);
|
||||
if(c < 0)
|
||||
b->i_left = addtree(b->i_left, p);
|
||||
else if (c>0)
|
||||
b->i_right= addtree(b->i_right, p);
|
||||
return(b);
|
||||
}
|
||||
|
||||
char *stash(s)
|
||||
register char *s;
|
||||
{
|
||||
shead = store(shead, s);
|
||||
return(__s);
|
||||
}
|
||||
store(b, s)
|
||||
register struct string *b;
|
||||
register char *s;
|
||||
{
|
||||
register x;
|
||||
|
||||
if(b == 0) {
|
||||
b = (struct string *) calloc(1, sizeof(struct string));
|
||||
__s = b->s_data = strsave(s);
|
||||
} else if((x=strcmp(b->s_data, s)) == 0)
|
||||
__s = b->s_data;
|
||||
else if(x<0)
|
||||
b->s_left = store(b->s_left, s);
|
||||
else
|
||||
b->s_right= store(b->s_right,s);
|
||||
return(b);
|
||||
}
|
||||
strsave(s)
|
||||
register char *s;
|
||||
{
|
||||
register char *t;
|
||||
char *calloc();
|
||||
|
||||
t = calloc(strlen(s)+1, 1);
|
||||
strcpy(t, s);
|
||||
return(t);
|
||||
}
|
||||
int crcol = 0;
|
||||
crprint(p, i)
|
||||
register struct item *p;
|
||||
{
|
||||
if(p == NULL) return;
|
||||
|
||||
crprint(p->i_right, i);
|
||||
if ((p->i_code & 07) == i) {
|
||||
char *code;
|
||||
if (symnam != p->i_name)
|
||||
crcol = 0, printf("\n%-6.6s\t", symnam = p->i_name);
|
||||
if(crcol == NCOLS) {
|
||||
crcol = 1;
|
||||
printf("\n\t");
|
||||
}
|
||||
else crcol++;
|
||||
|
||||
|
||||
if(i == 4 || i == 2)
|
||||
code = 0;
|
||||
else
|
||||
code = Code[3 & (p->i_code >>8)];
|
||||
|
||||
prx(p->i_page, p->i_line, code, crcol);
|
||||
}
|
||||
crprint(p->i_left, i);
|
||||
}
|
||||
prx(page, line, code, col)
|
||||
char *code;
|
||||
{
|
||||
char buf[15];
|
||||
|
||||
if(Maxpage>1)
|
||||
sprintf(buf, "%d-%d", page, line);
|
||||
else
|
||||
sprintf(buf, "%d", line);
|
||||
if(code)
|
||||
strcat(buf, code);
|
||||
if(col == NCOLS)
|
||||
printf("%s", buf);
|
||||
else {
|
||||
printf("%8s", buf);
|
||||
if(strlen(buf) > 7) printf(" ");
|
||||
}
|
||||
}
|
||||
join(s,t)
|
||||
register char *s, *t;
|
||||
{
|
||||
for(;*s;s++)
|
||||
if(any(*s, t))
|
||||
return(1);
|
||||
return(0);
|
||||
}
|
||||
|
||||
any(c, s)
|
||||
register char c, *s;
|
||||
{
|
||||
for(;*s;s++)
|
||||
if(*s == c)
|
||||
return(1);
|
||||
return(0);
|
||||
}
|
||||
minuspr(x, y)
|
||||
{
|
||||
char buf[30];
|
||||
sprintf(buf,"%d-%d", x, y);
|
||||
printf(" %4s", buf);
|
||||
}
|
||||
dump(p)
|
||||
struct item *p;
|
||||
{
|
||||
if(p==NULL)return;
|
||||
dump(p->i_left);
|
||||
fprintf(stderr, "%s: %o %d %d\n", p->i_name, p->i_code, p->i_page, p->i_line);
|
||||
dump(p->i_right);
|
||||
}
|
||||
305
tests/2.11BSD/m11/misc.m11
Normal file
305
tests/2.11BSD/m11/misc.m11
Normal file
@@ -0,0 +1,305 @@
|
||||
.title atmisc
|
||||
|
||||
.ident /14dec3/ ;
|
||||
|
||||
.globl ..z,sdebug
|
||||
.mcall (at)sdebug,ndebug
|
||||
.mcall (at)always,ch.mne,ct.mne,error
|
||||
always
|
||||
ch.mne
|
||||
ct.mne
|
||||
|
||||
.globl symbol, chrpnt, symbeg, value
|
||||
|
||||
.globl cpopj, setwrd, setbyt, dnc, r50unp
|
||||
.globl getsym, mulr50, getr50, setr50, tstr50
|
||||
.globl cvtnum
|
||||
.globl setsym, getnb, setnb, getchr, setchr
|
||||
.globl savreg, xmit0, movbyt, mul, div
|
||||
|
||||
xitsec ;start in default sector
|
||||
setwrd: mov r1,-(sp) ;stack reg
|
||||
mov 2(r1),r1 ;get actual value
|
||||
movb #dig.0/2,(r2) ;set primitive
|
||||
asl r1
|
||||
rolb (r2)+ ;move in bit
|
||||
mov #5,r0
|
||||
br setbyx
|
||||
|
||||
setbyt: mov r1,-(sp) ;stack index
|
||||
movb 2(r1),r1 ;get value
|
||||
mov #space,r0
|
||||
movb r0,(r2)+ ;pad with spaces
|
||||
movb r0,(r2)+
|
||||
movb r0,(r2)+
|
||||
swab r1 ;manipulate to left half
|
||||
rorb r1 ;get the last guy
|
||||
clc
|
||||
ror r1
|
||||
mov #3,r0
|
||||
setbyx: swab r0
|
||||
add #3,r0
|
||||
movb #dig.0/10,(r2)
|
||||
1$: asl r1
|
||||
rolb (r2)
|
||||
decb r0
|
||||
bgt 1$
|
||||
tstb (r2)+
|
||||
swab r0
|
||||
sob r0,setbyx
|
||||
mov (sp)+,r1
|
||||
return
|
||||
dnc: ;decimal number conversion
|
||||
mov #10.,r3 ;set divisor
|
||||
1$: ;entry for other than decimal
|
||||
clr r0
|
||||
div r3,r0 ;divide r1
|
||||
mov r1,-(sp) ;save remainder
|
||||
mov r0,r1 ;set for next divide
|
||||
beq 2$ ; unless zero
|
||||
call 1$ ;recurse
|
||||
2$: mov (sp)+,r1 ;retrieve number
|
||||
add #dig.0,r1 ;convert to ascii
|
||||
movb r1,(r2)+ ;store
|
||||
return
|
||||
|
||||
|
||||
r50unp: ;rad 50 unpack routine
|
||||
mov r4,-(sp) ;save reg
|
||||
mov #symbol,r4 ;point to symbol storage
|
||||
1$: mov (r4)+,r1 ;get next word
|
||||
mov #50*50,r3 ;set divisor
|
||||
call 10$ ;divide and stuff it
|
||||
mov #50,r3
|
||||
call 10$ ;again for next
|
||||
mov r1,r0
|
||||
call 11$ ;finish last guy
|
||||
cmp r4,#symbol+4 ;through?
|
||||
bne 1$ ; no
|
||||
mov (sp)+,r4 ;yes, restore register
|
||||
return
|
||||
|
||||
|
||||
10$: clr r0
|
||||
div r3,r0
|
||||
11$: tst r0 ;space?
|
||||
beq 23$ ; yes
|
||||
cmp r0,#33 ;test middle
|
||||
blt 22$ ;alpha
|
||||
beq 21$ ;dollar
|
||||
add #22-11,r0 ;dot or dollar
|
||||
21$: add #11-100,r0
|
||||
22$: add #100-40,r0
|
||||
23$: add #40,r0
|
||||
movb r0,(r2)+ ;stuff it
|
||||
return
|
||||
.sbttl symbol/character handlers
|
||||
|
||||
getsym:
|
||||
call savreg
|
||||
mov chrpnt,symbeg ;save in case of rescan
|
||||
mov #symbol+4,r1
|
||||
clr -(r1)
|
||||
clr -(r1)
|
||||
bitb cttbl(r5),#ct.alp ;alpha?
|
||||
beq 5$ ; no, exit false
|
||||
mov #26455,r2
|
||||
call setr50
|
||||
1$: call mulr50
|
||||
2$: asr r2
|
||||
bcs 1$
|
||||
add r0,(r1)
|
||||
3$: call getr50
|
||||
ble 4$
|
||||
asr r2
|
||||
bcs 2$
|
||||
beq 3$
|
||||
tst (r1)+
|
||||
br 1$
|
||||
|
||||
4$: call setnb
|
||||
5$: mov symbol,r0
|
||||
return
|
||||
|
||||
|
||||
mulr50: ;multiply r0 * 50
|
||||
; imuli 50,r0
|
||||
mov r0,-(sp)
|
||||
asl r0
|
||||
asl r0
|
||||
add (sp)+,r0
|
||||
asl r0
|
||||
asl r0
|
||||
asl r0
|
||||
return
|
||||
|
||||
entsec impure
|
||||
chrpnt: .blkw ;character pointer
|
||||
symbeg: .blkw ;start of current symbol
|
||||
xitsec
|
||||
getr50: call getchr
|
||||
setr50: mov r5,r0
|
||||
tstr50: bitb #ct.lc!ct.alp!ct.num!ct.sp,cttbl(r0) ;alpha, numeric, or space?
|
||||
beq 1$ ; no, exit minus
|
||||
cmp r0,#ch.dol ;yes, try dollar
|
||||
blo 2$ ;space
|
||||
beq 3$ ;dollar
|
||||
bitb #ct.lc,cttbl(r0)
|
||||
beq 10$
|
||||
add #'A-'a,r0
|
||||
10$:
|
||||
cmp r0,#let.a
|
||||
cmp r0,#let.a
|
||||
blo 4$ ;dot or digit
|
||||
br 5$ ;alpha
|
||||
|
||||
1$: mov #100000+space,r0 ;invalid, force minus
|
||||
2$: sub #space-11,r0 ;space
|
||||
3$: sub #11-22,r0 ;dollar
|
||||
4$: sub #22-100,r0 ;dot, digit
|
||||
5$: sub #100,r0 ;alphabetic
|
||||
return
|
||||
cvtnum: ;convert text to numeric
|
||||
|
||||
; in - r2 radix
|
||||
|
||||
; out - value result
|
||||
; r0 - high bit - overflow
|
||||
; - high byte - character count
|
||||
; - low byte - oversize count
|
||||
|
||||
|
||||
call savreg
|
||||
clr r0 ;result flag register
|
||||
clr r1 ;numeric accumulator
|
||||
1$: mov r5,r3 ;get a copy of the current char
|
||||
sub #dig.0,r3 ;convert to absolute
|
||||
cmp r3,#9. ;numeric?
|
||||
bhi 9$ ; no, we're through
|
||||
cmp r3,r2 ;yes, less than radix?
|
||||
blo 2$ ; yes
|
||||
inc r0 ;no, bump "n" error count
|
||||
2$:
|
||||
.if ndf pdpv45
|
||||
mov r2,r4 ;copy of current radix
|
||||
clr -(sp) ;temp ac
|
||||
3$: asr r4 ;shift radix
|
||||
bcc 4$ ;branch if no accumulation
|
||||
add r1,(sp) ;add in
|
||||
4$: tst r4 ;any more bits to process?
|
||||
beq 5$ ; no
|
||||
asl r1 ;yes, shift pattern
|
||||
bcc 3$ ;branch if no overflow
|
||||
bis #100000,r0 ;oh, oh. flag it
|
||||
br 3$
|
||||
|
||||
5$: mov (sp)+,r1 ;set new number
|
||||
.iff
|
||||
mul r2,r1
|
||||
.endc
|
||||
add r3,r1 ;add in current number
|
||||
call getchr ;get another character
|
||||
add #000400,r0 ;tally character count
|
||||
br 1$
|
||||
|
||||
9$: mov r1,value ;return result in "value"
|
||||
return ;return, testing r0
|
||||
;ct.eol= 000 ; eol
|
||||
;ct.com= 001 ; comma
|
||||
;ct.tab= 002 ; tab
|
||||
;ct.sp= 004 ; space
|
||||
;ct.pcx= 010 ; printing character
|
||||
;ct.num= 020 ; numeric
|
||||
;ct.alp= 040 ; alpha, dot, dollar
|
||||
;ct.lc= 100 ; lower case alpha
|
||||
;ct.smc= 200 ; semi-colon (minus bit)
|
||||
;
|
||||
;ct.pc= ct.com!ct.smc!ct.pcx!ct.num!ct.alp ;printing chars
|
||||
|
||||
.macro genctt arg ;generate character type table
|
||||
.irp a, <arg>
|
||||
.byte ct.'a
|
||||
.endm
|
||||
.endm
|
||||
|
||||
|
||||
entsec dpure
|
||||
cttbl: ;character type table
|
||||
genctt <eol, eol, eol, eol, eol, eol, eol, eol>
|
||||
genctt <eol, tab, eol, eol, eol, eol, eol, eol>
|
||||
genctt <eol, eol, eol, eol, eol, eol, eol, eol>
|
||||
genctt <eol, eol, eol, eol, eol, eol, eol, eol>
|
||||
|
||||
genctt <sp , pcx, pcx, pcx, alp, pcx, pcx, pcx>
|
||||
genctt <pcx, pcx, pcx, pcx, com, pcx, alp, pcx>
|
||||
genctt <num, num, num, num, num, num, num, num>
|
||||
genctt <num, num, pcx, smc, pcx, pcx, pcx, pcx>
|
||||
|
||||
genctt <pcx, alp, alp, alp, alp, alp, alp, alp>
|
||||
genctt <alp, alp, alp, alp, alp, alp, alp, alp>
|
||||
genctt <alp, alp, alp, alp, alp, alp, alp, alp>
|
||||
genctt <alp, alp, alp, pcx, pcx, pcx, pcx, pcx>
|
||||
|
||||
genctt <eol, lc , lc , lc , lc , lc , lc , lc >
|
||||
genctt <lc , lc , lc , lc , lc , lc , lc , lc >
|
||||
genctt <lc , lc , lc , lc , lc , lc , lc , lc >
|
||||
genctt <lc , lc , lc , eol, eol, eol, eol, eol>
|
||||
|
||||
xitsec
|
||||
setsym: ;set symbol for re-scan
|
||||
mov symbeg,chrpnt ;set the pointer
|
||||
br setchr ;set character and flags
|
||||
|
||||
getnb: ;get a non-blank character
|
||||
inc chrpnt ;bump pointer
|
||||
setnb: call setchr ;set register and flags
|
||||
bitb #ct.sp!ct.tab,cttbl(r5) ;blank?
|
||||
bne getnb ; yes, bypass
|
||||
br setchr ;exit, setting flags
|
||||
|
||||
getchr: ;get the next character
|
||||
inc chrpnt ;bump pointer
|
||||
setchr: movb @chrpnt,r5 ;set register and flags
|
||||
.if ndf xedlc
|
||||
cmp r5,#141 ;lower case?
|
||||
blo 1$ ;no
|
||||
cmp r5,#172
|
||||
bhi 1$ ;no
|
||||
sub #40,r5 ;convert to upper case
|
||||
1$: tst r5 ;set condition codes
|
||||
.endc
|
||||
;bmi getchr ;loop if invalid character
|
||||
bpl 2$ ;non invalid char, return
|
||||
error 13,i,<illegal character>
|
||||
mov #'? ,r5
|
||||
movb #200!'?,@chrpnt ; put the qm into linbuf
|
||||
2$: return
|
||||
savreg: ;save registers
|
||||
mov r3,-(sp)
|
||||
mov r2,-(sp)
|
||||
mov r1,-(sp)
|
||||
mov 6.(sp),-(sp) ;place return address on top
|
||||
mov r4,8.(sp)
|
||||
; call tststk ;test stack
|
||||
call @(sp)+ ;return the call
|
||||
mov (sp)+,r1 ;restore registers
|
||||
mov (sp)+,r2
|
||||
mov (sp)+,r3
|
||||
mov (sp)+,r4
|
||||
tst r0 ;set condition codes
|
||||
cpopj: return
|
||||
|
||||
|
||||
.rept 20 ;generate xmit sequence
|
||||
mov (r1)+,(r2)+
|
||||
.endm
|
||||
xmit0: return
|
||||
|
||||
movbyt: ;move byte string
|
||||
1$: movb (r1)+,(r2)+ ;move one
|
||||
bne 1$ ;loop if non-null
|
||||
tstb -(r2) ;end, point back to null
|
||||
return
|
||||
|
||||
|
||||
.end
|
||||
77
tests/2.11BSD/m11/often.m11
Normal file
77
tests/2.11BSD/m11/often.m11
Normal file
@@ -0,0 +1,77 @@
|
||||
.title often
|
||||
|
||||
;
|
||||
; these are routines which get called periodically:
|
||||
;
|
||||
; xctlin once per line
|
||||
; xctpas once per pass
|
||||
; xctprg once per program
|
||||
;
|
||||
|
||||
.ident /sept81/
|
||||
|
||||
.mcall (at)always,st.flg
|
||||
always
|
||||
st.flg
|
||||
.globl xctpas, xctlin, xctprg
|
||||
.globl objsec
|
||||
.globl macdfn
|
||||
|
||||
.globl lst.kb,ioftbl,lstchn, lst.lp
|
||||
.globl lstflg, u.flag
|
||||
.globl io.tty
|
||||
.globl lstdev
|
||||
.globl cradix,pcrcnt
|
||||
|
||||
.globl defttl,chrpnt, setchr,title,endvec
|
||||
|
||||
.text
|
||||
xctprg:
|
||||
mov #^pl impure,r0
|
||||
1$: clr (r0)+
|
||||
cmp r0,#^ph implin
|
||||
blo 1$
|
||||
call fixtit
|
||||
inc endvec+6 ;default to no end vector
|
||||
|
||||
; fall through to
|
||||
|
||||
xctpas:
|
||||
mov #^pl imppas,r0
|
||||
1$: clr (r0)+
|
||||
cmp r0,#^ph implin
|
||||
blo 1$
|
||||
|
||||
comb objsec ;force sequence break
|
||||
|
||||
mov #lst.kb*400,r0 ;set error slot
|
||||
tstb ioftbl+lstchn ;listing device?
|
||||
beq 2$ ; no
|
||||
bis #lst.kb!100200,r0 ;yes, assume teletype
|
||||
bit #io.tty,ioftbl+lstchn ;true?
|
||||
bne 2$ ; yes
|
||||
add #<lst.lp-lst.kb>*401,r0 ;no, upgrade to lp
|
||||
2$: mov r0,lstdev ;set flags
|
||||
|
||||
3$:
|
||||
mov #8.,cradix ;init to octal radix
|
||||
|
||||
clr macdfn
|
||||
; fall through to
|
||||
|
||||
xctlin:
|
||||
mov #^pl implin,r0
|
||||
1$: clr (r0)+
|
||||
cmp r0,#^ph implin
|
||||
blo 1$
|
||||
|
||||
dec pcrcnt
|
||||
return
|
||||
|
||||
.globl fixtit
|
||||
fixtit:
|
||||
mov #defttl,chrpnt
|
||||
call setchr
|
||||
call title
|
||||
return
|
||||
.end
|
||||
286
tests/2.11BSD/m11/pst.m11
Normal file
286
tests/2.11BSD/m11/pst.m11
Normal file
@@ -0,0 +1,286 @@
|
||||
.title pst v095a11 permanent symbol table
|
||||
|
||||
.ident /03apr4/
|
||||
|
||||
; copyright 1972 digital equipment corporation
|
||||
; 15 nov 72
|
||||
|
||||
.mcall (at) always
|
||||
always
|
||||
|
||||
.globl wrdsym ;pointer to .word
|
||||
|
||||
dr1= 200 ;destructive reference in first field
|
||||
dr2= 100 ;destructive reference in second field
|
||||
|
||||
.globl dflgdg, dflgev, dflgbm, dflcnd, dflmac, dflsmc
|
||||
|
||||
dflgdg= 040 ;data generating directive
|
||||
dflgev= 020 ;directive requires even location
|
||||
dflgbm= 010 ;directive uses byte mode
|
||||
dflcnd= 004 ;conditional directive
|
||||
dflmac= 002 ;macro directive
|
||||
dflsmc= 001 ;mcall
|
||||
|
||||
.if df pal11r ;pal11r subset
|
||||
xmacro= 0
|
||||
x40= 0
|
||||
x45= 0
|
||||
.endc
|
||||
|
||||
.if df x40&x45
|
||||
xfltg= 0
|
||||
x4045= 0
|
||||
.endc
|
||||
|
||||
.iif df x45!xfltg, x45flt= 0
|
||||
|
||||
.iif df x40!xfltg, x40flt= 0
|
||||
|
||||
.iif df xmacro, xsml= 0
|
||||
|
||||
.macro opcdef name, class, value, flags, cond
|
||||
aaaa = 0
|
||||
.if nb cond
|
||||
aaaa = 1
|
||||
.endc
|
||||
;.if ndf cond ; this assembler can assemble for any pdp-11
|
||||
.rad50 /name/
|
||||
.byte flags+aaaa
|
||||
.globl opcl'class
|
||||
.byte 200+opcl'class
|
||||
.word value
|
||||
;.endc
|
||||
.endm
|
||||
|
||||
.macro dirdef name, flags, cond
|
||||
.rad50 /.'name/
|
||||
.byte flags+0, 0
|
||||
.if df cond
|
||||
.globl opcerr
|
||||
.word opcerr
|
||||
.iff
|
||||
.globl name
|
||||
.word name
|
||||
.endc
|
||||
.endm
|
||||
|
||||
;.psect pstsec con, shr ;pst is shareable
|
||||
.psect pstsec con ; << not in v7 unix it aint!
|
||||
|
||||
entsec pstsec
|
||||
opcdef <absd >, 01, 170600, dr1, x45flt
|
||||
opcdef <absf >, 01, 170600, dr1, x45flt
|
||||
opcdef <adc >, 01, 005500, dr1
|
||||
opcdef <adcb >, 01, 105500, dr1
|
||||
opcdef <add >, 02, 060000, dr2
|
||||
opcdef <addd >, 11, 172000, dr2, x45flt
|
||||
opcdef <addf >, 11, 172000, dr2, x45flt
|
||||
opcdef <ash >, 09, 072000, dr2, x4045
|
||||
opcdef <ashc >, 09, 073000, dr2, x4045
|
||||
opcdef <asl >, 01, 006300, dr1
|
||||
opcdef <aslb >, 01, 106300, dr1
|
||||
opcdef <asr >, 01, 006200, dr1
|
||||
opcdef <asrb >, 01, 106200, dr1
|
||||
opcdef <bcc >, 04, 103000,
|
||||
opcdef <bcs >, 04, 103400,
|
||||
opcdef <beq >, 04, 001400,
|
||||
opcdef <bge >, 04, 002000,
|
||||
opcdef <bgt >, 04, 003000,
|
||||
opcdef <bhi >, 04, 101000,
|
||||
opcdef <bhis >, 04, 103000,
|
||||
opcdef <bic >, 02, 040000, dr2
|
||||
opcdef <bicb >, 02, 140000, dr2
|
||||
opcdef <bis >, 02, 050000, dr2
|
||||
opcdef <bisb >, 02, 150000, dr2
|
||||
opcdef <bit >, 02, 030000,
|
||||
opcdef <bitb >, 02, 130000,
|
||||
opcdef <ble >, 04, 003400,
|
||||
opcdef <blo >, 04, 103400,
|
||||
opcdef <blos >, 04, 101400,
|
||||
opcdef <blt >, 04, 002400,
|
||||
opcdef <bmi >, 04, 100400,
|
||||
opcdef <bne >, 04, 001000,
|
||||
opcdef <bpl >, 04, 100000,
|
||||
opcdef <bpt >, 00, 000003,
|
||||
opcdef <br >, 04, 000400,
|
||||
opcdef <bvc >, 04, 102000,
|
||||
opcdef <bvs >, 04, 102400,
|
||||
opcdef <call >, 01, 004700,
|
||||
opcdef <ccc >, 00, 000257,
|
||||
opcdef <cfcc >, 00, 170000, , x45flt
|
||||
opcdef <clc >, 00, 000241,
|
||||
opcdef <cln >, 00, 000250,
|
||||
opcdef <clr >, 01, 005000, dr1
|
||||
opcdef <clrb >, 01, 105000, dr1
|
||||
opcdef <clrd >, 01, 170400, dr1, x45flt
|
||||
opcdef <clrf >, 01, 170400, dr1, x45flt
|
||||
opcdef <clv >, 00, 000242,
|
||||
opcdef <clz >, 00, 000244,
|
||||
opcdef <cmp >, 02, 020000,
|
||||
opcdef <cmpb >, 02, 120000,
|
||||
opcdef <cmpd >, 11, 173400, , x45flt
|
||||
opcdef <cmpf >, 11, 173400, , x45flt
|
||||
opcdef <cnz >, 00, 000254,
|
||||
opcdef <com >, 01, 005100, dr1
|
||||
opcdef <comb >, 01, 105100, dr1
|
||||
opcdef <dec >, 01, 005300, dr1
|
||||
opcdef <decb >, 01, 105300, dr1
|
||||
opcdef <div >, 07, 071000, dr2, x4045
|
||||
opcdef <divd >, 11, 174400, dr2, x45flt
|
||||
opcdef <divf >, 11, 174400, dr2, x45flt
|
||||
opcdef <emt >, 06, 104000,
|
||||
opcdef <fadd >, 03, 075000, dr1, x40flt
|
||||
opcdef <fdiv >, 03, 075030, dr1, x40flt
|
||||
opcdef <fmul >, 03, 075020, dr1, x40flt
|
||||
opcdef <fsub >, 03, 075010, dr1, x40flt
|
||||
opcdef <halt >, 00, 000000,
|
||||
opcdef <inc >, 01, 005200, dr1
|
||||
opcdef <incb >, 01, 105200, dr1
|
||||
opcdef <iot >, 00, 000004,
|
||||
opcdef <jmp >, 01, 000100,
|
||||
opcdef <jsr >, 05, 004000, dr1
|
||||
opcdef <ldcdf >, 11, 177400, dr2, x45flt
|
||||
opcdef <ldcfd >, 11, 177400, dr2, x45flt
|
||||
opcdef <ldcid >, 14, 177000, dr2, x45flt
|
||||
opcdef <ldcif >, 14, 177000, dr2, x45flt
|
||||
opcdef <ldcld >, 14, 177000, dr2, x45flt
|
||||
opcdef <ldclf >, 14, 177000, dr2, x45flt
|
||||
opcdef <ldd >, 11, 172400, dr2, x45flt
|
||||
opcdef <ldexp >, 14, 176400, dr2, x45flt
|
||||
opcdef <ldf >, 11, 172400, dr2, x45flt
|
||||
opcdef <ldfps >, 01, 170100, , x45flt
|
||||
opcdef <ldsc >, 00, 170004, , x45flt
|
||||
opcdef <ldub >, 00, 170003, , x45flt
|
||||
opcdef <mark >, 10, 006400, , x45
|
||||
opcdef <mfpd >, 01, 106500, , x45
|
||||
opcdef <mfpi >, 01, 006500, , x4045
|
||||
opcdef <modd >, 11, 171400, dr2, x45flt
|
||||
opcdef <modf >, 11, 171400, dr2, x45flt
|
||||
opcdef <mov >, 02, 010000, dr2
|
||||
opcdef <movb >, 02, 110000, dr2
|
||||
opcdef <mtpd >, 01, 106600, dr1, x45
|
||||
opcdef <mtpi >, 01, 006600, dr1, x4045
|
||||
opcdef <mul >, 07, 070000, dr2, x4045
|
||||
opcdef <muld >, 11, 171000, dr2, x45flt
|
||||
opcdef <mulf >, 11, 171000, dr2, x45flt
|
||||
opcdef <neg >, 01, 005400, dr1
|
||||
opcdef <negb >, 01, 105400, dr1
|
||||
opcdef <negd >, 01, 170700, dr1, x45flt
|
||||
opcdef <negf >, 01, 170700, dr1, x45flt
|
||||
opcdef <nop >, 00, 000240,
|
||||
opcdef <reset >, 00, 000005,
|
||||
opcdef <return>, 00, 000207,
|
||||
opcdef <rol >, 01, 006100, dr1
|
||||
opcdef <rolb >, 01, 106100, dr1
|
||||
opcdef <ror >, 01, 006000, dr1
|
||||
opcdef <rorb >, 01, 106000, dr1
|
||||
opcdef <rti >, 00, 000002,
|
||||
opcdef <rts >, 03, 000200, dr1
|
||||
opcdef <rtt >, 00, 000006,
|
||||
opcdef <sbc >, 01, 005600, dr1
|
||||
opcdef <sbcb >, 01, 105600, dr1
|
||||
opcdef <scc >, 00, 000277,
|
||||
opcdef <sec >, 00, 000261,
|
||||
opcdef <sen >, 00, 000270,
|
||||
opcdef <setd >, 00, 170011, , x45flt
|
||||
opcdef <setf >, 00, 170001, , x45flt
|
||||
opcdef <seti >, 00, 170002, , x45flt
|
||||
opcdef <setl >, 00, 170012, , x45flt
|
||||
opcdef <sev >, 00, 000262,
|
||||
opcdef <sez >, 00, 000264,
|
||||
opcdef <sob >, 08, 077000, dr1, x4045
|
||||
opcdef <spl >, 13, 000230, , x45
|
||||
opcdef <sta0 >, 00, 170005, , x45flt
|
||||
opcdef <stb0 >, 00, 170006, , x45flt
|
||||
opcdef <stcdf >, 12, 176000, dr2, x45flt
|
||||
opcdef <stcdi >, 12, 175400, dr2, x45flt
|
||||
opcdef <stcdl >, 12, 175400, dr2, x45flt
|
||||
opcdef <stcfd >, 12, 176000, dr2, x45flt
|
||||
opcdef <stcfi >, 12, 175400, dr2, x45flt
|
||||
opcdef <stcfl >, 12, 175400, dr2, x45flt
|
||||
opcdef <std >, 12, 174000, dr2, x45flt
|
||||
opcdef <stexp >, 12, 175000, dr2, x45flt
|
||||
opcdef <stf >, 12, 174000, dr2, x45flt
|
||||
opcdef <stfps >, 01, 170200, dr1, x45flt
|
||||
opcdef <stq0 >, 00, 170007, , x45flt
|
||||
opcdef <stst >, 01, 170300, dr1, x45flt
|
||||
opcdef <sub >, 02, 160000, dr2
|
||||
opcdef <subd >, 11, 173000, dr2, x45flt
|
||||
opcdef <subf >, 11, 173000, dr2, x45flt
|
||||
opcdef <swab >, 01, 000300, dr1
|
||||
opcdef <sxt >, 01, 006700, dr1, x4045
|
||||
opcdef <trap >, 06, 104400,
|
||||
opcdef <tst >, 01, 005700,
|
||||
opcdef <tstb >, 01, 105700,
|
||||
opcdef <tstd >, 01, 170500, , x45flt
|
||||
opcdef <tstf >, 01, 170500, , x45flt
|
||||
opcdef <wait >, 00, 000001,
|
||||
opcdef <xor >, 05, 074000, dr2, x4045
|
||||
|
||||
dirdef <ascii>, dflgbm
|
||||
dirdef <asciz>, dflgbm!dflgdg
|
||||
dirdef <asect>, , xrel
|
||||
dirdef <blkb >
|
||||
dirdef <blkw >, dflgev
|
||||
dirdef <byte >, dflgbm!dflgdg
|
||||
dirdef <csect>, , xrel
|
||||
dirdef <dsabl>
|
||||
dirdef <enabl>
|
||||
dirdef <end >
|
||||
dirdef <endc >, dflcnd
|
||||
dirdef <endm >, dflmac, xmacro
|
||||
dirdef <endr >, dflmac, xmacro
|
||||
dirdef <eot >
|
||||
dirdef <error>
|
||||
dirdef <even >
|
||||
dirdef <flt2 >, dflgev!dflgdg, xfltg
|
||||
dirdef <flt4 >, dflgev!dflgdg, xfltg
|
||||
dirdef <globl>, , xrel
|
||||
dirdef <ident>
|
||||
dirdef <if >, dflcnd
|
||||
dirdef <ifdf >, dflcnd
|
||||
dirdef <ifeq >, dflcnd
|
||||
dirdef <iff >, dflcnd
|
||||
dirdef <ifg >, dflcnd
|
||||
dirdef <ifge >, dflcnd
|
||||
dirdef <ifgt >, dflcnd
|
||||
dirdef <ifl >, dflcnd
|
||||
dirdef <ifle >, dflcnd
|
||||
dirdef <iflt >, dflcnd
|
||||
dirdef <ifndf>, dflcnd
|
||||
dirdef <ifne >, dflcnd
|
||||
dirdef <ifnz >, dflcnd
|
||||
dirdef <ift >, dflcnd
|
||||
dirdef <iftf >, dflcnd
|
||||
dirdef <ifz >, dflcnd
|
||||
dirdef <iif >
|
||||
dirdef <irp >, dflmac, xmacro
|
||||
dirdef <irpc >, dflmac, xmacro
|
||||
dirdef <limit>, dflgev!dflgdg, xrel
|
||||
dirdef <list >
|
||||
dirdef <macr >, dflmac, xmacro
|
||||
dirdef <macro>, dflmac, xmacro
|
||||
dirdef <mcall>, dflsmc, xsml
|
||||
dirdef <mexit> , , xmacro
|
||||
dirdef <narg > , , xmacro
|
||||
dirdef <nchr > , , xmacro
|
||||
dirdef <nlist>
|
||||
dirdef <ntype> , , xmacro
|
||||
dirdef <odd >
|
||||
dirdef <page >
|
||||
dirdef <print>
|
||||
dirdef <psect>
|
||||
dirdef <radix>
|
||||
dirdef <rad50>, dflgev!dflgdg
|
||||
dirdef <rem >
|
||||
dirdef <rept >, dflmac, xmacro
|
||||
dirdef <sbttl>
|
||||
dirdef <title>
|
||||
wrdsym:
|
||||
dirdef <word >, dflgev!dflgdg
|
||||
|
||||
|
||||
xitsec
|
||||
|
||||
.end
|
||||
323
tests/2.11BSD/m11/srch.m11
Normal file
323
tests/2.11BSD/m11/srch.m11
Normal file
@@ -0,0 +1,323 @@
|
||||
.title srch
|
||||
.ident /03apr4/
|
||||
|
||||
.mcall (at)always,scan,genedt
|
||||
.mcall (at)sdebug,ndebug
|
||||
always
|
||||
|
||||
.globl srchi
|
||||
.globl search, next, scan, scanc, scanw
|
||||
.globl append, insert, zap
|
||||
.globl rolndx, rolupd, mactop , symbot
|
||||
|
||||
.globl symovf
|
||||
|
||||
.globl xmit0
|
||||
.globl symlp, symhp, dumrol
|
||||
.globl savreg, symbol
|
||||
|
||||
.if df rsx11d
|
||||
.globl ed.reg, edmask, symrol, regrol, cpopj
|
||||
.endc
|
||||
|
||||
xitsec ;start in default sector
|
||||
|
||||
srchi: ;search init
|
||||
mov #dumrol,r0 ;end of variable rolls
|
||||
1$: mov symhp,<^pl rolbas>(r0) ;point all to top
|
||||
mov symhp,<^pl roltop>(r0)
|
||||
clrb <^pl rolsiz>+1(r0)
|
||||
sub #2,r0 ;get next lower
|
||||
bge 1$
|
||||
mov symlp,mactop ;bottom is start of macros
|
||||
add #bpmb-1,mactop ;must be even
|
||||
bic #bpmb-1,mactop
|
||||
mov symhp,symbot ;for sake of 'uplift' <<< REEDS
|
||||
mov symhp,symlp ;symlp should always == symbot [debug, REEDS]
|
||||
return
|
||||
.if ndf rsx11d
|
||||
|
||||
search: ;binary roll search
|
||||
call setrol ;set roll registers
|
||||
mov r3,-(sp)
|
||||
sub r3,r1 ;point one slot low
|
||||
mov r2,r3
|
||||
sub r1,r3 ;compute size
|
||||
clr r0 ;get set to compute search offset
|
||||
sec ; (r0 doubles as t/f flag)
|
||||
1$: rol r0 ;shift bit
|
||||
bic r0,r3 ;clear corresponding bit. last one?
|
||||
bne 1$ ; no
|
||||
2$: add r0,r1
|
||||
3$: asr r0 ;end of iteration, halve offset
|
||||
bic #2,r0 ;end?
|
||||
beq 7$ ; yes
|
||||
4$: cmp r2,r1 ;off in no-mans's land?
|
||||
blos 6$ ; yes
|
||||
cmp (r4),(r1) ;no, first words match?
|
||||
bne 5$ ; no
|
||||
cmp 2(r4),2(r1) ;yes, how about second?
|
||||
beq 8$ ; yes, found
|
||||
5$: bhi 2$ ;no, branch if too high
|
||||
6$: sub r0,r1 ;lower index
|
||||
br 3$
|
||||
|
||||
7$: cmp (r1)+,(r1)+ ;point to insertion slot
|
||||
8$: mov (sp)+,r3
|
||||
br scanx ;exit through scan
|
||||
.iff
|
||||
|
||||
search:
|
||||
call setrol
|
||||
bit #ed.reg,edmask ;register definition enabled?
|
||||
bne 10$ ;if ne no
|
||||
cmp r5,#symrol ;symbol roll?
|
||||
bne 10$ ;if ne no
|
||||
bit #7,(r4) ;make ruff ruff test bypass 90%
|
||||
bne 10$ ;if ne don't check for register
|
||||
scan regrol ;scan register roll
|
||||
mov r5,rolndx ;restore roll index
|
||||
tst r0 ;find symbol?
|
||||
beq 10$ ;if eq no find em
|
||||
return ;
|
||||
10$: mov r1,-(sp) ;save roll base
|
||||
cmp r1,r2 ;any in roll?
|
||||
beq 5$ ;if eq no
|
||||
sub r3,r2 ;calculate high and low bounds
|
||||
mov r1,r0 ;
|
||||
bic #177770,(sp) ;
|
||||
1$: mov r0,r1 ;calculate trial index
|
||||
add r2,r1 ;
|
||||
ror r1 ;halve result
|
||||
bic #7,r1 ;clear garbage bits
|
||||
bis (sp),r1 ;
|
||||
cmp (r1),(r4) ;compare high parts
|
||||
bhi 3$ ;if hi set new high limit
|
||||
blo 2$ ;if lo set new low limit
|
||||
cmp 2(r1),2(r4) ;compare low parts
|
||||
beq 6$ ;if eq hit
|
||||
bhi 3$ ;if hi set new high limit
|
||||
2$: mov r1,r0 ;set new low limit
|
||||
add r3,r0 ;reduce by one more
|
||||
cmp r0,r2 ;any more to search?
|
||||
blos 1$ ;if los yes
|
||||
add r3,r1 ;point to proper entry
|
||||
br 5$ ;exit
|
||||
3$: mov r1,r2 ;se new high limit
|
||||
sub r3,r2 ;reduce by one more
|
||||
cmp r0,r2 ;any more to search?
|
||||
blos 1$ ;if los yes
|
||||
5$: clr r0 ;set false flag
|
||||
6$: tst (sp)+ ;clean stack
|
||||
br scanx ;vammoosa
|
||||
|
||||
genedt reg
|
||||
|
||||
.endc
|
||||
next: ;get the next entry
|
||||
call setrol
|
||||
mov rolupd,r0
|
||||
add r0,r1
|
||||
add r3,r0
|
||||
cmp r1,r2
|
||||
blo scanx
|
||||
br scanxf
|
||||
|
||||
scanw: ;scan one word
|
||||
call setrol ;set registers
|
||||
clr r0 ;assume false
|
||||
1$: inc r0 ;tally entry count
|
||||
cmp (r4),(r1) ;match?
|
||||
beq scany ; yes
|
||||
add r3,r1 ;no, increment pointer
|
||||
cmp r1,r2 ;finished?
|
||||
blo 1$ ; no
|
||||
clr r0
|
||||
return ;yes, exit false
|
||||
|
||||
scanc: ;scan continuation
|
||||
call setrof ;set regs
|
||||
mov rolpnt,r1 ;get current pointer
|
||||
add r3,r1 ;update
|
||||
br scanf ;jump into middle
|
||||
|
||||
scan: ;linear roll scan
|
||||
call setrol ;set roll registers
|
||||
scanf: clr r0 ;assume false
|
||||
1$: cmp r1,r2 ;end?
|
||||
bhis scanxf ; yes, exit false
|
||||
inc r0
|
||||
cmp (r4),(r1) ;no, match on first words?
|
||||
bne 2$ ; yes
|
||||
cmp 2(r4),2(r1) ;no, how about second?
|
||||
beq scanx ; yes
|
||||
2$: add r3,r1 ;increment by size
|
||||
br 1$
|
||||
|
||||
.enabl lsb
|
||||
scanxf: clr r0 ;false exit
|
||||
scanx: mov r1,rolpnt ;set entry pointer
|
||||
mov r0,rolupd ;save flag
|
||||
beq 1$ ;branch if not found
|
||||
scany: mov r4,r2 ;pointer to "symbol"
|
||||
neg r3 ;negate entry size
|
||||
jmp xmit0(r3) ;found, xfer arguments
|
||||
|
||||
1$: cmp (r4)+,(r4)+ ;bypass symbol itself
|
||||
asr r3 ;get word count
|
||||
sub #2,r3 ;compensate for above cmp
|
||||
ble 3$ ;branch if end
|
||||
2$: clr (r4)+ ;clear word
|
||||
sob r3,2$
|
||||
3$: return
|
||||
.dsabl lsb
|
||||
append: ;append to end of roll
|
||||
call setrol
|
||||
mov r2,rolpnt ;set pointer
|
||||
clr rolupd
|
||||
br inserf
|
||||
|
||||
insert: ;insert in roll
|
||||
call setrof ;set roll registers (but no arg)
|
||||
inserf: mov rolpnt,r0 ;points to proper slot
|
||||
tst rolupd ;was search true?
|
||||
bne 5$ ; yes
|
||||
incb <^pl rolsiz>+1(r5) ;update entry count
|
||||
add r3,<^pl roltop>(r5) ;update top pointer
|
||||
cmp r2,<^pl rolbas>+2(r5) ;gap between rolls?
|
||||
bne 5$ ; yes, just stuff it
|
||||
mov <^pl rolbas>,r1 ;ditto for separate stack
|
||||
mov r1,r2
|
||||
sub r3,r2
|
||||
mov r2,symbot
|
||||
;cmp r2,mactop ;room?
|
||||
;bhi 1$ ; yes
|
||||
;jmp symovf ;no, error
|
||||
mov #symovf,upbomb ; where to go on error
|
||||
call uplift
|
||||
add upgap,r0
|
||||
add upgap,r1
|
||||
add upgap,r2
|
||||
|
||||
; fall through...
|
||||
1$: sub r1,r0 ;compute byte count
|
||||
asr r0 ; now word count
|
||||
beq 4$ ;branch if first time
|
||||
|
||||
2$: mov (r1)+,(r2)+ ;move an entry down
|
||||
sob r0,2$
|
||||
4$: sub r3,<^pl rolbas>(r5) ;decrement pointers
|
||||
sub r3,<^pl roltop>(r5)
|
||||
sub #2,r5 ;more rolls?
|
||||
bge 4$ ; yes
|
||||
mov r2,r0 ;point to insertion slot
|
||||
5$: asr r3 ;halve size count
|
||||
6$: mov (r4)+,(r0)+ ;move an entry into place
|
||||
sob r3,6$ ;loop if not end
|
||||
mov <^pl rolbas>,symbot
|
||||
mov <^pl rolbas>,symlp
|
||||
return
|
||||
|
||||
|
||||
.globl $brkad, $brksy ; defined in exec.m11
|
||||
|
||||
.globl putn
|
||||
uplift:: ;<<< REEDS. move all the rolls up in core
|
||||
; can be called from 'insert' above and also
|
||||
; from 'getblk' in mac.m11. Thanks to Steve
|
||||
; Ragle for showing the need for a call from
|
||||
; otherwise growing macros can scribble.
|
||||
; And to Joel Rubin for debugging help.
|
||||
.irpc xx,<0123>
|
||||
mov r'xx,-(sp)
|
||||
.endm
|
||||
cmp symbot,mactop
|
||||
blos 10$
|
||||
clr upgap
|
||||
jmp 99$
|
||||
10$: ; go here if symbot <= mactop
|
||||
|
||||
mov symhp,upgap ; stash old highest in-space address
|
||||
add #10102,symhp
|
||||
bic #77,symhp ; click bic rounds to next highest mult of 64
|
||||
|
||||
mov symhp,$brkad
|
||||
mov $brkad,-(sp)
|
||||
tst -(sp)
|
||||
$sbrk
|
||||
bcs 98$
|
||||
cmp (sp)+,(sp)+
|
||||
br 1$
|
||||
98$:
|
||||
cmp (sp)+,(sp)+
|
||||
jmp @upbomb ; error bail-out: symovf or macovf
|
||||
1$:
|
||||
sub #2,symhp ; new highest in-space address
|
||||
mov symhp,r0
|
||||
mov upgap,r1 ; recall old highest address
|
||||
mov r0,r3
|
||||
sub r1,r3 ; r3 has the distance syms were shifted
|
||||
mov symlp,r2 ; symlp is OLD bottom of symbols.
|
||||
tst -(r2) ; r2 ==> word before old bottom
|
||||
2$:
|
||||
mov (r1),(r0)
|
||||
tst -(r1)
|
||||
tst -(r0)
|
||||
cmp r1,r2
|
||||
bne 2$
|
||||
|
||||
9$: mov r3,upgap ; how much the syms were lifted
|
||||
mov #dumrol,r0 ; swiped from srchi
|
||||
3$: add r3,<^pl rolbas>(r0)
|
||||
add r3,<^pl roltop>(r0)
|
||||
sub #2,r0
|
||||
bge 3$
|
||||
|
||||
add r3,rolpnt
|
||||
add r3,symlp
|
||||
mov symlp,symbot
|
||||
tst rolupd
|
||||
beq 30$
|
||||
add r3,rolupd
|
||||
30$:
|
||||
99$:
|
||||
.irpc xx,<3210>
|
||||
mov (sp)+,r'xx
|
||||
.endm
|
||||
return
|
||||
|
||||
entsect mixed
|
||||
upgap: .blkw
|
||||
upbomb:: .blkw ; contains address of error handler
|
||||
xitsec
|
||||
zap: ;empty a roll
|
||||
call setrol
|
||||
mov r1,<^pl roltop>(r5) ;make top = bottom
|
||||
clrb <^pl rolsiz>+1(r5) ;clear entry count
|
||||
return
|
||||
|
||||
|
||||
setrol: ;set roll registers
|
||||
mov r0,rolndx ;set argument
|
||||
setrof: mov (sp)+,r0 ;save return address
|
||||
call savreg ;save registers
|
||||
mov r5,-(sp) ; and current character
|
||||
mov rolndx,r5 ;set index
|
||||
mov <^pl rolbas>(r5),r1 ;current base
|
||||
mov <^pl roltop>(r5),r2 ;current top
|
||||
movb <^pl rolsiz>(r5),r3 ;entry size
|
||||
mov #symbol,r4 ;pointer to symbol
|
||||
call (r0) ;call proper routine
|
||||
mov (sp)+,r5 ;restore current character
|
||||
return ; and rest of regs
|
||||
|
||||
entsec mixed
|
||||
rolndx: .blkw ;roll index
|
||||
rolpnt: .blkw ;roll pointer
|
||||
rolupd: .blkw ;roll update
|
||||
mactop: .blkw ;current top of macro storage
|
||||
symbot: .blkw ;current bottom of dynamic rolls.
|
||||
; @mactop<=@symbot or uplift will fix it
|
||||
xitsec
|
||||
|
||||
.end
|
||||
17
tests/2.11BSD/m11/syscalls.m11
Normal file
17
tests/2.11BSD/m11/syscalls.m11
Normal file
@@ -0,0 +1,17 @@
|
||||
.globl $creat, $open, $close, $exit, $read, $write, $sbrk
|
||||
.globl $seek, $gettod, $fork, $wait, $execv
|
||||
|
||||
$exit = ^O104401
|
||||
$fork = ^O104402
|
||||
$read = ^O104403
|
||||
$write = ^O104404
|
||||
$open = ^O104405
|
||||
$close = ^O104406
|
||||
$wait = ^O104524
|
||||
$creat = ^O104410
|
||||
$execv = ^O104413
|
||||
$gettod = ^O104564
|
||||
$sbrk = ^O104505
|
||||
$seek = ^O104423
|
||||
|
||||
.end
|
||||
1059
tests/2.11BSD/m11/xlat.m11
Normal file
1059
tests/2.11BSD/m11/xlat.m11
Normal file
File diff suppressed because it is too large
Load Diff
16
tests/2.11BSD/m11/xpcor.m11
Normal file
16
tests/2.11BSD/m11/xpcor.m11
Normal file
@@ -0,0 +1,16 @@
|
||||
.title xpcor
|
||||
|
||||
;this file must be linked last to ensure that it is the last
|
||||
;sector in the BSS area.
|
||||
|
||||
|
||||
.globl inicor
|
||||
|
||||
inicor= 3000. ;initial minimum # words for symbol table, etc.
|
||||
|
||||
.psect xpcor, con, bss, gbl
|
||||
|
||||
|
||||
.blkw inicor
|
||||
|
||||
.end
|
||||
@@ -26,8 +26,9 @@ TESTS="test-asciz \
|
||||
test-undef \
|
||||
test-word-comma"
|
||||
|
||||
for t in $TESTS
|
||||
do
|
||||
assemble() {
|
||||
t="$1"
|
||||
|
||||
../macro11 -l "$t".lst -o "$t".obj "$t".mac 2>/dev/null
|
||||
|
||||
if [ -e "$t".lst.ok ]
|
||||
@@ -40,4 +41,27 @@ do
|
||||
../dumpobj "$t".obj >"$t".objd
|
||||
diff -u "$t".objd.ok "$t".objd
|
||||
fi
|
||||
}
|
||||
|
||||
for t in $TESTS
|
||||
do
|
||||
assemble "$t"
|
||||
done
|
||||
|
||||
for t in 2.11BSD/m11/*.m11
|
||||
do
|
||||
fn=$( echo ${t%.m11} | sed 's;/;-;g' )
|
||||
|
||||
cat >${fn}.mac <<EOF
|
||||
;;;; Wrapper for $t
|
||||
.list
|
||||
.list
|
||||
.list
|
||||
.enabl lc
|
||||
debug = 1
|
||||
.include "2.11BSD/m11/at.sml"
|
||||
.include "${t}"
|
||||
EOF
|
||||
|
||||
assemble "$fn"
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user