https://github.com/akkartik/mu/blob/master/subx/apps/pack.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 == code
19
20
21
22
23 Entry:
24
25
26
27
28
29
30
31 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
32
33
34 81 7/subop/compare 1/mod/*+disp8 5/rm32/EBP . . . . 0/disp8 1/imm32
35 7e/jump-if-lesser-or-equal $run-main/disp8
36
37
38 68/push "test"/imm32
39 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
40
41 e8/call kernel-string-equal?/disp32
42
43 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
44
45 3d/compare-EAX 1/imm32
46 75/jump-if-not-equal $run-main/disp8
47
48 e8/call run-tests/disp32
49 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32
50 eb/jump $main:end/disp8
51 $run-main:
52
53
54 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
55 89/copy 3/mod/direct 0/rm32/EAX . . . 4/r32/ESP . .
56
57
58 c7 0/subop/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
59
60
61 50/push-EAX/ed
62 68/push Stderr/imm32
63 68/push Stdout/imm32
64 68/push Stdin/imm32
65
66 e8/call convert/disp32
67
68 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
69
70 bb/copy-to-EBX 0/imm32
71 $main:end:
72 b8/copy-to-EAX 1/imm32/exit
73 cd/syscall 0x80/imm8
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95 convert:
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119 55/push-EBP
120 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
121
122 50/push-EAX
123 51/push-ECX
124 52/push-EDX
125 53/push-EBX
126
127 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0x200/imm32
128 68/push 0x200/imm32/length
129 68/push 0/imm32/read
130 68/push 0/imm32/write
131 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
132
133 68/push 0/imm32/end
134 68/push 0/imm32/curr
135 89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . .
136
137 68/push 0/imm32/false
138 89/copy 3/mod/direct 3/rm32/EBX . . . 4/r32/ESP . .
139 $convert:loop:
140
141
142 51/push-ECX
143
144 e8/call clear-stream/disp32
145
146 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
147
148
149 51/push-ECX
150 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
151
152 e8/call read-line/disp32
153
154 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
155 $convert:check0:
156
157 81 7/subop/compare 0/mod/indirect 1/rm32/ECX . . . . . 0/imm32
158 0f 84/jump-if-equal $convert:break/disp32
159 +-- 34 lines: #? # dump current line -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
193
194
195 52/push-EDX
196 51/push-ECX
197
198 e8/call next-word/disp32
199
200 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
201 $convert:check1:
202
203
204
205 52/push-EDX
206
207 e8/call slice-empty?/disp32
208
209 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
210
211 3d/compare-EAX 0/imm32
212 0f 85/jump-if-not-equal $convert:pass-through/disp32
213 $convert:check2:
214 +-- 50 lines: #? # dump current word -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
264
265
266
267
268
269
270 68/push "=="/imm32
271 52/push-EDX
272
273 e8/call slice-equal?/disp32
274
275 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
276
277 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32
278 0f 84/jump-if-equal $convert:check3/disp32
279
280
281 52/push-EDX
282 51/push-ECX
283
284 e8/call next-word/disp32
285
286 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
287 +-- 50 lines: #? # dump segment name -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
337
338
339 68/push "code"/imm32
340 52/push-EDX
341
342 e8/call slice-equal?/disp32
343
344 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
345
346 89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . .
347
348 eb/jump $convert:pass-through/disp8
349 $convert:check3:
350
351
352
353 51/push-ECX
354
355 e8/call rewind-stream/disp32
356
357 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
358
359 81 7/subop/compare 3/mod/direct 3/rm32/EBX . . . . . 0/imm32
360 74/jump-if-equal $convert:data/disp8
361 $convert:code:
362
363
364 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
365 51/push-ECX
366
367 e8/call convert-instruction/disp32
368
369 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
370
371 e9/jump $convert:loop/disp32
372 $convert:data:
373
374
375 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
376 51/push-ECX
377
378 e8/call convert-data/disp32
379
380 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
381
382 e9/jump $convert:loop/disp32
383 $convert:pass-through:
384
385
386 51/push-ECX
387 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
388
389 e8/call write-stream-buffered/disp32
390
391 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
392
393 e9/jump $convert:loop/disp32
394 $convert:break:
395
396
397 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
398
399 e8/call flush/disp32
400
401 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
402 $convert:end:
403
404 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x218/imm32
405
406 5b/pop-to-EBX
407 5a/pop-to-EDX
408 59/pop-to-ECX
409 58/pop-to-EAX
410
411 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
412 5d/pop-to-EBP
413 c3/return
414
415 test-convert-passes-empty-lines-through:
416
417
418 55/push-EBP
419 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
420
421
422
423 68/push _test-input-stream/imm32
424
425 e8/call clear-stream/disp32
426
427 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
428
429
430 b8/copy-to-EAX _test-input-buffered-file/imm32
431 05/add-to-EAX 4/imm32
432 50/push-EAX
433
434 e8/call clear-stream/disp32
435
436 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
437
438
439 68/push _test-output-stream/imm32
440
441 e8/call clear-stream/disp32
442
443 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
444
445
446 b8/copy-to-EAX _test-output-buffered-file/imm32
447 05/add-to-EAX 4/imm32
448 50/push-EAX
449
450 e8/call clear-stream/disp32
451
452 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
453
454
455
456 68/push _test-output-buffered-file/imm32
457 68/push _test-input-buffered-file/imm32
458
459 e8/call convert/disp32
460
461 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
462
463
464
465 68/push _test-output-buffered-file/imm32
466
467 e8/call flush/disp32
468
469 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
470
471
472 68/push "F - test-convert-passes-empty-lines-through"/imm32
473 68/push ""/imm32
474 68/push _test-output-stream/imm32
475
476 e8/call check-stream-equal/disp32
477
478 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
479
480 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
481 5d/pop-to-EBP
482 c3/return
483
484 test-convert-passes-lines-with-just-whitespace-through:
485
486
487 55/push-EBP
488 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
489
490
491
492 68/push _test-input-stream/imm32
493
494 e8/call clear-stream/disp32
495
496 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
497
498
499 b8/copy-to-EAX _test-input-buffered-file/imm32
500 05/add-to-EAX 4/imm32
501 50/push-EAX
502
503 e8/call clear-stream/disp32
504
505 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
506
507
508 68/push _test-output-stream/imm32
509
510 e8/call clear-stream/disp32
511
512 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
513
514
515 b8/copy-to-EAX _test-output-buffered-file/imm32
516 05/add-to-EAX 4/imm32
517 50/push-EAX
518
519 e8/call clear-stream/disp32
520
521 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
522
523
524
525 68/push " "/imm32
526 68/push _test-input-stream/imm32
527
528 e8/call write/disp32
529
530 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
531
532
533 68/push _test-output-buffered-file/imm32
534 68/push _test-input-buffered-file/imm32
535
536 e8/call convert/disp32
537
538 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
539
540
541
542 68/push _test-output-buffered-file/imm32
543
544 e8/call flush/disp32
545
546 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
547
548
549 68/push "F - test-convert-passes-with-just-whitespace-through"/imm32
550 68/push " "/imm32
551 68/push _test-output-stream/imm32
552
553 e8/call check-next-stream-line-equal/disp32
554
555 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
556
557 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
558 5d/pop-to-EBP
559 c3/return
560
561 test-convert-passes-segment-headers-through:
562
563
564 55/push-EBP
565 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
566
567
568
569 68/push _test-input-stream/imm32
570
571 e8/call clear-stream/disp32
572
573 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
574
575
576 b8/copy-to-EAX _test-input-buffered-file/imm32
577 05/add-to-EAX 4/imm32
578 50/push-EAX
579
580 e8/call clear-stream/disp32
581
582 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
583
584
585 68/push _test-output-stream/imm32
586
587 e8/call clear-stream/disp32
588
589 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
590
591
592 b8/copy-to-EAX _test-output-buffered-file/imm32
593 05/add-to-EAX 4/imm32
594 50/push-EAX
595
596 e8/call clear-stream/disp32
597
598 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
599
600
601
602 68/push "== abcd"/imm32
603 68/push _test-input-stream/imm32
604
605 e8/call write/disp32
606
607 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
608
609
610 68/push _test-output-buffered-file/imm32
611 68/push _test-input-buffered-file/imm32
612
613 e8/call convert/disp32
614
615 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
616
617
618
619 68/push _test-output-buffered-file/imm32
620
621 e8/call flush/disp32
622
623 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
624
625
626 68/push "F - test-convert-passes-segment-headers-through"/imm32
627 68/push "== abcd"/imm32
628 68/push _test-output-stream/imm32
629
630 e8/call check-stream-equal/disp32
631
632 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
633
634 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
635 5d/pop-to-EBP
636 c3/return
637
638 test-convert-in-data-segment:
639
640
641 55/push-EBP
642 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
643
644
645
646 68/push _test-input-stream/imm32
647
648 e8/call clear-stream/disp32
649
650 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
651
652
653 b8/copy-to-EAX _test-input-buffered-file/imm32
654 05/add-to-EAX 4/imm32
655 50/push-EAX
656
657 e8/call clear-stream/disp32
658
659 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
660
661
662 68/push _test-output-stream/imm32
663
664 e8/call clear-stream/disp32
665
666 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
667
668
669 b8/copy-to-EAX _test-output-buffered-file/imm32
670 05/add-to-EAX 4/imm32
671 50/push-EAX
672
673 e8/call clear-stream/disp32
674
675 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
676
677
678
679 68/push "== code"/imm32
680 68/push _test-input-stream/imm32
681
682 e8/call write/disp32
683
684 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
685
686
687 68/push Newline/imm32
688 68/push _test-input-stream/imm32
689
690 e8/call write/disp32
691
692 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
693
694
695 68/push "== data"/imm32
696 68/push _test-input-stream/imm32
697
698 e8/call write/disp32
699
700 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
701
702
703 68/push Newline/imm32
704 68/push _test-input-stream/imm32
705
706 e8/call write/disp32
707
708 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
709
710
711 68/push "3 4/imm32"/imm32
712 68/push _test-input-stream/imm32
713
714 e8/call write/disp32
715
716 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
717
718
719 68/push Newline/imm32
720 68/push _test-input-stream/imm32
721
722 e8/call write/disp32
723
724 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
725
726
727 68/push _test-output-buffered-file/imm32
728 68/push _test-input-buffered-file/imm32
729
730 e8/call convert/disp32
731
732 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
733
734 +-- 34 lines: #? # debug print -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
768
769
770 68/push _test-output-buffered-file/imm32
771
772 e8/call flush/disp32
773
774 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
775
776
777 68/push "F - test-convert-in-data-segment/0"/imm32
778 68/push "== code"/imm32
779 68/push _test-output-stream/imm32
780
781 e8/call check-next-stream-line-equal/disp32
782
783 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
784
785
786 68/push "F - test-convert-in-data-segment/1"/imm32
787 68/push "== data"/imm32
788 68/push _test-output-stream/imm32
789
790 e8/call check-next-stream-line-equal/disp32
791
792 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
793
794
795 68/push "F - test-convert-in-data-segment/2"/imm32
796 68/push "03 04 00 00 00 "/imm32
797 68/push _test-output-stream/imm32
798
799 e8/call check-next-stream-line-equal/disp32
800
801 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
802
803 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
804 5d/pop-to-EBP
805 c3/return
806
807 convert-data:
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826 55/push-EBP
827 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
828
829 50/push-EAX
830 51/push-ECX
831 52/push-EDX
832
833 68/push 0/imm32/end
834 68/push 0/imm32/start
835 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
836 +-- 26 lines: #? # dump line -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
862 $convert-data:loop:
863
864
865 51/push-ECX
866 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
867
868 e8/call next-word/disp32
869
870 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
871 +-- 26 lines: #? # dump word-slice -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
897 $convert-data:check0:
898
899
900
901 51/push-ECX
902
903 e8/call slice-empty?/disp32
904
905 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
906
907 3d/compare-EAX 0/imm32
908 75/jump-if-not-equal $convert-data:break/disp8
909 $convert-data:check1:
910
911
912 8b/copy 0/mod/indirect 1/rm32/ECX . . . 2/r32/EDX . .
913
914 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
915 8a/copy-byte 0/mod/indirect 2/rm32/EDX . . . 0/r32/AL . .
916
917 3d/compare-with-EAX 0x23/imm32/hash
918 74/jump-if-equal $convert-data:pass-line-through/disp8
919 $convert-data:check2:
920
921
922 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 2/r32/EDX 4/disp8 .
923
924 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
925 8a/copy-byte 1/mod/*+disp8 2/rm32/EDX . . . 0/r32/AL -1/disp8 .
926
927 3d/compare-with-EAX 0x3a/imm32/colon
928 74/jump-if-equal $convert-data:pass-line-through/disp8
929 $convert-data:check3:
930
931
932
933 68/push "imm32"/imm32
934 51/push-ECX
935
936 e8/call has-metadata?/disp32
937
938 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x8/imm32
939
940 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32
941 74/jump-if-equal $convert-data:single-byte/disp8
942 $convert-data:imm32:
943
944
945 68/push 4/imm32
946 51/push-ECX
947 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
948
949 e8/call emit/disp32
950
951 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
952 e9/jump $convert-data:loop/disp32
953 $convert-data:single-byte:
954
955
956 68/push 1/imm32
957 51/push-ECX
958 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
959
960 e8/call emit/disp32
961
962 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
963 e9/jump $convert-data:loop/disp32
964 $convert-data:pass-line-through:
965
966
967 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
968 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
969
970 e8/call write-stream-buffered/disp32
971
972 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
973
974 $convert-data:break:
975 $convert-data:end:
976
977 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
978
979 5a/pop-to-EDX
980 59/pop-to-ECX
981 58/pop-to-EAX
982
983 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
984 5d/pop-to-EBP
985 c3/return
986
987 test-convert-data-passes-comments-through:
988
989
990 55/push-EBP
991 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
992
993
994
995 68/push _test-input-stream/imm32
996
997 e8/call clear-stream/disp32
998
999 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1000
1001
1002 68/push _test-output-stream/imm32
1003
1004 e8/call clear-stream/disp32
1005
1006 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1007
1008
1009 b8/copy-to-EAX _test-buffered-file/imm32
1010 05/add-to-EAX 4/imm32
1011 50/push-EAX
1012
1013 e8/call clear-stream/disp32
1014
1015 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1016
1017
1018
1019 68/push "# abcd"/imm32
1020 68/push _test-input-stream/imm32
1021
1022 e8/call write/disp32
1023
1024 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1025
1026
1027 68/push _test-output-buffered-file/imm32
1028 68/push _test-input-stream/imm32
1029
1030 e8/call convert-data/disp32
1031
1032 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1033
1034
1035
1036 68/push _test-output-buffered-file/imm32
1037
1038 e8/call flush/disp32
1039
1040 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1041
1042
1043 68/push "F - test-convert-data-passes-comments-through"/imm32
1044 68/push "# abcd"/imm32
1045 68/push _test-output-stream/imm32
1046
1047 e8/call check-stream-equal/disp32
1048
1049 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1050
1051 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1052 5d/pop-to-EBP
1053 c3/return
1054
1055 test-convert-data-passes-labels-through:
1056
1057
1058 55/push-EBP
1059 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1060
1061
1062
1063 68/push _test-input-stream/imm32
1064
1065 e8/call clear-stream/disp32
1066
1067 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1068
1069
1070 68/push _test-output-stream/imm32
1071
1072 e8/call clear-stream/disp32
1073
1074 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1075
1076
1077 b8/copy-to-EAX _test-output-buffered-file/imm32
1078 05/add-to-EAX 4/imm32
1079 50/push-EAX
1080
1081 e8/call clear-stream/disp32
1082
1083 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1084
1085
1086
1087 68/push "ab: # cd"/imm32
1088 68/push _test-input-stream/imm32
1089
1090 e8/call write/disp32
1091
1092 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1093
1094
1095 68/push _test-output-buffered-file/imm32
1096 68/push _test-input-stream/imm32
1097
1098 e8/call convert-data/disp32
1099
1100 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1101
1102
1103
1104 68/push _test-output-buffered-file/imm32
1105
1106 e8/call flush/disp32
1107
1108 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1109
1110
1111 68/push "F - test-convert-data-passes-labels-through"/imm32
1112 68/push "ab: # cd"/imm32
1113 68/push _test-output-stream/imm32
1114
1115 e8/call check-stream-equal/disp32
1116
1117 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1118
1119 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1120 5d/pop-to-EBP
1121 c3/return
1122
1123 test-convert-data-passes-names-through:
1124
1125
1126
1127 55/push-EBP
1128 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1129
1130
1131
1132 68/push _test-input-stream/imm32
1133
1134 e8/call clear-stream/disp32
1135
1136 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1137
1138
1139 68/push _test-output-stream/imm32
1140
1141 e8/call clear-stream/disp32
1142
1143 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1144
1145
1146 b8/copy-to-EAX _test-output-buffered-file/imm32
1147 05/add-to-EAX 4/imm32
1148 50/push-EAX
1149
1150 e8/call clear-stream/disp32
1151
1152 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1153
1154
1155
1156 68/push "abcd/imm32"/imm32
1157 68/push _test-input-stream/imm32
1158
1159 e8/call write/disp32
1160
1161 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1162
1163
1164 68/push _test-output-buffered-file/imm32
1165 68/push _test-input-stream/imm32
1166
1167 e8/call convert-data/disp32
1168
1169 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1170
1171
1172
1173 68/push _test-output-buffered-file/imm32
1174
1175 e8/call flush/disp32
1176
1177 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1178
1179
1180 68/push "F - test-convert-data-passes-names-through"/imm32
1181 68/push "abcd/imm32 "/imm32
1182 68/push _test-output-stream/imm32
1183
1184 e8/call check-stream-equal/disp32
1185
1186 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1187
1188 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1189 5d/pop-to-EBP
1190 c3/return
1191
1192 test-convert-data-handles-imm32:
1193
1194
1195 55/push-EBP
1196 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1197
1198
1199
1200 68/push _test-input-stream/imm32
1201
1202 e8/call clear-stream/disp32
1203
1204 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1205
1206
1207 68/push _test-output-stream/imm32
1208
1209 e8/call clear-stream/disp32
1210
1211 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1212
1213
1214 b8/copy-to-EAX _test-output-buffered-file/imm32
1215 05/add-to-EAX 4/imm32
1216 50/push-EAX
1217
1218 e8/call clear-stream/disp32
1219
1220 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1221
1222
1223
1224 68/push "30/imm32"/imm32
1225 68/push _test-input-stream/imm32
1226
1227 e8/call write/disp32
1228
1229 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1230
1231
1232 68/push _test-output-buffered-file/imm32
1233 68/push _test-input-stream/imm32
1234
1235 e8/call convert-data/disp32
1236
1237 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1238
1239
1240
1241 68/push _test-output-buffered-file/imm32
1242
1243 e8/call flush/disp32
1244
1245 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1246
1247
1248 68/push "F - test-convert-data-handles-imm32"/imm32
1249 68/push "30 00 00 00 "/imm32
1250 68/push _test-output-stream/imm32
1251
1252 e8/call check-stream-equal/disp32
1253
1254 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1255
1256 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1257 5d/pop-to-EBP
1258 c3/return
1259
1260 test-convert-data-handles-single-byte:
1261
1262
1263
1264 55/push-EBP
1265 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1266
1267
1268
1269 68/push _test-input-stream/imm32
1270
1271 e8/call clear-stream/disp32
1272
1273 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1274
1275
1276 68/push _test-output-stream/imm32
1277
1278 e8/call clear-stream/disp32
1279
1280 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1281
1282
1283 b8/copy-to-EAX _test-output-buffered-file/imm32
1284 05/add-to-EAX 4/imm32
1285 50/push-EAX
1286
1287 e8/call clear-stream/disp32
1288
1289 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1290
1291
1292
1293 68/push "30/imm16"/imm32
1294 68/push _test-input-stream/imm32
1295
1296 e8/call write/disp32
1297
1298 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1299
1300
1301 68/push _test-output-buffered-file/imm32
1302 68/push _test-input-stream/imm32
1303
1304 e8/call convert-data/disp32
1305
1306 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1307
1308
1309
1310 68/push _test-output-buffered-file/imm32
1311
1312 e8/call flush/disp32
1313
1314 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1315
1316
1317 68/push "F - test-convert-data-handles-single-byte"/imm32
1318 68/push "30 "/imm32
1319 68/push _test-output-stream/imm32
1320
1321 e8/call check-stream-equal/disp32
1322
1323 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1324
1325 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1326 5d/pop-to-EBP
1327 c3/return
1328
1329 test-convert-data-multiple-bytes:
1330
1331
1332 55/push-EBP
1333 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1334
1335
1336
1337 68/push _test-input-stream/imm32
1338
1339 e8/call clear-stream/disp32
1340
1341 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1342
1343
1344 68/push _test-output-stream/imm32
1345
1346 e8/call clear-stream/disp32
1347
1348 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1349
1350
1351 b8/copy-to-EAX _test-output-buffered-file/imm32
1352 05/add-to-EAX 4/imm32
1353 50/push-EAX
1354
1355 e8/call clear-stream/disp32
1356
1357 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1358
1359
1360
1361 68/push "1 2"/imm32
1362 68/push _test-input-stream/imm32
1363
1364 e8/call write/disp32
1365
1366 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1367
1368
1369 68/push _test-output-buffered-file/imm32
1370 68/push _test-input-stream/imm32
1371
1372 e8/call convert-data/disp32
1373
1374 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1375
1376
1377
1378 68/push _test-output-buffered-file/imm32
1379
1380 e8/call flush/disp32
1381
1382 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1383
1384
1385 68/push "F - test-convert-data-multiple-bytes"/imm32
1386 68/push "01 02 "/imm32
1387 68/push _test-output-stream/imm32
1388
1389 e8/call check-stream-equal/disp32
1390
1391 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1392
1393 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1394 5d/pop-to-EBP
1395 c3/return
1396
1397 test-convert-data-byte-then-name:
1398
1399
1400 55/push-EBP
1401 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1402
1403
1404
1405 68/push _test-input-stream/imm32
1406
1407 e8/call clear-stream/disp32
1408
1409 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1410
1411
1412 68/push _test-output-stream/imm32
1413
1414 e8/call clear-stream/disp32
1415
1416 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1417
1418
1419 b8/copy-to-EAX _test-output-buffered-file/imm32
1420 05/add-to-EAX 4/imm32
1421 50/push-EAX
1422
1423 e8/call clear-stream/disp32
1424
1425 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1426
1427
1428
1429 68/push "30 abcd/o"/imm32
1430 68/push _test-input-stream/imm32
1431
1432 e8/call write/disp32
1433
1434 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1435
1436
1437 68/push _test-output-buffered-file/imm32
1438 68/push _test-input-stream/imm32
1439
1440 e8/call convert-data/disp32
1441
1442 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1443
1444
1445
1446 68/push _test-output-buffered-file/imm32
1447
1448 e8/call flush/disp32
1449
1450 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1451
1452
1453 68/push "F - test-convert-data-byte-then-name"/imm32
1454 68/push "30 abcd/o "/imm32
1455 68/push _test-output-stream/imm32
1456
1457 e8/call check-stream-equal/disp32
1458
1459 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1460
1461 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1462 5d/pop-to-EBP
1463 c3/return
1464
1465 test-convert-data-multiple-words:
1466
1467
1468 55/push-EBP
1469 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1470
1471
1472
1473 68/push _test-input-stream/imm32
1474
1475 e8/call clear-stream/disp32
1476
1477 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1478
1479
1480 68/push _test-output-stream/imm32
1481
1482 e8/call clear-stream/disp32
1483
1484 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1485
1486
1487 b8/copy-to-EAX _test-output-buffered-file/imm32
1488 05/add-to-EAX 4/imm32
1489 50/push-EAX
1490
1491 e8/call clear-stream/disp32
1492
1493 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1494
1495
1496
1497 68/push "30 abcd/o 42e1/imm32"/imm32
1498 68/push _test-input-stream/imm32
1499
1500 e8/call write/disp32
1501
1502 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1503
1504
1505 68/push _test-output-buffered-file/imm32
1506 68/push _test-input-stream/imm32
1507
1508 e8/call convert-data/disp32
1509
1510 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1511
1512
1513
1514 68/push _test-output-buffered-file/imm32
1515
1516 e8/call flush/disp32
1517
1518 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1519 +-- 34 lines: # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1553
1554
1555 68/push "F - test-convert-data-multiple-words"/imm32
1556 68/push "30 abcd/o e1 42 00 00 "/imm32
1557 68/push _test-output-stream/imm32
1558
1559 e8/call check-stream-equal/disp32
1560
1561 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1562
1563 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1564 5d/pop-to-EBP
1565 c3/return
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577 convert-instruction:
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599 55/push-EBP
1600 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1601
1602 50/push-EAX
1603 51/push-ECX
1604 52/push-EDX
1605
1606 68/push 0/imm32/end
1607 68/push 0/imm32/start
1608 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1609
1610
1611 51/push-ECX
1612 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1613
1614 e8/call next-word/disp32
1615
1616 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1617 $convert-instruction:check0:
1618
1619
1620
1621 51/push-ECX
1622
1623 e8/call slice-empty?/disp32
1624
1625 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1626
1627 3d/compare-EAX 0/imm32
1628 75/jump-if-not-equal $convert-instruction:pass-through/disp8
1629 $convert-instruction:check1:
1630
1631
1632 8b/copy 0/mod/indirect 1/rm32/ECX . . . 2/r32/EDX . .
1633
1634 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
1635 8a/copy-byte 0/mod/indirect 2/rm32/EDX . . . 0/r32/AL . .
1636
1637 3d/compare-with-EAX 0x23/imm32/hash
1638 74/jump-if-equal $convert-instruction:pass-through/disp8
1639 $convert-instruction:check2:
1640
1641
1642 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 2/r32/EDX 4/disp8 .
1643
1644 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
1645 8a/copy-byte 1/mod/*+disp8 2/rm32/EDX . . . 0/r32/AL -1/disp8 .
1646
1647 3d/compare-with-EAX 0x3a/imm32/colon
1648 74/jump-if-equal $convert-instruction:pass-through/disp8
1649 $convert-instruction:pass-through:
1650
1651
1652 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1653 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1654
1655 e8/call write-stream-buffered/disp32
1656
1657 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1658
1659 eb/jump $convert-instruction:end/disp8
1660 $convert-instruction:really-convert:
1661
1662
1663 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1664 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1665
1666 e8/call emit-opcodes/disp32
1667
1668 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1669
1670
1671 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1672 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1673
1674 e8/call emit-modrm/disp32
1675
1676 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1677
1678
1679 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1680 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1681
1682 e8/call emit-sib/disp32
1683
1684 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1685
1686
1687 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1688 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1689
1690 e8/call emit-disp/disp32
1691
1692 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1693
1694
1695 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1696 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1697
1698 e8/call emit-imm/disp32
1699
1700 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1701
1702
1703 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1704 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1705
1706 e8/call emit-line-in-comment/disp32
1707
1708 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1709 $convert-instruction:end:
1710
1711 5a/pop-to-EDX
1712 59/pop-to-ECX
1713 58/pop-to-EAX
1714
1715 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1716 5d/pop-to-EBP
1717 c3/return
1718
1719 emit-opcodes:
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741 55/push-EBP
1742 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1743
1744 $emit-opcodes:end:
1745
1746
1747 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1748 5d/pop-to-EBP
1749 c3/return
1750
1751 emit-modrm:
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777 55/push-EBP
1778 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1779
1780 $emit-modrm:end:
1781
1782
1783 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1784 5d/pop-to-EBP
1785 c3/return
1786
1787 emit-sib:
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812 55/push-EBP
1813 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1814
1815 $emit-sib:end:
1816
1817
1818 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1819 5d/pop-to-EBP
1820 c3/return
1821
1822 emit-disp:
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843 55/push-EBP
1844 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1845
1846 $emit-disp:end:
1847
1848
1849 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1850 5d/pop-to-EBP
1851 c3/return
1852
1853 emit-imm:
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874 55/push-EBP
1875 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1876
1877 $emit-imm:end:
1878
1879
1880 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1881 5d/pop-to-EBP
1882 c3/return
1883
1884 emit-line-in-comment:
1885
1886
1887
1888
1889
1890 55/push-EBP
1891 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1892
1893 $emit-line-in-comment:end:
1894
1895
1896 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1897 5d/pop-to-EBP
1898 c3/return
1899
1900 test-convert-instruction-passes-comments-through:
1901
1902
1903 55/push-EBP
1904 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1905
1906
1907
1908 68/push _test-input-stream/imm32
1909
1910 e8/call clear-stream/disp32
1911
1912 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1913
1914
1915 68/push _test-output-stream/imm32
1916
1917 e8/call clear-stream/disp32
1918
1919 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1920
1921
1922 b8/copy-to-EAX _test-buffered-file/imm32
1923 05/add-to-EAX 4/imm32
1924 50/push-EAX
1925
1926 e8/call clear-stream/disp32
1927
1928 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1929
1930
1931
1932 68/push "# abcd"/imm32
1933 68/push _test-input-stream/imm32
1934
1935 e8/call write/disp32
1936
1937 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1938
1939
1940 68/push _test-output-buffered-file/imm32
1941 68/push _test-input-stream/imm32
1942
1943 e8/call convert-instruction/disp32
1944
1945 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1946
1947
1948
1949 68/push _test-output-buffered-file/imm32
1950
1951 e8/call flush/disp32
1952
1953 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1954
1955
1956 68/push "F - test-convert-instruction-passes-comments-through"/imm32
1957 68/push "# abcd"/imm32
1958 68/push _test-output-stream/imm32
1959
1960 e8/call check-stream-equal/disp32
1961
1962 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1963
1964 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1965 5d/pop-to-EBP
1966 c3/return
1967
1968 test-convert-instruction-passes-labels-through:
1969
1970
1971 55/push-EBP
1972 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1973
1974
1975
1976 68/push _test-input-stream/imm32
1977
1978 e8/call clear-stream/disp32
1979
1980 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1981
1982
1983 68/push _test-output-stream/imm32
1984
1985 e8/call clear-stream/disp32
1986
1987 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1988
1989
1990 b8/copy-to-EAX _test-output-buffered-file/imm32
1991 05/add-to-EAX 4/imm32
1992 50/push-EAX
1993
1994 e8/call clear-stream/disp32
1995
1996 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1997
1998
1999
2000 68/push "ab: # cd"/imm32
2001 68/push _test-input-stream/imm32
2002
2003 e8/call write/disp32
2004
2005 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2006
2007
2008 68/push _test-output-buffered-file/imm32
2009 68/push _test-input-stream/imm32
2010
2011 e8/call convert-instruction/disp32
2012
2013 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2014
2015
2016
2017 68/push _test-output-buffered-file/imm32
2018
2019 e8/call flush/disp32
2020
2021 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2022
2023
2024 68/push "F - test-convert-instruction-passes-labels-through"/imm32
2025 68/push "ab: # cd"/imm32
2026 68/push _test-output-stream/imm32
2027
2028 e8/call check-stream-equal/disp32
2029
2030 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2031
2032 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2033 5d/pop-to-EBP
2034 c3/return
2035
2036
2037
2038 next-word:
2039
2040 55/push-EBP
2041 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2042
2043 50/push-EAX
2044 51/push-ECX
2045 56/push-ESI
2046 57/push-EDI
2047
2048 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
2049
2050 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 0xc/disp8 .
2051
2052
2053 68/push 0x20/imm32/space
2054 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2055
2056 e8/call skip-chars-matching/disp32
2057
2058 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2059 $next-word:check0:
2060
2061
2062 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
2063
2064 3b/compare 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
2065 7c/jump-if-lesser $next-word:check1/disp8
2066
2067 c7 0/subop/copy 0/mod/direct 7/rm32/EDI . . . . . 0/imm32
2068 c7 0/subop/copy 1/mod/*+disp8 7/rm32/EDI . . . . 4/disp8 0/imm32
2069 eb/jump $next-word:end/disp8
2070 $next-word:check1:
2071
2072 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 .
2073 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/EAX 0xc/disp8 .
2074 89/copy 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . .
2075
2076
2077 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
2078 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0xc/disp8 .
2079
2080 3d/compare-EAX-with 0x23/imm32/pound
2081 75/jump-if-not-equal $next-word:not-comment/disp8
2082
2083 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
2084 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 0/index/EAX . 0/r32/EAX 0xc/disp8 .
2085 89/copy 1/mod/*+disp8 7/rm32/EDI . . . 0/r32/EAX 4/disp8 .
2086
2087 89/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
2088
2089 eb/jump $next-word:end/disp8
2090 $next-word:not-comment:
2091
2092
2093 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2094
2095 e8/call skip-chars-not-matching-whitespace/disp32
2096
2097 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2098
2099 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 .
2100 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/EAX 0xc/disp8 .
2101 89/copy 1/mod/*+disp8 7/rm32/EDI . . . 0/r32/EAX 4/disp8 .
2102 $next-word:end:
2103
2104 5f/pop-to-EDI
2105 5e/pop-to-ESI
2106 59/pop-to-ECX
2107 58/pop-to-EAX
2108
2109 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2110 5d/pop-to-EBP
2111 c3/return
2112
2113 test-next-word:
2114
2115 55/push-EBP
2116 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2117
2118
2119
2120 68/push _test-stream/imm32
2121
2122 e8/call clear-stream/disp32
2123
2124 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2125
2126 68/push 0/imm32/end
2127 68/push 0/imm32/start
2128 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2129
2130
2131 68/push " ab"/imm32
2132 68/push _test-stream/imm32
2133
2134 e8/call write/disp32
2135
2136 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2137
2138
2139 51/push-ECX
2140 68/push _test-stream/imm32
2141
2142 e8/call next-word/disp32
2143
2144 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2145
2146
2147
2148 68/push "F - test-next-word: start"/imm32
2149 68/push 0xe/imm32
2150
2151 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
2152 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-stream/imm32
2153 50/push-EAX
2154
2155 e8/call check-ints-equal/disp32
2156
2157 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2158
2159
2160
2161 68/push "F - test-next-word: end"/imm32
2162 68/push 0x10/imm32
2163
2164 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
2165 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-stream/imm32
2166 50/push-EAX
2167
2168 e8/call check-ints-equal/disp32
2169
2170 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2171
2172 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2173 5d/pop-to-EBP
2174 c3/return
2175
2176 test-next-word-returns-whole-comment:
2177
2178 55/push-EBP
2179 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2180
2181
2182
2183 68/push _test-stream/imm32
2184
2185 e8/call clear-stream/disp32
2186
2187 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2188
2189 68/push 0/imm32/end
2190 68/push 0/imm32/start
2191 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2192
2193
2194 68/push " # a"/imm32
2195 68/push _test-stream/imm32
2196
2197 e8/call write/disp32
2198
2199 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2200
2201
2202 51/push-ECX
2203 68/push _test-stream/imm32
2204
2205 e8/call next-word/disp32
2206
2207 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2208
2209
2210
2211 68/push "F - test-next-word-returns-whole-comment: start"/imm32
2212 68/push 0xe/imm32
2213
2214 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
2215 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-stream/imm32
2216 50/push-EAX
2217
2218 e8/call check-ints-equal/disp32
2219
2220 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2221
2222
2223
2224 68/push "F - test-next-word-returns-whole-comment: end"/imm32
2225 68/push 0x11/imm32
2226
2227 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
2228 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-stream/imm32
2229 50/push-EAX
2230
2231 e8/call check-ints-equal/disp32
2232
2233 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2234
2235 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2236 5d/pop-to-EBP
2237 c3/return
2238
2239 test-next-word-returns-empty-string-on-eof:
2240
2241 55/push-EBP
2242 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2243
2244
2245
2246 68/push _test-stream/imm32
2247
2248 e8/call clear-stream/disp32
2249
2250 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2251
2252 68/push 0/imm32/end
2253 68/push 0/imm32/start
2254 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2255
2256
2257
2258 51/push-ECX
2259 68/push _test-stream/imm32
2260
2261 e8/call next-word/disp32
2262
2263 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2264
2265
2266 68/push "F - test-next-word-returns-empty-string-on-eof"/imm32
2267 68/push 0/imm32
2268
2269 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
2270 2b/subtract 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
2271 50/push-EAX
2272
2273 e8/call check-ints-equal/disp32
2274
2275 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2276
2277 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2278 5d/pop-to-EBP
2279 c3/return
2280
2281 has-metadata?:
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292 55/push-EBP
2293 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2294
2295 51/push-ECX
2296 52/push-EDX
2297 56/push-ESI
2298 57/push-EDI
2299
2300 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
2301
2302 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 2/r32/EDX 4/disp8 .
2303
2304 68/push 0/imm32/end
2305 68/push 0/imm32/start
2306 89/copy 3/mod/direct 7/rm32/EDI . . . 4/r32/ESP . .
2307
2308
2309 57/push-EDI
2310 68/push 0x2f/imm32/slash
2311 52/push-EDX
2312 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
2313
2314 e8/call next-token-from-slice/disp32
2315
2316 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
2317
2318 8b/copy 1/mod/*+disp8 7/rm32/EDI . . . 1/r32/ECX 4/disp8 .
2319 $has-metadata?:loop:
2320
2321
2322 57/push-EDI
2323 68/push 0x2f/imm32/slash
2324 52/push-EDX
2325 51/push-ECX
2326
2327 e8/call next-token-from-slice/disp32
2328
2329 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
2330
2331
2332
2333 57/push-EDI
2334
2335 e8/call slice-empty?/disp32
2336
2337 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2338
2339 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32
2340 75/jump-if-not-equal $has-metadata?:false/disp8
2341
2342
2343
2344 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
2345 57/push-EDI
2346
2347 e8/call slice-equal?/disp32
2348
2349 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2350
2351 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32
2352 75/jump-if-not-equal $has-metadata?:true/disp8
2353
2354 8b/copy 1/mod/*+disp8 7/rm32/EDI . . . 1/r32/ECX 4/disp8 .
2355 eb/jump $has-metadata?:loop/disp8
2356 $has-metadata?:true:
2357 b8/copy-to-EAX 1/imm32/true
2358 eb/jump $has-metadata?:end/disp8
2359 $has-metadata?:false:
2360 b8/copy-to-EAX 0/imm32/false
2361 $has-metadata?:end:
2362
2363 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2364
2365 5f/pop-to-EDI
2366 5e/pop-to-ESI
2367 5a/pop-to-EDX
2368 59/pop-to-ECX
2369
2370 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2371 5d/pop-to-EBP
2372 c3/return
2373
2374 test-has-metadata-true:
2375
2376 55/push-EBP
2377 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2378
2379 b8/copy-to-EAX "ab/c"/imm32
2380 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2381 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2382 05/add-to-EAX 4/imm32
2383
2384 51/push-ECX
2385 50/push-EAX
2386 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
2387
2388
2389 68/push "c"/imm32
2390 56/push-ESI
2391
2392 e8/call has-metadata?/disp32
2393
2394 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x8/imm32
2395
2396
2397 68/push "F - test-has-metadata-true"/imm32
2398 68/push 1/imm32/true
2399 50/push-EAX
2400
2401 e8/call check-ints-equal/disp32
2402
2403 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2404
2405 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2406 5d/pop-to-EBP
2407 c3/return
2408
2409 test-has-metadata-false:
2410
2411 55/push-EBP
2412 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2413
2414 b8/copy-to-EAX "ab/c"/imm32
2415 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2416 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2417 05/add-to-EAX 4/imm32
2418
2419 51/push-ECX
2420 50/push-EAX
2421 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
2422
2423
2424 68/push "d"/imm32
2425 56/push-ESI
2426
2427 e8/call has-metadata?/disp32
2428
2429 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x8/imm32
2430
2431
2432 68/push "F - test-has-metadata-false"/imm32
2433 68/push 0/imm32/false
2434 50/push-EAX
2435
2436 e8/call check-ints-equal/disp32
2437
2438 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2439
2440 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2441 5d/pop-to-EBP
2442 c3/return
2443
2444 test-has-metadata-ignore-name:
2445
2446 55/push-EBP
2447 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2448
2449 b8/copy-to-EAX "a/b"/imm32
2450 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2451 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2452 05/add-to-EAX 4/imm32
2453
2454 51/push-ECX
2455 50/push-EAX
2456 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
2457
2458
2459 68/push "a"/imm32
2460 56/push-ESI
2461
2462 e8/call has-metadata?/disp32
2463
2464 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x8/imm32
2465
2466
2467 68/push "F - test-has-metadata-ignore-name"/imm32
2468 68/push 0/imm32/false
2469 50/push-EAX
2470
2471 e8/call check-ints-equal/disp32
2472
2473 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2474
2475 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2476 5d/pop-to-EBP
2477 c3/return
2478
2479 test-has-metadata-multiple-true:
2480
2481 55/push-EBP
2482 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2483
2484 b8/copy-to-EAX "a/b/c"/imm32
2485 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2486 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2487 05/add-to-EAX 4/imm32
2488
2489 51/push-ECX
2490 50/push-EAX
2491 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
2492
2493
2494 68/push "c"/imm32
2495 56/push-ESI
2496
2497 e8/call has-metadata?/disp32
2498
2499 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x8/imm32
2500
2501
2502 68/push "F - test-has-metadata-multiple-true"/imm32
2503 68/push 1/imm32/true
2504 50/push-EAX
2505
2506 e8/call check-ints-equal/disp32
2507
2508 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2509
2510 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2511 5d/pop-to-EBP
2512 c3/return
2513
2514 test-has-metadata-multiple-false:
2515
2516 55/push-EBP
2517 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2518
2519 b8/copy-to-EAX "a/b/c"/imm32
2520 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2521 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2522 05/add-to-EAX 4/imm32
2523
2524 51/push-ECX
2525 50/push-EAX
2526 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
2527
2528
2529 68/push "d"/imm32
2530 56/push-ESI
2531
2532 e8/call has-metadata?/disp32
2533
2534 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x8/imm32
2535
2536
2537 68/push "F - test-has-metadata-multiple-false"/imm32
2538 68/push 0/imm32/false
2539 50/push-EAX
2540
2541 e8/call check-ints-equal/disp32
2542
2543 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2544
2545 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2546 5d/pop-to-EBP
2547 c3/return
2548
2549
2550
2551
2552
2553 emit:
2554
2555 55/push-EBP
2556 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2557
2558 50/push-EAX
2559 56/push-ESI
2560 57/push-EDI
2561
2562 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 0xc/disp8 .
2563
2564 68/push 0/imm32/end
2565 68/push 0/imm32/start
2566 89/copy 3/mod/direct 7/rm32/EDI . . . 4/r32/ESP . .
2567
2568
2569 57/push-EDI
2570 68/push 0x2f/imm32/slash
2571 ff 6/subop/push 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 .
2572 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
2573
2574 e8/call next-token-from-slice/disp32
2575
2576 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
2577
2578
2579
2580 57/push-EDI
2581
2582 e8/call is-valid-name?/disp32
2583
2584 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2585
2586 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32
2587 74/jump-if-equal $emit:hex-int/disp8
2588 $emit:name:
2589
2590
2591 56/push-ESI
2592 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2593
2594 e8/call write-slice/disp32
2595
2596 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2597
2598
2599 68/push " "/imm32
2600 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2601
2602 e8/call write-buffered/disp32
2603
2604 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2605
2606 eb/jump $emit:end/disp8
2607
2608
2609
2610
2611
2612 $emit:hex-int:
2613
2614
2615 57/push-EDI
2616
2617 e8/call parse-hex-int/disp32
2618
2619 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2620
2621
2622 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
2623 50/push-EAX
2624 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2625
2626 e8/call emit-hex/disp32
2627
2628 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2629 $emit:end:
2630
2631 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2632
2633 5f/pop-to-EDI
2634 5e/pop-to-ESI
2635 58/pop-to-EAX
2636
2637 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2638 5d/pop-to-EBP
2639 c3/return
2640
2641 test-emit-number:
2642
2643 55/push-EBP
2644 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2645
2646
2647
2648 68/push _test-stream/imm32
2649
2650 e8/call clear-stream/disp32
2651
2652 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2653
2654
2655 b8/copy-to-EAX _test-buffered-file/imm32
2656 05/add-to-EAX 4/imm32
2657 50/push-EAX
2658
2659 e8/call clear-stream/disp32
2660
2661 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2662
2663 68/push _test-slice-three-zero-end/imm32/end
2664 68/push _test-slice-three-zero/imm32/start
2665 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2666
2667
2668 68/push 1/imm32
2669 51/push-ECX
2670 68/push _test-buffered-file/imm32
2671
2672 e8/call emit/disp32
2673
2674 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2675
2676
2677 68/push _test-buffered-file/imm32
2678
2679 e8/call flush/disp32
2680
2681 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2682
2683
2684 68/push "F - test-emit-number/1"/imm32
2685 68/push "30 "/imm32
2686 68/push _test-stream/imm32
2687
2688 e8/call check-stream-equal/disp32
2689
2690 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2691
2692 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2693 5d/pop-to-EBP
2694 c3/return
2695
2696 test-emit-negative-number:
2697
2698
2699 55/push-EBP
2700 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2701
2702
2703
2704 68/push _test-stream/imm32
2705
2706 e8/call clear-stream/disp32
2707
2708 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2709
2710
2711 b8/copy-to-EAX _test-buffered-file/imm32
2712 05/add-to-EAX 4/imm32
2713 50/push-EAX
2714
2715 e8/call clear-stream/disp32
2716
2717 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2718
2719 68/push _test-slice-negative-two-end/imm32/end
2720 68/push _test-slice-negative-two/imm32/start
2721 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2722
2723
2724 68/push 2/imm32
2725 51/push-ECX
2726 68/push _test-buffered-file/imm32
2727
2728 e8/call emit/disp32
2729
2730 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2731
2732
2733 68/push _test-buffered-file/imm32
2734
2735 e8/call flush/disp32
2736
2737 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2738
2739
2740 68/push "F - test-emit-number/1"/imm32
2741 68/push "fe ff "/imm32
2742 68/push _test-stream/imm32
2743
2744 e8/call check-stream-equal/disp32
2745
2746 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2747
2748 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2749 5d/pop-to-EBP
2750 c3/return
2751
2752 test-emit-number-with-metadata:
2753
2754 55/push-EBP
2755 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2756
2757
2758
2759 68/push _test-stream/imm32
2760
2761 e8/call clear-stream/disp32
2762
2763 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2764
2765
2766 b8/copy-to-EAX _test-buffered-file/imm32
2767 05/add-to-EAX 4/imm32
2768 50/push-EAX
2769
2770 e8/call clear-stream/disp32
2771
2772 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2773
2774 68/push _test-slice-negative-two-metadata-end/imm32/end
2775 68/push _test-slice-negative-two/imm32/start
2776 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2777
2778
2779 68/push 2/imm32
2780 51/push-ECX
2781 68/push _test-buffered-file/imm32
2782
2783 e8/call emit/disp32
2784
2785 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2786
2787
2788 68/push _test-buffered-file/imm32
2789
2790 e8/call flush/disp32
2791
2792 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2793
2794
2795
2796 68/push "F - test-emit-number-with-metadata"/imm32
2797 68/push "fe ff "/imm32
2798 68/push _test-stream/imm32
2799
2800 e8/call check-stream-equal/disp32
2801
2802 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2803
2804 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2805 5d/pop-to-EBP
2806 c3/return
2807
2808 test-emit-non-number:
2809
2810 55/push-EBP
2811 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2812
2813
2814
2815 68/push _test-stream/imm32
2816
2817 e8/call clear-stream/disp32
2818
2819 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2820
2821
2822 b8/copy-to-EAX _test-buffered-file/imm32
2823 05/add-to-EAX 4/imm32
2824 50/push-EAX
2825
2826 e8/call clear-stream/disp32
2827
2828 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2829
2830 68/push _test-slice-non-number-word-end/imm32/end
2831 68/push _test-slice-non-number-word/imm32/start
2832 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2833
2834
2835 68/push 2/imm32
2836 51/push-ECX
2837 68/push _test-buffered-file/imm32
2838
2839 e8/call emit/disp32
2840
2841 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2842
2843
2844 68/push _test-buffered-file/imm32
2845
2846 e8/call flush/disp32
2847
2848 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2849
2850
2851 68/push "F - test-emit-non-number"/imm32
2852 68/push "xyz "/imm32
2853 68/push _test-stream/imm32
2854
2855 e8/call check-stream-equal/disp32
2856
2857 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2858
2859 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2860 5d/pop-to-EBP
2861 c3/return
2862
2863 test-emit-non-number-with-metadata:
2864
2865 55/push-EBP
2866 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2867
2868
2869
2870 68/push _test-stream/imm32
2871
2872 e8/call clear-stream/disp32
2873
2874 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2875
2876
2877 b8/copy-to-EAX _test-buffered-file/imm32
2878 05/add-to-EAX 4/imm32
2879 50/push-EAX
2880
2881 e8/call clear-stream/disp32
2882
2883 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2884
2885 68/push _test-slice-non-number-word-metadata-end/imm32/end
2886 68/push _test-slice-non-number-word/imm32/start
2887 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2888
2889
2890 68/push 2/imm32
2891 51/push-ECX
2892 68/push _test-buffered-file/imm32
2893
2894 e8/call emit/disp32
2895
2896 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2897
2898
2899 68/push _test-buffered-file/imm32
2900
2901 e8/call flush/disp32
2902
2903 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2904
2905
2906 68/push "F - test-emit-non-number-with-metadata"/imm32
2907 68/push "xyz/ "/imm32
2908 68/push _test-stream/imm32
2909
2910 e8/call check-stream-equal/disp32
2911
2912 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2913
2914 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2915 5d/pop-to-EBP
2916 c3/return
2917
2918 test-emit-non-number-with-all-hex-digits-and-metadata:
2919
2920 55/push-EBP
2921 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2922
2923
2924
2925 68/push _test-stream/imm32
2926
2927 e8/call clear-stream/disp32
2928
2929 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2930
2931
2932 b8/copy-to-EAX _test-buffered-file/imm32
2933 05/add-to-EAX 4/imm32
2934 50/push-EAX
2935
2936 e8/call clear-stream/disp32
2937
2938 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2939
2940 68/push _test-slice-hexlike-non-number-word-metadata-end/imm32/end
2941 68/push _test-slice-hexlike-non-number-word/imm32/start
2942 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2943
2944
2945 68/push 2/imm32
2946 51/push-ECX
2947 68/push _test-buffered-file/imm32
2948
2949 e8/call emit/disp32
2950
2951 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2952
2953
2954 68/push _test-buffered-file/imm32
2955
2956 e8/call flush/disp32
2957
2958 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2959
2960
2961 68/push "F - test-emit-non-number-with-all-hex-digits"/imm32
2962 68/push "abcd/xyz"/imm32
2963 68/push _test-stream/imm32
2964
2965 e8/call check-stream-equal/disp32
2966
2967 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2968
2969 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2970 5d/pop-to-EBP
2971 c3/return
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981 is-valid-name?:
2982
2983 55/push-EBP
2984 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2985
2986 51/push-ECX
2987 56/push-ESI
2988
2989 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
2990
2991 8b/copy 0/mod/indirect 6/rm32/ESI . . . 1/r32/ECX . .
2992
2993 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
2994 $is-valid-name?:check0:
2995
2996 39/compare 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
2997 7d/jump-if-greater-or-equal $is-valid-name?:false/disp8
2998 $is-valid-name?:check1:
2999
3000 29/subtract 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
3001
3002 3d/compare-with-EAX 2/imm32
3003 74/jump-if-equal $is-valid-name?:false/disp8
3004 $is-valid-name?:check2:
3005
3006 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
3007 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
3008
3009 3d/compare-with-EAX 2d/imm32/-
3010 74/jump-if-equal $is-valid-name?:false/disp8
3011 $is-valid-name?:check3a:
3012
3013 3d/compare-with-EAX 30/imm32/0
3014 7c/jump-if-lesser $is-valid-name?:true/disp8
3015 $is-valid-name?:check3b:
3016
3017 3d/compare-with-EAX 39/imm32/9
3018 7f/jump-if-greater $is-valid-name?:true/disp8
3019 $is-valid-name?:false:
3020
3021 b8/copy-to-EAX 0/imm32/false
3022 eb/jump $is-valid-name?:end/disp8
3023 $is-valid-name?:true:
3024
3025 b8/copy-to-EAX 1/imm32/true
3026 $is-valid-name?:end:
3027
3028 5e/pop-to-ESI
3029 59/pop-to-ECX
3030
3031 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3032 5d/pop-to-EBP
3033 c3/return
3034
3035 test-is-valid-name-digit-prefix:
3036
3037 55/push-EBP
3038 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3039
3040 68/push _test-slice-hex-int-end/imm32
3041 68/push _test-slice-hex-int/imm32
3042 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3043
3044
3045 51/push-ECX
3046
3047 e8/call is-valid-name?/disp32
3048
3049 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3050
3051
3052 68/push "F - test-is-valid-name-digit-prefix"/imm32
3053 68/push 0/imm32/false
3054 50/push-EAX
3055
3056 e8/call check-ints-equal/disp32
3057
3058 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3059
3060 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3061 5d/pop-to-EBP
3062 c3/return
3063
3064 test-is-valid-name-negative-prefix:
3065
3066 55/push-EBP
3067 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3068
3069 68/push _test-slice-hex-int-with-0x-prefix-end/imm32
3070 68/push _test-slice-hex-int-with-0x-prefix-negative/imm32
3071 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3072
3073
3074 51/push-ECX
3075
3076 e8/call is-valid-name?/disp32
3077
3078 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3079
3080
3081 68/push "F - test-is-valid-name-negative-prefix"/imm32
3082 68/push 0/imm32/false
3083 50/push-EAX
3084
3085 e8/call check-ints-equal/disp32
3086
3087 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3088
3089 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3090 5d/pop-to-EBP
3091 c3/return
3092
3093 test-is-valid-name-0x-prefix:
3094
3095 55/push-EBP
3096 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3097
3098 68/push _test-slice-hex-int-with-0x-prefix-end/imm32
3099 68/push _test-slice-hex-int-with-0x-prefix/imm32
3100 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3101
3102
3103 51/push-ECX
3104
3105 e8/call is-valid-name?/disp32
3106
3107 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3108
3109
3110 68/push "F - test-is-valid-name-0x-prefix"/imm32
3111 68/push 0/imm32/false
3112 50/push-EAX
3113
3114 e8/call check-ints-equal/disp32
3115
3116 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3117
3118 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3119 5d/pop-to-EBP
3120 c3/return
3121
3122 test-is-valid-name-starts-with-pre-digit:
3123
3124 55/push-EBP
3125 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3126
3127 68/push _test-slice-with-slash-prefix-end/imm32
3128 68/push _test-slice-with-slash-prefix/imm32
3129 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3130
3131
3132 51/push-ECX
3133
3134 e8/call is-valid-name?/disp32
3135
3136 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3137
3138
3139 68/push "F - test-is-valid-name-starts-with-pre-digit"/imm32
3140 68/push 1/imm32/true
3141 50/push-EAX
3142
3143 e8/call check-ints-equal/disp32
3144
3145 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3146
3147 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3148 5d/pop-to-EBP
3149 c3/return
3150
3151 test-is-valid-name-starts-with-post-digit:
3152
3153 55/push-EBP
3154 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3155
3156 68/push _test-slice-char-and-digits-end/imm32
3157 68/push _test-slice-char-and-digits/imm32
3158 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3159
3160
3161 51/push-ECX
3162
3163 e8/call is-valid-name?/disp32
3164
3165 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3166
3167
3168 68/push "F - test-is-valid-name-starts-with-post-digit"/imm32
3169 68/push 1/imm32/true
3170 50/push-EAX
3171
3172 e8/call check-ints-equal/disp32
3173
3174 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3175
3176 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3177 5d/pop-to-EBP
3178 c3/return
3179
3180 test-is-valid-name-starts-with-digit:
3181
3182 55/push-EBP
3183 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3184
3185 68/push _test-slice-hex-int-with-0x-prefix-end/imm32
3186 68/push _test-slice-hex-int-with-0x-prefix/imm32
3187 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3188
3189
3190 51/push-ECX
3191
3192 e8/call is-valid-name?/disp32
3193
3194 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3195
3196
3197 68/push "F - test-is-valid-name-starts-with-digit"/imm32
3198 68/push 0/imm32/false
3199 50/push-EAX
3200
3201 e8/call check-ints-equal/disp32
3202
3203 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3204
3205 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3206 5d/pop-to-EBP
3207 c3/return
3208
3209
3210 emit-hex:
3211
3212 55/push-EBP
3213 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3214
3215 50/push-EAX
3216 51/push-ECX
3217 52/push-EDX
3218 53/push-EBX
3219 57/push-EDI
3220
3221 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 8/disp8 .
3222
3223 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 3/r32/EBX 0xc/disp8 .
3224
3225 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 2/r32/EDX 0x10/disp8 .
3226
3227 31/xor 3/mod/direct 1/rm32/ECX . . . 1/r32/ECX . .
3228 $emit-hex:loop:
3229
3230 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
3231 7d/jump-if-greater-or-equal $emit-hex:end/disp8
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248 53/push-EBX
3249 57/push-EDI
3250
3251 e8/call print-byte/disp32
3252
3253 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3254
3255
3256 68/push 0x20/imm32/space
3257 57/push-EDI
3258
3259 e8/call write-byte/disp32
3260
3261 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3262
3263 c1/shift 5/subop/logic-right 3/mod/direct 3/rm32/EBX . . . . . 8/imm8
3264
3265
3266 41/increment-ECX
3267 eb/jump $emit-hex:loop/disp8
3268 $emit-hex:end:
3269
3270 5f/pop-to-EDI
3271 5b/pop-to-EBX
3272 5a/pop-to-EDX
3273 59/pop-to-ECX
3274 58/pop-to-EAX
3275
3276 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3277 5d/pop-to-EBP
3278 c3/return
3279
3280 test-emit-hex-single-byte:
3281
3282
3283
3284 68/push _test-stream/imm32
3285
3286 e8/call clear-stream/disp32
3287
3288 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3289
3290
3291 b8/copy-to-EAX _test-buffered-file/imm32
3292 05/add-to-EAX 4/imm32
3293 50/push-EAX
3294
3295 e8/call clear-stream/disp32
3296
3297 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3298
3299
3300 68/push 1/imm32
3301 68/push 0xab/imm32
3302 68/push _test-buffered-file/imm32
3303
3304 e8/call emit-hex/disp32
3305
3306 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3307
3308
3309 68/push _test-buffered-file/imm32
3310
3311 e8/call flush/disp32
3312
3313 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3314
3315
3316 68/push "F - test-emit-hex-single-byte"/imm32
3317 68/push 0x206261/imm32
3318
3319 b8/copy-to-EAX _test-stream/imm32
3320 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
3321
3322 e8/call check-ints-equal/disp32
3323
3324 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3325
3326 c3/return
3327
3328 test-emit-hex-multiple-byte:
3329
3330
3331
3332 68/push _test-stream/imm32
3333
3334 e8/call clear-stream/disp32
3335
3336 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3337
3338
3339 b8/copy-to-EAX _test-buffered-file/imm32
3340 05/add-to-EAX 4/imm32
3341 50/push-EAX
3342
3343 e8/call clear-stream/disp32
3344
3345 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3346
3347
3348 68/push 2/imm32
3349 68/push 0x1234/imm32
3350 68/push _test-buffered-file/imm32
3351
3352 e8/call emit-hex/disp32
3353
3354 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3355
3356
3357 68/push _test-buffered-file/imm32
3358
3359 e8/call flush/disp32
3360
3361 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3362
3363
3364 68/push "F - test-emit-hex-multiple-byte/1"/imm32
3365 68/push "34 12 "/imm32
3366 68/push _test-stream/imm32
3367
3368 e8/call check-stream-equal/disp32
3369
3370 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3371
3372 c3/return
3373
3374 test-emit-hex-zero-pad:
3375
3376
3377
3378 68/push _test-stream/imm32
3379
3380 e8/call clear-stream/disp32
3381
3382 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3383
3384
3385 b8/copy-to-EAX _test-buffered-file/imm32
3386 05/add-to-EAX 4/imm32
3387 50/push-EAX
3388
3389 e8/call clear-stream/disp32
3390
3391 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3392
3393
3394 68/push 2/imm32
3395 68/push 0xab/imm32
3396 68/push _test-buffered-file/imm32
3397
3398 e8/call emit-hex/disp32
3399
3400 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3401
3402
3403 68/push _test-buffered-file/imm32
3404
3405 e8/call flush/disp32
3406
3407 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3408
3409
3410 68/push "F - test-emit-hex-zero-pad/1"/imm32
3411 68/push "ab 00 "/imm32
3412 68/push _test-stream/imm32
3413
3414 e8/call check-stream-equal/disp32
3415
3416 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3417
3418 c3/return
3419
3420 test-emit-hex-negative:
3421
3422
3423
3424 68/push _test-stream/imm32
3425
3426 e8/call clear-stream/disp32
3427
3428 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3429
3430
3431 b8/copy-to-EAX _test-buffered-file/imm32
3432 05/add-to-EAX 4/imm32
3433 50/push-EAX
3434
3435 e8/call clear-stream/disp32
3436
3437 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3438
3439
3440 68/push 2/imm32
3441 68/push -1/imm32
3442 68/push _test-buffered-file/imm32
3443
3444 e8/call emit-hex/disp32
3445
3446 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3447
3448
3449 68/push _test-buffered-file/imm32
3450
3451 e8/call flush/disp32
3452
3453 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3454
3455
3456 68/push "F - test-emit-hex-negative/1"/imm32
3457 68/push "ff ff "/imm32
3458 68/push _test-stream/imm32
3459
3460 e8/call check-stream-equal/disp32
3461
3462 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3463
3464 c3/return
3465
3466 == data
3467
3468 _test-slice-negative-two:
3469 2d/- 32/2
3470 _test-slice-negative-two-end:
3471 2f/slash 66/f 6f/o 6f/o
3472 _test-slice-negative-two-metadata-end:
3473
3474 _test-slice-three-zero:
3475 33/3 30/0
3476 _test-slice-three-zero-end:
3477
3478 _test-slice-non-number-word:
3479 78/x 79/y 7a/z
3480 _test-slice-non-number-word-end:
3481 2f/slash
3482 _test-slice-non-number-word-metadata-end:
3483
3484 _test-input-stream:
3485
3486 0/imm32
3487
3488 0/imm32
3489
3490 0x20/imm32
3491
3492 00 00 00 00 00 00 00 00
3493 00 00 00 00 00 00 00 00
3494 00 00 00 00 00 00 00 00
3495 00 00 00 00 00 00 00 00
3496
3497
3498 _test-input-buffered-file:
3499
3500 _test-input-stream/imm32
3501
3502 0/imm32
3503
3504 0/imm32
3505
3506 6/imm32
3507
3508 00 00 00 00 00 00
3509
3510 _test-output-stream:
3511
3512 0/imm32
3513
3514 0/imm32
3515
3516 0x20/imm32
3517
3518 00 00 00 00 00 00 00 00
3519 00 00 00 00 00 00 00 00
3520 00 00 00 00 00 00 00 00
3521 00 00 00 00 00 00 00 00
3522
3523
3524 _test-output-buffered-file:
3525
3526 _test-output-stream/imm32
3527
3528 0/imm32
3529
3530 0/imm32
3531
3532 6/imm32
3533
3534 00 00 00 00 00 00
3535
3536 _test-slice-hexlike-non-number-word:
3537 61/a 62/b 63/c 64/d
3538 _test-slice-hexlike-non-number-word-end:
3539 2f/slash
3540 78/x 79/y 7a/z
3541 _test-slice-hexlike-non-number-word-metadata-end:
3542
3543 _test-slice-with-slash-prefix:
3544 2f/slash 30/0 33/3
3545 _test-slice-with-slash-prefix-end:
3546
3547