https://github.com/akkartik/mu/blob/main/linux/116write-buffered.subx
1
2
3 == code
4
5
6
7
8 write-buffered:
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30 55/push-ebp
31 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
32
33 50/push-eax
34 51/push-ecx
35 52/push-edx
36 53/push-ebx
37 56/push-esi
38 57/push-edi
39
40 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 0/r32/eax 0xc/disp8 .
41
42 8d/copy-address 1/mod/*+disp8 0/rm32/eax . . . 6/r32/esi 4/disp8 .
43
44 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
45 8d/copy-address 0/mod/indirect 4/rm32/sib 6/base/esi 1/index/ecx . 1/r32/ecx . .
46
47 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 7/r32/edi 8/disp8 .
48
49 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 2/r32/edx 0xc/disp8 .
50
51 8b/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 4/disp8 .
52 $write-buffered:loop:
53
54 39/compare 3/mod/direct 6/rm32/esi . . . 1/r32/ecx . .
55 73/jump-if-addr>= $write-buffered:loop-end/disp8
56
57 39/compare 3/mod/direct 3/rm32/ebx . . . 2/r32/edx . .
58 7c/jump-if-< $write-buffered:to-stream/disp8
59
60 89/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 4/disp8 .
61
62
63 57/push-edi
64
65 e8/call flush/disp32
66
67 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
68
69
70 8d/copy-address 1/mod/*+disp8 7/rm32/edi . . . 0/r32/eax 4/disp8 .
71 50/push-eax
72
73 e8/call clear-stream/disp32
74
75 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
76
77 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
78 $write-buffered:to-stream:
79
80
81
82 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
83 8a/copy-byte 0/mod/indirect 6/rm32/esi . . . 0/r32/AL . .
84
85 88/copy-byte 1/mod/*+disp8 4/rm32/sib 7/base/edi 3/index/ebx . 0/r32/AL 0x10/disp8 .
86
87 43/increment-ebx
88
89 46/increment-esi
90 eb/jump $write-buffered:loop/disp8
91 $write-buffered:loop-end:
92
93 89/copy 1/mod/*+disp8 7/rm32/edi . . . 3/r32/ebx 4/disp8 .
94 $write-buffered:end:
95
96 5f/pop-to-edi
97 5e/pop-to-esi
98 5b/pop-to-ebx
99 5a/pop-to-edx
100 59/pop-to-ecx
101 58/pop-to-eax
102
103 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
104 5d/pop-to-ebp
105 c3/return
106
107 test-write-buffered:
108
109
110
111
112 68/push _test-stream/imm32
113
114 e8/call clear-stream/disp32
115
116 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
117
118
119 68/push $_test-buffered-file->buffer/imm32
120
121 e8/call clear-stream/disp32
122
123 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
124
125
126 68/push "Abc"/imm32
127 68/push _test-buffered-file/imm32
128
self.assertRaises(OK, self.ui.finalize)
widget.__clear__()
widget.press = raise_ok
random_key = 123
self.assertRaises(OK, self.ui.handle_key, random_key)
widget.__clear__()
widget.destroy = raise_ok
self.assertRaises(OK, self.ui.destroy)
widget.__clear__()
if __name__ == '__main__':
unittest.main()
n class="Constant">"Abc"/imm32
143 68/push _test-stream/imm32
144
145 e8/call check-stream-equal/disp32
146
147 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
148
149 c3/return
150
151 test-write-buffered-with-intermediate-flush:
152
153
154
155
156 68/push _test-stream/imm32
157
158 e8/call clear-stream/disp32
159
160 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
161
162
163 68/push $_test-buffered-file->buffer/imm32
164
165 e8/call clear-stream/disp32
166
167 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
168
169
170
171
172 68/push "Abcdefg"/imm32
173 68/push _test-buffered-file/imm32
174
175 e8/call write-buffered/disp32
176
177 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
178
179
180
181
182 68/push "F - test-write-buffered-with-intermediate-flush: flushed data"/imm32
183 68/push 6/imm32
184
185 b8/copy-to-eax _test-stream/imm32
186 ff 6/subop/push 0/mod/indirect 0/rm32/eax . . . . . .
187
188 e8/call check-ints-equal/disp32
189
190 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
191
192
193
194 68/push "F - test-write-buffered-with-intermediate-flush: unflushed bytes"/imm32
195 68/push 1/imm32
196
197 b8/copy-to-eax _test-buffered-file/imm32
198 ff 6/subop/push 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 .
199
200 e8/call check-ints-equal/disp32
201
202 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
203
204 c3/return
205
206 == data
207
208
209 Stderr:
210
211 2/imm32
212 $Stderr->buffer:
213
214
215 0/imm32
216
217 0/imm32
218
219 8/imm32
220
221 00 00 00 00 00 00 00 00
222
223
224
225
226