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 39/compare 1/mod/*+disp8 1/rm32/ecx . . . 0/r32/eax 4/disp8 .
22 b8/copy-to-eax 1/imm32/true
23 74/jump-if-equal $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 23/imm32/end
68 68/push 34/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 slice-equal?:
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112 55/push-ebp
113 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
114
115 51/push-ecx
116 52/push-edx
117 53/push-ebx
118 56/push-esi
119
120 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
121
122 8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . .
123
124 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 4/disp8 .
125
126 89/copy 3/mod/direct 0/rm32/eax . . . 6/r32/esi . .
127 29/subtract 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
128
129 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 3/r32/ebx 0xc/disp8 .
130
131 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0/imm32
132 75/jump-if-not-equal $slice-equal?:nonnull-string/disp8
133 $slice-equal?:null-string:
134
135 3d/compare-eax-and 0/imm32
136 74/jump-if-equal $slice-equal?:true/disp8
137 eb/jump $slice-equal?:false/disp8
138 $slice-equal?:nonnull-string:
139
140 39/compare 0/mod/indirect 3/rm32/ebx . . . 0/r32/eax . .
141 75/jump-if-not-equal $slice-equal?:false/disp8
142
143 81 0/subop/add 3/mod/direct 3/rm32/ebx . . . . . 4/imm32
144
145 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
146 31/xor 3/mod/direct 1/rm32/ecx . . . 1/r32/ecx . .
147 $slice-equal?:loop:
148
149 39/compare 3/mod/direct 2/rm32/edx . . . 6/r32/esi . .
150 73/jump-if-greater-or-equal-unsigned $slice-equal?:true/disp8
151
152 8a/copy-byte 0/mod/indirect 3/rm32/ebx . . . 0/r32/AL . .
153
154 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 1/r32/CL . .
155
156 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
157 75/jump-if-not-equal $slice-equal?:false/disp8
158
159 43/increment-ebx
160
161 42/increment-edx
162 eb/jump $slice-equal?:loop/disp8
163 $slice-equal?:false:
164 b8/copy-to-eax 0/imm32
165 eb/jump $slice-equal?:end/disp8
166 $slice-equal?:true:
167 b8/copy-to-eax 1/imm32
168 $slice-equal?:end:
169
170 5e/pop-to-esi
171 5b/pop-to-ebx
172 5a/pop-to-edx
173 59/pop-to-ecx
174
175 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
176 5d/pop-to-ebp
177 c3/return
178
179 test-slice-equal:
180
181
182 55/push-ebp
183 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
184
185 b8/copy-to-eax "Abc"/imm32
186 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
187 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
188 05/add-to-eax 4/imm32
189
190 51/push-ecx
191 50/push-eax
192 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
193
194
195 68/push "Abc"/imm32
196 51/push-ecx
197
198 e8/call slice-equal?/disp32
199
200 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
201
202
203 68/push "F - test-slice-equal"/imm32
204 68/push 1/imm32
205 50/push-eax
206
207 e8/call check-ints-equal/disp32
208
209 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
210
211 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
212 5d/pop-to-ebp
213 c3/return
214
215 test-slice-equal-false:
216
217
218 55/push-ebp
219 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
220
221 b8/copy-to-eax "bcd"/imm32
222 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
223 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
224 05/add-to-eax 4/imm32
225
226 51/push-ecx
227 50/push-eax
228 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
229
230
231 68/push "Abc"/imm32
232 51/push-ecx
233
234 e8/call slice-equal?/disp32
235
236 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
237
238
239 68/push "F - test-slice-equal-false"/imm32
240 68/push 0/imm32
241 50/push-eax
242
243 e8/call check-ints-equal/disp32
244
245 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
246
247 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
248 5d/pop-to-ebp
249 c3/return
250
251 test-slice-equal-too-long:
252
253
254 55/push-ebp
255 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
256
257 b8/copy-to-eax "Abcd"/imm32
258 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
259 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
260 05/add-to-eax 4/imm32
261
262 51/push-ecx
263 50/push-eax
264 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
265
266
267 68/push "Abc"/imm32
268 51/push-ecx
269
270 e8/call slice-equal?/disp32
271
272 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
273
274
275 68/push "F - test-slice-equal-too-long"/imm32
276 68/push 0/imm32
277 50/push-eax
278
279 e8/call check-ints-equal/disp32
280
281 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
282
283 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
284 5d/pop-to-ebp
285 c3/return
286
287 test-slice-equal-too-short:
288
289
290 55/push-ebp
291 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
292
293 b8/copy-to-eax "A"/imm32
294 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
295 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
296 05/add-to-eax 4/imm32
297
298 51/push-ecx
299 50/push-eax
300 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
301
302
303 68/push "Abc"/imm32
304 51/push-ecx
305
306 e8/call slice-equal?/disp32
307
308 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
309
310
311 68/push "F - test-slice-equal-too-short"/imm32
312 68/push 0/imm32
313 50/push-eax
314
315 e8/call check-ints-equal/disp32
316
317 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
318
319 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
320 5d/pop-to-ebp
321 c3/return
322
323 test-slice-equal-empty:
324
325
326 55/push-ebp
327 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
328
329 68/push 0/imm32/end
330 68/push 0/imm32/start
331 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
332
333
334 68/push "Abc"/imm32
335 51/push-ecx
336
337 e8/call slice-equal?/disp32
338
339 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
340
341
342 68/push "F - test-slice-equal-empty"/imm32
343 68/push 0/imm32
344 50/push-eax
345
346 e8/call check-ints-equal/disp32
347
348 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
349
350 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
351 5d/pop-to-ebp
352 c3/return
353
354 test-slice-equal-with-empty:
355
356
357 55/push-ebp
358 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
359
360 b8/copy-to-eax "Ab"/imm32
361 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
362 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
363 05/add-to-eax 4/imm32
364
365 51/push-ecx
366 50/push-eax
367 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
368
369
370 68/push ""/imm32
371 51/push-ecx
372
373 e8/call slice-equal?/disp32
374
375 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
376
377
378 68/push "F - test-slice-equal-with-empty"/imm32
379 68/push 0/imm32
380 50/push-eax
381
382 e8/call check-ints-equal/disp32
383
384 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
385
386 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
387 5d/pop-to-ebp
388 c3/return
389
390 test-slice-equal-empty-with-empty:
391
392
393 55/push-ebp
394 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
395
396 68/push 0/imm32/end
397 68/push 0/imm32/start
398 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
399
400
401 68/push ""/imm32
402 51/push-ecx
403
404 e8/call slice-equal?/disp32
405
406 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
407
408
409 68/push "F - test-slice-equal-empty-with-empty"/imm32
410 68/push 1/imm32
411 50/push-eax
412
413 e8/call check-ints-equal/disp32
414
415 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
416
417 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
418 5d/pop-to-ebp
419 c3/return
420
421 test-slice-equal-with-null:
422
423
424 55/push-ebp
425 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
426
427 b8/copy-to-eax "Ab"/imm32
428 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
429 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
430 05/add-to-eax 4/imm32
431
432 51/push-ecx
433 50/push-eax
434 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
435
436
437 68/push 0/imm32
438 51/push-ecx
439
440 e8/call slice-equal?/disp32
441
442 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
443
444
445 68/push "F - test-slice-equal-with-null"/imm32
446 68/push 0/imm32
447 50/push-eax
448
449 e8/call check-ints-equal/disp32
450
451 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
452
453 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
454 5d/pop-to-ebp
455 c3/return
456
457 slice-starts-with?:
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480 55/push-ebp
481 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
482
483 51/push-ecx
484 52/push-edx
485 53/push-ebx
486 56/push-esi
487 57/push-edi
488
489 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
490
491 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 1/r32/ecx 4/disp8 .
492 2b/subtract 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
493
494 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 0xc/disp8 .
495
496 8b/copy 0/mod/indirect 7/rm32/edi . . . 2/r32/edx . .
497
498 39/compare 3/mod/direct 2/rm32/edx . . . 1/r32/ecx . .
499 7f/jump-if-greater $slice-starts-with?:false/disp8
500
501 8b/subtract 0/mod/indirect 6/rm32/esi . . . 6/r32/esi . .
502
503 81 0/subop/add 3/mod/direct 7/rm32/edi . . . . . 4/imm32
504
505 31/xor 3/mod/direct 1/rm32/ecx . . . 1/r32/ecx . .
506
507 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
508 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
509 $slice-starts-with?:loop:
510
511 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
512 7d/jump-if-greater-or-equal $slice-starts-with?:true/disp8
513
514 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . .
515
516 8a/copy-byte 0/mod/indirect 7/rm32/edi . . . 3/r32/BL . .
517
518 39/compare 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
519 75/jump-if-not-equal $slice-starts-with?:false/disp8
520
521 41/increment-ecx
522
523 46/increment-esi
524
525 47/increment-edi
526 eb/jump $slice-starts-with?:loop/disp8
527 $slice-starts-with?:true:
528 b8/copy-to-eax 1/imm32
529 eb/jump $slice-starts-with?:end/disp8
530 $slice-starts-with?:false:
531 b8/copy-to-eax 0/imm32
532 $slice-starts-with?:end:
533
534 5f/pop-to-edi
535 5e/pop-to-esi
536 5b/pop-to-ebx
537 5a/pop-to-edx
538 59/pop-to-ecx
539
540 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
541 5d/pop-to-ebp
542 c3/return
543
544 test-slice-starts-with-single-character:
545
546
547 55/push-ebp
548 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
549
550 b8/copy-to-eax "Abc"/imm32
551 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
552 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
553 05/add-to-eax 4/imm32
554
555 51/push-ecx
556 50/push-eax
557 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
558
559
560 68/push "A"/imm32
561 51/push-ecx
562
563 e8/call slice-starts-with?/disp32
564
565 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
566
567
568 68/push "F - test-slice-starts-with-single-character"/imm32
569 68/push 1/imm32
570 50/push-eax
571
572 e8/call check-ints-equal/disp32
573
574 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
575
576 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
577 5d/pop-to-ebp
578 c3/return
579
580 test-slice-starts-with-empty-string:
581
582
583 55/push-ebp
584 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
585
586 b8/copy-to-eax "Abc"/imm32
587 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
588 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
589 05/add-to-eax 4/imm32
590
591 51/push-ecx
592 50/push-eax
593 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
594
595
596 68/push ""/imm32
597 51/push-ecx
598
599 e8/call slice-starts-with?/disp32
600
601 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
602
603
604 68/push "F - test-slice-starts-with-empty-string"/imm32
605 68/push 1/imm32
606 50/push-eax
607
608 e8/call check-ints-equal/disp32
609
610 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
611
612 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
613 5d/pop-to-ebp
614 c3/return
615
616 test-slice-starts-with-multiple-characters:
617
618
619 55/push-ebp
620 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
621
622 b8/copy-to-eax "Abc"/imm32
623 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
624 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
625 05/add-to-eax 4/imm32
626
627 51/push-ecx
628 50/push-eax
629 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
630
631
632 68/push "Ab"/imm32
633 51/push-ecx
634
635 e8/call slice-starts-with?/disp32
636
637 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
638
639
640 68/push "F - test-slice-starts-with-multiple-characters"/imm32
641 68/push 1/imm32
642 50/push-eax
643
644 e8/call check-ints-equal/disp32
645
646 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
647
648 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
649 5d/pop-to-ebp
650 c3/return
651
652 test-slice-starts-with-entire-string:
653
654
655 55/push-ebp
656 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
657
658 b8/copy-to-eax "Abc"/imm32
659 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
660 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
661 05/add-to-eax 4/imm32
662
663 51/push-ecx
664 50/push-eax
665 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
666
667
668 68/push "Abc"/imm32
669 51/push-ecx
670
671 e8/call slice-starts-with?/disp32
672
673 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
674
675
676 68/push "F - test-slice-starts-with-entire-string"/imm32
677 68/push 1/imm32
678 50/push-eax
679
680 e8/call check-ints-equal/disp32
681
682 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
683
684 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
685 5d/pop-to-ebp
686 c3/return
687
688 test-slice-starts-with-fails:
689
690
691 55/push-ebp
692 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
693
694 b8/copy-to-eax "Abc"/imm32
695 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
696 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
697 05/add-to-eax 4/imm32
698
699 51/push-ecx
700 50/push-eax
701 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
702
703
704 68/push "Abd"/imm32
705 51/push-ecx
706
707 e8/call slice-starts-with?/disp32
708
709 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
710
711
712 68/push "F - test-slice-starts-with-fails"/imm32
713 68/push 0/imm32
714 50/push-eax
715
716 e8/call check-ints-equal/disp32
717
718 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
719
720 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
721 5d/pop-to-ebp
722 c3/return
723
724 test-slice-starts-with-fails-2:
725
726
727 55/push-ebp
728 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
729
730 b8/copy-to-eax "Abc"/imm32
731 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
732 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
733 05/add-to-eax 4/imm32
734
735 51/push-ecx
736 50/push-eax
737 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
738
739
740 68/push "Ac"/imm32
741 51/push-ecx
742
743 e8/call slice-starts-with?/disp32
744
745 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
746
747
748 68/push "F - test-slice-starts-with-fails-2"/imm32
749 68/push 0/imm32
750 50/push-eax
751
752 e8/call check-ints-equal/disp32
753
754 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
755
756 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
757 5d/pop-to-ebp
758 c3/return
759
760
761
762 write-slice:
763
764 55/push-ebp
765 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
766
767 50/push-eax
768 51/push-ecx
769 52/push-edx
770 53/push-ebx
771 56/push-esi
772 57/push-edi
773
774 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
775
776 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
777
778 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 4/disp8 .
779
780 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 7/r32/edi 8/disp8 .
781
782 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 2/r32/edx 8/disp8 .
783
784 8b/copy 0/mod/indirect 7/rm32/edi . . . 3/r32/ebx . .
785 $write-slice:loop:
786
787 39/compare 3/mod/direct 1/rm32/ecx . . . 6/r32/esi . .
788 73/jump-if-greater-or-equal-unsigned $write-slice:loop-end/disp8
789
790 39/compare 3/mod/direct 3/rm32/ebx . . . 2/r32/edx . .
791 7d/jump-if-greater-or-equal $write-slice:abort/disp8
792
793
794 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
795 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
796
797 88/copy-byte 1/mod/*+disp8 4/rm32/sib 7/base/edi 3/index/ebx . 0/r32/AL 0xc/disp8 .
798
799 43/increment-ebx
800
801 41/increment-ecx
802 eb/jump $write-slice:loop/disp8
803 $write-slice:loop-end:
804
805 89/copy 0/mod/indirect 7/rm32/edi . . . 3/r32/ebx . .
806 $write-slice:end:
807
808 5f/pop-to-edi
809 5e/pop-to-esi
810 5b/pop-to-ebx
811 5a/pop-to-edx
812 59/pop-to-ecx
813 58/pop-to-eax
814
815 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
816 5d/pop-to-ebp
817 c3/return
818
819 $write-slice:abort:
820
821
822 68/push "write-slice: out of space"/imm32
823 68/push 2/imm32/stderr
824
825 e8/call _write/disp32
826
827 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
828
829 bb/copy-to-ebx 1/imm32
830 b8/copy-to-eax 1/imm32/exit
831 cd/syscall 0x80/imm8
832
833
834 test-write-slice:
835
836 55/push-ebp
837 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
838
839
840
841 68/push _test-stream/imm32
842
843 e8/call clear-stream/disp32
844
845 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
846
847 b8/copy-to-eax "Abc"/imm32
848 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
849 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
850 05/add-to-eax 4/imm32
851
852 51/push-ecx
853 50/push-eax
854 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
855
856
857 51/push-ecx
858 68/push _test-stream/imm32
859
860 e8/call write-slice/disp32
861
862 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
863
864
865 68/push "F - test-write-slice"/imm32
866 68/push "Abc"/imm32
867 68/push _test-stream/imm32
868
869 e8/call check-stream-equal/disp32
870
871 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
872
873 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
874 5d/pop-to-ebp
875 c3/return
876
877
878 write-slice-buffered:
879
880 55/push-ebp
881 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
882
883 50/push-eax
884 51/push-ecx
885 52/push-edx
886 53/push-ebx
887 56/push-esi
888 57/push-edi
889
890 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
891
892 8b/copy 0/mod/indirect 6/rm32/esi . . . 1/r32/ecx . .
893
894 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 6/r32/esi 4/disp8 .
895
896 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 7/r32/edi 8/disp8 .
897
898 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 2/r32/edx 0xc/disp8 .
899
900 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 4/disp8 .
901 $write-slice-buffered:loop:
902
903 39/compare 3/mod/direct 1/rm32/ecx . . . 6/r32/esi . .
904 73/jump-if-greater-or-equal-unsigned $write-slice-buffered:loop-end/disp8
905
906 39/compare 3/mod/direct 3/rm32/ebx . . . 2/r32/edx . .
907 7c/jump-if-lesser $write-slice-buffered:to-stream/disp8
908
909 89/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 4/disp8 .
910
911
912 57/push-edi
913
914 e8/call flush/disp32
915
916 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
917
918
919 8d/copy-address 1/mod/*+disp8 7/rm32/edi . . . 0/r32/eax 4/disp8 .
920 50/push-eax
921
922 e8/call clear-stream/disp32
923
924 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
925
926 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
927 $write-slice-buffered:to-stream:
928
929
930 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
931 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
932
933 88/copy-byte 1/mod/*+disp8 4/rm32/sib 7/base/edi 3/index/ebx . 0/r32/AL 0x10/disp8 .
934
935 43/increment-ebx
936
937 41/increment-ecx
938 eb/jump $write-slice-buffered:loop/disp8
939 $write-slice-buffered:loop-end:
940
941 89/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 4/disp8 .
942 $write-slice-buffered:end:
943
944 5f/pop-to-edi
945 5e/pop-to-esi
946 5b/pop-to-ebx
947 5a/pop-to-edx
948 59/pop-to-ecx
949 58/pop-to-eax
950
951 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
952 5d/pop-to-ebp
953 c3/return
954
955 test-write-slice-buffered:
956
957 55/push-ebp
958 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
959
960
961
962 68/push _test-stream/imm32
963
964 e8/call clear-stream/disp32
965
966 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
967
968
969 b8/copy-to-eax _test-buffered-file/imm32
970 05/add-to-eax 4/imm32
971 50/push-eax
972
973 e8/call clear-stream/disp32
974
975 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
976
977 b8/copy-to-eax "Abc"/imm32
978 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
979 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
980 05/add-to-eax 4/imm32
981
982 51/push-ecx
983 50/push-eax
984 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
985
986
987 51/push-ecx
988 68/push _test-buffered-file/imm32
989
990 e8/call write-slice-buffered/disp32
991
992 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
993
994
995 68/push _test-buffered-file/imm32
996
997 e8/call flush/disp32
998
999 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1000
1001
1002 68/push "F - test-write-slice-buffered"/imm32
1003 68/push "Abc"/imm32
1004 68/push _test-stream/imm32
1005
1006 e8/call check-stream-equal/disp32
1007
1008 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1009
1010 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1011 5d/pop-to-ebp
1012 c3/return
1013
1014
1015 slice-to-string:
1016
1017 55/push-ebp
1018 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1019
1020 51/push-ecx
1021 52/push-edx
1022 53/push-ebx
1023 56/push-esi
1024
1025 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 0xc/disp8 .
1026
1027 8b/copy 0/mod/indirect 6/rm32/esi . . . 2/r32/edx . .
1028
1029 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 3/r32/ebx 4/disp8 .
1030
1031 89/copy 3/mod/direct 1/rm32/ecx . . . 3/r32/ebx . .
1032 29/subtract 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
1033 81 0/subop/add 3/mod/direct 1/rm32/ecx . . . . . 4/imm32
1034
1035
1036 51/push-ecx
1037 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
1038
1039 e8/call allocate/disp32
1040
1041 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1042
1043 3d/compare-eax-and 0/imm32
1044 74/jump-if-equal $slice-to-string:abort/disp8
1045
1046 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
1047 81 5/subop/subtract 0/mod/indirect 0/rm32/eax . . . . . 4/imm32
1048
1049 50/push-eax
1050
1051
1052 53/push-ebx
1053 52/push-edx
1054
1055 01/add 3/mod/direct 1/rm32/ecx . . . 0/r32/eax . .
1056 51/push-ecx
1057
1058 81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 4/imm32
1059 50/push-eax
1060
1061 e8/call _append-4/disp32
1062
1063 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1064
1065 58/pop-to-eax
1066 $slice-to-string:end:
1067
1068 5e/pop-to-esi
1069 5b/pop-to-ebx
1070 5a/pop-to-edx
1071 59/pop-to-ecx
1072
1073 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1074 5d/pop-to-ebp
1075 c3/return
1076
1077 $slice-to-string:abort:
1078
1079
1080 68/push "slice-to-string: out of space\n"/imm32
1081 68/push 2/imm32/stderr
1082
1083 e8/call _write/disp32
1084
1085 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1086
1087 bb/copy-to-ebx 1/imm32
1088 b8/copy-to-eax 1/imm32/exit
1089 cd/syscall 0x80/imm8
1090
1091
1092 test-slice-to-string:
1093
1094 55/push-ebp
1095 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1096
1097 68/push 0/imm32/limit
1098 68/push 0/imm32/curr
1099 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1100
1101
1102 52/push-edx
1103 68/push 0x200/imm32
1104
1105 e8/call new-segment/disp32
1106
1107 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1108
1109 b8/copy-to-eax "Abc"/imm32
1110 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
1111 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
1112 05/add-to-eax 4/imm32
1113
1114 51/push-ecx
1115 50/push-eax
1116 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
1117
1118
1119 51/push-ecx
1120 52/push-edx
1121
1122 e8/call slice-to-string/disp32
1123
1124 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1125 +-- 26 lines: #? # dump word-slice -----------------------------------------------------------------------------------------------------------------------
1151
1152
1153 68/push "Abc"/imm32
1154 50/push-eax
1155
1156 e8/call string-equal?/disp32
1157
1158 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1159
1160
1161 68/push "F - test-slice-to-string"/imm32
1162 68/push 1/imm32/true
1163 50/push-eax
1164
1165 e8/call check-ints-equal/disp32
1166
1167 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1168
1169 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1170 5d/pop-to-ebp
1171 c3/return
1172
1173