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