aboutsummaryrefslogtreecommitdiffstats
path: root/code/tools/lcc/alpha/osf/tst/wf1.sbk
blob: 507b38fb4b64bae6d7f54f6ab64296528687f085 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
.globl main
.text
.text
.ent main
main:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x4000000,-96
.frame $sp,96,$26,48
stq $26,0($sp)
.prologue 1
stq $31,-88+96($sp)
stl $31,next
br L.3
L.2:
lda $16,-76+96($sp)
lda $17,-88+96($sp)
jsr $26,lookup
ldgp $gp,0($26)
ldl $25,($0)
lda $25,1($25)
stl $25,($0)
L.3:
lda $16,-76+96($sp)
jsr $26,getword
ldgp $gp,0($26)
cmpeq $0,$31,$23
beq $23,L.2
ldq $16,-88+96($sp)
jsr $26,tprint
ldgp $gp,0($26)
mov $31,$0
L.1:
ldq $26,0($sp)
lda $sp,96($sp)
ret
.end main
.globl err
.text
.ent err
err:
ldgp $gp,0($27)
lda $sp,-64($sp)
.mask 0x4000000,-64
.frame $sp,64,$26,48
stq $26,0($sp)
stq $16,16($sp)
.prologue 1
lda $16,L.6
ldq $17,-48+64($sp)
jsr $26,printf
ldgp $gp,0($26)
lda $16,1
jsr $26,exit
ldgp $gp,0($26)
mov $31,$0
L.5:
ldq $26,0($sp)
lda $sp,64($sp)
ret
.end err
.globl getword
.text
.ent getword
getword:
ldgp $gp,0($27)
lda $sp,-96($sp)
.mask 0x5006000,-72
.frame $sp,96,$26,48
stq $13,0($sp)
stq $14,8($sp)
stq $24,16($sp)
stq $26,24($sp)
stq $16,48($sp)
.prologue 1
L.8:
L.9:
jsr $26,getchar
ldgp $gp,0($26)
mov $0,$27
mov $27,$14
lda $25,-1
cmpeq $27,$25,$23
bne $23,L.11
mov $14,$16
jsr $26,isletter
ldgp $gp,0($26)
cmpeq $0,$31,$23
bne $23,L.8
L.11:
ldq $13,-48+96($sp)
br L.15
L.12:
mov $13,$27
lda $13,1($27)
mov $14,$25
stb $25,($27)
L.13:
jsr $26,getchar
ldgp $gp,0($26)
mov $0,$14
L.15:
mov $14,$16
jsr $26,isletter
ldgp $gp,0($26)
mov $0,$14
cmpeq $0,$31,$23
beq $23,L.12
stb $31,($13)
mov $13,$27
ldq $25,-48+96($sp)
cmpule $27,$25,$23
bne $23,L.16
lda $0,1
br L.7
L.16:
mov $31,$0
L.7:
ldq $13,0($sp)
ldq $14,8($sp)
ldq $24,16($sp)
ldq $26,24($sp)
lda $sp,96($sp)
ret
.end getword
.globl isletter
.text
.ent isletter
isletter:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
lda $27,65
cmplt $16,$27,$23
bne $23,L.19
lda $27,90
cmple $16,$27,$23
beq $23,L.19
lda $16,32($16)
L.19:
lda $27,97
cmplt $16,$27,$23
bne $23,L.21
lda $27,122
cmple $16,$27,$23
beq $23,L.21
mov $16,$0
br L.18
L.21:
mov $31,$0
L.18:
lda $sp,64($sp)
ret
.end isletter
.globl lookup
.text
.ent lookup
lookup:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
stq $16,32($sp)
mov $17,$14
.prologue 1
ldq $27,($14)
cmpeq $27,$31,$23
bne $23,L.24
ldq $16,-48+80($sp)
ldq $27,($14)
ldq $17,24($27)
jsr $26,strcmp
ldgp $gp,0($26)
stl $0,-60+80($sp)
ldl $27,-60+80($sp)
cmplt $27,$31,$23
beq $23,L.26
ldq $16,-48+80($sp)
ldq $27,($14)
lda $17,8($27)
jsr $26,lookup
ldgp $gp,0($26)
mov $0,$27
br L.23
L.26:
ldl $27,-60+80($sp)
cmple $27,$31,$23
bne $23,L.28
ldq $16,-48+80($sp)
ldq $27,($14)
lda $17,16($27)
jsr $26,lookup
ldgp $gp,0($26)
mov $0,$27
br L.23
L.28:
ldq $0,($14)
br L.23
L.24:
ldl $27,next
lda $25,2000
cmplt $27,$25,$23
bne $23,L.30
lda $16,L.32
jsr $26,err
ldgp $gp,0($26)
L.30:
ldl $27,next
sll $27,5,$27
stl $31,words($27)
ldl $27,next
sll $27,5,$27
stq $31,words+16($27)
stq $31,words+8($27)
ldq $16,-48+80($sp)
jsr $26,strlen
ldgp $gp,0($26)
mov $0,$27
lda $16,1($27)
jsr $26,malloc
ldgp $gp,0($26)
ldl $25,next
sll $25,5,$25
stq $0,words+24($25)
ldl $27,next
sll $27,5,$27
ldq $27,words+24($27)
cmpeq $27,$31,$23
beq $23,L.36
lda $16,L.39
jsr $26,err
ldgp $gp,0($26)
L.36:
ldl $27,next
sll $27,5,$27
ldq $16,words+24($27)
ldq $17,-48+80($sp)
jsr $26,strcpy
ldgp $gp,0($26)
ldl $27,next
lda $25,1($27)
stl $25,next
sll $27,8*(8-4),$27
sra $27,8*(8-4),$27
sll $27,5,$27
lda $27,words($27)
stq $27,($14)
mov $27,$0
L.23:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end lookup
.globl tprint
.text
.ent tprint
tprint:
ldgp $gp,0($27)
lda $sp,-80($sp)
.mask 0x4004000,-72
.frame $sp,80,$26,48
stq $14,0($sp)
stq $26,8($sp)
mov $16,$14
.prologue 1
mov $14,$27
cmpeq $27,$31,$23
bne $23,L.42
ldq $16,8($14)
jsr $26,tprint
ldgp $gp,0($26)
lda $16,L.44
ldl $17,($14)
ldq $18,24($14)
jsr $26,printf
ldgp $gp,0($26)
ldq $16,16($14)
jsr $26,tprint
ldgp $gp,0($26)
L.42:
mov $31,$0
L.41:
ldq $14,0($sp)
ldq $26,8($sp)
lda $sp,80($sp)
ret
.end tprint
.globl strcmp
.text
.ent strcmp
strcmp:
ldgp $gp,0($27)
lda $sp,-64($sp)
.frame $sp,64,$26,48
.prologue 1
br L.47
L.46:
mov $16,$27
lda $16,1($27)
ldb $27,($27)
cmpeq $27,$31,$23
beq $23,L.49
mov $31,$0
br L.45
L.49:
lda $17,1($17)
L.47:
ldb $27,($16)
ldb $25,($17)
cmpeq $27,$25,$23
bne $23,L.46
ldb $27,($16)
cmpeq $27,$31,$23
beq $23,L.51
lda $0,-1
br L.45
L.51:
ldb $27,($17)
cmpeq $27,$31,$23
beq $23,L.53
lda $0,1
br L.45
L.53:
ldb $27,($16)
ldb $25,($17)
subl $27,$25,$0
L.45:
lda $sp,64($sp)
ret
.end strcmp
.globl next
.comm next,4
.globl words
.comm words,64000
.rdata
.align 0
L.44:
.byte 37
.byte 100
.byte 9
.byte 37
.byte 115
.byte 10
.byte 0
.align 0
L.39:
.byte 111
.byte 117
.byte 116
.byte 32
.byte 111
.byte 102
.byte 32
.byte 119
.byte 111
.byte 114
.byte 100
.byte 32
.byte 115
.byte 116
.byte 111
.byte 114
.byte 97
.byte 103
.byte 101
.byte 0
.align 0
L.32:
.byte 111
.byte 117
.byte 116
.byte 32
.byte 111
.byte 102
.byte 32
.byte 110
.byte 111
.byte 100
.byte 101
.byte 32
.byte 115
.byte 116
.byte 111
.byte 114
.byte 97
.byte 103
.byte 101
.byte 0
.align 0
L.6:
.byte 63
.byte 32
.byte 37
.byte 115
.byte 10
.byte 0