https://github.com/akkartik/mu/blob/main/123slice.subx
1
2
3
4 == code
5
6
7
8
9 slice-empty?:
10
11 55/push-ebp
12 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
13
14 51/push-ecx
15
16 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
17
18
19 8b/copy 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
20
21 3b/compare 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 4/disp8 .
22 b8/copy-to-eax 1/imm32/true
23 73/jump-if-addr>= $slice-empty?:end/disp8
24 b8/copy-to-eax 0/imm32/false
25 $slice-empty?:end:
26
27 59/pop-to-ecx
28
29 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
30 5d/pop-to-ebp
31 c3/return
32
33 test-slice-empty-true:
34
35 55/push-ebp
36 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
37
38 68/push 34/imm32/end
39 68/push 34/imm32/start
40 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
41
42
43 51/push-ecx
44
45 e8/call slice-empty?/disp32
46
47 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
48
49
50 68/push "F - test-slice-empty-true"/imm32
51 68/push 1/imm32
52 50/push-eax
53
54 e8/call check-ints-equal/disp32
55
56 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
57
58 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
59 5d/pop-to-ebp
60 c3/return
61
62 test-slice-empty-false:
63
64 55/push-ebp
65 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
66
67 68/push 34/imm32/end
68 68/push 32/imm32/start
69 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
70
71
72 51/push-ecx
73
74 e8/call slice-empty?/disp32
75
76 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
77
78
79 68/push "F - test-slice-empty-false"/imm32
80 68/push 0/imm32
81 50/push-eax
82
83 e8/call check-ints-equal/disp32
84
85 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
86
87 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
88 5d/pop-to-ebp
89 c3/return
90
91 test-slice-empty-if-start-greater-than-end:
92
93 55/push-ebp
94 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
95
96 68/push 32/imm32/end
97 68/push 34/imm32/start
98 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
99
100
101 51/push-ecx
102
103 e8/call slice-empty?/disp32
104
105 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
106
107
108 68/push "F - test-slice-empty-if-start-greater-than-end"/imm32
109 68/push 1/imm32
110 50/push-eax
111
112 e8/call check-ints-equal/disp32
113
114 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
115
116 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
117 5d/pop-to-ebp
118 c3/return
119
120 slice-equal?:
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141 55/push-ebp
142 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
143
144 51/push-ecx
145 52/push-edx
146 53/push-ebx
147 56/push-esi
148
149 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
150
151 8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . .
152
153 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 4/disp8 .
154
155 89/copy 3/mod/direct 0/rm32/eax . . . 6/r32/esi . .
156 29/subtract 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
157
158 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 3/r32/ebx 0xc/disp8 .
159
160 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0/imm32
161 75/jump-if-!= $slice-equal?:nonnull-string/disp8
162 $slice-equal?:null-string:
163
164 3d/compare-eax-and 0/imm32
165 74/jump-if-= $slice-equal?:true/disp8
166 eb/jump $slice-equal?:false/disp8
167 $slice-equal?:nonnull-string:
168
169 39/compare 0/mod/indirect 3/rm32/ebx . . . 0/r32/eax . .
170 75/jump-if-!= $slice-equal?:false/disp8
171
172 81 0/subop/add 3/mod/direct 3/rm32/ebx . . . . . 4/imm32
173
174 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
175
176 31/xor 3/mod/direct 1/rm32/ecx . . . 1/r32/ecx . .
177 $slice-equal?:loop:
178
179 39/compare 3/mod/direct 2/rm32/edx . . . 6/r32/esi . .
180 73/jump-if-addr>= $slice-equal?:true/disp8
181
182 8a/copy-byte 0/mod/indirect 3/rm32/ebx . . . 0/r32/AL . .
183
184 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 1/r32/CL . .
185
186 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
187 75/jump-if-!= $slice-equal?:false/disp8
188
189 43/increment-ebx
190
191 42/increment-edx
192 eb/jump $slice-equal?:loop/disp8
193 $slice-equal?:false:
194 b8/copy-to-eax 0/imm32
195 eb/jump $slice-equal?:end/disp8
196 $slice-equal?:true:
197 b8/copy-to-eax 1/imm32
198 $slice-equal?:end:
199
200 5e/pop-to-esi
201 5b/pop-to-ebx
202 5a/pop-to-edx
203 59/pop-to-ecx
204
205 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
206 5d/pop-to-ebp
207 c3/return
208
209 test-slice-equal:
210
211
212 55/push-ebp
213 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
214
215 b8/copy-to-eax "Abc"/imm32
216 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
217 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
218 05/add-to-eax 4/imm32
219
220 51/push-ecx
221 50/push-eax
222 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
223
224
225 68/push "Abc"/imm32
226 51/push-ecx
227
228 e8/call slice-equal?/disp32
229
230 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
231
232
233 68/push "F - test-slice-equal"/imm32
234 68/push 1/imm32
235 50/push-eax
236
237 e8/call check-ints-equal/disp32
238
239 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
240
241 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
242 5d/pop-to-ebp
243 c3/return
244
245 test-slice-equal-false:
246
247
248 55/push-ebp
249 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
250
251 b8/copy-to-eax "bcd"/imm32
252 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
253 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
254 05/add-to-eax 4/imm32
255
256 51/push-ecx
257 50/push-eax
258 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
259
260
261 68/push "Abc"/imm32
262 51/push-ecx
263
264 e8/call slice-equal?/disp32
265
266 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
267
268
269 68/push "F - test-slice-equal-false"/imm32
270 68/push 0/imm32
271 50/push-eax
272
273 e8/call check-ints-equal/disp32
274
275 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
276
277 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
278 5d/pop-to-ebp
279 c3/return
280
281 test-slice-equal-too-long:
282
283
284 55/push-ebp
285 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
286
287 b8/copy-to-eax "Abcd"/imm32
288 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
289 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
290 05/add-to-eax 4/imm32
291
292 51/push-ecx
293 50/push-eax
294 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
295
296
297 68/push "Abc"/imm32
298 51/push-ecx
299
300 e8/call slice-equal?/disp32
301
302 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
303
304
305 68/push "F - test-slice-equal-too-long"/imm32
306 68/push 0/imm32
307 50/push-eax
308
309 e8/call check-ints-equal/disp32
310
311 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
312
313 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
314 5d/pop-to-ebp
315 c3/return
316
317 test-slice-equal-too-short:
318
319
320 55/push-ebp
321 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
322
323 b8/copy-to-eax "A"/imm32
324 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
325 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
326 05/add-to-eax 4/imm32
327
328 51/push-ecx
329 50/push-eax
330 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
331
332
333 68/push "Abc"/imm32
334 51/push-ecx
335
336 e8/call slice-equal?/disp32
337
338 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
339
340
341 68/push "F - test-slice-equal-too-short"/imm32
342 68/push 0/imm32
343 50/push-eax
344
345 e8/call check-ints-equal/disp32
346
347 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
348
349 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
350 5d/pop-to-ebp
351 c3/return
352
353 test-slice-equal-empty:
354
355
356 55/push-ebp
357 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
358
359 68/push 0/imm32/end
360 68/push 0/imm32/start
361 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
362
363
364 68/push "Abc"/imm32
365 51/push-ecx
366
367 e8/call slice-equal?/disp32
368
369 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
370
371
372 68/push "F - test-slice-equal-empty"/imm32
373 68/push 0/imm32
374 50/push-eax
375
376 e8/call check-ints-equal/disp32
377
378 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
379
380 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
381 5d/pop-to-ebp
382 c3/return
383
384 "Normal"> . </span> <span class="Normal"> . </span> 4/r32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy esp to ebp</span>
<span id="L17" class="LineNr"> 17 </span> <span class="subxS1Comment"># . save registers</span>
<span id="L18" class="LineNr"> 18 </span> 51/push-ecx
<span id="L19" class="LineNr"> 19 </span> 56/push-esi
<span id="L20" class="LineNr"> 20 </span> <span class="subxComment"># esi = s</span>
<span id="L21" class="LineNr"> 21 </span> 8b/copy 1/mod/*+disp8 5/rm32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 6/r32/esi 8/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(ebp+8) to esi</span>
<span id="L22" class="LineNr"> 22 </span> <span class="subxComment"># ecx = s->read</span>
<span id="L23" class="LineNr"> 23 </span> 8b/copy 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy *(esi+4) to ecx</span>
<span id="L24" class="LineNr"> 24 </span> <span class="subxComment"># if (f->read >= f->write) abort</span>
<span id="L25" class="LineNr"> 25 </span> 3b/compare 0/mod/indirect 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 1/r32/ecx <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># compare ecx with *esi</span>
<span id="L26" class="LineNr"> 26 </span> 0f 8d/jump-if->= $read-byte:<a href='501draw-text.mu.html#L481'>abort</a>/disp32
<span id="L27" class="LineNr"> 27 </span> <span class="subxComment"># result = f->data[f->read]</span>
<span id="L28" class="LineNr"> 28 </span> 31/xor 3/mod/direct 0/rm32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 0/r32/eax <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># clear eax</span>
<span id="L29" class="LineNr"> 29 </span> 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/esi 1/index/ecx <span class="Normal"> . </span> 0/r32/AL 0xc/disp8 <span class="Normal"> . </span> <span class="subxComment"># copy byte at *(esi+ecx+12) to AL</span>
<span id="L30" class="LineNr"> 30 </span> <span class="subxComment"># ++f->read</span>
<span id="L31" class="LineNr"> 31 </span> ff 0/subop/increment 1/mod/*+disp8 6/rm32/esi <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 4/disp8 <span class="Normal"> . </span> <span class="subxComment"># increment *(esi+4)</span>
<span id="L32" class="LineNr"> 32 </span><span class="Constant">$read-byte:end</span>:
<span id="L33" class="LineNr"> 33 </span> <span class="subxS1Comment"># . restore registers</span>
<span id="L34" class="LineNr"> 34 </span> 5e/pop-to-esi
<span id="L35" class="LineNr"> 35 </span> 59/pop-to-ecx
<span id="L36" class="LineNr"> 36 </span> <span class="subxS1Comment"># . epilogue</span>
<span id="L37" class="LineNr"> 37 </span> 89/copy 3/mod/direct 4/rm32/esp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="Normal"> . </span> 5/r32/ebp <span class="Normal"> . </span> <span class="Normal"> . </span> <span class="subxComment"># copy ebp to esp</span>
<span id="L38" class="LineNr"> 38 </span> 5d/pop-to-ebp
<span id="L39" class="LineNr"> 39 </span> c3/return
<span id="L40" class="LineNr"> 40 </span>
<span id="L41" class="LineNr"> 41 </span><span class="Constant">$read-byte:<a href='501draw-text.mu.html#L481'>abort</a></span>:
<span id="L42" class="LineNr"> 42 </span> (<a href='501draw-text.mu.html#L258'>draw-text-wrapping-right-then-down-from-cursor-over-full-screen</a> 0 <span class="Constant">"read-byte: empty stream"</span> 3 0) <span class="subxComment"># 3=cyan</span>
<span id="L43" class="LineNr"> 43 </span> {
<span id="L44" class="LineNr"> 44 </span> eb/jump <span class="Constant">loop</span>/disp8
<span id="L45" class="LineNr"> 45 </span> }
<span id="L46" class="LineNr"> 46 </span> <span class="subxComment"># never gets here</span>
<span id="L47" class="LineNr"> 47 </span>
<span id="L48" class="LineNr"> 48 </span>== data
<span id="L49" class="LineNr"> 49 </span>
<span id="L50" class="LineNr"> 50 </span><span class="subxMinorFunction">_test-input-stream</span>: <span class="subxComment"># (stream byte)</span>
<span id="L51" class="LineNr"> 51 </span> <span class="subxComment"># current write index</span>
<span id="L52" class="LineNr"> 52 </span> 0/imm32
<span id="L53" class="LineNr"> 53 </span> <span class="subxComment"># current read index</span>
<span id="L54" class="LineNr"> 54 </span> 0/imm32
<span id="L55" class="LineNr"> 55 </span> <span class="subxComment"># size</span>
<span id="L56" class="LineNr"> 56 </span> 0x400/imm32 <span class="subxComment"># 1024 bytes</span>
<span id="L57" class="LineNr"> 57 </span> <span class="subxComment"># data (64 lines x 16 bytes/line)</span>
<span id="L58" class="LineNr"> 58 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L59" class="LineNr"> 59 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L60" class="LineNr"> 60 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L61" class="LineNr"> 61 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L62" class="LineNr"> 62 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L63" class="LineNr"> 63 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L64" class="LineNr"> 64 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L65" class="LineNr"> 65 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L66" class="LineNr"> 66 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L67" class="LineNr"> 67 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L68" class="LineNr"> 68 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L69" class="LineNr"> 69 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L70" class="LineNr"> 70 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L71" class="LineNr"> 71 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L72" class="LineNr"> 72 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L73" class="LineNr"> 73 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L74" class="LineNr"> 74 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L75" class="LineNr"> 75 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L76" class="LineNr"> 76 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L77" class="LineNr"> 77 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L78" class="LineNr"> 78 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L79" class="LineNr"> 79 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L80" class="LineNr"> 80 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L81" class="LineNr"> 81 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L82" class="LineNr"> 82 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L83" class="LineNr"> 83 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L84" class="LineNr"> 84 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L85" class="LineNr"> 85 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L86" class="LineNr"> 86 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L87" class="LineNr"> 87 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L88" class="LineNr"> 88 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L89" class="LineNr"> 89 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L90" class="LineNr"> 90 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L91" class="LineNr"> 91 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L92" class="LineNr"> 92 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L93" class="LineNr"> 93 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L94" class="LineNr"> 94 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L95" class="LineNr"> 95 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L96" class="LineNr"> 96 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L97" class="LineNr"> 97 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L98" class="LineNr"> 98 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L99" class="LineNr"> 99 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L100" class="LineNr">100 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L101" class="LineNr">101 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L102" class="LineNr">102 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L103" class="LineNr">103 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L104" class="LineNr">104 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L105" class="LineNr">105 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L106" class="LineNr">106 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L107" class="LineNr">107 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L108" class="LineNr">108 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L109" class="LineNr">109 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L110" class="LineNr">110 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L111" class="LineNr">111 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L112" class="LineNr">112 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L113" class="LineNr">113 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L114" class="LineNr">114 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L115" class="LineNr">115 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L116" class="LineNr">116 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L117" class="LineNr">117 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L118" class="LineNr">118 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L119" class="LineNr">119 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L120" class="LineNr">120 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L121" class="LineNr">121 </span> 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
<span id="L122" class="LineNr">122 </span>
<span id="L123" class="LineNr">123 </span><span class="subxS2Comment"># . . vim:nowrap:textwidth=0</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->
n class="subxComment"># var curr/ecx: (addr byte) = s->start
807 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
808
809 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 4/disp8 .
810
811 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 7/r32/edi 8/disp8 .
812
813 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 2/r32/edx 8/disp8 .
814
815 8b/copy 0/mod/indirect 7/rm32/edi . . . 3/r32/ebx . .
816 $write-slice:loop:
817
818 39/compare 3/mod/direct 1/rm32/ecx . . . 6/r32/esi . .
819 73/jump-if-addr>= $write-slice:loop-end/disp8
820
821 39/compare 3/mod/direct 3/rm32/ebx . . . 2/r32/edx . .
822 7d/jump-if->= $write-slice:abort/disp8
823
824
825 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
826 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
827
828 88/copy-byte 1/mod/*+disp8 4/rm32/sib 7/base/edi 3/index/ebx . 0/r32/AL 0xc/disp8 .
829
830 43/increment-ebx
831
832 41/increment-ecx
833 eb/jump $write-slice:loop/disp8
834 $write-slice:loop-end:
835
836 89/copy 0/mod/indirect 7/rm32/edi . . . 3/r32/ebx . .
837 $write-slice:end:
838
839 5f/pop-to-edi
840 5e/pop-to-esi
841 5b/pop-to-ebx
842 5a/pop-to-edx
843 59/pop-to-ecx
844 58/pop-to-eax
845
846 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
847 5d/pop-to-ebp
848 c3/return
849
850 $write-slice:abort:
851 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "write-slice: out of space" 3 0)
852 {
853 eb/jump loop/disp8
854 }
855
856
857 test-write-slice:
858
859 55/push-ebp
860 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
861
862
863
864 68/push _test-stream/imm32
865
866 e8/call clear-stream/disp32
867
868 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
869
870 b8/copy-to-eax "Abc"/imm32
871 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
872 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
873 05/add-to-eax 4/imm32
874
875 51/push-ecx
876 50/push-eax
877 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
878
879
880 51/push-ecx
881 68/push _test-stream/imm32
882
883 e8/call write-slice/disp32
884
885 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
886
887
888 68/push "F - test-write-slice"/imm32
889 68/push "Abc"/imm32
890 68/push _test-stream/imm32
891
892 e8/call check-stream-equal/disp32
893
894 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
895
896 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
897 5d/pop-to-ebp
898 c3/return
899
900
901 slice-to-string:
902
903 55/push-ebp
904 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
905
906 50/push-eax
907 51/push-ecx
908 52/push-edx
909 53/push-ebx
910 56/push-esi
911
912 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
913
914 8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . .
915
916 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 3/r32/ebx 4/disp8 .
917
918 89/copy 3/mod/direct 1/rm32/ecx . . . 3/r32/ebx . .
919 29/subtract 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
920 81 0/subop/add 3/mod/direct 1/rm32/ecx . . . . . 4/imm32
921
922
923 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
924 51/push-ecx
925 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
926
927 e8/call allocate/disp32
928
929 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
930
931 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 0x10/disp8 .
932 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 0/r32/eax 4/disp8 .
933
934 05/add-to-eax 4/imm32
935
936 3d/compare-eax-and 0/imm32
937 74/jump-if-= $slice-to-string:abort/disp8
938
939 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
940 81 5/subop/subtract 0/mod/indirect 0/rm32/eax . . . . . 4/imm32
941
942 50/push-eax
943 $slice-to-string:initialize:
944
945
946 53/push-ebx
947 52/push-edx
948
949 01/add 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . .
950 51/push-ecx
951
952 81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 4/imm32
953 50/push-eax
954
955 e8/call _append-4/disp32
956
957 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
958
959 58/pop-to-eax
960 $slice-to-string:end:
961
962 5e/pop-to-esi
963 5b/pop-to-ebx
964 5a/pop-to-edx
965 59/pop-to-ecx
966 58/pop-to-eax
967
968 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
969 5d/pop-to-ebp
970 c3/return
971
972 $slice-to-string:abort:
973 (draw-text-wrapping-right-then-down-from-cursor-over-full-screen 0 "slice-to-string: out of space\n" 3 0)
974 {
975 eb/jump loop/disp8
976 }
977
978
979 test-slice-to-string:
980
981 55/push-ebp
982 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
983
984
985 89/<- %ecx 4/r32/esp
986 81 5/subop/subtract %esp 0x10/imm32
987
988 89/<- %edx 4/r32/esp
989
990 51/push-ecx
991 52/push-edx
992 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
993
994 b8/copy-to-eax "Abc"/imm32
995 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
996 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
997 05/add-to-eax 4/imm32
998
999 51/push-ecx
1000 50/push-eax
1001 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1002
1003 68/push 0/imm32
1004 68/push 0/imm32
1005 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
1006
1007
1008 53/push-ebx
1009 51/push-ecx
1010 52/push-edx
1011
1012 e8/call slice-to-string/disp32
1013
1014 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1015
1016 8b/copy 1/mod/*+disp8 3/rm32/ebx . . . 0/r32/eax 4/disp8 .
1017
1018 05/add-to-eax 4/imm32
1019 +-- 26 lines: #? # dump eax ---------------------------------------------------------------------------------------------------------------------------------------------------------
1045
1046
1047 68/push "Abc"/imm32
1048 50/push-eax
1049
1050 e8/call string-equal?/disp32
1051
1052 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1053
1054
1055 68/push "F - test-slice-to-string"/imm32
1056 68/push 1/imm32/true
1057 50/push-eax
1058
1059 e8/call check-ints-equal/disp32
1060
1061 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1062
1063 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
1064
1065 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1066 5d/pop-to-ebp
1067 c3/return
1068
1069