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 == data
162
163 _test-stream2:
164
165 4/imm32
166
167 1/imm32
168
169 8/imm32
170
171 41/A 42/B 43/C 44/D 00 00 00 00
172
173