https://github.com/akkartik/mu/blob/master/subx/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