1
2
3
4
5
6
7
8
9
10 == data
11
12
13
14
15 Stdin:
16
17 00 00 00 00
18
19 00 00 00 00
20
21 00 00 00 00
22
23 08 00 00 00
24
25 00 00 00 00 00 00 00 00
26
27
28
29 == code
30
31
32
33
34
35 e8/call run-tests/disp32
36
37
38 8b/copy 0/mod/indirect 5/rm32/.disp32 3/r32/EBX Num-test-failures/disp32
39 b8/copy-to-EAX 1/imm32
40 cd/syscall 0x80/imm8
41
42
43
44 read-byte:
45
46 55/push-EBP
47 89/copy 3/mod/direct 5/rm32/EBP 4/r32/ESP
48
49 51/push-ECX
50 56/push-ESI
51
52 8b/copy 1/mod/*+disp8 4/rm32/sib 5/base/EBP 4/index/none 6/r32/ESI 8/disp8
53
54 8b/copy 1/mod/*+disp8 6/rm32/ESI 1/r32/ECX 8/disp8
55
56 3b/compare 1/mod/*+disp8 6/rm32/ESI 1/r32/ECX 4/disp8
57 7c/jump-if-lesser $read-byte:from-stream/disp8
58
59
60 8d/copy-address 1/mod/*+disp8 6/rm32/ESI 0/r32/EAX 4/disp8
61 50/push-EAX
62
63 e8/call clear-stream/disp32
64
65 81 0/subop/add 3/mod/direct 4/rm32/ESP 4/imm32
66
67
68 50/push-EAX
69 ff 6/subop/push 0/mod/indirect 6/rm32/ESI
70
71 e8/call read/disp32
72
73 81 0/subop/add 3/mod/direct 4/rm32/ESP 8/imm32
74
75 81 7/subop/compare 3/mod/direct 0/rm32/EAX 0/imm32
76 75/jump-if-not-equal $read-byte:from-stream/disp8
77 b8/copy-to-EAX 0xffffffff/imm32
78 eb/jump $read-byte:end/disp8
79 $read-byte:from-stream:
80
81 31/xor 3/mod/direct 0/rm32/EAX 0/r32/EAX
82 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX 0/r32/AL 0x10/disp8
83
84 ff 0/subop/increment 1/mod/*+disp8 6/rm32/ESI 8/disp8
85 $read-byte:end:
86
87 5e/pop-to-ESI
88 59/pop-to-ECX
89
90 89/copy 3/mod/direct 4/rm32/ESP 5/r32/EBP
91 5d/pop-to-EBP
92 c3/return
93
94
95
96
97
98
99 test-read-byte-single:
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 b8/copy-to-EAX _test-buffered-file/imm32
111 05/add-to-EAX 4/imm32
112 50/push-EAX
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 "Ab"/imm32
120 68/push _test-stream/imm32
121
122 e8/call write/disp32
123
124 81 0/subop/add 3/mod/direct 4/rm32/ESP 8/imm32
125
126
127 68/push _test-buffered-file/imm32
128
129 e8/call read-byte/disp32
130
131 81 0/subop/add 3/mod/direct 4/rm32/ESP 4/imm32
132
133
134 68/push "F - test-read-byte-single"/imm32
135 68/push 0x41/imm32
136 50/push-EAX
137
138 e8/call check-ints-equal/disp32
139
140 81 0/subop/add 3/mod/direct 4/rm32/ESP 0xc/imm32
141
142 c3/return
143
144 test-read-byte-multiple:
145
146
147
148 68/push _test-stream/imm32
149
150 e8/call clear-stream/disp32
151
152 81 0/subop/add 3/mod/direct 4/rm32/ESP 4/imm32
153
154
155 b8/copy-to-EAX _test-buffered-file/imm32
156 05/add-to-EAX 4/imm32
157 50/push-EAX
158
159 e8/call clear-stream/disp32
160
161 81 0/subop/add 3/mod/direct 4/rm32/ESP 4/imm32
162
163
164 68/push "Ab"/imm32
165 68/push _test-stream/imm32
166
167 e8/call write/disp32
168
169 81 0/subop/add 3/mod/direct 4/rm32/ESP 8/imm32
170
171
172 68/push _test-buffered-file/imm32
173
174 e8/call read-byte/disp32
175
176 81 0/subop/add 3/mod/direct 4/rm32/ESP 4/imm32
177
178
179 68/push _test-buffered-file/imm32
180
181 e8/call read-byte/disp32
182
183 81 0/subop/add 3/mod/direct 4/rm32/ESP 4/imm32
184
185
186 68/push "F - test-read-byte-multiple"/imm32
187 68/push 0x62/imm32
188 50/push-EAX
189
190 e8/call check-ints-equal/disp32
191
192 81 0/subop/add 3/mod/direct 4/rm32/ESP 0xc/imm32
193
194 c3/return
195
196 test-read-byte-end-of-file:
197
198
199
200 68/push _test-stream/imm32
201
202 e8/call clear-stream/disp32
203
204 81 0/subop/add 3/mod/direct 4/rm32/ESP 4/imm32
205
206
207 b8/copy-to-EAX _test-buffered-file/imm32
208 05/add-to-EAX 4/imm32
209 50/push-EAX
210
211 e8/call clear-stream/disp32
212
213 81 0/subop/add 3/mod/direct 4/rm32/ESP 4/imm32
214
215
216 68/push _test-buffered-file/imm32
217
218 e8/call read-byte/disp32
219
220 81 0/subop/add 3/mod/direct 4/rm32/ESP 4/imm32
221
222
223 68/push "F - test-read-byte-end-of-file"/imm32
224 68/push -1/imm32
225 50/push-EAX
226
227 e8/call check-ints-equal/disp32
228
229 81 0/subop/add 3/mod/direct 4/rm32/ESP 0xc/imm32
230
231 c3/return
232
233 == data
234
235 _test-buffered-file:
236
237 _test-stream/imm32
238
239 00 00 00 00
240
241 00 00 00 00
242
243 08 00 00 00
244
245 00 00 00 00 00 00 00 00
246
247