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 Entry:
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 $argv-equal:loop:
42
43 b8/copy-to-EAX 0/imm32
44 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
45 bb/copy-to-EBX 0/imm32
46 8a/copy-byte 0/mod/indirect 2/rm32/EDX . . . 3/r32/BL . .
47
48 3d/compare-EAX 0/imm32
49 74/jump-if-equal $argv-equal:break/disp8
50
51 39/compare 3/mod/direct 0/rm32/EAX . . . 3/r32/EBX . .
52 75/jump-if-not-equal $argv-equal:false/disp8
53
54 41/inc-ECX
55 42/inc-EDX
56
57 eb/jump $argv-equal:loop/disp8
58 $argv-equal:break:
59
60 81 7/subop/compare 3/mod/direct 3/rm32/EBX . . . . . 0/imm32
61 75/jump-if-not-equal $argv-equal:false/disp8
62 $argv-equal:success:
63 b8/copy-to-EAX 1/imm32
64 c3/return
65
66 $argv-equal:false:
67 b8/copy-to-EAX 0/imm32
68 c3/return
69
70