https://github.com/akkartik/mu/blob/master/072slice.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 test-slice-equal-with-empty:
385
386
387 55/push-ebp
388 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
389
390 b8/copy-to-eax "Ab"/imm32
391 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
392 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
393 05/add-to-eax 4/imm32
394
395 51/push-ecx
396 50/push-eax
397 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
398
399
400 68/push ""/imm32
401 51/push-ecx
402
403 e8/call slice-equal?/disp32
404
405 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
406
407
408 68/push "F - test-slice-equal-with-empty"/imm32
409 68/push 0/imm32
410 50/push-eax
411
412 e8/call check-ints-equal/disp32
413
414 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
415
416 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
417 5d/pop-to-ebp
418 c3/return
419
420 test-slice-equal-empty-with-empty:
421
422
423 55/push-ebp
424 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
425
426 68/push 0/imm32/end
427 68/push 0/imm32/start
428 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
429
430
431 68/push ""/imm32
432 51/push-ecx
433
434 e8/call slice-equal?/disp32
435
436 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
437
438
439 68/push "F - test-slice-equal-empty-with-empty"/imm32
440 68/push 1/imm32
441 50/push-eax
442
443 e8/call check-ints-equal/disp32
444
445 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
446
447 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
448 5d/pop-to-ebp
449 c3/return
450
451 test-slice-equal-with-null:
452
453
454 55/push-ebp
455 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
456
457 b8/copy-to-eax "Ab"/imm32
458 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
459 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
460 05/add-to-eax 4/imm32
461
462 51/push-ecx
463 50/push-eax
464 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
465
466
467 68/push 0/imm32
468 51/push-ecx
469
470 e8/call slice-equal?/disp32
471
472 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
473
474
475 68/push "F - test-slice-equal-with-null"/imm32
476 68/push 0/imm32
477 50/push-eax
478
479 e8/call check-ints-equal/disp32
480
481 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
482
483 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
484 5d/pop-to-ebp
485 c3/return
486
487 slice-starts-with?:
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510 55/push-ebp
511 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
512
513 51/push-ecx
514 52/push-edx
515 53/push-ebx
516 56/push-esi
517 57/push-edi
518
519 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
520
521 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 4/disp8 .
522 2b/subtract 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
523
524 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 0xc/disp8 .
525
526 8b/copy 0/mod/indirect 7/rm32/edi . . . 2/r32/edx . .
527
528 39/compare 3/mod/direct 2/rm32/edx . . . 1/r32/ecx . .
529 7f/jump-if-> $slice-starts-with?:false/disp8
530
531 8b/subtract 0/mod/indirect 6/rm32/esi . . . 6/r32/esi . .
532
533 81 0/subop/add 3/mod/direct 7/rm32/edi . . . . . 4/imm32
534
535 31/xor 3/mod/direct 1/rm32/ecx . . . 1/r32/ecx . .
536
537 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
538
539 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
540 $slice-starts-with?:loop:
541
542 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
543 7d/jump-if->= $slice-starts-with?:true/disp8
544
545 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . .
546
547 8a/copy-byte 0/mod/indirect 7/rm32/edi . . . 3/r32/BL . .
548
549 39/compare 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
550 75/jump-if-!= $slice-starts-with?:false/disp8
551
552 41/increment-ecx
553
554 46/increment-esi
555
556 47/increment-edi
557 eb/jump $slice-starts-with?:loop/disp8
558 $slice-starts-with?:true:
559 b8/copy-to-eax 1/imm32
560 eb/jump $slice-starts-with?:end/disp8
561 $slice-starts-with?:false:
562 b8/copy-to-eax 0/imm32
563 $slice-starts-with?:end:
564
565 5f/pop-to-edi
566 5e/pop-to-esi
567 5b/pop-to-ebx
568 5a/pop-to-edx
569 59/pop-to-ecx
570
571 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
572 5d/pop-to-ebp
573 c3/return
574
575 test-slice-starts-with-single-character:
576
577
578 55/push-ebp
579 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
580
581 b8/copy-to-eax "Abc"/imm32
582 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
583 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
584 05/add-to-eax 4/imm32
585
586 51/push-ecx
587 50/push-eax
588 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
589
590
591 68/push "A"/imm32
592 51/push-ecx
593
594 e8/call slice-starts-with?/disp32
595
596 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
597
598
599 68/push "F - test-slice-starts-with-single-character"/imm32
600 68/push 1/imm32
601 50/push-eax
602
603 e8/call check-ints-equal/disp32
604
605 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
606
607 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
608 5d/pop-to-ebp
609 c3/return
610
611 test-slice-starts-with-empty-string:
612
613
614 55/push-ebp
615 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
616
617 b8/copy-to-eax "Abc"/imm32
618 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
619 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
620 05/add-to-eax 4/imm32
621
622 51/push-ecx
623 50/push-eax
624 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
625
626
627 68/push ""/imm32
628 51/push-ecx
629
630 e8/call slice-starts-with?/disp32
631
632 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
633
634
635 68/push "F - test-slice-starts-with-empty-string"/imm32
636 68/push 1/imm32
637 50/push-eax
638
639 e8/call check-ints-equal/disp32
640
641 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
642
643 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
644 5d/pop-to-ebp
645 c3/return
646
647 test-slice-starts-with-multiple-characters:
648
649
650 55/push-ebp
651 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
652
653 b8/copy-to-eax "Abc"/imm32
654 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
655 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
656 05/add-to-eax 4/imm32
657
658 51/push-ecx
659 50/push-eax
660 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
661
662
663 68/push "Ab"/imm32
664 51/push-ecx
665
666 e8/call slice-starts-with?/disp32
667
668 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
669
670
671 68/push "F - test-slice-starts-with-multiple-characters"/imm32
672 68/push 1/imm32
673 50/push-eax
674
675 e8/call check-ints-equal/disp32
676
677 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
678
679 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
680 5d/pop-to-ebp
681 c3/return
682
683 test-slice-starts-with-entire-string:
684
685
686 55/push-ebp
687 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
688
689 b8/copy-to-eax "Abc"/imm32
690 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
691 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
692 05/add-to-eax 4/imm32
693
694 51/push-ecx
695 50/push-eax
696 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
697
698
699 68/push "Abc"/imm32
700 51/push-ecx
701
702 e8/call slice-starts-with?/disp32
703
704 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
705
706
707 68/push "F - test-slice-starts-with-entire-string"/imm32
708 68/push 1/imm32
709 50/push-eax
710
711 e8/call check-ints-equal/disp32
712
713 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
714
715 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
716 5d/pop-to-ebp
717 c3/return
718
719 test-slice-starts-with-fails:
720
721
722 55/push-ebp
723 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
724
725 b8/copy-to-eax "Abc"/imm32
726 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
727 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
728 05/add-to-eax 4/imm32
729
730 51/push-ecx
731 50/push-eax
732 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
733
734
735 68/push "Abd"/imm32
736 51/push-ecx
737
738 e8/call slice-starts-with?/disp32
739
740 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
741
742
743 68/push "F - test-slice-starts-with-fails"/imm32
744 68/push 0/imm32
745 50/push-eax
746
747 e8/call check-ints-equal/disp32
748
749 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
750
751 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
752 5d/pop-to-ebp
753 c3/return
754
755 test-slice-starts-with-fails-2:
756
757
758 55/push-ebp
759 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
760
761 b8/copy-to-eax "Abc"/imm32
762 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
763 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
764 05/add-to-eax 4/imm32
765
766 51/push-ecx
767 50/push-eax
768 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
769
770
771 68/push "Ac"/imm32
772 51/push-ecx
773
774 e8/call slice-starts-with?/disp32
775
776 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
777
778
779 68/push "F - test-slice-starts-with-fails-2"/imm32
780 68/push 0/imm32
781 50/push-eax
782
783 e8/call check-ints-equal/disp32
784
785 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
786
787 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
788 5d/pop-to-ebp
789 c3/return
790
791
792
793 write-slice:
794
795 55/push-ebp
796 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
797
798 50/push-eax
799 51/push-ecx
800 52/push-edx
801 53/push-ebx
802 56/push-esi
803 57/push-edi
804
805 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
806
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
852
853 68/push "write-slice: out of space"/imm32
854 68/push 2/imm32/stderr
855
856 e8/call _write/disp32
857
858 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
859
860 bb/copy-to-ebx 1/imm32
861 b8/copy-to-eax 1/imm32/exit
862 cd/syscall 0x80/imm8
863
864
865 test-write-slice:
866
867 55/push-ebp
868 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
869
870
871
872 68/push _test-stream/imm32
873
874 e8/call clear-stream/disp32
875
876 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
877
878 b8/copy-to-eax "Abc"/imm32
879 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
880 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
881 05/add-to-eax 4/imm32
882
883 51/push-ecx
884 50/push-eax
885 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
886
887
888 51/push-ecx
889 68/push _test-stream/imm32
890
891 e8/call write-slice/disp32
892
893 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
894
895
896 68/push "F - test-write-slice"/imm32
897 68/push "Abc"/imm32
898 68/push _test-stream/imm32
899
900 e8/call check-stream-equal/disp32
901
902 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
903
904 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
905 5d/pop-to-ebp
906 c3/return
907
908
909 write-slice-buffered:
910
911 55/push-ebp
912 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
913
914 50/push-eax
915 51/push-ecx
916 52/push-edx
917 53/push-ebx
918 56/push-esi
919 57/push-edi
920
921 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
922
923 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
924
925 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 4/disp8 .
926
927 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 7/r32/edi 8/disp8 .
928
929 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 2/r32/edx 0xc/disp8 .
930
931 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 4/disp8 .
932 $write-slice-buffered:loop:
933
934 39/compare 3/mod/direct 1/rm32/ecx . . . 6/r32/esi . .
935 73/jump-if-addr>= $write-slice-buffered:loop-end/disp8
936
937 39/compare 3/mod/direct 3/rm32/ebx . . . 2/r32/edx . .
938 7c/jump-if-< $write-slice-buffered:to-stream/disp8
939
940 89/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 4/disp8 .
941
942
943 57/push-edi
944
945 e8/call flush/disp32
946
947 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
948
949
950 8d/copy-address 1/mod/*+disp8 7/rm32/edi . . . 0/r32/eax 4/disp8 .
951 50/push-eax
952
953 e8/call clear-stream/disp32
954
955 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
956
957 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
958 $write-slice-buffered:to-stream:
959
960
961 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
962 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
963
964 88/copy-byte 1/mod/*+disp8 4/rm32/sib 7/base/edi 3/index/ebx . 0/r32/AL 0x10/disp8 .
965
966 43/increment-ebx
967
968 41/increment-ecx
969 eb/jump $write-slice-buffered:loop/disp8
970 $write-slice-buffered:loop-end:
971
972 89/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 4/disp8 .
973 $write-slice-buffered:end:
974
975 5f/pop-to-edi
976 5e/pop-to-esi
977 5b/pop-to-ebx
978 5a/pop-to-edx
979 59/pop-to-ecx
980 58/pop-to-eax
981
982 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
983 5d/pop-to-ebp
984 c3/return
985
986 test-write-slice-buffered:
987
988 55/push-ebp
989 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
990
991
992
993 68/push _test-stream/imm32
994
995 e8/call clear-stream/disp32
996
997 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
998
999
1000 68/push $_test-buffered-file->buffer/imm32
1001
1002 e8/call clear-stream/disp32
1003
1004 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1005
1006 b8/copy-to-eax "Abc"/imm32
1007 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
1008 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
1009 05/add-to-eax 4/imm32
1010
1011 51/push-ecx
1012 50/push-eax
1013 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1014
1015
1016 51/push-ecx
1017 68/push _test-buffered-file/imm32
1018
1019 e8/call write-slice-buffered/disp32
1020
1021 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1022
1023
1024 68/push _test-buffered-file/imm32
1025
1026 e8/call flush/disp32
1027
1028 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1029
1030
1031 68/push "F - test-write-slice-buffered"/imm32
1032 68/push "Abc"/imm32
1033 68/push _test-stream/imm32
1034
1035 e8/call check-stream-equal/disp32
1036
1037 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1038
1039 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1040 5d/pop-to-ebp
1041 c3/return
1042
1043
1044 slice-to-string:
1045
1046 55/push-ebp
1047 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1048
1049 51/push-ecx
1050 52/push-edx
1051 53/push-ebx
1052 56/push-esi
1053
1054 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
1055
1056 8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . .
1057
1058 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 3/r32/ebx 4/disp8 .
1059
1060 89/copy 3/mod/direct 1/rm32/ecx . . . 3/r32/ebx . .
1061 29/subtract 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
1062 81 0/subop/add 3/mod/direct 1/rm32/ecx . . . . . 4/imm32
1063
1064
1065 51/push-ecx
1066 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1067
1068 e8/call allocate/disp32
1069
1070 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1071
1072 3d/compare-eax-and 0/imm32
1073 74/jump-if-= $slice-to-string:abort/disp8
1074
1075 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
1076 81 5/subop/subtract 0/mod/indirect 0/rm32/eax . . . . . 4/imm32
1077
1078 50/push-eax
1079 $slice-to-string:initialize:
1080
1081
1082 53/push-ebx
1083 52/push-edx
1084
1085 01/add 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . .
1086 51/push-ecx
1087
1088 81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 4/imm32
1089 50/push-eax
1090
1091 e8/call _append-4/disp32
1092
1093 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1094
1095 58/pop-to-eax
1096 $slice-to-string:end:
1097
1098 5e/pop-to-esi
1099 5b/pop-to-ebx
1100 5a/pop-to-edx
1101 59/pop-to-ecx
1102
1103 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1104 5d/pop-to-ebp
1105 c3/return
1106
1107 $slice-to-string:abort:
1108
1109
1110 68/push "slice-to-string: out of space\n"/imm32
1111 68/push 2/imm32/stderr
1112
1113 e8/call _write/disp32
1114
1115 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1116
1117 bb/copy-to-ebx 1/imm32
1118 b8/copy-to-eax 1/imm32/exit
1119 cd/syscall 0x80/imm8
1120
1121
1122 test-slice-to-string:
1123
1124 55/push-ebp
1125 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1126
1127 68/push 0/imm32/limit
1128 68/push 0/imm32/curr
1129 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1130
1131
1132 52/push-edx
1133 68/push 0x200/imm32
1134
1135 e8/call new-segment/disp32
1136
1137 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1138
1139 b8/copy-to-eax "Abc"/imm32
1140 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
1141 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
1142 05/add-to-eax 4/imm32
1143
1144 51/push-ecx
1145 50/push-eax
1146 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1147
1148
1149 51/push-ecx
1150 52/push-edx
1151
1152 e8/call slice-to-string/disp32
1153
1154 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1155 +-- 26 lines: #? # dump word-slice -----------------------------------------------------------------------------------------------------------------------
1181
1182
1183 68/push "Abc"/imm32
1184 50/push-eax
1185
1186 e8/call string-equal?/disp32
1187
1188 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1189
1190
1191 68/push "F - test-slice-to-string"/imm32
1192 68/push 1/imm32/true
1193 50/push-eax
1194
1195 e8/call check-ints-equal/disp32
1196
1197 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1198
1199 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1200 5d/pop-to-ebp
1201 c3/return
1202
1203