https://github.com/akkartik/mu/blob/master/apps/desugar.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 == code
36
37
38
39
40 Entry:
41
42
43
44 68/push Heap/imm32
45 ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Heap-size/disp32
46
47 e8/call new-segment/disp32
48
49 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
50
51
52
53 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
54
55
56 81 7/subop/compare 1/mod/*+disp8 5/rm32/EBP . . . . 0/disp8 1/imm32
57 7e/jump-if-lesser-or-equal $run-main/disp8
58
59
60 68/push "test"/imm32
61 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
62
63 e8/call kernel-string-equal?/disp32
64
65 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
66
67 3d/compare-EAX-and 1/imm32
68 75/jump-if-not-equal $run-main/disp8
69
70 e8/call run-tests/disp32
71 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32
72 eb/jump $main:end/disp8
73 $run-main:
74
75
76
77 68/push Stdout/imm32
78 68/push Stdin/imm32
79
80 e8/call convert/disp32
81
82 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x8/imm32
83
84 bb/copy-to-EBX 0/imm32
85 $main:end:
86 b8/copy-to-EAX 1/imm32/exit
87 cd/syscall 0x80/imm8
88
89
90
91 convert:
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118 55/push-EBP
119 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
120
121 50/push-EAX
122 51/push-ECX
123 52/push-EDX
124 53/push-EBX
125
126 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0x200/imm32
127 68/push 0x200/imm32/length
128 68/push 0/imm32/read
129 68/push 0/imm32/write
130 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
131
132 68/push 0/imm32/end
133 68/push 0/imm32/start
134 89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . .
135 $convert:line-loop:
136
137
138 51/push-ECX
139
140 e8/call clear-stream/disp32
141
142 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
143
144
145 51/push-ECX
146 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
147
148 e8/call read-line-buffered/disp32
149
150 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
151 $convert:check0:
152
153 81 7/subop/compare 0/mod/indirect 1/rm32/ECX . . . . . 0/imm32
154 0f 84/jump-if-equal $convert:break/disp32
155 $convert:word-loop:
156
157
158 52/push-EDX
159 51/push-ECX
160
161 e8/call next-word-or-expression/disp32
162
163 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
164 $convert:check1:
165
166
167
168 52/push-EDX
169
170 e8/call slice-empty?/disp32
171
172 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
173
174 3d/compare-EAX-and 0/imm32
175 0f 85/jump-if-not-equal $convert:next-line/disp32
176 $convert:check-for-comment:
177
178
179 8b/copy 0/mod/indirect 2/rm32/EDX . . . 3/r32/EBX . .
180
181 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
182 8a/copy-byte 0/mod/indirect 3/rm32/EBX . . . 0/r32/AL . .
183
184 3d/compare-EAX-and 0x23/imm32/hash
185 74/jump-if-equal $convert:word-loop/disp8
186 $convert:check-for-direct-mode:
187
188 3d/compare-EAX-and 0x25/imm32/percent
189 75/jump-if-not-equal $convert:check-for-indirect-mode/disp8
190 $convert:direct-mode:
191 +-- 46 lines: #? # dump word-slice -----------------------------------------------------------------------------------------------------------------------
237
238
239 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
240 52/push-EDX
241
242 e8/call emit-direct-mode/disp32
243
244 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
245
246 e9/jump $convert:next-word/disp32
247 $convert:check-for-indirect-mode:
248
249 3d/compare-EAX-and 0x2a/imm32/asterisk
250 75/jump-if-not-equal $convert:check-for-invalid-addition/disp8
251 $convert:indirect-mode:
252
253 50/push-EAX
254 51/push-ECX
255 52/push-EDX
256 53/push-EBX
257
258
259 52/push-EDX
260
261 e8/call parse-effective-address/disp32
262
263 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
264
265
266 53/push-EBX
267 52/push-EDX
268 51/push-ECX
269 50/push-EAX
270 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
271
272 e8/call emit-indirect-mode/disp32
273
274 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
275
276 5b/pop-to-EBX
277 5a/pop-to-EDX
278 59/pop-to-ECX
279 58/pop-to-EAX
280
281 e9/jump $convert:next-word/disp32
282 $convert:check-for-invalid-addition:
283
284 3d/compare-EAX-and 0x2b/imm32/plus
285 74/jump-if-equal $convert:error1/disp8
286 $convert:check-for-invalid-left-shift:
287
288 3d/compare-EAX-and 0x3c/imm32/less-than
289 74/jump-if-equal $convert:error1/disp8
290 $convert:regular-word:
291
292
293 52/push-EDX
294 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
295
296 e8/call write-slice-buffered/disp32
297
298 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
299
300 $convert:next-word:
301
302
303 68/push " "/imm32
304 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
305
306 e8/call write-buffered/disp32
307
308 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
309
310 e9/jump $convert:word-loop/disp32
311 $convert:next-line:
312
313
314 68/push Newline/imm32
315 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
316
317 e8/call write-buffered/disp32
318
319 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
320
321 e9/jump $convert:line-loop/disp32
322 $convert:break:
323
324
325 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
326
327 e8/call flush/disp32
328
329 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
330 $convert:end:
331
332 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x214/imm32
333
334 5b/pop-to-EBX
335 5a/pop-to-EDX
336 59/pop-to-ECX
337 58/pop-to-EAX
338
339 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
340 5d/pop-to-EBP
341 c3/return
342
343 $convert:error1:
344
345
346
347 68/push "error: '"/imm32
348 68/push Stderr/imm32
349
350 e8/call write-buffered/disp32
351
352 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
353
354
355 50/push-EAX
356 68/push Stderr/imm32
357
358 e8/call write-byte-buffered/disp32
359
360 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
361
362
363 68/push "' only permitted within '*(...)' in '"/imm32
364 68/push Stderr/imm32
365
366 e8/call write-buffered/disp32
367
368 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
369
370
371 51/push-ECX
372 68/push Stderr/imm32
373
374 e8/call write-stream-data/disp32
375
376 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
377
378
379 68/push "'"/imm32
380 68/push Stderr/imm32
381
382 e8/call write-buffered/disp32
383
384 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
385
386
387 68/push Stderr/imm32
388
389 e8/call flush/disp32
390
391 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
392
393 bb/copy-to-EBX 1/imm32
394 b8/copy-to-EAX 1/imm32/exit
395 cd/syscall 0x80/imm8
396
397
398 test-convert-passes-most-words-through:
399
400 55/push-EBP
401 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
402
403
404
405 68/push _test-input-stream/imm32
406
407 e8/call clear-stream/disp32
408
409 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
410
411
412 b8/copy-to-EAX _test-input-buffered-file/imm32
413 05/add-to-EAX 4/imm32
414 50/push-EAX
415
416 e8/call clear-stream/disp32
417
418 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
419
420
421 68/push _test-output-stream/imm32
422
423 e8/call clear-stream/disp32
424
425 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
426
427
428 b8/copy-to-EAX _test-output-buffered-file/imm32
429 05/add-to-EAX 4/imm32
430 50/push-EAX
431
432 e8/call clear-stream/disp32
433
434 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
435
436
437
438 68/push "== abcd 0x1"/imm32
439 68/push _test-input-stream/imm32
440
441 e8/call write/disp32
442
443 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
444
445
446 68/push _test-output-buffered-file/imm32
447 68/push _test-input-buffered-file/imm32
448
449 e8/call convert/disp32
450
451 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
452
453
454
455 68/push _test-output-buffered-file/imm32
456
457 e8/call flush/disp32
458
459 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
460 +-- 26 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
486
487
488 68/push "F - test-convert-passes-most-words-through"/imm32
489 68/push "== abcd 0x1 \n"/imm32
490 68/push _test-output-stream/imm32
491
492 e8/call check-stream-equal/disp32
493
494 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
495
496 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
497 5d/pop-to-EBP
498 c3/return
499
500 test-convert-direct-mode:
501
502 55/push-EBP
503 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
504
505
506
507 68/push _test-input-stream/imm32
508
509 e8/call clear-stream/disp32
510
511 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
512
513
514 b8/copy-to-EAX _test-input-buffered-file/imm32
515 05/add-to-EAX 4/imm32
516 50/push-EAX
517
518 e8/call clear-stream/disp32
519
520 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
521
522
523 68/push _test-output-stream/imm32
524
525 e8/call clear-stream/disp32
526
527 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
528
529
530 b8/copy-to-EAX _test-output-buffered-file/imm32
531 05/add-to-EAX 4/imm32
532 50/push-EAX
533
534 e8/call clear-stream/disp32
535
536 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
537
538
539
540 68/push "ab %ecx"/imm32
541 68/push _test-input-stream/imm32
542
543 e8/call write/disp32
544
545 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
546
547
548 68/push _test-output-buffered-file/imm32
549 68/push _test-input-buffered-file/imm32
550
551 e8/call convert/disp32
552
553 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
554
555
556
557 68/push _test-output-buffered-file/imm32
558
559 e8/call flush/disp32
560
561 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
562 +-- 26 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
588
589
590 68/push "F - test-convert-direct-mode"/imm32
591 68/push "ab 3/mod/direct 0x00000001/rm32 \n"/imm32
592 68/push _test-output-stream/imm32
593
594 e8/call check-stream-equal/disp32
595
596 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
597
598 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
599 5d/pop-to-EBP
600 c3/return
601
602 test-convert-register-indirect-mode:
603
604 55/push-EBP
605 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
606
607
608
609 68/push _test-input-stream/imm32
610
611 e8/call clear-stream/disp32
612
613 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
614
615
616 b8/copy-to-EAX _test-input-buffered-file/imm32
617 05/add-to-EAX 4/imm32
618 50/push-EAX
619
620 e8/call clear-stream/disp32
621
622 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
623
624
625 68/push _test-output-stream/imm32
626
627 e8/call clear-stream/disp32
628
629 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
630
631
632 b8/copy-to-EAX _test-output-buffered-file/imm32
633 05/add-to-EAX 4/imm32
634 50/push-EAX
635
636 e8/call clear-stream/disp32
637
638 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
639
640
641
642 68/push "ab *ecx"/imm32
643 68/push _test-input-stream/imm32
644
645 e8/call write/disp32
646
647 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
648
649
650 68/push _test-output-buffered-file/imm32
651 68/push _test-input-buffered-file/imm32
652
653 e8/call convert/disp32
654
655 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
656
657
658
659 68/push _test-output-buffered-file/imm32
660
661 e8/call flush/disp32
662
663 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
664 +-- 26 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
690
691
692 68/push "F - test-convert-indirect-mode"/imm32
693 68/push "ab 0/mod/indirect 0x00000001/rm32 \n"/imm32
694 68/push _test-output-stream/imm32
695
696 e8/call check-stream-equal/disp32
697
698 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
699
700 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
701 5d/pop-to-EBP
702 c3/return
703
704 test-convert-register-indirect-mode-without-displacement:
705
706 55/push-EBP
707 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
708
709
710
711 68/push _test-input-stream/imm32
712
713 e8/call clear-stream/disp32
714
715 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
716
717
718 b8/copy-to-EAX _test-input-buffered-file/imm32
719 05/add-to-EAX 4/imm32
720 50/push-EAX
721
722 e8/call clear-stream/disp32
723
724 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
725
726
727 68/push _test-output-stream/imm32
728
729 e8/call clear-stream/disp32
730
731 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
732
733
734 b8/copy-to-EAX _test-output-buffered-file/imm32
735 05/add-to-EAX 4/imm32
736 50/push-EAX
737
738 e8/call clear-stream/disp32
739
740 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
741
742
743
744 68/push "ab *(ecx)"/imm32
745 68/push _test-input-stream/imm32
746
747 e8/call write/disp32
748
749 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
750
751
752 68/push _test-output-buffered-file/imm32
753 68/push _test-input-buffered-file/imm32
754
755 e8/call convert/disp32
756
757 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
758
759
760
761 68/push _test-output-buffered-file/imm32
762
763 e8/call flush/disp32
764
765 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
766 +-- 26 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
792
793
794 68/push "F - test-convert-indirect-mode-without-displacement"/imm32
795 68/push "ab 0/mod/indirect 0x00000001/rm32 \n"/imm32
796 68/push _test-output-stream/imm32
797
798 e8/call check-stream-equal/disp32
799
800 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
801
802 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
803 5d/pop-to-EBP
804 c3/return
805
806 test-convert-register-indirect-mode-with-displacement:
807
808 55/push-EBP
809 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
810
811
812
813 68/push _test-input-stream/imm32
814
815 e8/call clear-stream/disp32
816
817 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
818
819
820 b8/copy-to-EAX _test-input-buffered-file/imm32
821 05/add-to-EAX 4/imm32
822 50/push-EAX
823
824 e8/call clear-stream/disp32
825
826 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
827
828
829 68/push _test-output-stream/imm32
830
831 e8/call clear-stream/disp32
832
833 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
834
835
836 b8/copy-to-EAX _test-output-buffered-file/imm32
837 05/add-to-EAX 4/imm32
838 50/push-EAX
839
840 e8/call clear-stream/disp32
841
842 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
843
844
845
846 68/push "ab *(ecx+4)"/imm32
847 68/push _test-input-stream/imm32
848
849 e8/call write/disp32
850
851 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
852
853
854 68/push _test-output-buffered-file/imm32
855 68/push _test-input-buffered-file/imm32
856
857 e8/call convert/disp32
858
859 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
860
861
862
863 68/push _test-output-buffered-file/imm32
864
865 e8/call flush/disp32
866
867 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
868 +-- 26 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
894
895
896 68/push "F - test-convert-indirect-mode-with-displacement"/imm32
897 68/push "ab 2/mod/*+disp32 0x00000001/rm32 0x00000004/disp32 \n"/imm32
898 68/push _test-output-stream/imm32
899
900 e8/call check-stream-equal/disp32
901
902 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
903
904 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
905 5d/pop-to-EBP
906 c3/return
907
908
909 test-convert-register-indirect-mode-with-sib-byte:
910
911 55/push-EBP
912 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
913
914
915
916 68/push _test-input-stream/imm32
917
918 e8/call clear-stream/disp32
919
920 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
921
922
923 b8/copy-to-EAX _test-input-buffered-file/imm32
924 05/add-to-EAX 4/imm32
925 50/push-EAX
926
927 e8/call clear-stream/disp32
928
929 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
930
931
932 68/push _test-output-stream/imm32
933
934 e8/call clear-stream/disp32
935
936 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
937
938
939 b8/copy-to-EAX _test-output-buffered-file/imm32
940 05/add-to-EAX 4/imm32
941 50/push-EAX
942
943 e8/call clear-stream/disp32
944
945 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
946
947
948
949 68/push "ab *(ecx + edx<<3 + 4)"/imm32
950 68/push _test-input-stream/imm32
951
952 e8/call write/disp32
953
954 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
955
956
957 68/push _test-output-buffered-file/imm32
958 68/push _test-input-buffered-file/imm32
959
960 e8/call convert/disp32
961
962 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
963
964
965
966 68/push _test-output-buffered-file/imm32
967
968 e8/call flush/disp32
969
970 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
971 +-- 26 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
997
998
999 68/push "F - test-convert-indirect-mode-with-sib-byte"/imm32
1000 68/push "ab 2/mod/*+disp32 4/rm32/sib 0x00000001/base 0x00000002/index 0x00000003/scale 0x00000004/disp32 \n"/imm32
1001 68/push _test-output-stream/imm32
1002
1003 e8/call check-stream-equal/disp32
1004
1005 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1006
1007 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1008 5d/pop-to-EBP
1009 c3/return
1010
1011 test-convert-register-indirect-mode-with-sib-byte-negative-displacement:
1012
1013 55/push-EBP
1014 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1015
1016
1017
1018 68/push _test-input-stream/imm32
1019
1020 e8/call clear-stream/disp32
1021
1022 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1023
1024
1025 b8/copy-to-EAX _test-input-buffered-file/imm32
1026 05/add-to-EAX 4/imm32
1027 50/push-EAX
1028
1029 e8/call clear-stream/disp32
1030
1031 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1032
1033
1034 68/push _test-output-stream/imm32
1035
1036 e8/call clear-stream/disp32
1037
1038 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1039
1040
1041 b8/copy-to-EAX _test-output-buffered-file/imm32
1042 05/add-to-EAX 4/imm32
1043 50/push-EAX
1044
1045 e8/call clear-stream/disp32
1046
1047 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1048
1049
1050
1051 68/push "ab *(ecx + edx<<3 - 4)"/imm32
1052 68/push _test-input-stream/imm32
1053
1054 e8/call write/disp32
1055
1056 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1057
1058
1059 68/push _test-output-buffered-file/imm32
1060 68/push _test-input-buffered-file/imm32
1061
1062 e8/call convert/disp32
1063
1064 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1065
1066
1067
1068 68/push _test-output-buffered-file/imm32
1069
1070 e8/call flush/disp32
1071
1072 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1073 +-- 26 lines: #? # dump _test-output-stream --------------------------------------------------------------------------------------------------------------
1099
1100
1101 68/push "F - test-convert-indirect-mode-with-sib-byte-negative-displacement"/imm32
1102 68/push "ab 2/mod/*+disp32 4/rm32/sib 0x00000001/base 0x00000002/index 0x00000003/scale 0xfffffffc/disp32 \n"/imm32
1103 68/push _test-output-stream/imm32
1104
1105 e8/call check-stream-equal/disp32
1106
1107 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1108
1109 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1110 5d/pop-to-EBP
1111 c3/return
1112
1113
1114 emit-direct-mode:
1115
1116 55/push-EBP
1117 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1118
1119 50/push-EAX
1120
1121
1122 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 0/r32/EAX 8/disp8 .
1123
1124 ff 0/subop/increment 0/mod/indirect 0/rm32/EAX . . . . . .
1125
1126
1127 68/push "Registers"/imm32
1128 68/push 8/imm32/row-size
1129 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1130 68/push Registers/imm32
1131
1132 e8/call get-slice/disp32
1133
1134 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
1135
1136
1137 68/push "3/mod/direct "/imm32
1138 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1139
1140 e8/call write-buffered/disp32
1141
1142 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1143
1144
1145 ff 6/subop/push 0/mod/indirect 0/rm32/EAX . . . . . .
1146 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1147
1148 e8/call print-int32-buffered/disp32
1149
1150 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1151
1152
1153 68/push "/rm32"/imm32
1154 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
1155
1156 e8/call write-buffered/disp32
1157
1158 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1159 $emit-direct-mode:end:
1160
1161 58/pop-to-EAX
1162
1163 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1164 5d/pop-to-EBP
1165 c3/return
1166
1167 test-emit-direct-mode:
1168
1169 55/push-EBP
1170 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1171
1172
1173
1174 68/push _test-output-stream/imm32
1175
1176 e8/call clear-stream/disp32
1177
1178 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1179
1180
1181 b8/copy-to-EAX _test-output-buffered-file/imm32
1182 05/add-to-EAX 4/imm32
1183 50/push-EAX
1184
1185 e8/call clear-stream/disp32
1186
1187 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1188
1189 b8/copy-to-EAX "%eax"/imm32
1190 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1191 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1192 05/add-to-EAX 4/imm32
1193
1194 51/push-ECX
1195 50/push-EAX
1196 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1197
1198
1199 68/push _test-output-buffered-file/imm32
1200 51/push-ECX
1201
1202 e8/call emit-direct-mode/disp32
1203
1204 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1205
1206
1207 68/push _test-output-buffered-file/imm32
1208
1209 e8/call flush/disp32
1210
1211 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1212 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1238
1239
1240 68/push "F - test-emit-direct-mode/0"/imm32
1241 68/push "3/mod/direct 0x00000000/rm32"/imm32
1242 68/push _test-output-stream/imm32
1243
1244 e8/call check-stream-equal/disp32
1245
1246 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1247
1248 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1249 5d/pop-to-EBP
1250 c3/return
1251
1252 test-emit-direct-mode-2:
1253
1254 55/push-EBP
1255 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1256
1257
1258
1259 68/push _test-output-stream/imm32
1260
1261 e8/call clear-stream/disp32
1262
1263 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1264
1265
1266 b8/copy-to-EAX _test-output-buffered-file/imm32
1267 05/add-to-EAX 4/imm32
1268 50/push-EAX
1269
1270 e8/call clear-stream/disp32
1271
1272 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1273
1274 b8/copy-to-EAX "%edi"/imm32
1275 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1276 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1277 05/add-to-EAX 4/imm32
1278
1279 51/push-ECX
1280 50/push-EAX
1281 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1282
1283
1284 68/push _test-output-buffered-file/imm32
1285 51/push-ECX
1286
1287 e8/call emit-direct-mode/disp32
1288
1289 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1290
1291
1292 68/push _test-output-buffered-file/imm32
1293
1294 e8/call flush/disp32
1295
1296 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1297 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1323
1324
1325 68/push "F - test-emit-direct-mode/1"/imm32
1326 68/push "3/mod/direct 0x00000007/rm32"/imm32
1327 68/push _test-output-stream/imm32
1328
1329 e8/call check-stream-equal/disp32
1330
1331 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1332
1333 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1334 5d/pop-to-EBP
1335 c3/return
1336
1337
1338
1339
1340
1341
1342
1343 next-word-or-expression:
1344
1345 55/push-EBP
1346 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1347
1348 50/push-EAX
1349 51/push-ECX
1350 56/push-ESI
1351 57/push-EDI
1352
1353 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
1354
1355 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 0xc/disp8 .
1356
1357
1358 68/push 0x20/imm32/space
1359 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1360
1361 e8/call skip-chars-matching/disp32
1362
1363 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1364 $next-word-or-expression:check0:
1365
1366
1367 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
1368
1369 3b/compare 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
1370 7c/jump-if-lesser $next-word-or-expression:check-for-comment/disp8
1371
1372 c7 0/subop/copy 0/mod/direct 7/rm32/EDI . . . . . 0/imm32
1373 c7 0/subop/copy 1/mod/*+disp8 7/rm32/EDI . . . . 4/disp8 0/imm32
1374 eb/jump $next-word-or-expression:end/disp8
1375 $next-word-or-expression:check-for-comment:
1376
1377 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 .
1378 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/EAX 0xc/disp8 .
1379 89/copy 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . .
1380
1381
1382 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
1383 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0xc/disp8 .
1384
1385 3d/compare-EAX-and 0x23/imm32/pound
1386 75/jump-if-not-equal $next-word-or-expression:check-for-paren/disp8
1387 $next-word-or-expression:comment:
1388
1389 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
1390 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 0/index/EAX . 0/r32/EAX 0xc/disp8 .
1391 89/copy 1/mod/*+disp8 7/rm32/EDI . . . 0/r32/EAX 4/disp8 .
1392
1393 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
1394 89/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
1395
1396 eb/jump $next-word-or-expression:end/disp8
1397 $next-word-or-expression:check-for-paren:
1398
1399
1400 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
1401 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0xc/disp8 .
1402
1403 3d/compare-EAX-and 0x2a/imm32/asterisk
1404 75/jump-if-not-equal $next-word-or-expression:regular-word/disp8
1405
1406 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0xd/disp8 .
1407
1408 3d/compare-EAX-and 0x20/imm32/space
1409 74/jump-if-equal $next-word-or-expression:error1/disp8
1410
1411 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0xd/disp8 .
1412
1413 3d/compare-EAX-and 0x28/imm32/open-paren
1414 75/jump-if-not-equal $next-word-or-expression:regular-word/disp8
1415 $next-word-or-expression:paren:
1416
1417
1418 56/push-ESI
1419
1420 e8/call skip-until-close-paren/disp32
1421
1422 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1423
1424 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 .
1425 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0xc/disp8 .
1426
1427 3d/compare-EAX-and 0x29/imm32/close-paren
1428 75/jump-if-not-equal $next-word-or-expression:error2/disp8
1429
1430 ff 0/subop/increment 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 .
1431
1432 $next-word-or-expression:regular-word:
1433
1434
1435 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1436
1437 e8/call skip-chars-not-matching-whitespace/disp32
1438
1439 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1440
1441 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 .
1442 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/EAX 0xc/disp8 .
1443 89/copy 1/mod/*+disp8 7/rm32/EDI . . . 0/r32/EAX 4/disp8 .
1444 $next-word-or-expression:end:
1445
1446 5f/pop-to-EDI
1447 5e/pop-to-ESI
1448 59/pop-to-ECX
1449 58/pop-to-EAX
1450
1451 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1452 5d/pop-to-EBP
1453 c3/return
1454
1455 $next-word-or-expression:error1:
1456
1457
1458
1459 68/push "error: no space allowed after '*' in '"/imm32
1460 68/push Stderr/imm32
1461
1462 e8/call write-buffered/disp32
1463
1464 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1465
1466
1467 56/push-ESI
1468 68/push Stderr/imm32
1469
1470 e8/call write-stream-data/disp32
1471
1472 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1473
1474
1475 68/push "'"/imm32
1476 68/push Stderr/imm32
1477
1478 e8/call write-buffered/disp32
1479
1480 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1481
1482
1483 68/push Stderr/imm32
1484
1485 e8/call flush/disp32
1486
1487 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1488
1489 bb/copy-to-EBX 1/imm32
1490 b8/copy-to-EAX 1/imm32/exit
1491 cd/syscall 0x80/imm8
1492
1493
1494 $next-word-or-expression:error2:
1495
1496
1497
1498 68/push "error: *(...) expression must be all on a single line in '"/imm32
1499 68/push Stderr/imm32
1500
1501 e8/call write-buffered/disp32
1502
1503 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1504
1505
1506 56/push-ESI
1507 68/push Stderr/imm32
1508
1509 e8/call write-stream-data/disp32
1510
1511 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1512
1513
1514 68/push "'"/imm32
1515 68/push Stderr/imm32
1516
1517 e8/call write-buffered/disp32
1518
1519 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1520
1521
1522 68/push Stderr/imm32
1523
1524 e8/call flush/disp32
1525
1526 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1527
1528 bb/copy-to-EBX 1/imm32
1529 b8/copy-to-EAX 1/imm32/exit
1530 cd/syscall 0x80/imm8
1531
1532
1533 test-next-word-or-expression:
1534
1535 55/push-EBP
1536 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1537
1538
1539
1540 68/push _test-input-stream/imm32
1541
1542 e8/call clear-stream/disp32
1543
1544 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1545
1546 68/push 0/imm32/end
1547 68/push 0/imm32/start
1548 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1549
1550
1551 68/push " ab"/imm32
1552 68/push _test-input-stream/imm32
1553
1554 e8/call write/disp32
1555
1556 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1557
1558
1559 51/push-ECX
1560 68/push _test-input-stream/imm32
1561
1562 e8/call next-word-or-expression/disp32
1563
1564 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1565
1566
1567 68/push "F - test-next-word-or-expression/updates-stream-read-correctly"/imm32
1568 68/push 4/imm32
1569 b8/copy-to-EAX _test-input-stream/imm32
1570 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
1571
1572 e8/call check-ints-equal/disp32
1573
1574 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1575
1576
1577
1578 68/push "F - test-next-word-or-expression: start"/imm32
1579 68/push 0xe/imm32
1580
1581 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
1582 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
1583 50/push-EAX
1584
1585 e8/call check-ints-equal/disp32
1586
1587 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1588
1589
1590
1591 68/push "F - test-next-word-or-expression: end"/imm32
1592 68/push 0x10/imm32
1593
1594 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
1595 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
1596 50/push-EAX
1597
1598 e8/call check-ints-equal/disp32
1599
1600 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1601
1602 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1603 5d/pop-to-EBP
1604 c3/return
1605
1606 test-next-word-or-expression-returns-whole-comment:
1607
1608 55/push-EBP
1609 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1610
1611
1612
1613 68/push _test-input-stream/imm32
1614
1615 e8/call clear-stream/disp32
1616
1617 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1618
1619 68/push 0/imm32/end
1620 68/push 0/imm32/start
1621 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1622
1623
1624 68/push " # a"/imm32
1625 68/push _test-input-stream/imm32
1626
1627 e8/call write/disp32
1628
1629 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1630
1631
1632 51/push-ECX
1633 68/push _test-input-stream/imm32
1634
1635 e8/call next-word-or-expression/disp32
1636
1637 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1638
1639
1640 68/push "F - test-next-word-or-expression-returns-whole-comment/updates-stream-read-correctly"/imm32
1641 68/push 5/imm32
1642 b8/copy-to-EAX _test-input-stream/imm32
1643 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
1644
1645 e8/call check-ints-equal/disp32
1646
1647 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1648
1649
1650
1651 68/push "F - test-next-word-or-expression-returns-whole-comment: start"/imm32
1652 68/push 0xe/imm32
1653
1654 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
1655 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
1656 50/push-EAX
1657
1658 e8/call check-ints-equal/disp32
1659
1660 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1661
1662
1663
1664 68/push "F - test-next-word-or-expression-returns-whole-comment: end"/imm32
1665 68/push 0x11/imm32
1666
1667 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
1668 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
1669 50/push-EAX
1670
1671 e8/call check-ints-equal/disp32
1672
1673 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1674
1675 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1676 5d/pop-to-EBP
1677 c3/return
1678
1679 test-next-word-or-expression-returns-empty-expression-on-eof:
1680
1681 55/push-EBP
1682 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1683
1684
1685
1686 68/push _test-input-stream/imm32
1687
1688 e8/call clear-stream/disp32
1689
1690 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1691
1692 68/push 0/imm32/end
1693 68/push 0/imm32/start
1694 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1695
1696
1697
1698 51/push-ECX
1699 68/push _test-input-stream/imm32
1700
1701 e8/call next-word-or-expression/disp32
1702
1703 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1704
1705
1706 68/push "F - test-next-word-or-expression-returns-empty-expression-on-eof"/imm32
1707 68/push 0/imm32
1708
1709 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
1710 2b/subtract 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
1711 50/push-EAX
1712
1713 e8/call check-ints-equal/disp32
1714
1715 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1716
1717 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1718 5d/pop-to-EBP
1719 c3/return
1720
1721 test-next-word-or-expression-returns-whole-expression:
1722
1723 55/push-EBP
1724 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1725
1726
1727
1728 68/push _test-input-stream/imm32
1729
1730 e8/call clear-stream/disp32
1731
1732 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1733
1734 68/push 0/imm32/end
1735 68/push 0/imm32/start
1736 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1737
1738
1739 68/push " *(a b)/imm32 "/imm32
1740 68/push _test-input-stream/imm32
1741
1742 e8/call write/disp32
1743
1744 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1745
1746
1747 51/push-ECX
1748 68/push _test-input-stream/imm32
1749
1750 e8/call next-word-or-expression/disp32
1751
1752 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1753
1754
1755
1756 68/push "F - test-next-word-or-expression-returns-whole-expression: start"/imm32
1757 68/push 0xd/imm32
1758
1759 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
1760 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
1761 50/push-EAX
1762
1763 e8/call check-ints-equal/disp32
1764
1765 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1766
1767
1768
1769 68/push "F - test-next-word-or-expression-returns-whole-expression: end"/imm32
1770 68/push 0x19/imm32
1771
1772 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
1773 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-input-stream/imm32
1774 50/push-EAX
1775
1776 e8/call check-ints-equal/disp32
1777
1778 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1779
1780 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1781 5d/pop-to-EBP
1782 c3/return
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793 parse-effective-address:
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829 55/push-EBP
1830 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1831
1832 56/push-ESI
1833 57/push-EDI
1834
1835 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
1836
1837 ff 0/subop/increment 0/mod/indirect 6/rm32/ESI . . . . . .
1838
1839
1840 bf/copy-to-EDI 0/imm32
1841 b9/copy-to-ECX 4/imm32/no-index
1842 ba/copy-to-EDX 0/imm32/.scale
1843 bb/copy-to-EBX 0/imm32/disp
1844 $parse-effective-address:check-for-simple-register:
1845
1846 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
1847 8a/copy-byte 0/mod/indirect 0/rm32/EAX . . . 0/r32/AL . .
1848 81 4/subop/and 3/mod/direct 0/rm32/EAX . . . . . 0xff/imm32
1849 3d/compare-EAX-and 0x28/imm32/open-paren
1850 74/jump-if-equal $parse-effective-address:compound-expression/disp8
1851 $parse-effective-address:simple-register:
1852
1853
1854
1855 68/push "Registers"/imm32
1856 68/push 8/imm32/row-size
1857 56/push-ESI
1858 68/push Registers/imm32
1859
1860 e8/call get-slice/disp32
1861
1862 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
1863
1864 8b/copy 0/mod/indirect 0/rm32/EAX . . . 7/r32/EDI . .
1865
1866 e9/jump $parse-effective-address:end/disp32
1867 $parse-effective-address:compound-expression:
1868
1869 ff 0/subop/increment 0/mod/indirect 6/rm32/ESI . . . . . .
1870
1871
1872
1873 ff 6/subop/push 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 .
1874 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
1875
1876 e8/call skip-chars-matching-whitespace-in-slice/disp32
1877
1878 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1879
1880 89/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
1881
1882
1883
1884 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1885
1886 e8/call next-register/disp32
1887
1888 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1889
1890 8b/copy 0/mod/indirect 0/rm32/EAX . . . 7/r32/EDI . .
1891
1892
1893
1894 ff 6/subop/push 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 .
1895 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
1896
1897 e8/call skip-chars-matching-whitespace-in-slice/disp32
1898
1899 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1900
1901 89/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
1902
1903 8a/copy-byte 0/mod/indirect 0/rm32/EAX . . . 0/r32/AL . .
1904 81 4/subop/and 3/mod/direct 0/rm32/EAX . . . . . 0xff/imm32
1905 3d/compare-EAX-and 0x29/imm32/close-paren
1906 0f 84/jump-if-equal $parse-effective-address:end/disp32
1907
1908 3d/compare-EAX-and 0x2d/imm32/minus
1909 0f 84/jump-if-equal $parse-effective-address:displacement/disp32
1910
1911 3d/compare-EAX-and 0x2b/imm32/plus
1912 0f 85/jump-if-not-equal $parse-effective-address:error1/disp32
1913 $parse-effective-address:check-for-index:
1914
1915 ff 0/subop/increment 0/mod/indirect 6/rm32/ESI . . . . . .
1916
1917
1918
1919 ff 6/subop/push 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 .
1920 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
1921
1922 e8/call skip-chars-matching-whitespace-in-slice/disp32
1923
1924 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1925
1926 89/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
1927 $parse-effective-address:resolve-ambiguity:
1928
1929
1930 51/push-ECX
1931
1932
1933 89/copy 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
1934
1935 05/add-to-EAX 3/imm32
1936
1937 50/push-EAX
1938 51/push-ECX
1939
1940 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1941
1942
1943 68/push 8/imm32/row-size
1944 51/push-ECX
1945 68/push Registers/imm32
1946
1947 e8/call maybe-get-slice/disp32
1948
1949 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1950
1951 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1952
1953 59/pop-to-ECX
1954
1955 3d/compare-EAX-and 0/imm32
1956 0f 84/jump-if-equal $parse-effective-address:displacement/disp32
1957 $parse-effective-address:index:
1958
1959
1960
1961 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1962
1963 e8/call next-register/disp32
1964
1965 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1966
1967 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1968
1969
1970
1971 ff 6/subop/push 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 .
1972 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
1973
1974 e8/call skip-chars-matching-whitespace-in-slice/disp32
1975
1976 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1977
1978 89/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
1979
1980 8a/copy-byte 0/mod/indirect 0/rm32/EAX . . . 0/r32/AL . .
1981 81 4/subop/and 3/mod/direct 0/rm32/EAX . . . . . 0xff/imm32
1982 3d/compare-EAX-and 0x29/imm32/close-paren
1983 0f 84/jump-if-equal $parse-effective-address:end/disp32
1984 $parse-effective-address:check-for-scale:
1985
1986 3d/compare-EAX-and 0x3c/imm32/less-than
1987 75/jump-if-not-equal $parse-effective-address:check-for-displacement/disp8
1988
1989 ff 0/subop/increment 0/mod/indirect 6/rm32/ESI . . . . . .
1990
1991 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
1992 8a/copy-byte 0/mod/indirect 0/rm32/EAX . . . 0/r32/AL . .
1993 81 4/subop/and 3/mod/direct 0/rm32/EAX . . . . . 0xff/imm32
1994 3d/compare-EAX-and 0x3c/imm32/less-than
1995 0f 85/jump-if-not-equal $parse-effective-address:error2/disp32
1996
1997 ff 0/subop/increment 0/mod/indirect 6/rm32/ESI . . . . . .
1998
1999
2000
2001 ff 6/subop/push 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 .
2002 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
2003
2004 e8/call skip-chars-matching-whitespace-in-slice/disp32
2005
2006 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2007
2008 89/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
2009 $parse-effective-address:scale:
2010
2011
2012
2013 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2014
2015 e8/call next-positive-hex-int/disp32
2016
2017 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2018
2019 89/copy 3/mod/direct 2/rm32/EDX . . . 0/r32/EAX . .
2020
2021
2022
2023 ff 6/subop/push 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 .
2024 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
2025
2026 e8/call skip-chars-matching-whitespace-in-slice/disp32
2027
2028 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2029
2030 89/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
2031
2032 8a/copy-byte 0/mod/indirect 0/rm32/EAX . . . 0/r32/AL . .
2033 81 4/subop/and 3/mod/direct 0/rm32/EAX . . . . . 0xff/imm32
2034 3d/compare-EAX-and 0x29/imm32/close-paren
2035 74/jump-if-equal $parse-effective-address:end/disp8
2036 $parse-effective-address:check-for-displacement:
2037
2038 3d/compare-EAX-and 0x2b/imm32/plus
2039 74/jump-if-equal $parse-effective-address:displacement/disp8
2040 3d/compare-EAX-and 0x2d/imm32/minus
2041 74/jump-if-equal $parse-effective-address:displacement/disp8
2042 e9/jump $parse-effective-address:error3/disp32
2043 $parse-effective-address:displacement:
2044
2045
2046
2047 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2048
2049 e8/call next-hex-int/disp32
2050
2051 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2052
2053 89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . .
2054
2055
2056
2057 ff 6/subop/push 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 .
2058 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
2059
2060 e8/call skip-chars-matching-whitespace-in-slice/disp32
2061
2062 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2063
2064 89/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
2065
2066 8a/copy-byte 0/mod/indirect 0/rm32/EAX . . . 0/r32/AL . .
2067 81 4/subop/and 3/mod/direct 0/rm32/EAX . . . . . 0xff/imm32
2068 3d/compare-EAX-and 0x29/imm32/close-paren
2069 0f 85/jump-if-not-equal $parse-effective-address:error4/disp32
2070 $parse-effective-address:end:
2071
2072 89/copy 3/mod/direct 0/rm32/EAX . . . 7/r32/EDI . .
2073
2074 5f/pop-to-EDI
2075 5e/pop-to-ESI
2076
2077 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2078 5d/pop-to-EBP
2079 c3/return
2080
2081 $parse-effective-address:error1:
2082
2083
2084
2085 68/push "error: unexpected character: "/imm32
2086 68/push Stderr/imm32
2087
2088 e8/call write-buffered/disp32
2089
2090 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2091
2092
2093 50/push-EAX
2094 68/push Stderr/imm32
2095
2096 e8/call print-int32-buffered/disp32
2097
2098 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2099
2100
2101 68/push "\n"/imm32
2102 68/push Stderr/imm32
2103
2104 e8/call write-buffered/disp32
2105
2106 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2107
2108
2109 68/push Stderr/imm32
2110
2111 e8/call flush/disp32
2112
2113 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2114
2115 bb/copy-to-EBX 1/imm32
2116 b8/copy-to-EAX 1/imm32/exit
2117 cd/syscall 0x80/imm8
2118
2119
2120 $parse-effective-address:error2:
2121
2122
2123
2124 68/push "error: '<' can only be followed by '<' but got: "/imm32
2125 68/push Stderr/imm32
2126
2127 e8/call write-buffered/disp32
2128
2129 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2130
2131
2132 50/push-EAX
2133 68/push Stderr/imm32
2134
2135 e8/call print-int32-buffered/disp32
2136
2137 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2138
2139
2140 68/push "\n"/imm32
2141 68/push Stderr/imm32
2142
2143 e8/call write-buffered/disp32
2144
2145 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2146
2147
2148 68/push Stderr/imm32
2149
2150 e8/call flush/disp32
2151
2152 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2153
2154 bb/copy-to-EBX 1/imm32
2155 b8/copy-to-EAX 1/imm32/exit
2156 cd/syscall 0x80/imm8
2157
2158
2159 $parse-effective-address:error3:
2160
2161
2162
2163 68/push "error: unexpected character before displacement: "/imm32
2164 68/push Stderr/imm32
2165
2166 e8/call write-buffered/disp32
2167
2168 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2169
2170
2171 50/push-EAX
2172 68/push Stderr/imm32
2173
2174 e8/call print-int32-buffered/disp32
2175
2176 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2177
2178
2179 68/push "\n"/imm32
2180 68/push Stderr/imm32
2181
2182 e8/call write-buffered/disp32
2183
2184 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2185
2186
2187 68/push Stderr/imm32
2188
2189 e8/call flush/disp32
2190
2191 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2192
2193 bb/copy-to-EBX 1/imm32
2194 b8/copy-to-EAX 1/imm32/exit
2195 cd/syscall 0x80/imm8
2196
2197
2198 $parse-effective-address:error4:
2199
2200
2201
2202 68/push "error: unexpected character after displacement: "/imm32
2203 68/push Stderr/imm32
2204
2205 e8/call write-buffered/disp32
2206
2207 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2208
2209
2210 50/push-EAX
2211 68/push Stderr/imm32
2212
2213 e8/call print-int32-buffered/disp32
2214
2215 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2216
2217
2218 68/push "; expected ')' to wrap up\n"/imm32
2219 68/push Stderr/imm32
2220
2221 e8/call write-buffered/disp32
2222
2223 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2224
2225
2226 68/push Stderr/imm32
2227
2228 e8/call flush/disp32
2229
2230 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2231
2232 bb/copy-to-EBX 1/imm32
2233 b8/copy-to-EAX 1/imm32/exit
2234 cd/syscall 0x80/imm8
2235
2236
2237
2238
2239 next-register:
2240
2241 55/push-EBP
2242 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2243
2244 51/push-ECX
2245 56/push-ESI
2246
2247 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
2248
2249 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
2250 05/add-to-EAX 3/imm32
2251 50/push-EAX
2252 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
2253 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2254
2255 81 0/subop/add 0/mod/indirect 6/rm32/ESI . . . . . 3/imm32
2256
2257
2258 68/push "next-register"/imm32
2259 68/push 8/imm32/row-size
2260 51/push-ECX
2261 68/push Registers/imm32
2262
2263 e8/call get-slice/disp32
2264
2265 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
2266 $next-register:end:
2267
2268 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2269
2270 5e/pop-to-ESI
2271 59/pop-to-ECX
2272
2273 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2274 5d/pop-to-EBP
2275 c3/return
2276
2277 test-parse-effective-address-simple:
2278
2279 55/push-EBP
2280 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2281
2282 b8/copy-to-EAX "*esi"/imm32
2283 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2284 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2285 05/add-to-EAX 4/imm32
2286
2287 51/push-ECX
2288 50/push-EAX
2289 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2290
2291
2292 51/push-ECX
2293
2294 e8/call parse-effective-address/disp32
2295
2296 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2297
2298
2299
2300 68/push "F - test-parse-effective-address-simple/base"/imm32
2301 68/push 6/imm32/ESI
2302 50/push-EAX
2303
2304 e8/call check-ints-equal/disp32
2305
2306 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2307
2308
2309 68/push "F - test-parse-effective-address-simple/index"/imm32
2310 68/push 4/imm32/none
2311 51/push-ECX
2312
2313 e8/call check-ints-equal/disp32
2314
2315 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2316
2317
2318 68/push "F - test-parse-effective-address-simple/scale"/imm32
2319 68/push 0/imm32/none
2320 52/push-EDX
2321
2322 e8/call check-ints-equal/disp32
2323
2324 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2325
2326
2327 68/push "F - test-parse-effective-address-simple/displacement"/imm32
2328 68/push 0/imm32/none
2329 53/push-EBX
2330
2331 e8/call check-ints-equal/disp32
2332
2333 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2334
2335 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2336 5d/pop-to-EBP
2337 c3/return
2338
2339 test-parse-effective-address-base:
2340
2341 55/push-EBP
2342 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2343
2344 b8/copy-to-EAX "*(esi )"/imm32
2345 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2346 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2347 05/add-to-EAX 4/imm32
2348
2349 51/push-ECX
2350 50/push-EAX
2351 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2352
2353
2354 51/push-ECX
2355
2356 e8/call parse-effective-address/disp32
2357
2358 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2359
2360
2361
2362 68/push "F - test-parse-effective-address-base/base"/imm32
2363 68/push 6/imm32/ESI
2364 50/push-EAX
2365
2366 e8/call check-ints-equal/disp32
2367
2368 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2369
2370
2371 68/push "F - test-parse-effective-address-base/index"/imm32
2372 68/push 4/imm32/none
2373 51/push-ECX
2374
2375 e8/call check-ints-equal/disp32
2376
2377 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2378
2379
2380 68/push "F - test-parse-effective-address-base/scale"/imm32
2381 68/push 0/imm32/none
2382 52/push-EDX
2383
2384 e8/call check-ints-equal/disp32
2385
2386 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2387
2388
2389 68/push "F - test-parse-effective-address-base/displacement"/imm32
2390 68/push 0/imm32/none
2391 53/push-EBX
2392
2393 e8/call check-ints-equal/disp32
2394
2395 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2396
2397 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2398 5d/pop-to-EBP
2399 c3/return
2400
2401 test-parse-effective-address-base-displacement:
2402
2403 55/push-EBP
2404 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2405
2406 b8/copy-to-EAX "*(esi+3)"/imm32
2407 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2408 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2409 05/add-to-EAX 4/imm32
2410
2411 51/push-ECX
2412 50/push-EAX
2413 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2414
2415
2416 51/push-ECX
2417
2418 e8/call parse-effective-address/disp32
2419
2420 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2421
2422
2423
2424 68/push "F - test-parse-effective-address-base-displacement/base"/imm32
2425 68/push 6/imm32/ESI
2426 50/push-EAX
2427
2428 e8/call check-ints-equal/disp32
2429
2430 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2431
2432
2433 68/push "F - test-parse-effective-address-base-displacement/index"/imm32
2434 68/push 4/imm32/none
2435 51/push-ECX
2436
2437 e8/call check-ints-equal/disp32
2438
2439 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2440
2441
2442 68/push "F - test-parse-effective-address-base-displacement/scale"/imm32
2443 68/push 0/imm32/none
2444 52/push-EDX
2445
2446 e8/call check-ints-equal/disp32
2447
2448 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2449
2450
2451 68/push "F - test-parse-effective-address-base-displacement/displacement"/imm32
2452 68/push 3/imm32
2453 53/push-EBX
2454
2455 e8/call check-ints-equal/disp32
2456
2457 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2458
2459 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2460 5d/pop-to-EBP
2461 c3/return
2462
2463 test-parse-effective-address-base-negative-displacement:
2464
2465 55/push-EBP
2466 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2467
2468 b8/copy-to-EAX "*(esi-3)"/imm32
2469 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2470 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2471 05/add-to-EAX 4/imm32
2472
2473 51/push-ECX
2474 50/push-EAX
2475 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2476
2477
2478 51/push-ECX
2479
2480 e8/call parse-effective-address/disp32
2481
2482 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2483
2484
2485
2486 68/push "F - test-parse-effective-address-base-negative-displacement/base"/imm32
2487 68/push 6/imm32/ESI
2488 50/push-EAX
2489
2490 e8/call check-ints-equal/disp32
2491
2492 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2493
2494
2495 68/push "F - test-parse-effective-address-base-negative-displacement/index"/imm32
2496 68/push 4/imm32/none
2497 51/push-ECX
2498
2499 e8/call check-ints-equal/disp32
2500
2501 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2502
2503
2504 68/push "F - test-parse-effective-address-base-negative-displacement/scale"/imm32
2505 68/push 0/imm32/none
2506 52/push-EDX
2507
2508 e8/call check-ints-equal/disp32
2509
2510 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2511
2512
2513 68/push "F - test-parse-effective-address-base-negative-displacement/displacement"/imm32
2514 68/push -3/imm32
2515 53/push-EBX
2516
2517 e8/call check-ints-equal/disp32
2518
2519 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2520
2521 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2522 5d/pop-to-EBP
2523 c3/return
2524
2525 test-parse-effective-address-base-index:
2526
2527 55/push-EBP
2528 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2529
2530 b8/copy-to-EAX "*(esi+ecx)"/imm32
2531 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2532 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2533 05/add-to-EAX 4/imm32
2534
2535 51/push-ECX
2536 50/push-EAX
2537 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2538
2539
2540 51/push-ECX
2541
2542 e8/call parse-effective-address/disp32
2543
2544 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2545
2546
2547
2548 68/push "F - test-parse-effective-address-base-index/base"/imm32
2549 68/push 6/imm32/ESI
2550 50/push-EAX
2551
2552 e8/call check-ints-equal/disp32
2553
2554 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2555
2556
2557 68/push "F - test-parse-effective-address-base-index/index"/imm32
2558 68/push 1/imm32/none
2559 51/push-ECX
2560
2561 e8/call check-ints-equal/disp32
2562
2563 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2564
2565
2566 68/push "F - test-parse-effective-address-base-index/scale"/imm32
2567 68/push 0/imm32/none
2568 52/push-EDX
2569
2570 e8/call check-ints-equal/disp32
2571
2572 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2573
2574
2575 68/push "F - test-parse-effective-address-base-index/displacement"/imm32
2576 68/push 0/imm32
2577 53/push-EBX
2578
2579 e8/call check-ints-equal/disp32
2580
2581 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2582
2583 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2584 5d/pop-to-EBP
2585 c3/return
2586
2587 test-parse-effective-address-base-index-scale:
2588
2589 55/push-EBP
2590 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2591
2592 b8/copy-to-EAX "*(esi+ecx<<2)"/imm32
2593 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2594 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2595 05/add-to-EAX 4/imm32
2596
2597 51/push-ECX
2598 50/push-EAX
2599 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2600
2601
2602 51/push-ECX
2603
2604 e8/call parse-effective-address/disp32
2605
2606 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2607
2608
2609
2610 68/push "F - test-parse-effective-address-base-index-scale/base"/imm32
2611 68/push 6/imm32/ESI
2612 50/push-EAX
2613
2614 e8/call check-ints-equal/disp32
2615
2616 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2617
2618
2619 68/push "F - test-parse-effective-address-base-index-scale/index"/imm32
2620 68/push 1/imm32/none
2621 51/push-ECX
2622
2623 e8/call check-ints-equal/disp32
2624
2625 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2626
2627
2628 68/push "F - test-parse-effective-address-base-index-scale/scale"/imm32
2629 68/push 2/imm32
2630 52/push-EDX
2631
2632 e8/call check-ints-equal/disp32
2633
2634 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2635
2636
2637 68/push "F - test-parse-effective-address-base-index-scale/displacement"/imm32
2638 68/push 0/imm32
2639 53/push-EBX
2640
2641 e8/call check-ints-equal/disp32
2642
2643 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2644
2645 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2646 5d/pop-to-EBP
2647 c3/return
2648
2649 test-parse-effective-address-base-index-scale-displacement:
2650
2651 55/push-EBP
2652 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2653
2654 b8/copy-to-EAX "*(esi + ecx<<2 - 0x34)"/imm32
2655 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2656 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2657 05/add-to-EAX 4/imm32
2658
2659 51/push-ECX
2660 50/push-EAX
2661 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2662
2663
2664 51/push-ECX
2665
2666 e8/call parse-effective-address/disp32
2667
2668 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2669
2670
2671
2672 68/push "F - test-parse-effective-address-base-index-scale/base"/imm32
2673 68/push 6/imm32/ESI
2674 50/push-EAX
2675
2676 e8/call check-ints-equal/disp32
2677
2678 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2679
2680
2681 68/push "F - test-parse-effective-address-base-index-scale/index"/imm32
2682 68/push 1/imm32/none
2683 51/push-ECX
2684
2685 e8/call check-ints-equal/disp32
2686
2687 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2688
2689
2690 68/push "F - test-parse-effective-address-base-index-scale/scale"/imm32
2691 68/push 2/imm32
2692 52/push-EDX
2693
2694 e8/call check-ints-equal/disp32
2695
2696 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2697
2698
2699 68/push "F - test-parse-effective-address-base-index-scale/displacement"/imm32
2700 68/push -0x34/imm32
2701 53/push-EBX
2702
2703 e8/call check-ints-equal/disp32
2704
2705 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2706
2707 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2708 5d/pop-to-EBP
2709 c3/return
2710
2711
2712
2713
2714
2715 emit-indirect-mode:
2716
2717 55/push-EBP
2718 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2719 $emit-indirect-mode:check-for-sib:
2720
2721 81 7/subop/compare 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 4/imm32
2722 0f 84/jump-if-equal $emit-indirect-mode:check-for-disp/disp32
2723 $emit-indirect-mode:emit-sib:
2724
2725
2726
2727 68/push "2/mod/*+disp32 4/rm32/sib "/imm32
2728 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2729
2730 e8/call write-buffered/disp32
2731
2732 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2733
2734
2735 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
2736 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2737
2738 e8/call print-int32-buffered/disp32
2739
2740 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2741
2742
2743 68/push "/base "/imm32
2744 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2745
2746 e8/call write-buffered/disp32
2747
2748 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2749
2750
2751 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
2752 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2753
2754 e8/call print-int32-buffered/disp32
2755
2756 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2757
2758
2759 68/push "/index "/imm32
2760 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2761
2762 e8/call write-buffered/disp32
2763
2764 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2765
2766
2767 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x14/disp8 .
2768 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2769
2770 e8/call print-int32-buffered/disp32
2771
2772 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2773
2774
2775 68/push "/scale "/imm32
2776 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2777
2778 e8/call write-buffered/disp32
2779
2780 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2781
2782
2783 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x18/disp8 .
2784 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2785
2786 e8/call print-int32-buffered/disp32
2787
2788 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2789
2790
2791 68/push "/disp32"/imm32
2792 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2793
2794 e8/call write-buffered/disp32
2795
2796 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2797 e9/jump $emit-indirect-mode:end/disp32
2798 $emit-indirect-mode:check-for-disp:
2799
2800 81 7/subop/compare 1/mod/*+disp8 5/rm32/EBP . . . . 0x18/disp8 0/imm32
2801 74/jump-if-equal $emit-indirect-mode:emit-indirect/disp8
2802 $emit-indirect-mode:emit-disp:
2803
2804
2805
2806 68/push "2/mod/*+disp32 "/imm32
2807 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2808
2809 e8/call write-buffered/disp32
2810
2811 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2812
2813
2814 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
2815 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2816
2817 e8/call print-int32-buffered/disp32
2818
2819 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2820
2821
2822 68/push "/rm32 "/imm32
2823 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2824
2825 e8/call write-buffered/disp32
2826
2827 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2828
2829
2830 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x18/disp8 .
2831 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2832
2833 e8/call print-int32-buffered/disp32
2834
2835 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2836
2837
2838 68/push "/disp32"/imm32
2839 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2840
2841 e8/call write-buffered/disp32
2842
2843 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2844 eb/jump $emit-indirect-mode:end/disp8
2845 $emit-indirect-mode:emit-indirect:
2846
2847
2848
2849 68/push "0/mod/indirect "/imm32
2850 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2851
2852 e8/call write-buffered/disp32
2853
2854 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2855
2856
2857 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
2858 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2859
2860 e8/call print-int32-buffered/disp32
2861
2862 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2863
2864
2865 68/push "/rm32"/imm32
2866 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
2867
2868 e8/call write-buffered/disp32
2869
2870 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2871 $emit-indirect-mode:end:
2872
2873 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2874 5d/pop-to-EBP
2875 c3/return
2876
2877 test-emit-indirect-mode:
2878
2879 55/push-EBP
2880 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2881
2882
2883
2884 68/push _test-output-stream/imm32
2885
2886 e8/call clear-stream/disp32
2887
2888 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2889
2890
2891 b8/copy-to-EAX _test-output-buffered-file/imm32
2892 05/add-to-EAX 4/imm32
2893 50/push-EAX
2894
2895 e8/call clear-stream/disp32
2896
2897 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2898
2899
2900 68/push 0/imm32/.disp
2901 68/push 0/imm32/.scale
2902 68/push 4/imm32/.index/none
2903 68/push 0/imm32/.base
2904 68/push _test-output-buffered-file/imm32
2905
2906 e8/call emit-indirect-mode/disp32
2907
2908 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
2909
2910
2911 68/push _test-output-buffered-file/imm32
2912
2913 e8/call flush/disp32
2914
2915 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2916 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
2942
2943
2944 68/push "F - test-emit-indirect-mode"/imm32
2945 68/push "0/mod/indirect 0x00000000/rm32"/imm32
2946 68/push _test-output-stream/imm32
2947
2948 e8/call check-stream-equal/disp32
2949
2950 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2951
2952 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2953 5d/pop-to-EBP
2954 c3/return
2955
2956 test-emit-indirect-mode-2:
2957
2958 55/push-EBP
2959 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2960
2961
2962
2963 68/push _test-output-stream/imm32
2964
2965 e8/call clear-stream/disp32
2966
2967 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2968
2969
2970 b8/copy-to-EAX _test-output-buffered-file/imm32
2971 05/add-to-EAX 4/imm32
2972 50/push-EAX
2973
2974 e8/call clear-stream/disp32
2975
2976 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2977
2978
2979 68/push 0/imm32/.disp
2980 68/push 0/imm32/.scale
2981 68/push 4/imm32/.index/none
2982 68/push 7/imm32/.base
2983 68/push _test-output-buffered-file/imm32
2984
2985 e8/call emit-indirect-mode/disp32
2986
2987 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
2988
2989
2990 68/push _test-output-buffered-file/imm32
2991
2992 e8/call flush/disp32
2993
2994 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2995 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
3021
3022
3023 68/push "F - test-emit-indirect-mode-2"/imm32
3024 68/push "0/mod/indirect 0x00000007/rm32"/imm32
3025 68/push _test-output-stream/imm32
3026
3027 e8/call check-stream-equal/disp32
3028
3029 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3030
3031 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3032 5d/pop-to-EBP
3033 c3/return
3034
3035 test-emit-indirect-mode-with-disp:
3036
3037 55/push-EBP
3038 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3039
3040
3041
3042 68/push _test-output-stream/imm32
3043
3044 e8/call clear-stream/disp32
3045
3046 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3047
3048
3049 b8/copy-to-EAX _test-output-buffered-file/imm32
3050 05/add-to-EAX 4/imm32
3051 50/push-EAX
3052
3053 e8/call clear-stream/disp32
3054
3055 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3056
3057
3058 68/push 4/imm32/.disp
3059 68/push 0/imm32/.scale
3060 68/push 4/imm32/.index/none
3061 68/push 6/imm32/.base
3062 68/push _test-output-buffered-file/imm32
3063
3064 e8/call emit-indirect-mode/disp32
3065
3066 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
3067
3068
3069 68/push _test-output-buffered-file/imm32
3070
3071 e8/call flush/disp32
3072
3073 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3074 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
3100
3101
3102 68/push "F - test-emit-indirect-mode-with-disp"/imm32
3103 68/push "2/mod/*+disp32 0x00000006/rm32 0x00000004/disp32"/imm32
3104 68/push _test-output-stream/imm32
3105
3106 e8/call check-stream-equal/disp32
3107
3108 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3109
3110 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3111 5d/pop-to-EBP
3112 c3/return
3113
3114 test-emit-indirect-mode-with-disp-negative:
3115
3116 55/push-EBP
3117 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3118
3119
3120
3121 68/push _test-output-stream/imm32
3122
3123 e8/call clear-stream/disp32
3124
3125 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3126
3127
3128 b8/copy-to-EAX _test-output-buffered-file/imm32
3129 05/add-to-EAX 4/imm32
3130 50/push-EAX
3131
3132 e8/call clear-stream/disp32
3133
3134 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3135
3136
3137 68/push -4/imm32/.disp
3138 68/push 0/imm32/.scale
3139 68/push 4/imm32/.index/none
3140 68/push 6/imm32/.base
3141 68/push _test-output-buffered-file/imm32
3142
3143 e8/call emit-indirect-mode/disp32
3144
3145 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
3146
3147
3148 68/push _test-output-buffered-file/imm32
3149
3150 e8/call flush/disp32
3151
3152 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3153 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
3179
3180
3181 68/push "F - test-emit-indirect-mode-with-disp"/imm32
3182 68/push "2/mod/*+disp32 0x00000006/rm32 0xfffffffc/disp32"/imm32
3183 68/push _test-output-stream/imm32
3184
3185 e8/call check-stream-equal/disp32
3186
3187 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3188
3189 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3190 5d/pop-to-EBP
3191 c3/return
3192
3193 test-emit-indirect-mode-with-sib:
3194
3195 55/push-EBP
3196 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3197
3198
3199
3200 68/push _test-output-stream/imm32
3201
3202 e8/call clear-stream/disp32
3203
3204 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3205
3206
3207 b8/copy-to-EAX _test-output-buffered-file/imm32
3208 05/add-to-EAX 4/imm32
3209 50/push-EAX
3210
3211 e8/call clear-stream/disp32
3212
3213 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3214
3215
3216 68/push 4/imm32/.disp
3217 68/push 2/imm32/.scale
3218 68/push 1/imm32/.index
3219 68/push 6/imm32/.base
3220 68/push _test-output-buffered-file/imm32
3221
3222 e8/call emit-indirect-mode/disp32
3223
3224 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x14/imm32
3225
3226
3227 68/push _test-output-buffered-file/imm32
3228
3229 e8/call flush/disp32
3230
3231 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3232 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
3258
3259
3260 68/push "F - test-emit-indirect-mode-with-sib"/imm32
3261 68/push "2/mod/*+disp32 4/rm32/sib 0x00000006/base 0x00000001/index 0x00000002/scale 0x00000004/disp32"/imm32
3262 68/push _test-output-stream/imm32
3263
3264 e8/call check-stream-equal/disp32
3265
3266 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3267
3268 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3269 5d/pop-to-EBP
3270 c3/return
3271
3272
3273
3274 skip-until-close-paren:
3275
3276 55/push-EBP
3277 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3278
3279 50/push-EAX
3280 51/push-ECX
3281 52/push-EDX
3282
3283 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 1/r32/ECX 8/disp8 .
3284
3285
3286 8b/copy 1/mod/*+disp8 1/rm32/ECX . . 2/r32/EDX 8/disp8 .
3287 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ECX 2/index/EDX . 2/r32/EDX 0xc/disp8 .
3288 52/push-EDX
3289
3290 8b/copy 1/mod/*+disp8 1/rm32/ECX . . 2/r32/EDX 4/disp8 .
3291 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ECX 2/index/EDX . 2/r32/EDX 0xc/disp8 .
3292 52/push-EDX
3293
3294 e8/call skip-until-close-paren-in-slice/disp32
3295
3296 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3297
3298 29/subtract 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
3299 2d/subtract-from-EAX 0xc/imm32
3300 89/copy 1/mod/*+disp8 1/rm32/ECX . . 0/r32/EAX 4/disp8 .
3301 $skip-until-close-paren:end:
3302
3303 5a/pop-to-EDX
3304 59/pop-to-ECX
3305 58/pop-to-EAX
3306
3307 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3308 5d/pop-to-EBP
3309 c3/return
3310
3311 test-skip-until-close-paren:
3312
3313 55/push-EBP
3314 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3315
3316
3317
3318 68/push _test-input-stream/imm32
3319
3320 e8/call clear-stream/disp32
3321
3322 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3323
3324
3325
3326 68/push "*(abc) def"/imm32
3327 68/push _test-input-stream/imm32
3328
3329 e8/call write/disp32
3330
3331 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3332
3333
3334 68/push "F - test-skip-until-close-paren/precondition"/imm32
3335 68/push 0/imm32
3336 b8/copy-to-EAX _test-input-stream/imm32
3337 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
3338
3339 e8/call check-ints-equal/disp32
3340
3341 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3342
3343
3344 68/push _test-input-stream/imm32
3345
3346 e8/call skip-until-close-paren/disp32
3347
3348 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3349
3350
3351 68/push "F - test-skip-until-close-paren"/imm32
3352 68/push 5/imm32
3353 b8/copy-to-EAX _test-input-stream/imm32
3354 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
3355
3356 e8/call check-ints-equal/disp32
3357
3358 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3359
3360 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3361 5d/pop-to-EBP
3362 c3/return
3363
3364 test-skip-until-close-paren-ignores-spaces:
3365
3366 55/push-EBP
3367 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3368
3369
3370
3371 68/push _test-input-stream/imm32
3372
3373 e8/call clear-stream/disp32
3374
3375 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3376
3377
3378 68/push "*(a b)/yz"/imm32
3379 68/push _test-input-stream/imm32
3380
3381 e8/call write/disp32
3382
3383 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3384
3385
3386 68/push "F - test-skip-until-close-paren-ignores-spaces/precondition"/imm32
3387 68/push 0/imm32
3388 b8/copy-to-EAX _test-input-stream/imm32
3389 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
3390
3391 e8/call check-ints-equal/disp32
3392
3393 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3394
3395
3396 68/push _test-input-stream/imm32
3397
3398 e8/call skip-until-close-paren/disp32
3399
3400 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3401
3402
3403 68/push "F - test-skip-until-close-paren-ignores-spaces"/imm32
3404 68/push 5/imm32
3405 b8/copy-to-EAX _test-input-stream/imm32
3406 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
3407
3408 e8/call check-ints-equal/disp32
3409
3410 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3411
3412 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3413 5d/pop-to-EBP
3414 c3/return
3415
3416 test-skip-until-close-paren-works-from-mid-stream:
3417
3418 55/push-EBP
3419 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3420
3421
3422
3423 68/push _test-input-stream/imm32
3424
3425 e8/call clear-stream/disp32
3426
3427 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3428
3429
3430 68/push "0 *(a b)/yz"/imm32
3431 68/push _test-input-stream/imm32
3432
3433 e8/call write/disp32
3434
3435 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3436
3437 c7 0/subop/copy 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 2/imm32
3438
3439
3440 68/push _test-input-stream/imm32
3441
3442 e8/call skip-until-close-paren/disp32
3443
3444 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3445
3446
3447 68/push "F - test-skip-until-close-paren-works-from-mid-stream"/imm32
3448 68/push 7/imm32
3449 b8/copy-to-EAX _test-input-stream/imm32
3450 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
3451
3452 e8/call check-ints-equal/disp32
3453
3454 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3455
3456 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3457 5d/pop-to-EBP
3458 c3/return
3459
3460 skip-until-close-paren-in-slice:
3461
3462 55/push-EBP
3463 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3464
3465 51/push-ECX
3466 52/push-EDX
3467
3468 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 1/r32/ECX 8/disp8 .
3469
3470 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 2/r32/EDX 0xc/disp8 .
3471
3472 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
3473
3474 41/increment-ECX
3475 $skip-until-close-paren-in-slice:loop:
3476
3477 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
3478 73/jump-if-greater-unsigned-or-equal $skip-until-close-paren-in-slice:break/disp8
3479
3480 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
3481 $skip-until-close-paren-in-slice:check-close:
3482
3483 3d/compare-EAX-and 0x29/imm32/close-paren
3484 74/jump-if-equal $skip-until-close-paren-in-slice:break/disp8
3485
3486 41/increment-ECX
3487 eb/jump $skip-until-close-paren-in-slice:loop/disp8
3488 $skip-until-close-paren-in-slice:break:
3489
3490 89/copy 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
3491 $skip-until-close-paren-in-slice:end:
3492
3493 5a/pop-to-EDX
3494 59/pop-to-ECX
3495
3496 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3497 5d/pop-to-EBP
3498 c3/return
3499
3500 test-skip-until-close-paren-in-slice:
3501
3502 55/push-EBP
3503 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3504
3505 b8/copy-to-EAX "*(abc) def"/imm32
3506 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3507 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3508 05/add-to-EAX 4/imm32
3509
3510
3511 51/push-ECX
3512 50/push-EAX
3513
3514 e8/call skip-until-close-paren-in-slice/disp32
3515
3516 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3517
3518
3519 68/push "F - test-skip-until-close-paren-in-slice"/imm32
3520 68/push 5/imm32
3521
3522 29/subtract 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
3523 51/push-ECX
3524
3525 e8/call check-ints-equal/disp32
3526
3527 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3528
3529 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3530 5d/pop-to-EBP
3531 c3/return
3532
3533 test-skip-until-close-paren-in-slice-ignores-spaces:
3534
3535 55/push-EBP
3536 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3537
3538 b8/copy-to-EAX "*(a b)/yz"/imm32
3539 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3540 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3541 05/add-to-EAX 4/imm32
3542
3543
3544 51/push-ECX
3545 50/push-EAX
3546
3547 e8/call skip-until-close-paren-in-slice/disp32
3548
3549 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3550
3551
3552 68/push "F - test-skip-until-close-paren-in-slice-ignores-spaces"/imm32
3553 68/push 4/imm32
3554
3555 29/subtract 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
3556 51/push-ECX
3557
3558 e8/call check-ints-equal/disp32
3559
3560 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3561
3562 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3563 5d/pop-to-EBP
3564 c3/return
3565
3566 test-skip-until-close-paren-in-slice-stops-at-end:
3567
3568 55/push-EBP
3569 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3570
3571 b8/copy-to-EAX "*(abc"/imm32
3572 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3573 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3574 05/add-to-EAX 4/imm32
3575
3576
3577 51/push-ECX
3578 50/push-EAX
3579
3580 e8/call skip-until-close-paren-in-slice/disp32
3581
3582 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3583
3584
3585 68/push "F - test-skip-until-close-paren-in-slice-stops-at-end"/imm32
3586 68/push 0/imm32
3587
3588 29/subtract 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
3589 51/push-ECX
3590
3591 e8/call check-ints-equal/disp32
3592
3593 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3594
3595 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3596 5d/pop-to-EBP
3597 c3/return
3598
3599
3600
3601
3602 next-hex-int:
3603
3604 55/push-EBP
3605 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3606
3607 51/push-ECX
3608 52/push-EDX
3609 53/push-EBX
3610 56/push-ESI
3611 57/push-EDI
3612
3613 31/xor 3/mod/direct 7/rm32/EDI . . . 7/r32/EDI . .
3614
3615 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
3616
3617 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 2/r32/EDX 4/disp8 .
3618
3619 8b/copy 0/mod/indirect 6/rm32/ESI . . . 1/r32/ECX . .
3620
3621 31/xor 3/mod/direct 3/rm32/EBX . . . 3/r32/EBX . .
3622
3623 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
3624 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
3625 $next-hex-int:positive:
3626
3627 3d/compare-EAX-and 0x2b/imm32/+
3628 75/jump-if-not-equal $next-hex-int:negative/disp8
3629
3630 41/increment-ECX
3631 eb/jump $next-hex-int:skip-whitespace/disp8
3632 $next-hex-int:negative:
3633
3634 3d/compare-EAX-and 0x2d/imm32/-
3635 75/jump-if-not-equal $next-hex-int:skip-whitespace/disp8
3636 $next-hex-int:need-to-negate:
3637
3638 41/increment-ECX
3639
3640 bb/copy-to-EBX 1/imm32/true
3641
3642 $next-hex-int:skip-whitespace:
3643
3644 50/push-EAX
3645
3646
3647 52/push-EDX
3648 51/push-ECX
3649
3650 e8/call skip-chars-matching-whitespace-in-slice/disp32
3651
3652 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3653
3654 89/copy 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
3655
3656 58/pop-to-EAX
3657 $next-hex-int:initial-0:
3658
3659
3660 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
3661 3d/compare-EAX-and 0x30/imm32/0
3662 75/jump-if-not-equal $next-hex-int:loop/disp8
3663
3664 41/increment-ECX
3665 $next-hex-int:initial-0x:
3666
3667 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
3668 73/jump-if-greater-or-equal-unsigned $next-hex-int:end/disp8
3669
3670 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
3671 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
3672 3d/compare-EAX-and 0x78/imm32/x
3673 75/jump-if-not-equal $next-hex-int:loop/disp8
3674
3675 41/increment-ECX
3676 $next-hex-int:loop:
3677
3678 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
3679 73/jump-if-greater-or-equal-unsigned $next-hex-int:break/disp8
3680
3681
3682 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
3683
3684
3685 50/push-EAX
3686
3687 e8/call is-hex-digit?/disp32
3688
3689 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3690
3691 3d/compare-EAX-and 0/imm32
3692 74/jump-if-equal $next-hex-int:break/disp8
3693
3694
3695 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
3696
3697 e8/call from-hex-char/disp32
3698
3699 c1/shift 4/subop/left 3/mod/direct 7/rm32/EDI . . . . . 4/imm8
3700 01/add 3/mod/direct 7/rm32/EDI . . . 0/r32/EAX . .
3701
3702 41/increment-ECX
3703
3704 eb/jump $next-hex-int:loop/disp8
3705 $next-hex-int:break:
3706 81 7/subop/compare 3/mod/direct 3/rm32/EBX . . . . . 0/imm32
3707 74/jump-if-equal $next-hex-int:end/disp8
3708 $next-hex-int:negate:
3709 f7 3/subop/negate 3/mod/direct 7/rm32/EDI . . . . . .
3710 $next-hex-int:end:
3711
3712 89/copy 0/mod/indirect 6/rm32/ESI . . . 1/r32/ECX . .
3713
3714 89/copy 3/mod/direct 0/rm32/EAX . . . 7/r32/EDI . .
3715
3716 5f/pop-to-EDI
3717 5e/pop-to-ESI
3718 5b/pop-to-EBX
3719 5a/pop-to-EDX
3720 59/pop-to-ECX
3721
3722 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3723 5d/pop-to-EBP
3724 c3/return
3725
3726 $next-hex-int:abort:
3727
3728
3729 68/push "next-hex-int: invalid hex char: "/imm32
3730 68/push 2/imm32/stderr
3731
3732 e8/call _write/disp32
3733
3734 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3735
3736
3737 50/push-EAX
3738
3739 b8/copy-to-EAX Stderr/imm32
3740 05/add-to-EAX 4/imm32
3741 50/push-EAX
3742
3743 e8/call clear-stream/disp32
3744
3745 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3746
3747 58/pop-to-EAX
3748
3749
3750 50/push-EAX
3751 68/push Stderr/imm32
3752
3753 e8/call print-int32-buffered/disp32
3754
3755 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3756
3757
3758 68/push Stderr/imm32
3759
3760 e8/call flush/disp32
3761
3762 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3763
3764
3765 68/push "\n"/imm32
3766 68/push 2/imm32/stderr
3767
3768 e8/call _write/disp32
3769
3770 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
3771
3772 bb/copy-to-EBX 1/imm32
3773 b8/copy-to-EAX 1/imm32/exit
3774 cd/syscall 0x80/imm8
3775
3776
3777 test-next-hex-int-single-digit:
3778
3779 55/push-EBP
3780 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3781
3782 b8/copy-to-EAX "+a)"/imm32
3783 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3784 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3785 05/add-to-EAX 4/imm32
3786
3787 51/push-ECX
3788 50/push-EAX
3789 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3790
3791
3792 51/push-ECX
3793
3794 e8/call next-hex-int/disp32
3795
3796 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3797
3798
3799 68/push "F - test-next-hex-int-single-digit"/imm32
3800 68/push 0xa/imm32
3801 50/push-EAX
3802
3803 e8/call check-ints-equal/disp32
3804
3805 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3806
3807 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3808 5d/pop-to-EBP
3809 c3/return
3810
3811 test-next-hex-int-multi-digit:
3812
3813 55/push-EBP
3814 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3815
3816 b8/copy-to-EAX "+ 34a)"/imm32
3817 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3818 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3819 05/add-to-EAX 4/imm32
3820
3821 51/push-ECX
3822 50/push-EAX
3823 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3824
3825
3826 51/push-ECX
3827
3828 e8/call next-hex-int/disp32
3829
3830 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3831
3832
3833 68/push "F - test-next-hex-int-multi-digit"/imm32
3834 68/push 0x34a/imm32
3835 50/push-EAX
3836
3837 e8/call check-ints-equal/disp32
3838
3839 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3840
3841 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3842 5d/pop-to-EBP
3843 c3/return
3844
3845 test-next-hex-int-0x-prefix:
3846
3847 55/push-EBP
3848 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3849
3850 b8/copy-to-EAX "+0x34)"/imm32
3851 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3852 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3853 05/add-to-EAX 4/imm32
3854
3855 51/push-ECX
3856 50/push-EAX
3857 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3858
3859
3860 51/push-ECX
3861
3862 e8/call next-hex-int/disp32
3863
3864 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3865
3866
3867 68/push "F - test-next-hex-int-0x-prefix"/imm32
3868 68/push 0x34/imm32
3869 50/push-EAX
3870
3871 e8/call check-ints-equal/disp32
3872
3873 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3874
3875 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3876 5d/pop-to-EBP
3877 c3/return
3878
3879 test-next-hex-int-zero:
3880
3881 55/push-EBP
3882 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3883
3884 b8/copy-to-EAX "+0)"/imm32
3885 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3886 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3887 05/add-to-EAX 4/imm32
3888
3889 51/push-ECX
3890 50/push-EAX
3891 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3892
3893
3894 51/push-ECX
3895
3896 e8/call next-hex-int/disp32
3897
3898 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3899
3900
3901 68/push "F - test-next-hex-int-zero"/imm32
3902 68/push 0/imm32
3903 50/push-EAX
3904
3905 e8/call check-ints-equal/disp32
3906
3907 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3908
3909 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3910 5d/pop-to-EBP
3911 c3/return
3912
3913 test-next-hex-int-0-prefix:
3914
3915 55/push-EBP
3916 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3917
3918 b8/copy-to-EAX "+ 03)"/imm32
3919 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3920 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3921 05/add-to-EAX 4/imm32
3922
3923 51/push-ECX
3924 50/push-EAX
3925 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3926
3927
3928 51/push-ECX
3929
3930 e8/call next-hex-int/disp32
3931
3932 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3933
3934
3935 68/push "F - test-next-hex-int-0-prefix"/imm32
3936 68/push 3/imm32
3937 50/push-EAX
3938
3939 e8/call check-ints-equal/disp32
3940
3941 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3942
3943 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3944 5d/pop-to-EBP
3945 c3/return
3946
3947 test-next-hex-int-negative:
3948
3949 55/push-EBP
3950 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3951
3952 b8/copy-to-EAX "-03)"/imm32
3953 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3954 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3955 05/add-to-EAX 4/imm32
3956
3957 51/push-ECX
3958 50/push-EAX
3959 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3960
3961
3962 51/push-ECX
3963
3964 e8/call next-hex-int/disp32
3965
3966 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
3967
3968
3969 68/push "F - test-next-hex-int-negative"/imm32
3970 68/push -3/imm32
3971 50/push-EAX
3972
3973 e8/call check-ints-equal/disp32
3974
3975 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
3976
3977 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
3978 5d/pop-to-EBP
3979 c3/return
3980
3981 test-next-hex-int-negative-with-space:
3982
3983 55/push-EBP
3984 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
3985
3986 b8/copy-to-EAX "- 03)"/imm32
3987 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
3988 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
3989 05/add-to-EAX 4/imm32
3990
3991 51/push-ECX
3992 50/push-EAX
3993 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
3994
3995
3996 51/push-ECX
3997
3998 e8/call next-hex-int/disp32
3999
4000 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
4001
4002
4003 68/push "F - test-next-hex-int-negative-with-space"/imm32
4004 68/push -3/imm32
4005 50/push-EAX
4006
4007 e8/call check-ints-equal/disp32
4008
4009 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
4010
4011 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
4012 5d/pop-to-EBP
4013 c3/return
4014
4015
4016
4017
4018 next-positive-hex-int:
4019
4020 55/push-EBP
4021 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
4022
4023 51/push-ECX
4024 52/push-EDX
4025 53/push-EBX
4026 56/push-ESI
4027 57/push-EDI
4028
4029 31/xor 3/mod/direct 7/rm32/EDI . . . 7/r32/EDI . .
4030
4031 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
4032
4033 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 2/r32/EDX 4/disp8 .
4034
4035 8b/copy 0/mod/indirect 6/rm32/ESI . . . 1/r32/ECX . .
4036
4037 31/xor 3/mod/direct 3/rm32/EBX . . . 3/r32/EBX . .
4038
4039 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
4040 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
4041 $next-positive-hex-int:initial-0:
4042
4043
4044 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
4045 3d/compare-EAX-and 0x30/imm32/0
4046 75/jump-if-not-equal $next-positive-hex-int:loop/disp8
4047
4048 41/increment-ECX
4049 $next-positive-hex-int:initial-0x:
4050
4051 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
4052 73/jump-if-greater-or-equal-unsigned $next-positive-hex-int:end/disp8
4053
4054 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
4055 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
4056 3d/compare-EAX-and 0x78/imm32/x
4057 75/jump-if-not-equal $next-positive-hex-int:loop/disp8
4058
4059 41/increment-ECX
4060 $next-positive-hex-int:loop:
4061
4062 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
4063 73/jump-if-greater-or-equal-unsigned $next-positive-hex-int:end/disp8
4064
4065
4066 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
4067
4068
4069 50/push-EAX
4070
4071 e8/call is-hex-digit?/disp32
4072
4073 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
4074
4075 3d/compare-EAX-and 0/imm32
4076 74/jump-if-equal $next-positive-hex-int:end/disp8
4077
4078
4079 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
4080
4081 e8/call from-hex-char/disp32
4082
4083 c1/shift 4/subop/left 3/mod/direct 7/rm32/EDI . . . . . 4/imm8
4084 01/add 3/mod/direct 7/rm32/EDI . . . 0/r32/EAX . .
4085
4086 41/increment-ECX
4087
4088 eb/jump $next-positive-hex-int:loop/disp8
4089 $next-positive-hex-int:end:
4090
4091 89/copy 0/mod/indirect 6/rm32/ESI . . . 1/r32/ECX . .
4092
4093 89/copy 3/mod/direct 0/rm32/EAX . . . 7/r32/EDI . .
4094
4095 5f/pop-to-EDI
4096 5e/pop-to-ESI
4097 5b/pop-to-EBX
4098 5a/pop-to-EDX
4099 59/pop-to-ECX
4100
4101 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
4102 5d/pop-to-EBP
4103 c3/return
4104
4105 test-next-positive-hex-int-single-digit:
4106
4107 55/push-EBP
4108 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
4109
4110 b8/copy-to-EAX "a)"/imm32
4111 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
4112 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
4113 05/add-to-EAX 4/imm32
4114
4115 51/push-ECX
4116 50/push-EAX
4117 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
4118
4119
4120 51/push-ECX
4121
4122 e8/call next-positive-hex-int/disp32
4123
4124 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
4125
4126
4127 68/push "F - test-next-positive-hex-int-single-digit"/imm32
4128 68/push 0xa/imm32
4129 50/push-EAX
4130
4131 e8/call check-ints-equal/disp32
4132
4133 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
4134
4135 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
4136 5d/pop-to-EBP
4137 c3/return
4138
4139 test-next-positive-hex-int-multi-digit:
4140
4141 55/push-EBP
4142 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
4143
4144 b8/copy-to-EAX "34a)"/imm32
4145 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
4146 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
4147 05/add-to-EAX 4/imm32
4148
4149 51/push-ECX
4150 50/push-EAX
4151 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
4152
4153
4154 51/push-ECX
4155
4156 e8/call next-positive-hex-int/disp32
4157
4158 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
4159
4160
4161 68/push "F - test-next-positive-hex-int-multi-digit"/imm32
4162 68/push 0x34a/imm32
4163 50/push-EAX
4164
4165 e8/call check-ints-equal/disp32
4166
4167 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
4168
4169 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
4170 5d/pop-to-EBP
4171 c3/return
4172
4173 test-next-positive-hex-int-0x-prefix:
4174
4175 55/push-EBP
4176 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
4177
4178 b8/copy-to-EAX "0x34)"/imm32
4179 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
4180 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
4181 05/add-to-EAX 4/imm32
4182
4183 51/push-ECX
4184 50/push-EAX
4185 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
4186
4187
4188 51/push-ECX
4189
4190 e8/call next-positive-hex-int/disp32
4191
4192 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
4193
4194
4195 68/push "F - test-next-positive-hex-int-0x-prefix"/imm32
4196 68/push 0x34/imm32
4197 50/push-EAX
4198
4199 e8/call check-ints-equal/disp32
4200
4201 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
4202
4203 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
4204 5d/pop-to-EBP
4205 c3/return
4206
4207 test-next-positive-hex-int-zero:
4208
4209 55/push-EBP
4210 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
4211
4212 b8/copy-to-EAX "0"/imm32
4213 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
4214 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
4215 05/add-to-EAX 4/imm32
4216
4217 51/push-ECX
4218 50/push-EAX
4219 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
4220
4221
4222 51/push-ECX
4223
4224 e8/call next-positive-hex-int/disp32
4225
4226 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
4227
4228
4229 68/push "F - test-next-positive-hex-int-zero"/imm32
4230 68/push 0/imm32
4231 50/push-EAX
4232
4233 e8/call check-ints-equal/disp32
4234
4235 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
4236
4237 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
4238 5d/pop-to-EBP
4239 c3/return
4240
4241 test-next-positive-hex-int-0-prefix:
4242
4243 55/push-EBP
4244 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
4245
4246 b8/copy-to-EAX "03)"/imm32
4247 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
4248 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
4249 05/add-to-EAX 4/imm32
4250
4251 51/push-ECX
4252 50/push-EAX
4253 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
4254
4255
4256 51/push-ECX
4257
4258 e8/call next-positive-hex-int/disp32
4259
4260 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
4261
4262
4263 68/push "F - test-next-positive-hex-int-0-prefix"/imm32
4264 68/push 3/imm32
4265 50/push-EAX
4266
4267 e8/call check-ints-equal/disp32
4268
4269 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
4270
4271 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
4272 5d/pop-to-EBP
4273 c3/return
4274
4275 == data
4276 Registers:
4277
4278 0x40/imm32/write
4279 0/imm32/read
4280 0x40/imm32/length
4281
4282 "eax"/imm32 0/imm32
4283 "ecx"/imm32 1/imm32
4284 "edx"/imm32 2/imm32
4285 "ebx"/imm32 3/imm32
4286 "esp"/imm32 4/imm32
4287 "ebp"/imm32 5/imm32
4288 "esi"/imm32 6/imm32
4289 "edi"/imm32 7/imm32
4290
4291