https://github.com/akkartik/mu/blob/main/113write-stream.subx
1
2
3 == code
4
5
6
7
8 write-stream:
9
10 55/push-ebp
11 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
12
13 50/push-eax
14 56/push-esi
15 57/push-edi
16
17 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 7/r32/edi 8/disp8 .
18
19 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 6/r32/esi 0xc/disp8 .
20
21
22 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
23 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 .
24 50/push-eax
25
26 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 .
27 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 .
28 50/push-eax
29
30 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 0/r32/eax 8/disp8 .
31 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 0/index/eax . 0/r32/eax 0xc/disp8 .
32 50/push-eax
33
34 8b/copy 0/mod/indirect 7/rm32/edi . . . 0/r32/eax . .
35 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 0/index/eax . 0/r32/eax 0xc/disp8 .
36 50/push-eax
37
38 e8/call _append-4/disp32
39
40 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
41
42 01/add 0/mod/indirect 7/rm32/edi . . . 0/r32/eax . .
43
44 01/add 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 .
45 $write-stream:end:
46
47 5f/pop-to-edi
48 5e/pop-to-esi
49 58/pop-to-eax
50
51 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
52 5d/pop-to-ebp
53 c3/return
54
55 test-write-stream-single:
56
57
58
59 68/push _test-stream/imm32
60
61 e8/call clear-stream/disp32
62
63 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
64
65
66 68/push _test-stream2/imm32
67
68 e8/call clear-stream/disp32
69
70 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
71
72
73 68/push "Ab"/imm32
74 68/push _test-stream2/imm32
75
76 e8/call write/disp32
77
78 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
79
80
81 68/push _test-stream2/imm32
82 68/push _test-stream/imm32
83
84 e8/call write-stream/disp32
85
86 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
87
88
89 68/push "F - test-write-stream-single"/imm32
90 68/push "Ab"/imm32
91 68/push _test-stream/imm32
92
93 e8/call check-stream-equal/disp32
94
95 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
96
97 c3/return
98
99 test-write-stream-appends:
100
101
102
103 68/push _test-stream/imm32
104
105 e8/call clear-stream/disp32
106
107 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
108
109
110 68/push _test-stream2/imm32
111
112 e8/call clear-stream/disp32
113
114 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
115
116
117 68/push "C"/imm32
118 68/push _test-stream2/imm32
119
120 e8/call write/disp32
121
122 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
123
124
125
126 68/push _test-stream2/imm32
127 68/push _test-stream/imm32
128
129 e8/call write-stream/disp32
130
131 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
132
133
134
135 68/push "D"/imm32
136 68/push _test-stream2/imm32
137
138 e8/call write/disp32
139
140 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
141
142
143 68/push _test-stream2/imm32
144 68/push _test-stream/imm32
145
146 e8/call write-stream/disp32
147
148 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
149
150
151 68/push "F - test-write-stream-appends"/imm32
152 68/push "CD"/imm32
153 68/push _test-stream/imm32
154
155 e8/call check-stream-equal/disp32
156
157 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
158
159 c3/return
160
161
162
163 write-stream-immutable:
164
165 55/push-ebp
166 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
167
168 50/push-eax
169 56/push-esi
170 57/push-edi
171
172 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 7/r32/edi 8/disp8 .
173
174 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 6/r32/esi 0xc/disp8 .
175
176
177 8b/copy 0/mod/indirect 6/rm32/esi . . . 0/r32/eax . .
178 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 .
179 50/push-eax
180
181 8b/copy 1/mod/*+disp8 6/rm32/esi . . . 0/r32/eax 4/disp8 .
182 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/esi 0/index/eax . 0/r32/eax 0xc/disp8 .
183 50/push-eax
184
185 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 0/r32/eax 8/disp8 .
186 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 0/index/eax . 0/r32/eax 0xc/disp8 .
187 50/push-eax
188
189 8b/copy 0/mod/indirect 7/rm32/edi . . . 0/r32/eax . .
190 8d/copy-address 1/mod/*+disp8 4/rm32/sib 7/base/edi 0/index/eax . 0/r32/eax 0xc/disp8 .
191 50/push-eax
192
193 e8/call _append-4/disp32
194
195 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0x10/imm32
196
197 01/add 0/mod/indirect 7/rm32/edi . . . 0/r32/eax . .
198 $write-stream-immutable:end:
199
200 5f/pop-to-edi
201 5e/pop-to-esi
202 58/pop-to-eax
203
204 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
205 5d/pop-to-ebp
206 c3/return
207
208 == data
209
210 _test-stream2:
211
212 4/imm32
213
214 1/imm32
215
216 8/imm32
217
218 41/A 42/B 43/C 44/D 00 00 00 00
219
220