https://github.com/akkartik/mu/blob/main/linux/labels_baremetal.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37 == code
38
39
40
41
42 Entry:
43
44 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
45
46
47
48 68/push Heap/imm32
49 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Heap-size/disp32
50
51 e8/call new-segment/disp32
52
53 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
54
55
56 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-size/disp32
57
58 e8/call initialize-trace-stream/disp32
59
60 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
61
62
63
64 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 0/disp8 1/imm32
65 7e/jump-if-<= $subx-labels-main:interactive/disp8
66
67
68
69 68/push "test"/imm32
70 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
71
72 e8/call kernel-string-equal?/disp32
73
74 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
75
76 3d/compare-eax-and 0/imm32/false
77 74/jump-if-= $subx-labels-main:interactive/disp8
78
79
80 e8/call run-tests/disp32
81
82 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/ebx Num-test-failures/disp32
83 eb/jump $subx-labels-main:end/disp8
84 $subx-labels-main:interactive:
85
86
87
88 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x1000/imm32
89
90 68/push 0x1000/imm32
91
92 68/push 0/imm32/read
93
94 68/push 0/imm32/write
95
96 bb/copy-to-ebx Label-file/imm32
97 b9/copy-to-ecx 0/imm32/read-mode
98 ba/copy-to-edx 0x180/imm32/permissions
99 e8/call syscall_open/disp32
100 50/push-eax
101 89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . .
102
103
104 68/push Stdout/imm32
105 56/push-esi
106 68/push Stdin/imm32
107
108 e8/call subx-labels/disp32
109
110 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
111
112
113
114
115
116
117
118
119
120 bb/copy-to-ebx 0/imm32
121 $subx-labels-main:end:
122 e8/call syscall_exit/disp32
123
124 == data
125
126 Label-file:
127 6c/l 61/a 62/b 65/e 6c/l 73/s 00/nul
128
129 == code
130
131 subx-labels:
132
133
134
135
136
137
138
139
140 55/push-ebp
141 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
142
143 52/push-edx
144 56/push-esi
145
146
147
148 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Max-labels/disp32
149
150 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Max-labels/disp32
151
152 68/push 0/imm32/read
153
154 68/push 0/imm32/write
155 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
156
157
158 52/push-edx
159 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
160
161 e8/call load-labels/disp32
162
163 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
164
165
166 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Input-size/disp32
167
168 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Input-size/disp32
169
170 68/push 0/imm32/read
171
172 68/push 0/imm32/write
173 89/copy 3/mod/direct 6/rm32/esi . . . 4/r32/esp . .
174
175
176 56/push-esi
177 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
178
179 e8/call slurp/disp32
180
181 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
182
183
184 52/push-edx
185 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
186 56/push-esi
187
188 e8/call emit-output/disp32
189
190 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
191
192
193 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
194
195 e8/call flush/disp32
196
197 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
198 $subx-labels:end:
199
200 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x18/imm32
201 03/add 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Max-labels/disp32
202 03/add 0/mod/indirect 5/rm32/.disp32 . . 4/r32/esp Input-size/disp32
203
204 5e/pop-to-esi
205 5a/pop-to-edx
206
207 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
208 5d/pop-to-ebp
209 c3/return
210
211 load-labels:
212
213
214
215
216
217
218
219
220
221
222
223
224
225 55/push-ebp
226 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
227
228 50/push-eax
229 51/push-ecx
230 52/push-edx
231 56/push-esi
232 57/push-edi
233
234 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32
235 68/push 0x200/imm32/size
236 68/push 0/imm32/read
237 68/push 0/imm32/write
238 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
239
240 68/push 0/imm32/end
241 68/push 0/imm32/start
242 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
243 $load-labels:loop:
244
245
246 51/push-ecx
247
248 e8/call clear-stream/disp32
249
250 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
251
252
253 51/push-ecx
254 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
255
256 e8/call read-line-buffered/disp32
257
258 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
259 +-- 33 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------
292
293 81 7/subop/compare 0/mod/indirect 1/rm32/ecx . . . . . 0/imm32
294 0f 84/jump-if-= $load-labels:end/disp32
295
296
297 52/push-edx
298 51/push-ecx
299
300 e8/call next-word/disp32
301
302 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
303 +-- 33 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------
336
337
338
339 68/push Heap/imm32
340 68/push 0xc/imm32/row-size
341 52/push-edx
342 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
343
344 e8/call insert-slice-or-abort/disp32
345
346 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
347
348 89/copy 3/mod/direct 7/rm32/edi . . . 0/r32/eax . .
349
350
351 52/push-edx
352 51/push-ecx
353
354 e8/call next-word/disp32
355
356 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
357
358
359 52/push-edx
360
361 e8/call parse-hex-int-from-slice/disp32
362
363 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
364
365 89/copy 3/mod/direct 6/rm32/esi . . . 0/r32/eax . .
366
367 89/copy 0/mod/indirect 7/rm32/edi . . 6/r32/esi . .
368
369 e9/jump $load-labels:loop/disp32
370 $load-labels:end:
371
372 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x214/imm32
373
374 5f/pop-to-edi
375 5e/pop-to-esi
376 5a/pop-to-edx
377 59/pop-to-ecx
378 58/pop-to-eax
379
380 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
381 5d/pop-to-ebp
382 c3/return
383
384
385 == data
386
387 emit-output:datum:
388 0/imm32/start
389 0/imm32/end
390
391 == code
392
393 emit-output:
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462 55/push-ebp
463 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
464
465 50/push-eax
466 51/push-ecx
467 52/push-edx
468 53/push-ebx
469 56/push-esi
470 57/push-edi
471
472 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0x200/imm32
473 68/push 0x200/imm32/size
474 68/push 0/imm32/read
475 68/push 0/imm32/write
476 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
477
478 68/push 0/imm32/end
479 68/push 0/imm32/start
480 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
481
482 bb/copy-to-ebx 0x7c00/imm32
483 $emit-output:line-loop:
484
485
486 51/push-ecx
487
488 e8/call clear-stream/disp32
489
490 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
491
492
493 51/push-ecx
494 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
495
496 e8/call read-line/disp32
497
498 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
499 +-- 33 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------
532 $emit-output:check-for-end-of-input:
533
534 81 7/subop/compare 0/mod/indirect 1/rm32/ecx . . . . . 0/imm32
535 0f 84/jump-if-= $emit-output:end/disp32
536
537
538
539 51/push-ecx
540
541 e8/call num-bytes/disp32
542
543 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
544
545 01/add 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
546
547
548 51/push-ecx
549
550 e8/call far-jump-or-call?/disp32
551
552 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
553
554
555 51/push-ecx
556
557 e8/call rewind-stream/disp32
558
559 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
560 $emit-output:word-loop:
561
562
563 52/push-edx
564 51/push-ecx
565
566 e8/call next-word/disp32
567
568 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
569 +-- 33 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------
602 $emit-output:check-for-end-of-line:
603
604
605
606 52/push-edx
607
608 e8/call slice-empty?/disp32
609
610 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
611
612 3d/compare-eax-and 0/imm32/false
613 0f 85/jump-if-!= $emit-output:next-line/disp32
614 $emit-output:check-for-comment:
615
616
617 8b/copy 0/mod/indirect 2/rm32/edx . . . 6/r32/esi . .
618
619 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
620 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . .
621
622 3d/compare-eax-and 0x23/imm32/hash
623 0f 84/jump-if-= $emit-output:next-line/disp32
624 $emit-output:check-for-label:
625
626
627
628 52/push-edx
629
630 e8/call label?/disp32
631
632 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
633
634 3d/compare-eax-and 0/imm32/false
635 0f 85/jump-if-!= $emit-output:line-loop/disp32
636 $emit-output:check-for-segment-header:
637
638
639
640 68/push "=="/imm32
641 52/push-edx
642
643 e8/call slice-equal?/disp32
644
645 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
646
647 3d/compare-eax-and 0/imm32/false
648 0f 84/jump-if-= $emit-output:2-character/disp32
649
650
651
652 52/push-edx
653 51/push-ecx
654
655 e8/call next-word/disp32
656
657 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
658
659
660
661 52/push-edx
662 51/push-ecx
663
664 e8/call next-word/disp32
665
666 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
667
668
669 52/push-edx
670
671 e8/call slice-empty?/disp32
672
673 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
674
675 3d/compare-eax-and 0/imm32/false
676 0f 85/jump-if-!= $emit-output:padding-done/disp32
677
678
679 52/push-edx
680
681 e8/call parse-hex-int-from-slice/disp32
682
683 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
684
685
686
687 68/push "# "/imm32
688 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
689
690 e8/call write-buffered/disp32
691
692 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
693
694
695 53/push-ebx
696 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
697
698 e8/call write-int32-hex-buffered/disp32
699
700 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
701
702
703 68/push Newline/imm32
704 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
705
706 e8/call write-buffered/disp32
707
708 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
709 $emit-output:padding-loop:
710
711 39/compare 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
712 73/jump-if-addr>= $emit-output:padding-loop-done/disp8
713
714 53/push-ebx
715 81 4/subop/and 3/mod/direct 3/rm32/ebx . . . . . 7/imm32
716 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0/imm32
717 5b/pop-to-ebx
718 75/jump-if-!= $emit-output:padding-core/disp8
719
720
721 68/push Newline/imm32
722 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
723
724 e8/call write-buffered/disp32
725
726 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
727 $emit-output:padding-core:
728
729
730 68/push "00 "/imm32
731 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
732
733 e8/call write-buffered/disp32
734
735 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
736
737 43/increment-ebx
738
739 eb/jump $emit-output:padding-loop/disp8
740 $emit-output:padding-loop-done:
741
742
743 68/push Newline/imm32
744 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
745
746 e8/call write-buffered/disp32
747
748 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
749 $emit-output:padding-done:
750
751
752
753 68/push "# "/imm32
754 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
755
756 e8/call write-buffered/disp32
757
758 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
759
760
761 53/push-ebx
762 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
763
764 e8/call write-int32-hex-buffered/disp32
765
766 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
767
768
769 68/push Newline/imm32
770 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
771
772 e8/call write-buffered/disp32
773
774 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
775
776 e9/jump $emit-output:line-loop/disp32
777 $emit-output:2-character:
778
779
780 8b/copy 1/mod/*+disp8 2/rm32/edx . . . 0/r32/eax 4/disp8 .
781 2b/subtract 0/mod/indirect 2/rm32/edx . . . 0/r32/eax . .
782
783 3d/compare-eax-and 2/imm32
784 75/jump-if-!= $emit-output:check-metadata/disp8
785
786
787 52/push-edx
788 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
789
790 e8/call write-slice-buffered/disp32
791
792 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
793
794
795 68/push Space/imm32
796 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
797
798 e8/call write-buffered/disp32
799
800 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
801
802 e9/jump $emit-output:word-loop/disp32
803 $emit-output:check-metadata:
804
805
806
807 68/push emit-output:datum/imm32
808 68/push 0x2f/imm32/slash
809 ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
810 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
811
812 e8/call next-token-from-slice/disp32
813
814 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
815 +-- 33 lines: #? # dump datum -------------------------------------------------------------------------------------------------------------------------------------------------------
848
849
850
851 68/push "label table"/imm32
852 68/push 0xc/imm32/row-size
853 68/push emit-output:datum/imm32
854 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
855
856 e8/call get-slice/disp32
857
858 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
859
860 89/copy 3/mod/direct 6/rm32/esi . . . 0/r32/eax . .
861 $emit-output:check-imm8:
862
863
864
865 68/push "imm8"/imm32
866 52/push-edx
867
868 e8/call has-metadata?/disp32
869
870 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
871
872 3d/compare-eax-and 0/imm32/false
873 74/jump-if-= $emit-output:check-imm16/disp8
874 $emit-output:emit-imm8:
875
876
877 68/push 1/imm32
878 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
879 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
880
881 e8/call emit-hex/disp32
882
883 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
884
885 e9/jump $emit-output:word-loop/disp32
886 $emit-output:check-imm16:
887
888
889
890 68/push "imm16"/imm32
891 52/push-edx
892
893 e8/call has-metadata?/disp32
894
895 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
896
897 3d/compare-eax-and 0/imm32/false
898 74/jump-if-= $emit-output:check-imm32/disp8
899 +-- 33 lines: #? # dump *address ----------------------------------------------------------------------------------------------------------------------------------------------------
932 $emit-output:emit-imm16:
933
934
935 68/push 2/imm32
936 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
937 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
938
939 e8/call emit-hex/disp32
940
941 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
942
943
944 e9/jump $emit-output:word-loop/disp32
945 $emit-output:check-imm32:
946
947
948
949 68/push "imm32"/imm32
950 52/push-edx
951
952 e8/call has-metadata?/disp32
953
954 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
955
956 3d/compare-eax-and 0/imm32/false
957 74/jump-if-= $emit-output:check-disp8/disp8
958 +-- 33 lines: #? # dump *address ----------------------------------------------------------------------------------------------------------------------------------------------------
991 $emit-output:emit-imm32:
992
993
994 68/push 4/imm32
995 ff 6/subop/push 0/mod/indirect 6/rm32/esi . . . . . .
996 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
997
998 e8/call emit-hex/disp32
999
1000 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1001
1002 e9/jump $emit-output:word-loop/disp32
1003 $emit-output:check-disp8:
1004
1005
1006
1007 68/push "disp8"/imm32
1008 52/push-edx
1009
1010 e8/call has-metadata?/disp32
1011
1012 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1013
1014 3d/compare-eax-and 0/imm32/false
1015 74/jump-if-= $emit-output:check-disp16/disp8
1016 $emit-output:emit-disp8:
1017
1018 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
1019 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
1020
1021 3d/compare-eax-and 0x7f/imm32
1022 0f 8f/jump-if-> $emit-output:error-disp8-too-large/disp32
1023
1024 3d/compare-eax-and -0x80/imm32
1025 0f 8c/jump-if-< $emit-output:error-disp8-too-large/disp32
1026
1027
1028 68/push 1/imm32
1029 50/push-eax
1030 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1031
1032 e8/call emit-hex/disp32
1033
1034 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1035
1036 e9/jump $emit-output:word-loop/disp32
1037 $emit-output:check-disp16:
1038
1039
1040
1041 68/push "disp16"/imm32
1042 52/push-edx
1043
1044 e8/call has-metadata?/disp32
1045
1046 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1047
1048 3d/compare-eax-and 0/imm32/false
1049 74/jump-if-= $emit-output:check-disp32/disp8
1050 $emit-output:emit-disp16:
1051
1052
1053 68/push 2/imm32
1054 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
1055 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
1056 50/push-eax
1057 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1058
1059 e8/call emit-hex/disp32
1060
1061 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1062
1063 e9/jump $emit-output:word-loop/disp32
1064 $emit-output:check-disp32:
1065
1066
1067
1068 68/push "disp32"/imm32
1069 52/push-edx
1070
1071 e8/call has-metadata?/disp32
1072
1073 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1074
1075 3d/compare-eax-and 0/imm32/false
1076 0f 84/jump-if-= $emit-output:abort/disp32
1077 $emit-output:emit-disp32:
1078
1079 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
1080
1081 81 7/subop/compare 3/mod/direct 7/rm32/edi . . . . . 0/imm32/false
1082 74/jump-if-= $emit-output:really-emit-disp32/disp8
1083 29/subtract 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
1084 $emit-output:really-emit-disp32:
1085
1086
1087 68/push 4/imm32
1088 50/push-eax
1089 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1090
1091 e8/call emit-hex/disp32
1092
1093 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1094
1095 e9/jump $emit-output:word-loop/disp32
1096 $emit-output:next-line:
1097
1098
1099 68/push Newline/imm32
1100 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
1101
1102 e8/call write-buffered/disp32
1103
1104 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1105
1106 e9/jump $emit-output:line-loop/disp32
1107 $emit-output:end:
1108
1109 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x214/imm32
1110
1111 5f/pop-to-edi
1112 5e/pop-to-esi
1113 5b/pop-to-ebx
1114 5a/pop-to-edx
1115 59/pop-to-ecx
1116 58/pop-to-eax
1117
1118 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1119 5d/pop-to-ebp
1120 c3/return
1121
1122 $emit-output:abort:
1123
1124
1125
1126 68/push "emit-output: missing metadata in "/imm32
1127 68/push 2/imm32/stderr
1128
1129 e8/call _write/disp32
1130
1131 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1132
1133
1134 52/push-edx
1135 68/push Stderr/imm32
1136
1137 e8/call write-slice-buffered/disp32
1138
1139 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1140
1141
1142 68/push Stderr/imm32
1143
1144 e8/call flush/disp32
1145
1146 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1147
1148 bb/copy-to-ebx 1/imm32
1149 e8/call syscall_exit/disp32
1150
1151
1152 $emit-output:error-disp8-too-large:
1153
1154
1155
1156 52/push-edx
1157 68/push Stderr/imm32
1158
1159 e8/call write-slice-buffered/disp32
1160
1161 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1162
1163
1164 68/push Stderr/imm32
1165
1166 e8/call flush/disp32
1167
1168 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1169
1170
1171 68/push ": label too far below for /disp8; use /disp32"/imm32
1172 68/push 2/imm32/stderr
1173
1174 e8/call _write/disp32
1175
1176 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1177
1178 bb/copy-to-ebx 1/imm32
1179 e8/call syscall_exit/disp32
1180
1181
1182 $emit-output:error-disp8-too-small:
1183
1184
1185
1186 52/push-edx
1187 68/push Stderr/imm32
1188
1189 e8/call write-slice-buffered/disp32
1190
1191 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1192
1193
1194 68/push Stderr/imm32
1195
1196 e8/call flush/disp32
1197
1198 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1199
1200
1201 68/push ": label too far above for /disp8; use /disp32"/imm32
1202 68/push 2/imm32/stderr
1203
1204 e8/call _write/disp32
1205
1206 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1207
1208 bb/copy-to-ebx 1/imm32
1209 e8/call syscall_exit/disp32
1210
1211
1212 test-emit-output-non-far-control-flow:
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233 55/push-ebp
1234 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1235
1236
1237
1238 68/push _test-input-stream/imm32
1239
1240 e8/call clear-stream/disp32
1241
1242 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1243
1244
1245 68/push _test-output-stream/imm32
1246
1247 e8/call clear-stream/disp32
1248
1249 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1250
1251
1252 68/push $_test-output-buffered-file->buffer/imm32
1253
1254 e8/call clear-stream/disp32
1255
1256 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1257
1258 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
1259 68/push 0xc0/imm32/size
1260 68/push 0/imm32/read
1261 68/push 0/imm32/write
1262 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1263
1264 68/push 0/imm32
1265 68/push 0/imm32
1266 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
1267
1268
1269
1270 68/push "== code\n"/imm32
1271 68/push _test-input-stream/imm32
1272
1273 e8/call write/disp32
1274
1275 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1276
1277
1278 68/push "ab cd ef gh\n"/imm32
1279 68/push _test-input-stream/imm32
1280
1281 e8/call write/disp32
1282
1283 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1284
1285
1286 68/push "ij x/disp32\n"/imm32
1287 68/push _test-input-stream/imm32
1288
1289 e8/call write/disp32
1290
1291 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1292
1293
1294 68/push "== data\n"/imm32
1295 68/push _test-input-stream/imm32
1296
1297 e8/call write/disp32
1298
1299 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1300
1301
1302 68/push "00\n"/imm32
1303 68/push _test-input-stream/imm32
1304
1305 e8/call write/disp32
1306
1307 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1308
1309
1310 68/push "34\n"/imm32
1311 68/push _test-input-stream/imm32
1312
1313 e8/call write/disp32
1314
1315 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1316
1317 68/push 0x11223344/imm32/label-address
1318
1319 53/push-ebx
1320 68/push "x"/imm32
1321 68/push Heap/imm32
1322 e8/call copy-array/disp32
1323 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1324 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1325 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1326
1327 52/push-edx
1328
1329 e8/call stream-add2/disp32
1330
1331 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1332
1333
1334
1335 52/push-edx
1336 68/push _test-output-buffered-file/imm32
1337 68/push _test-input-stream/imm32
1338
1339 e8/call emit-output/disp32
1340
1341 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1342
1343
1344
1345 68/push _test-output-buffered-file/imm32
1346
1347 e8/call flush/disp32
1348
1349 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1350 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------
1383
1384
1385 68/push "F - test-emit-output-non-far-control-flow/0"/imm32
1386 68/push "# 0x00007c00"/imm32
1387 68/push _test-output-stream/imm32
1388
1389 e8/call check-next-stream-line-equal/disp32
1390
1391 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1392
1393
1394 68/push "F - test-emit-output-non-far-control-flow/1"/imm32
1395 68/push "ab cd ef gh "/imm32
1396 68/push _test-output-stream/imm32
1397
1398 e8/call check-next-stream-line-equal/disp32
1399
1400 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1401
1402
1403 68/push "F - test-emit-output-non-far-control-flow/2"/imm32
1404 68/push "ij 44 33 22 11 "/imm32
1405 68/push _test-output-stream/imm32
1406
1407 e8/call check-next-stream-line-equal/disp32
1408
1409 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1410
1411
1412 68/push "F - test-emit-output-non-far-control-flow/3"/imm32
1413 68/push "# 0x00007c09"/imm32
1414 68/push _test-output-stream/imm32
1415
1416 e8/call check-next-stream-line-equal/disp32
1417
1418 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1419
1420
1421 68/push "F - test-emit-output-non-far-control-flow/3"/imm32
1422 68/push "00 "/imm32
1423 68/push _test-output-stream/imm32
1424
1425 e8/call check-next-stream-line-equal/disp32
1426
1427 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1428
1429
1430 68/push "F - test-emit-output-non-far-control-flow/4"/imm32
1431 68/push "34 "/imm32
1432 68/push _test-output-stream/imm32
1433
1434 e8/call check-next-stream-line-equal/disp32
1435
1436 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1437
1438 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1439 5d/pop-to-ebp
1440 c3/return
1441
1442 test-emit-output-with-padding:
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461 55/push-ebp
1462 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1463
1464
1465
1466 68/push _test-input-stream/imm32
1467
1468 e8/call clear-stream/disp32
1469
1470 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1471
1472
1473 68/push _test-output-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-buffered-file->buffer/imm32
1481
1482 e8/call clear-stream/disp32
1483
1484 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1485
1486 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
1487 68/push 0xc0/imm32/size
1488 68/push 0/imm32/read
1489 68/push 0/imm32/write
1490 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1491
1492 68/push 0/imm32
1493 68/push 0/imm32
1494 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
1495
1496
1497
1498 68/push "== code\n"/imm32
1499 68/push _test-input-stream/imm32
1500
1501 e8/call write/disp32
1502
1503 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1504
1505
1506 68/push "ab cd ef gh\n"/imm32
1507 68/push _test-input-stream/imm32
1508
1509 e8/call write/disp32
1510
1511 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1512
1513
1514 68/push "== data 0x7c10\n"/imm32
1515 68/push _test-input-stream/imm32
1516
1517 e8/call write/disp32
1518
1519 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1520
1521
1522 68/push "34\n"/imm32
1523 68/push _test-input-stream/imm32
1524
1525 e8/call write/disp32
1526
1527 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1528
1529
1530
1531 52/push-edx
1532 68/push _test-output-buffered-file/imm32
1533 68/push _test-input-stream/imm32
1534
1535 e8/call emit-output/disp32
1536
1537 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1538
1539
1540
1541 68/push _test-output-buffered-file/imm32
1542
1543 e8/call flush/disp32
1544
1545 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1546 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------
1579
1580
1581 68/push "F - test-emit-output-with-padding/0"/imm32
1582 68/push "# 0x00007c00"/imm32
1583 68/push _test-output-stream/imm32
1584
1585 e8/call check-next-stream-line-equal/disp32
1586
1587 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1588
1589
1590 68/push "F - test-emit-output-with-padding/1"/imm32
1591 68/push "ab cd ef gh "/imm32
1592 68/push _test-output-stream/imm32
1593
1594 e8/call check-next-stream-line-equal/disp32
1595
1596 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1597
1598
1599 68/push "F - test-emit-output-with-padding/0"/imm32
1600 68/push "# 0x00007c04"/imm32
1601 68/push _test-output-stream/imm32
1602
1603 e8/call check-next-stream-line-equal/disp32
1604
1605 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1606
1607
1608 68/push "F - test-emit-output-with-padding/2"/imm32
1609 68/push "00 00 00 00 "/imm32
1610 68/push _test-output-stream/imm32
1611
1612 e8/call check-next-stream-line-equal/disp32
1613
1614 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1615
1616
1617 68/push "F - test-emit-output-with-padding/3"/imm32
1618 68/push "00 00 00 00 00 00 00 00 "/imm32
1619 68/push _test-output-stream/imm32
1620
1621 e8/call check-next-stream-line-equal/disp32
1622
1623 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1624
1625
1626 68/push "F - test-emit-output-with-padding/0"/imm32
1627 68/push "# 0x00007c10"/imm32
1628 68/push _test-output-stream/imm32
1629
1630 e8/call check-next-stream-line-equal/disp32
1631
1632 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1633
1634
1635 68/push "F - test-emit-output-with-padding/4"/imm32
1636 68/push "34 "/imm32
1637 68/push _test-output-stream/imm32
1638
1639 e8/call check-next-stream-line-equal/disp32
1640
1641 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1642
1643 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1644 5d/pop-to-ebp
1645 c3/return
1646
1647 test-emit-output-code-label:
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665 55/push-ebp
1666 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1667
1668
1669
1670 68/push _test-input-stream/imm32
1671
1672 e8/call clear-stream/disp32
1673
1674 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1675
1676
1677 68/push _test-output-stream/imm32
1678
1679 e8/call clear-stream/disp32
1680
1681 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1682
1683
1684 68/push $_test-output-buffered-file->buffer/imm32
1685
1686 e8/call clear-stream/disp32
1687
1688 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1689
1690 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
1691 68/push 0xc0/imm32/size
1692 68/push 0/imm32/read
1693 68/push 0/imm32/write
1694 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1695
1696 68/push 0/imm32
1697 68/push 0/imm32
1698 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
1699
1700
1701
1702 68/push "== code\n"/imm32
1703 68/push _test-input-stream/imm32
1704
1705 e8/call write/disp32
1706
1707 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1708
1709
1710 68/push "ab cd\n"/imm32
1711 68/push _test-input-stream/imm32
1712
1713 e8/call write/disp32
1714
1715 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1716
1717
1718 68/push "ef gh\n"/imm32
1719 68/push _test-input-stream/imm32
1720
1721 e8/call write/disp32
1722
1723 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1724
1725
1726 68/push "e8 l1/disp32\n"/imm32
1727 68/push _test-input-stream/imm32
1728
1729 e8/call write/disp32
1730
1731 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1732
1733 68/push 0x7c10/imm32/label-address
1734
1735 53/push-ebx
1736 68/push "l1"/imm32
1737 68/push Heap/imm32
1738 e8/call copy-array/disp32
1739 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1740 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1741 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1742
1743 52/push-edx
1744
1745 e8/call stream-add2/disp32
1746
1747 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1748
1749
1750
1751 52/push-edx
1752 68/push _test-output-buffered-file/imm32
1753 68/push _test-input-stream/imm32
1754
1755 e8/call emit-output/disp32
1756
1757 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1758
1759
1760
1761 68/push _test-output-buffered-file/imm32
1762
1763 e8/call flush/disp32
1764
1765 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1766 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------
1799
1800
1801 68/push "F - test-emit-output-code-label/0"/imm32
1802 68/push "# 0x00007c00"/imm32
1803 68/push _test-output-stream/imm32
1804
1805 e8/call check-next-stream-line-equal/disp32
1806
1807 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1808
1809
1810 68/push "F - test-emit-output-code-label/1"/imm32
1811 68/push "ab cd "/imm32
1812 68/push _test-output-stream/imm32
1813
1814 e8/call check-next-stream-line-equal/disp32
1815
1816 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1817
1818
1819 68/push "F - test-emit-output-code-label/2"/imm32
1820 68/push "ef gh "/imm32
1821 68/push _test-output-stream/imm32
1822
1823 e8/call check-next-stream-line-equal/disp32
1824
1825 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1826
1827
1828 68/push "F - test-emit-output-code-label/3"/imm32
1829 68/push "e8 07 00 00 00 "/imm32
1830 68/push _test-output-stream/imm32
1831
1832 e8/call check-next-stream-line-equal/disp32
1833
1834 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1835
1836 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
1837 5d/pop-to-ebp
1838 c3/return
1839
1840 test-emit-output-code-label-absolute:
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858 55/push-ebp
1859 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
1860
1861
1862
1863 68/push _test-input-stream/imm32
1864
1865 e8/call clear-stream/disp32
1866
1867 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1868
1869
1870 68/push _test-output-stream/imm32
1871
1872 e8/call clear-stream/disp32
1873
1874 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1875
1876
1877 68/push $_test-output-buffered-file->buffer/imm32
1878
1879 e8/call clear-stream/disp32
1880
1881 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1882
1883 81 5/subop/subtract 3/mod/direct 4/rm32/esp . . . . . 0xc0/imm32
1884 68/push 0xc0/imm32/size
1885 68/push 0/imm32/read
1886 68/push 0/imm32/write
1887 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
1888
1889 68/push 0/imm32
1890 68/push 0/imm32
1891 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
1892
1893
1894
1895 68/push "== code\n"/imm32
1896 68/push _test-input-stream/imm32
1897
1898 e8/call write/disp32
1899
1900 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1901
1902
1903 68/push "ab cd\n"/imm32
1904 68/push _test-input-stream/imm32
1905
1906 e8/call write/disp32
1907
1908 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1909
1910
1911 68/push "ef gh\n"/imm32
1912 68/push _test-input-stream/imm32
1913
1914 e8/call write/disp32
1915
1916 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1917
1918
1919 68/push "ij l1/imm32\n"/imm32
1920 68/push _test-input-stream/imm32
1921
1922 e8/call write/disp32
1923
1924 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
1925
1926 68/push 0x1056/imm32/label-address
1927
1928 53/push-ebx
1929 68/push "l1"/imm32
1930 68/push Heap/imm32
1931 e8/call copy-array/disp32
1932 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1933 ff 6/subop/push 1/mod/*+disp8 3/rm32/ebx . . . . 4/disp8 .
1934 ff 6/subop/push 0/mod/indirect 3/rm32/ebx . . . . . .
1935
1936 52/push-edx
1937
1938 e8/call stream-add2/disp32
1939
1940 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
1941
1942
1943
1944 52/push-edx
1945 68/push _test-output-buffered-file/imm32
1946 68/push _test-input-stream/imm32
1947
1948 e8/call emit-output/disp32
1949
1950 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
1951
1952
1953
1954 68/push _test-output-buffered-file/imm32
1955
1956 e8/call flush/disp32
1957
1958 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
1959 +-- 33 lines: #? # dump output ------------------------------------------------------------------------------------------------------------------------------------------------------
1992
1993
1994 68/push "F - test-emit-output-code-label-absolute/0"/imm32
1995 68/push "# 0x00007c00"/imm32
1996 68/push _test-output-stream/imm32
1997
1998 e8/call check-next-stream-line-equal/disp32
1999
2000 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2001
2002
2003 68/push "F - test-emit-output-code-label-absolute/1"/imm32
2004 68/push "ab cd "/imm32
2005 68/push _test-output-stream/imm32
2006
2007 e8/call check-next-stream-line-equal/disp32
2008
2009 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2010
2011
2012 68/push "F - test-emit-output-code-label-absolute/2"/imm32
2013 68/push "ef gh "/imm32
2014 68/push _test-output-stream/imm32
2015
2016 e8/call check-next-stream-line-equal/disp32
2017
2018 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2019
2020
2021 68/push "F - test-emit-output-code-label-absolute/3"/imm32
2022 68/push "ij 56 10 00 00 "/imm32
2023 68/push _test-output-stream/imm32
2024
2025 e8/call check-next-stream-line-equal/disp32
2026
2027 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2028
2029 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2030 5d/pop-to-ebp
2031 c3/return
2032
2033
2034
2035 far-jump-or-call?:
2036
2037 55/push-ebp
2038 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2039
2040 50/push-eax
2041 51/push-ecx
2042 52/push-edx
2043 53/push-ebx
2044
2045 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
2046
2047 68/push 0/imm32/end
2048 68/push 0/imm32/start
2049 89/copy 3/mod/direct 2/rm32/edx . . . 4/r32/esp . .
2050
2051 68/push 0/imm32/end
2052 68/push 0/imm32/start
2053 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
2054
2055 bf/copy-to-edi 0/imm32/false
2056 $far-jump-or-call?:check-first-word:
2057
2058
2059 52/push-edx
2060 51/push-ecx
2061
2062 e8/call next-word/disp32
2063
2064 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2065
2066
2067
2068 52/push-edx
2069
2070 e8/call slice-empty?/disp32
2071
2072 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2073
2074 3d/compare-eax-and 0/imm32/false
2075 0f 85/jump-if-!= $far-jump-or-call?:end/disp32
2076
2077
2078 53/push-ebx
2079 68/push 0x2f/imm32/slash
2080 ff 6/subop/push 1/mod/*+disp8 2/rm32/edx . . . . 4/disp8 .
2081 ff 6/subop/push 0/mod/indirect 2/rm32/edx . . . . . .
2082
2083 e8/call next-token-from-slice/disp32
2084
2085 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2086
2087
2088
2089 68/push "e8"/imm32
2090 53/push-ebx
2091
2092 e8/call slice-equal?/disp32
2093
2094 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2095
2096 3d/compare-eax-and 0/imm32/false
2097 75/jump-if-!= $far-jump-or-call?:return-true/disp8
2098
2099
2100
2101 68/push "e9"/imm32
2102 53/push-ebx
2103
2104 e8/call slice-equal?/disp32
2105
2106 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2107
2108 3d/compare-eax-and 0/imm32/false
2109 75/jump-if-!= $far-jump-or-call?:return-true/disp8
2110
2111
2112
2113 68/push "0f"/imm32
2114 53/push-ebx
2115
2116 e8/call slice-equal?/disp32
2117
2118 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2119
2120 3d/compare-eax-and 0/imm32/false
2121 74/jump-if-= $far-jump-or-call?:end/disp8
2122 $far-jump-or-call?:check-second-word:
2123
2124
2125 52/push-edx
2126 51/push-ecx
2127
2128 e8/call next-word/disp32
2129
2130 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2131
2132
2133
2134 52/push-edx
2135
2136 e8/call slice-empty?/disp32
2137
2138 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2139
2140 3d/compare-eax-and 0/imm32/false
2141 75/jump-if-!= $far-jump-or-call?:end/disp8
2142
2143
2144 8b/copy 0/mod/indirect 2/rm32/edx . . . 0/r32/eax . .
2145
2146 8a/copy-byte 0/mod/indirect 0/rm32/eax . . . 0/r32/AL . .
2147 25/and-eax-with 0xff/imm32
2148
2149 3d/compare-eax-and 0x38/imm32/8
2150 75/jump-if-!= $far-jump-or-call?:end/disp8
2151
2152 $far-jump-or-call?:return-true:
2153 bf/copy-to-edi 1/imm32/true
2154 $far-jump-or-call?:end:
2155
2156 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
2157
2158 5b/pop-to-ebx
2159 5a/pop-to-edx
2160 59/pop-to-ecx
2161 58/pop-to-eax
2162
2163 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2164 5d/pop-to-ebp
2165 c3/return
2166
2167
2168
2169 stream-add2:
2170
2171 55/push-ebp
2172 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2173
2174 50/push-eax
2175 51/push-ecx
2176 52/push-edx
2177 56/push-esi
2178
2179 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 6/r32/esi 8/disp8 .
2180
2181
2182 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
2183
2184 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 .
2185
2186
2187 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 2/r32/edx 8/disp8 .
2188
2189 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 2/index/edx . 2/r32/edx 0xc/disp8 .
2190
2191 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
2192 73/jump-if-addr>= $stream-add2:abort/disp8
2193
2194 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0xc/disp8 .
2195 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
2196
2197 05/add-to-eax 4/imm32
2198
2199 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
2200 73/jump-if-addr>= $stream-add2:abort/disp8
2201
2202 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x10/disp8 .
2203 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
2204
2205 05/add-to-eax 4/imm32
2206
2207 39/compare 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
2208 73/jump-if-addr>= $stream-add2:abort/disp8
2209
2210 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 0x14/disp8 .
2211 89/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
2212
2213 81 0/subop/add 0/mod/indirect 6/rm32/esi . . . . . 0xc/imm32
2214 $stream-add2:end:
2215
2216 5e/pop-to-esi
2217 5a/pop-to-edx
2218 59/pop-to-ecx
2219 58/pop-to-eax
2220
2221 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2222 5d/pop-to-ebp
2223 c3/return
2224
2225 $stream-add2:abort:
2226
2227
2228 68/push "overflow in stream-add2\n"/imm32
2229 68/push 2/imm32/stderr
2230
2231 e8/call _write/disp32
2232
2233 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2234
2235 bb/copy-to-ebx 1/imm32
2236 e8/call syscall_exit/disp32
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246 trace-slsns:
2247
2248 55/push-ebp
2249 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2250
2251
2252 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
2253 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2254
2255 e8/call write/disp32
2256
2257 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2258
2259
2260 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
2261 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2262
2263 e8/call write-slice/disp32
2264
2265 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2266
2267
2268 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x10/disp8 .
2269 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2270
2271 e8/call write/disp32
2272
2273 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2274
2275
2276 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x14/disp8 .
2277 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Trace-stream/disp32
2278
2279 e8/call write-int32-hex/disp32
2280
2281 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2282
2283
2284 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0x18/disp8 .
2285
2286 e8/call trace/disp32
2287
2288 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2289 $trace-slsns:end:
2290
2291 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2292 5d/pop-to-ebp
2293 c3/return
2294
2295 test-trace-slsns:
2296
2297 55/push-ebp
2298 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2299
2300
2301 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 0/r32/eax Trace-stream/disp32
2302 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
2303
2304 b8/copy-to-eax "b"/imm32
2305 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
2306 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
2307 05/add-to-eax 4/imm32
2308
2309 51/push-ecx
2310 50/push-eax
2311 89/copy 3/mod/direct 3/rm32/ebx . . . 4/r32/esp . .
2312
2313
2314 68/push " e"/imm32
2315 68/push 3/imm32
2316 68/push "c "/imm32
2317 53/push-ebx
2318 68/push "A"/imm32
2319
2320 e8/call trace-slsns/disp32
2321
2322 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x14/imm32
2323 +-- 26 lines: #? # dump *Trace-stream -----------------------------------------------------------------------------------------------------------------------------------------------
2349
2350
2351 68/push "F - test-trace-slsls"/imm32
2352 68/push "Abc 0x00000003 e"/imm32
2353
2354 e8/call check-trace-contains/disp32
2355
2356 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2357
2358 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2359 5d/pop-to-ebp
2360 c3/return
2361
2362 num-bytes:
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379 55/push-ebp
2380 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2381
2382 51/push-ecx
2383 52/push-edx
2384 53/push-ebx
2385
2386 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
2387
2388 68/push 0/imm32/end
2389 68/push 0/imm32/start
2390 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
2391 +-- 26 lines: #? # dump line --------------------------------------------------------------------------------------------------------------------------------------------------------
2417
2418
2419 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
2420
2421 e8/call rewind-stream/disp32
2422
2423 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2424 $num-bytes:loop:
2425
2426
2427 51/push-ecx
2428 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
2429
2430 e8/call next-word/disp32
2431
2432 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2433 +-- 40 lines: #? # dump word-slice --------------------------------------------------------------------------------------------------------------------------------------------------
2473 $num-bytes:check0:
2474
2475
2476 50/push-eax
2477
2478
2479 51/push-ecx
2480
2481 e8/call slice-empty?/disp32
2482
2483 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2484
2485 3d/compare-eax-and 0/imm32/false
2486
2487 58/pop-to-eax
2488 75/jump-if-!= $num-bytes:end/disp8
2489 $num-bytes:check-for-comment:
2490
2491
2492 8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . .
2493
2494 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
2495 8a/copy-byte 0/mod/indirect 2/rm32/edx . . . 3/r32/BL . .
2496
2497 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x23/imm32/hash
2498 74/jump-if-= $num-bytes:end/disp8
2499 $num-bytes:check-for-label:
2500
2501
2502 8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 .
2503
2504 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
2505 8a/copy-byte 1/mod/*+disp8 2/rm32/edx . . . 3/r32/BL -1/disp8 .
2506
2507 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x3a/imm32/colon
2508 74/jump-if-= $num-bytes:end/disp8
2509 $num-bytes:check-for-segment-header:
2510
2511
2512 50/push-eax
2513
2514
2515 68/push "=="/imm32
2516 51/push-ecx
2517
2518 e8/call slice-equal?/disp32
2519
2520 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2521
2522 3d/compare-eax-and 0/imm32/false
2523
2524 58/pop-to-eax
2525 75/jump-if-!= $num-bytes:end/disp8
2526 $num-bytes:loop-body:
2527
2528
2529 89/copy 3/mod/direct 2/rm32/edx . . . 0/r32/eax . .
2530
2531
2532 51/push-ecx
2533
2534 e8/call compute-width-of-slice/disp32
2535
2536 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2537
2538 01/add 3/mod/direct 0/rm32/eax . . . 2/r32/edx . .
2539 e9/jump $num-bytes:loop/disp32
2540 $num-bytes:end:
2541
2542
2543 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
2544
2545 e8/call rewind-stream/disp32
2546
2547 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2548
2549 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2550
2551 5b/pop-to-ebx
2552 5a/pop-to-edx
2553 59/pop-to-ecx
2554
2555 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2556 5d/pop-to-ebp
2557 c3/return
2558
2559 test-num-bytes-handles-empty-string:
2560
2561
2562 55/push-ebp
2563 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2564
2565
2566
2567 68/push _test-input-stream/imm32
2568
2569 e8/call clear-stream/disp32
2570
2571 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2572
2573
2574 68/push _test-output-stream/imm32
2575
2576 e8/call clear-stream/disp32
2577
2578 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2579
2580
2581
2582 68/push _test-input-stream/imm32
2583
2584 e8/call num-bytes/disp32
2585
2586 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2587
2588
2589 68/push "F - test-num-bytes-handles-empty-string"/imm32
2590 68/push 0/imm32/true
2591 50/push-eax
2592
2593 e8/call check-ints-equal/disp32
2594
2595 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2596
2597 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2598 5d/pop-to-ebp
2599 c3/return
2600
2601 test-num-bytes-ignores-comments:
2602
2603
2604 55/push-ebp
2605 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2606
2607
2608
2609 68/push _test-input-stream/imm32
2610
2611 e8/call clear-stream/disp32
2612
2613 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2614
2615
2616 68/push _test-output-stream/imm32
2617
2618 e8/call clear-stream/disp32
2619
2620 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2621
2622
2623
2624 68/push "# abcd"/imm32
2625 68/push _test-input-stream/imm32
2626
2627 e8/call write/disp32
2628
2629 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2630
2631
2632 68/push _test-input-stream/imm32
2633
2634 e8/call num-bytes/disp32
2635
2636 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2637
2638
2639 68/push "F - test-num-bytes-ignores-comments"/imm32
2640 68/push 0/imm32/true
2641 50/push-eax
2642
2643 e8/call check-ints-equal/disp32
2644
2645 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2646
2647 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2648 5d/pop-to-ebp
2649 c3/return
2650
2651 test-num-bytes-ignores-labels:
2652
2653
2654 55/push-ebp
2655 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2656
2657
2658
2659 68/push _test-input-stream/imm32
2660
2661 e8/call clear-stream/disp32
2662
2663 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2664
2665
2666 68/push _test-output-stream/imm32
2667
2668 e8/call clear-stream/disp32
2669
2670 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2671
2672
2673
2674 68/push "ab: # cd"/imm32
2675 68/push _test-input-stream/imm32
2676
2677 e8/call write/disp32
2678
2679 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2680
2681
2682 68/push _test-input-stream/imm32
2683
2684 e8/call num-bytes/disp32
2685
2686 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2687
2688
2689 68/push "F - test-num-bytes-ignores-labels"/imm32
2690 68/push 0/imm32/true
2691 50/push-eax
2692
2693 e8/call check-ints-equal/disp32
2694
2695 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2696
2697 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2698 5d/pop-to-ebp
2699 c3/return
2700
2701 test-num-bytes-ignores-segment-headers:
2702
2703
2704 55/push-ebp
2705 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2706
2707
2708
2709 68/push _test-input-stream/imm32
2710
2711 e8/call clear-stream/disp32
2712
2713 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2714
2715
2716 68/push _test-output-stream/imm32
2717
2718 e8/call clear-stream/disp32
2719
2720 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2721
2722
2723
2724 68/push "== ab cd"/imm32
2725 68/push _test-input-stream/imm32
2726
2727 e8/call write/disp32
2728
2729 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2730
2731
2732 68/push _test-input-stream/imm32
2733
2734 e8/call num-bytes/disp32
2735
2736 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2737
2738
2739 68/push "F - test-num-bytes-ignores-segment-headers"/imm32
2740 68/push 0/imm32/true
2741 50/push-eax
2742
2743 e8/call check-ints-equal/disp32
2744
2745 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2746
2747 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2748 5d/pop-to-ebp
2749 c3/return
2750
2751 test-num-bytes-counts-words-by-default:
2752
2753
2754 55/push-ebp
2755 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2756
2757
2758
2759 68/push _test-input-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 68/push _test-output-stream/imm32
2767
2768 e8/call clear-stream/disp32
2769
2770 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2771
2772
2773
2774 68/push "ab cd ef"/imm32
2775 68/push _test-input-stream/imm32
2776
2777 e8/call write/disp32
2778
2779 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2780
2781
2782 68/push _test-input-stream/imm32
2783
2784 e8/call num-bytes/disp32
2785
2786 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2787
2788
2789 68/push "F - test-num-bytes-counts-words-by-default"/imm32
2790 68/push 3/imm32/true
2791 50/push-eax
2792
2793 e8/call check-ints-equal/disp32
2794
2795 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2796
2797 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2798 5d/pop-to-ebp
2799 c3/return
2800
2801 test-num-bytes-ignores-trailing-comment:
2802
2803
2804 55/push-ebp
2805 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2806
2807
2808
2809 68/push _test-input-stream/imm32
2810
2811 e8/call clear-stream/disp32
2812
2813 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2814
2815
2816 68/push _test-output-stream/imm32
2817
2818 e8/call clear-stream/disp32
2819
2820 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2821
2822
2823
2824 68/push "ab cd # ef"/imm32
2825 68/push _test-input-stream/imm32
2826
2827 e8/call write/disp32
2828
2829 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2830
2831
2832 68/push _test-input-stream/imm32
2833
2834 e8/call num-bytes/disp32
2835
2836 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2837
2838
2839 68/push "F - test-num-bytes-ignores-trailing-comment"/imm32
2840 68/push 2/imm32/true
2841 50/push-eax
2842
2843 e8/call check-ints-equal/disp32
2844
2845 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2846
2847 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2848 5d/pop-to-ebp
2849 c3/return
2850
2851 test-num-bytes-handles-imm32:
2852
2853
2854 55/push-ebp
2855 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
2856
2857
2858
2859 68/push _test-input-stream/imm32
2860
2861 e8/call clear-stream/disp32
2862
2863 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2864
2865
2866 68/push _test-output-stream/imm32
2867
2868 e8/call clear-stream/disp32
2869
2870 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2871
2872
2873
2874 68/push "ab cd/imm32 ef"/imm32
2875 68/push _test-input-stream/imm32
2876
2877 e8/call write/disp32
2878
2879 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
2880
2881
2882 68/push _test-input-stream/imm32
2883
2884 e8/call num-bytes/disp32
2885
2886 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
2887
2888
2889 68/push "F - test-num-bytes-handles-imm32"/imm32
2890 68/push 6/imm32/true
2891 50/push-eax
2892
2893 e8/call check-ints-equal/disp32
2894
2895 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
2896
2897 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
2898 5d/pop-to-ebp
2899 c3/return
2900
2901