https://github.com/akkartik/mu/blob/master/subx/examples/ex10.subx
1
2
3
4
5
6
7
8
9
10 == code
11
12
13
14
15
16
17
18
19
20
21
22 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
23
24
25 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
26
27 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
28
29 e8/call argv-equal/disp32
30
31 89/copy 3/mod/direct 3/rm32/EBX . . . 0/r32/EAX . .
32 b8/copy-to-EAX 1/imm32/exit
33 cd/syscall 0x80/imm8
34
35
36
37 argv-equal:
38
39 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none . 1/r32/ECX 4/disp8 .
40 8b/copy 1/mod/*+disp8 4/rm32/sib 4/base/ESP 4/index/none . 2/r32/EDX 8/disp8 .
41
42 $argv-equal:loop:
43
44 b8/copy-to-EAX 0/imm32
45 8a/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
46 bb/copy-to-EBX 0/imm32
47 8a/copy 0/mod/indirect 2/rm32/EDX . . . 3/r32/EBX . .
48
49 3d/compare-EAX 0/imm32
50 74/jump-if-equal $argv-equal:break/disp8
51
52 39/compare 3/mod/direct 0/rm32/EAX . . . 3/r32/EBX . .
53 75/jump-if-not-equal $argv-equal:false/disp8
54
55 41/inc-ECX
56 42/inc-EDX
57
58 eb/jump $argv-equal:loop/disp8
59 $argv-equal:break:
60
61 81 7/subop/compare 3/mod/direct 3/rm32/EBX . . . . . 0/imm32
62 75/jump-if-not-equal $argv-equal:false/disp8
63 $argv-equal:success:
64 b8/copy-to-EAX 1/imm32
65 c3/return
66
67 $argv-equal:false:
68 b8/copy-to-EAX 0/imm32
69 c3/return
70
71