https://github.com/akkartik/mu/blob/master/057write.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 == code
19
20
21
22
23
24 write:
25
26 55/push-ebp
27 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
28
29 81 7/subop/compare 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 0x08000000/imm32
30 73/jump-if-greater-unsigned-or-equal $write:fake/disp8
31
32 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
33 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 8/disp8 .
34
35 e8/call _write/disp32
36
37 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
38 eb/jump $write:end/disp8
39 $write:fake:
40
41
42 50/push-eax
43 51/push-ecx
44 52/push-edx
45 53/push-ebx
46
47 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 1/r32/ecx 8/disp8 .
48
49 8b/copy 0/mod/indirect 1/rm32/ecx . . . 2/r32/edx . .
50
51 8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 3/r32/ebx 8/disp8 .
52
53
54 ff 6/subop/push 1/mod/*+disp8 5/rm32/ebp . . . . 0xc/disp8 .
55
56 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ecx 3/index/ebx . 3/r32/ebx 0xc/disp8 .
57 53/push-ebx
58
59 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ecx 2/index/edx . 3/r32/ebx 0xc/disp8 .
60 53/push-ebx
61
62 e8/call _append-3/disp32
63
64 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
65
66 01/add 0/mod/indirect 1/rm32/ecx . . . 0/r32/eax . .
67
68 5b/pop-to-ebx
69 5a/pop-to-edx
70 59/pop-to-ecx
71 58/pop-to-eax
72 $write:end:
73
74 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
75 5d/pop-to-ebp
76 c3/return
77
78 test-write-single:
79
80
81 68/push _test-stream/imm32
82
83 e8/call clear-stream/disp32
84
85 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
86
87
88 68/push "Ab"/imm32
89 68/push _test-stream/imm32
90
91 e8/call write/disp32
92
93 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
94
95
96 68/push "F - test-write-single"/imm32
97 68/push 0x006241/imm32/Ab
98
99 b8/copy-to-eax _test-stream/imm32
100 ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 0xc/disp8 .
101
102 e8/call check-ints-equal/disp32
103
104 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
105
106 c3/return
107
108 test-write-appends:
109
110
111 68/push _test-stream/imm32
112
113 e8/call clear-stream/disp32
114
115 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
116
117
118 68/push "C"/imm32
119 68/push _test-stream/imm32
120
121 e8/call write/disp32
122
123 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
124
125
126 68/push "D"/imm32
127 68/push _test-stream/imm32
128
129 e8/call write/disp32
130
131 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
132
133
134 68/push "F - test-write-appends"/imm32
135 68/push 0x00004443/imm32/C-D
136
137 b8/copy-to-eax _test-stream/imm32
138 ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 0xc/disp8 .
139
140 e8/call check-ints-equal/disp32
141
142 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
143
144 c3/return
145
146 == data
147
148 _test-stream:
149
150 0/imm32
151
152 0/imm32
153
154 0x10/imm32
155
156 00 00 00 00 00 00 00 00
157 00 00 00 00 00 00 00 00
158
159