OpenCores
URL https://opencores.org/ocsvn/eco32/eco32/trunk

Subversion Repositories eco32

[/] [eco32/] [trunk/] [lcc/] [x86/] [win32/] [tst/] [sort.sbk] - Blame information for rev 5

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 4 hellwig
.486
2
.model flat
3
extrn __fltused:near
4
extrn __ftol:near
5
_DATA segment
6
public _in
7
align 4
8
_in label byte
9
dd 10
10
dd 32
11
dd -1
12
dd 567
13
dd 3
14
dd 18
15
dd 1
16
dd -51
17
dd 789
18
dd 0
19
public _main
20
_DATA ends
21
_TEXT segment
22
_main:
23
push ebx
24
push esi
25
push edi
26
push ebp
27
mov ebp,esp
28
sub esp,4
29
push 10
30
lea edi,(_in)
31
push edi
32
call _sort
33
add esp,8
34
mov dword ptr (-4)[ebp],0
35
jmp L5
36
L2:
37
mov edi,dword ptr (-4)[ebp]
38
mov edi,dword ptr (_in)[edi*4]
39
push edi
40
call _putd
41
add esp,4
42
push 10
43
call _putchar
44
add esp,4
45
L3:
46
inc dword ptr (-4)[ebp]
47
L5:
48
mov edi,dword ptr (-4)[ebp]
49
cmp edi,10
50
jb L2
51
mov eax,0
52
L1:
53
mov esp,ebp
54
pop ebp
55
pop edi
56
pop esi
57
pop ebx
58
ret
59
public _putd
60
_putd:
61
push ebx
62
push esi
63
push edi
64
push ebp
65
mov ebp,esp
66
cmp dword ptr (20)[ebp],0
67
jge L7
68
push 45
69
call _putchar
70
add esp,4
71
neg dword ptr (20)[ebp]
72
L7:
73
mov eax,dword ptr (20)[ebp]
74
mov edi,10
75
cdq
76
idiv edi
77
cmp eax,0
78
je L9
79
mov eax,dword ptr (20)[ebp]
80
mov edi,10
81
cdq
82
idiv edi
83
push eax
84
call _putd
85
add esp,4
86
L9:
87
mov eax,dword ptr (20)[ebp]
88
mov edi,10
89
cdq
90
idiv edi
91
lea edi,(48)[edx]
92
push edi
93
call _putchar
94
add esp,4
95
mov eax,0
96
L6:
97
mov esp,ebp
98
pop ebp
99
pop edi
100
pop esi
101
pop ebx
102
ret
103
public _sort
104
_sort:
105
push ebx
106
push esi
107
push edi
108
push ebp
109
mov ebp,esp
110
mov edi,dword ptr (24)[ebp]
111
sub edi,1
112
mov dword ptr (24)[ebp],edi
113
push edi
114
push 0
115
mov edi,dword ptr (20)[ebp]
116
mov dword ptr (_xx),edi
117
push edi
118
call _quick
119
add esp,12
120
mov eax,0
121
L11:
122
mov esp,ebp
123
pop ebp
124
pop edi
125
pop esi
126
pop ebx
127
ret
128
public _quick
129
_quick:
130
push ebx
131
push esi
132
push edi
133
push ebp
134
mov ebp,esp
135
sub esp,4
136
mov edi,dword ptr (28)[ebp]
137
cmp dword ptr (24)[ebp],edi
138
jl L13
139
mov eax,0
140
jmp L12
141
L13:
142
mov edi,dword ptr (28)[ebp]
143
push edi
144
mov edi,dword ptr (24)[ebp]
145
push edi
146
mov edi,dword ptr (20)[ebp]
147
push edi
148
call _partition
149
add esp,12
150
mov dword ptr (-4)[ebp],eax
151
mov edi,dword ptr (-4)[ebp]
152
sub edi,1
153
push edi
154
mov edi,dword ptr (24)[ebp]
155
push edi
156
mov edi,dword ptr (20)[ebp]
157
push edi
158
call _quick
159
add esp,12
160
mov edi,dword ptr (28)[ebp]
161
push edi
162
mov edi,dword ptr (-4)[ebp]
163
lea edi,(1)[edi]
164
push edi
165
mov edi,dword ptr (20)[ebp]
166
push edi
167
call _quick
168
add esp,12
169
mov eax,0
170
L12:
171
mov esp,ebp
172
pop ebp
173
pop edi
174
pop esi
175
pop ebx
176
ret
177
public _partition
178
_partition:
179
push ebx
180
push esi
181
push edi
182
push ebp
183
mov ebp,esp
184
sub esp,8
185
inc dword ptr (28)[ebp]
186
mov edi,dword ptr (24)[ebp]
187
mov dword ptr (-8)[ebp],edi
188
mov edi,dword ptr (-8)[ebp]
189
mov esi,dword ptr (20)[ebp]
190
mov edi,dword ptr [esi][edi*4]
191
mov dword ptr (-4)[ebp],edi
192
jmp L17
193
L16:
194
inc dword ptr (24)[ebp]
195
jmp L20
196
L19:
197
inc dword ptr (24)[ebp]
198
L20:
199
mov edi,dword ptr (24)[ebp]
200
mov esi,dword ptr (20)[ebp]
201
mov ebx,dword ptr (-4)[ebp]
202
cmp dword ptr [esi][edi*4],ebx
203
jl L19
204
dec dword ptr (28)[ebp]
205
jmp L23
206
L22:
207
dec dword ptr (28)[ebp]
208
L23:
209
mov edi,dword ptr (28)[ebp]
210
mov esi,dword ptr (20)[ebp]
211
mov ebx,dword ptr (-4)[ebp]
212
cmp dword ptr [esi][edi*4],ebx
213
jg L22
214
mov edi,dword ptr (28)[ebp]
215
cmp dword ptr (24)[ebp],edi
216
jge L25
217
mov edi,dword ptr (20)[ebp]
218
mov esi,dword ptr (28)[ebp]
219
lea esi,[edi][esi*4]
220
push esi
221
mov esi,dword ptr (24)[ebp]
222
lea edi,[edi][esi*4]
223
push edi
224
call _exchange
225
add esp,8
226
L25:
227
L17:
228
mov edi,dword ptr (28)[ebp]
229
cmp dword ptr (24)[ebp],edi
230
jl L16
231
mov edi,dword ptr (20)[ebp]
232
mov esi,dword ptr (28)[ebp]
233
lea esi,[edi][esi*4]
234
push esi
235
mov esi,dword ptr (-8)[ebp]
236
lea edi,[edi][esi*4]
237
push edi
238
call _exchange
239
add esp,8
240
mov eax,dword ptr (28)[ebp]
241
L15:
242
mov esp,ebp
243
pop ebp
244
pop edi
245
pop esi
246
pop ebx
247
ret
248
public _exchange
249
_exchange:
250
push ebx
251
push esi
252
push edi
253
push ebp
254
mov ebp,esp
255
sub esp,4
256
mov edi,dword ptr (_xx)
257
mov esi,4
258
mov ebx,dword ptr (24)[ebp]
259
sub ebx,edi
260
mov eax,ebx
261
cdq
262
idiv esi
263
push eax
264
mov ebx,dword ptr (20)[ebp]
265
sub ebx,edi
266
mov eax,ebx
267
cdq
268
idiv esi
269
push eax
270
lea edi,(L28)
271
push edi
272
call _printf
273
add esp,12
274
mov edi,dword ptr (20)[ebp]
275
mov esi,dword ptr [edi]
276
mov dword ptr (-4)[ebp],esi
277
mov esi,dword ptr (24)[ebp]
278
mov esi,dword ptr [esi]
279
mov dword ptr [edi],esi
280
mov edi,dword ptr (24)[ebp]
281
mov esi,dword ptr (-4)[ebp]
282
mov dword ptr [edi],esi
283
mov eax,0
284
L27:
285
mov esp,ebp
286
pop ebp
287
pop edi
288
pop esi
289
pop ebx
290
ret
291
_TEXT ends
292
extrn _printf:near
293
_TEXT segment
294
_TEXT ends
295
extrn _putchar:near
296
_TEXT segment
297
_TEXT ends
298
_DATA segment
299
public _xx
300
align 4
301
_xx label byte
302
db 4 dup (0)
303
_DATA ends
304
_TEXT segment
305
align 1
306
L28 label byte
307
db 101
308
db 120
309
db 99
310
db 104
311
db 97
312
db 110
313
db 103
314
db 101
315
db 40
316
db 37
317
db 100
318
db 44
319
db 37
320
db 100
321
db 41
322
db 10
323
db 0
324
_TEXT ends
325
end

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.