https://github.com/akkartik/mu/blob/master/subx/apps/hex.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 == code
16
17
18
19
20 Entry:
21
22
23
24
25
26
27
28 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
29
30
31 81 7/subop/compare 1/mod/*+disp8 5/rm32/EBP . . . . 0/disp8 1/imm32
32 7e/jump-if-lesser-or-equal $run-main/disp8
33
34
35 68/push "test"/imm32
36 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
37
38 e8/call kernel-string-equal?/disp32
39
40 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
41
42 3d/compare-EAX-and 1/imm32
43 75/jump-if-not-equal $run-main/disp8
44
45 e8/call run-tests/disp32
46 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32
47 eb/jump $main:end/disp8
48 $run-main:
49
50
51 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
52 89/copy 3/mod/direct 0/rm32/EAX . . . 4/r32/ESP . .
53
54
55 c7 0/subop/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
56
57
58 50/push-EAX/ed
59 68/push Stderr/imm32
60 68/push Stdout/imm32
61 68/push Stdin/imm32
62
63 e8/call convert/disp32
64
65 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
66
67 bb/copy-to-EBX 0/imm32
68 $main:end:
69 b8/copy-to-EAX 1/imm32/exit
70 cd/syscall 0x80/imm8
71
72
73 convert:
74
75
76
77
78
79
80
81
82 55/push-EBP
83 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
84
85 50/push-EAX
86 $convert:loop:
87
88
89 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x14/disp8 .
90 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
91 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
92
93 e8/call convert-next-octet/disp32
94
95 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
96
97 3d/compare-EAX-and 0xffffffff/imm32/Eof
98 74/jump-if-equal $convert:loop-end/disp8
99
100
101 50/push-EAX
102 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
103
104 e8/call write-byte/disp32
105
106 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
107
108 eb/jump $convert:loop/disp8
109 $convert:loop-end:
110
111
112 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
113
114 e8/call flush/disp32
115
116 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
117 $convert:end:
118
119 58/pop-to-EAX
120
121 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
122 5d/pop-to-EBP
123 c3/return
124
125
126
127
128
129
130
131 convert-next-octet:
132
133
134
135
136
137
138
139
140
141
142
143 55/push-EBP
144 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
145
146 51/push-ECX
147
148
149 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
150 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
151 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
152
153 e8/call scan-next-byte/disp32
154
155 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
156
157 3d/compare-EAX-and 0xffffffff/imm32/Eof
158 74/jump-if-equal $convert-next-octet:end/disp8
159
160 e8/call from-hex-char/disp32
161
162 89/copy 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
163
164
165 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
166 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
167 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
168
169 e8/call scan-next-byte/disp32
170
171 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
172
173 3d/compare-EAX-and 0xffffffff/imm32/Eof
174 75/jump-if-not-equal $convert-next-octet:convert/disp8
175
176
177 68/push 0x2e/imm32/period/dummy
178 68/push "convert-next-octet: partial byte found"/imm32
179 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
180 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
181
182 e8/call error-byte/disp32
183 $convert-next-octet:convert:
184
185 e8/call from-hex-char/disp32
186
187
188 c1/shift 4/subop/left 3/mod/direct 1/rm32/ECX . . . . . 4/imm8
189
190 09/or 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
191 $convert-next-octet:end:
192
193 59/pop-to-ECX
194
195 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
196 5d/pop-to-EBP
197 c3/return
198
199 test-convert-next-octet:
200
201
202 55/push-EBP
203 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
204
205
206
207 68/push _test-stream/imm32
208
209 e8/call clear-stream/disp32
210
211 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
212
213
214 b8/copy-to-EAX _test-buffered-file/imm32
215 05/add-to-EAX 4/imm32
216 50/push-EAX
217
218 e8/call clear-stream/disp32
219
220 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
221
222
223 68/push _test-error-stream/imm32
224
225 e8/call clear-stream/disp32
226
227 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
228
229
230 b8/copy-to-EAX _test-error-buffered-file/imm32
231 05/add-to-EAX 4/imm32
232 50/push-EAX
233
234 e8/call clear-stream/disp32
235
236 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
237
238
239
240 68/push "abc"/imm32
241 68/push _test-stream/imm32
242
243 e8/call write/disp32
244
245 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
246
247
248 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
249 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
250
251
252 68/push 0xc/imm32/nbytes-of-args-for-convert-next-octet
253 51/push-ECX/ed
254
255 e8/call tailor-exit-descriptor/disp32
256
257 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
258
259
260 51/push-ECX/ed
261 68/push _test-error-buffered-file/imm32
262 68/push _test-buffered-file/imm32
263
264 e8/call convert-next-octet/disp32
265
266
267
268 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
269
270 59/pop-to-ECX
271
272
273
274 68/push "F - test-convert-next-octet: unexpected abort"/imm32
275 68/push 0/imm32
276
277 ff 6/subop/push 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 .
278
279 e8/call check-ints-equal/disp32
280
281 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
282
283 81 7/subop/compare 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 0/imm32
284 75/jump-if-not-equal $test-convert-next-octet:end/disp8
285
286
287 68/push "F - test-convert-next-octet"/imm32
288 68/push 0xab/imm32/ab
289 50/push-EAX
290
291 e8/call check-ints-equal/disp32
292
293 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
294 $test-convert-next-octet:end:
295
296
297 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
298 5d/pop-to-EBP
299 c3/return
300
301 test-convert-next-octet-handles-Eof:
302
303
304 55/push-EBP
305 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
306
307
308
309 68/push _test-stream/imm32
310
311 e8/call clear-stream/disp32
312
313 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
314
315
316 b8/copy-to-EAX _test-buffered-file/imm32
317 05/add-to-EAX 4/imm32
318 50/push-EAX
319
320 e8/call clear-stream/disp32
321
322 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
323
324
325 68/push _test-error-stream/imm32
326
327 e8/call clear-stream/disp32
328
329 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
330
331
332 b8/copy-to-EAX _test-error-buffered-file/imm32
333 05/add-to-EAX 4/imm32
334 50/push-EAX
335
336 e8/call clear-stream/disp32
337
338 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
339
340
341
342 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
343 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
344
345
346 68/push 0xc/imm32/nbytes-of-args-for-convert-next-octet
347 51/push-ECX/ed
348
349 e8/call tailor-exit-descriptor/disp32
350
351 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
352
353
354 51/push-ECX/ed
355 68/push _test-error-buffered-file/imm32
356 68/push _test-buffered-file/imm32
357
358 e8/call convert-next-octet/disp32
359
360
361
362 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
363
364 59/pop-to-ECX
365
366
367
368 68/push "F - test-convert-next-octet: unexpected abort"/imm32
369 68/push 0/imm32
370
371 ff 6/subop/push 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 .
372
373 e8/call check-ints-equal/disp32
374
375 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
376
377 81 7/subop/compare 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 0/imm32
378 75/jump-if-not-equal $test-convert-next-octet-handles-Eof:end/disp8
379
380
381 68/push "F - test-convert-next-octet-handles-Eof"/imm32
382 68/push 0xffffffff/imm32/Eof
383 50/push-EAX
384
385 e8/call check-ints-equal/disp32
386
387 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
388 $test-convert-next-octet-handles-Eof:end:
389
390
391 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
392 5d/pop-to-EBP
393 c3/return
394
395 test-convert-next-octet-aborts-on-single-hex-byte:
396
397
398 55/push-EBP
399 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
400
401
402
403 68/push _test-stream/imm32
404
405 e8/call clear-stream/disp32
406
407 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
408
409
410 b8/copy-to-EAX _test-buffered-file/imm32
411 05/add-to-EAX 4/imm32
412 50/push-EAX
413
414 e8/call clear-stream/disp32
415
416 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
417
418
419 68/push _test-error-stream/imm32
420
421 e8/call clear-stream/disp32
422
423 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
424
425
426 b8/copy-to-EAX _test-error-buffered-file/imm32
427 05/add-to-EAX 4/imm32
428 50/push-EAX
429
430 e8/call clear-stream/disp32
431
432 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
433
434
435
436 68/push "a"/imm32
437 68/push _test-stream/imm32
438
439 e8/call write/disp32
440
441 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
442
443
444 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
445 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
446
447
448 68/push 0xc/imm32/nbytes-of-args-for-convert-next-octet
449 51/push-ECX/ed
450
451 e8/call tailor-exit-descriptor/disp32
452
453 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
454
455
456 51/push-ECX/ed
457 68/push _test-error-buffered-file/imm32
458 68/push _test-buffered-file/imm32
459
460 e8/call convert-next-octet/disp32
461
462
463
464 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
465
466 59/pop-to-ECX
467
468
469
470 68/push "F - test-convert-next-octet-aborts-on-single-hex-byte: unexpected abort"/imm32
471 68/push 2/imm32
472
473 ff 6/subop/push 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 .
474
475 e8/call check-ints-equal/disp32
476
477 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
478 $test-convert-next-octet-aborts-on-single-hex-byte:end:
479
480
481 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
482 5d/pop-to-EBP
483 c3/return
484
485
486
487
488
489 scan-next-byte:
490
491
492
493
494
495
496
497
498
499
500 55/push-EBP
501 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
502
503 $scan-next-byte:loop:
504
505
506 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
507
508 e8/call read-byte/disp32
509
510 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
511
512 3d/compare-with-EAX 0xffffffff/imm32/Eof
513 74/jump-if-equal $scan-next-byte:end/disp8
514
515
516 50/push-EAX
517
518
519 50/push-EAX
520
521 e8/call is-hex-digit?/disp32
522
523 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
524
525 3d/compare-with-EAX 0/imm32
526
527 58/pop-to-EAX
528
529 75/jump-if-not-equal $scan-next-byte:end/disp8
530 $scan-next-byte:check1:
531
532 3d/compare-EAX-and 0x20/imm32/space
533 74/jump-if-equal $scan-next-byte:loop/disp8
534
535 3d/compare-EAX-and 9/imm32/tab
536 74/jump-if-equal $scan-next-byte:loop/disp8
537
538 3d/compare-EAX-and 0xa/imm32/newline
539 74/jump-if-equal $scan-next-byte:loop/disp8
540 $scan-next-byte:check2:
541
542 3d/compare-with-EAX 0x23/imm32
543 75/jump-if-not-equal $scan-next-byte:check3/disp8
544
545
546 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
547
548 e8/call skip-until-newline/disp32
549
550 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
551 eb/jump $scan-next-byte:loop/disp8
552 $scan-next-byte:check3:
553
554
555 50/push-EAX
556 68/push "scan-next-byte: invalid byte"/imm32
557 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
558 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
559
560 e8/call error-byte/disp32
561 $scan-next-byte:end:
562
563
564 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
565 5d/pop-to-EBP
566 c3/return
567
568 test-scan-next-byte:
569
570
571 55/push-EBP
572 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
573
574
575
576 68/push _test-stream/imm32
577
578 e8/call clear-stream/disp32
579
580 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
581
582
583 b8/copy-to-EAX _test-buffered-file/imm32
584 05/add-to-EAX 4/imm32
585 50/push-EAX
586
587 e8/call clear-stream/disp32
588
589 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
590
591
592 68/push _test-error-stream/imm32
593
594 e8/call clear-stream/disp32
595
596 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
597
598
599 b8/copy-to-EAX _test-error-buffered-file/imm32
600 05/add-to-EAX 4/imm32
601 50/push-EAX
602
603 e8/call clear-stream/disp32
604
605 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
606
607
608
609 68/push "abc"/imm32
610 68/push _test-stream/imm32
611
612 e8/call write/disp32
613
614 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
615
616
617 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
618 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
619
620
621 68/push 0xc/imm32/nbytes-of-args-for-scan-next-byte
622 51/push-ECX/ed
623
624 e8/call tailor-exit-descriptor/disp32
625
626 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
627
628
629 51/push-ECX/ed
630 68/push _test-error-buffered-file/imm32
631 68/push _test-buffered-file/imm32
632
633 e8/call scan-next-byte/disp32
634
635
636
637 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
638
639 59/pop-to-ECX
640
641
642
643 68/push "F - test-scan-next-byte: unexpected abort"/imm32
644 68/push 0/imm32
645
646 ff 6/subop/push 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 .
647
648 e8/call check-ints-equal/disp32
649
650 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
651
652 81 7/subop/compare 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 0/imm32
653 75/jump-if-not-equal $test-scan-next-byte:end/disp8
654
655
656 68/push "F - test-scan-next-byte"/imm32
657 68/push 0x61/imm32/a
658 50/push-EAX
659
660 e8/call check-ints-equal/disp32
661
662 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
663 $test-scan-next-byte:end:
664
665
666 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
667 5d/pop-to-EBP
668 c3/return
669
670 test-scan-next-byte-skips-whitespace:
671
672
673 55/push-EBP
674 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
675
676
677
678 68/push _test-stream/imm32
679
680 e8/call clear-stream/disp32
681
682 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
683
684
685 b8/copy-to-EAX _test-buffered-file/imm32
686 05/add-to-EAX 4/imm32
687 50/push-EAX
688
689 e8/call clear-stream/disp32
690
691 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
692
693
694 68/push _test-error-stream/imm32
695
696 e8/call clear-stream/disp32
697
698 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
699
700
701 b8/copy-to-EAX _test-error-buffered-file/imm32
702 05/add-to-EAX 4/imm32
703 50/push-EAX
704
705 e8/call clear-stream/disp32
706
707 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
708
709
710
711 68/push " abc"/imm32
712 68/push _test-stream/imm32
713
714 e8/call write/disp32
715
716 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
717
718
719 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
720 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
721
722
723 68/push 0xc/imm32/nbytes-of-args-for-scan-next-byte
724 51/push-ECX/ed
725
726 e8/call tailor-exit-descriptor/disp32
727
728 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
729
730
731 51/push-ECX/ed
732 68/push _test-error-buffered-file/imm32
733 68/push _test-buffered-file/imm32
734
735 e8/call scan-next-byte/disp32
736
737
738
739 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
740
741 59/pop-to-ECX
742
743
744
745 68/push "F - test-scan-next-byte-skips-whitespace: unexpected abort"/imm32
746 68/push 0/imm32
747
748 ff 6/subop/push 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 .
749
750 e8/call check-ints-equal/disp32
751
752 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
753
754 81 7/subop/compare 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 0/imm32
755 75/jump-if-not-equal $test-scan-next-byte-skips-whitespace:end/disp8
756
757
758 68/push "F - test-scan-next-byte-skips-whitespace"/imm32
759 68/push 0x61/imm32/a
760 50/push-EAX
761
762 e8/call check-ints-equal/disp32
763
764 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
765 $test-scan-next-byte-skips-whitespace:end:
766
767
768 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
769 5d/pop-to-EBP
770 c3/return
771
772 test-scan-next-byte-skips-comment:
773
774
775 55/push-EBP
776 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
777
778
779
780 68/push _test-stream/imm32
781
782 e8/call clear-stream/disp32
783
784 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
785
786
787 b8/copy-to-EAX _test-buffered-file/imm32
788 05/add-to-EAX 4/imm32
789 50/push-EAX
790
791 e8/call clear-stream/disp32
792
793 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
794
795
796 68/push _test-error-stream/imm32
797
798 e8/call clear-stream/disp32
799
800 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
801
802
803 b8/copy-to-EAX _test-error-buffered-file/imm32
804 05/add-to-EAX 4/imm32
805 50/push-EAX
806
807 e8/call clear-stream/disp32
808
809 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
810
811
812
813 68/push "#x\n"/imm32
814 68/push _test-stream/imm32
815
816 e8/call write/disp32
817
818 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
819
820
821 68/push "ab"/imm32
822 68/push _test-stream/imm32
823
824 e8/call write/disp32
825
826 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
827
828
829 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
830 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
831
832
833 68/push 0xc/imm32/nbytes-of-args-for-scan-next-byte
834 51/push-ECX/ed
835
836 e8/call tailor-exit-descriptor/disp32
837
838 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
839
840
841 51/push-ECX/ed
842 68/push _test-error-buffered-file/imm32
843 68/push _test-buffered-file/imm32
844
845 e8/call scan-next-byte/disp32
846
847
848
849 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
850
851 59/pop-to-ECX
852
853
854
855 68/push "F - test-scan-next-byte-skips-comment: unexpected abort"/imm32
856 68/push 0/imm32
857
858 ff 6/subop/push 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 .
859
860 e8/call check-ints-equal/disp32
861
862 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
863
864 81 7/subop/compare 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 0/imm32
865 75/jump-if-not-equal $test-scan-next-byte-skips-comment:end/disp8
866
867
868 68/push "F - test-scan-next-byte-skips-comment"/imm32
869 68/push 0x61/imm32/a
870 50/push-EAX
871
872 e8/call check-ints-equal/disp32
873
874 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
875 $test-scan-next-byte-skips-comment:end:
876
877
878 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
879 5d/pop-to-EBP
880 c3/return
881
882 test-scan-next-byte-skips-comment-and-whitespace:
883
884
885 55/push-EBP
886 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
887
888
889
890 68/push _test-stream/imm32
891
892 e8/call clear-stream/disp32
893
894 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
895
896
897 b8/copy-to-EAX _test-buffered-file/imm32
898 05/add-to-EAX 4/imm32
899 50/push-EAX
900
901 e8/call clear-stream/disp32
902
903 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
904
905
906 68/push _test-error-stream/imm32
907
908 e8/call clear-stream/disp32
909
910 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
911
912
913 b8/copy-to-EAX _test-error-buffered-file/imm32
914 05/add-to-EAX 4/imm32
915 50/push-EAX
916
917 e8/call clear-stream/disp32
918
919 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
920
921
922
923 68/push "#x\n"/imm32
924 68/push _test-stream/imm32
925
926 e8/call write/disp32
927
928 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
929
930
931 68/push " ab"/imm32
932 68/push _test-stream/imm32
933
934 e8/call write/disp32
935
936 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
937
938
939 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
940 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
941
942
943 68/push 0xc/imm32/nbytes-of-args-for-scan-next-byte
944 51/push-ECX/ed
945
946 e8/call tailor-exit-descriptor/disp32
947
948 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
949
950
951 51/push-ECX/ed
952 68/push _test-error-buffered-file/imm32
953 68/push _test-buffered-file/imm32
954
955 e8/call scan-next-byte/disp32
956
957
958
959 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
960
961 59/pop-to-ECX
962
963
964
965 68/push "F - test-scan-next-byte-skips-comment-and-whitespace: unexpected abort"/imm32
966 68/push 0/imm32
967
968 ff 6/subop/push 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 .
969
970 e8/call check-ints-equal/disp32
971
972 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
973
974 81 7/subop/compare 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 0/imm32
975 75/jump-if-not-equal $test-scan-next-byte-skips-comment-and-whitespace:end/disp8
976
977
978 68/push "F - test-scan-next-byte-skips-comment-and-whitespace"/imm32
979 68/push 0x61/imm32/a
980 50/push-EAX
981
982 e8/call check-ints-equal/disp32
983
984 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
985 $test-scan-next-byte-skips-comment-and-whitespace:end:
986
987
988 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
989 5d/pop-to-EBP
990 c3/return
991
992 test-scan-next-byte-skips-whitespace-and-comment:
993
994
995 55/push-EBP
996 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
997
998
999
1000 68/push _test-stream/imm32
1001
1002 e8/call clear-stream/disp32
1003
1004 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1005
1006
1007 b8/copy-to-EAX _test-buffered-file/imm32
1008 05/add-to-EAX 4/imm32
1009 50/push-EAX
1010
1011 e8/call clear-stream/disp32
1012
1013 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1014
1015
1016 68/push _test-error-stream/imm32
1017
1018 e8/call clear-stream/disp32
1019
1020 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1021
1022
1023 b8/copy-to-EAX _test-error-buffered-file/imm32
1024 05/add-to-EAX 4/imm32
1025 50/push-EAX
1026
1027 e8/call clear-stream/disp32
1028
1029 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1030
1031
1032
1033 68/push " #x\n"/imm32
1034 68/push _test-stream/imm32
1035
1036 e8/call write/disp32
1037
1038 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1039
1040
1041 68/push "ab"/imm32
1042 68/push _test-stream/imm32
1043
1044 e8/call write/disp32
1045
1046 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1047
1048
1049 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1050 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1051
1052
1053 68/push 0xc/imm32/nbytes-of-args-for-scan-next-byte
1054 51/push-ECX/ed
1055
1056 e8/call tailor-exit-descriptor/disp32
1057
1058 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1059
1060
1061 51/push-ECX/ed
1062 68/push _test-error-buffered-file/imm32
1063 68/push _test-buffered-file/imm32
1064
1065 e8/call scan-next-byte/disp32
1066
1067
1068
1069 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1070
1071 59/pop-to-ECX
1072
1073
1074
1075 68/push "F - test-scan-next-byte-skips-whitespace-and-comment: unexpected abort"/imm32
1076 68/push 0/imm32
1077
1078 ff 6/subop/push 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 .
1079
1080 e8/call check-ints-equal/disp32
1081
1082 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1083
1084 81 7/subop/compare 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 0/imm32
1085 75/jump-if-not-equal $test-scan-next-byte-skips-whitespace-and-comment:end/disp8
1086
1087
1088 68/push "F - test-scan-next-byte-skips-whitespace-and-comment"/imm32
1089 68/push 0x61/imm32/a
1090 50/push-EAX
1091
1092 e8/call check-ints-equal/disp32
1093
1094 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1095 $test-scan-next-byte-skips-whitespace-and-comment:end:
1096
1097
1098 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1099 5d/pop-to-EBP
1100 c3/return
1101
1102 test-scan-next-byte-reads-final-byte:
1103
1104
1105 55/push-EBP
1106 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1107
1108
1109
1110 68/push _test-stream/imm32
1111
1112 e8/call clear-stream/disp32
1113
1114 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1115
1116
1117 b8/copy-to-EAX _test-buffered-file/imm32
1118 05/add-to-EAX 4/imm32
1119 50/push-EAX
1120
1121 e8/call clear-stream/disp32
1122
1123 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1124
1125
1126 68/push _test-error-stream/imm32
1127
1128 e8/call clear-stream/disp32
1129
1130 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1131
1132
1133 b8/copy-to-EAX _test-error-buffered-file/imm32
1134 05/add-to-EAX 4/imm32
1135 50/push-EAX
1136
1137 e8/call clear-stream/disp32
1138
1139 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1140
1141
1142
1143 68/push "a"/imm32
1144 68/push _test-stream/imm32
1145
1146 e8/call write/disp32
1147
1148 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1149
1150
1151 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1152 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1153
1154
1155 68/push 0xc/imm32/nbytes-of-args-for-scan-next-byte
1156 51/push-ECX/ed
1157
1158 e8/call tailor-exit-descriptor/disp32
1159
1160 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1161
1162
1163 51/push-ECX/ed
1164 68/push _test-error-buffered-file/imm32
1165 68/push _test-buffered-file/imm32
1166
1167 e8/call scan-next-byte/disp32
1168
1169
1170
1171 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1172
1173 59/pop-to-ECX
1174
1175
1176
1177 68/push "F - test-scan-next-byte-reads-final-byte: unexpected abort"/imm32
1178 68/push 0/imm32
1179
1180 ff 6/subop/push 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 .
1181
1182 e8/call check-ints-equal/disp32
1183
1184 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1185
1186 81 7/subop/compare 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 0/imm32
1187 75/jump-if-not-equal $test-scan-next-byte-reads-final-byte:end/disp8
1188
1189
1190 68/push "F - test-scan-next-byte-reads-final-byte"/imm32
1191 68/push 0x61/imm32/a
1192 50/push-EAX
1193
1194 e8/call check-ints-equal/disp32
1195
1196 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1197 $test-scan-next-byte-reads-final-byte:end:
1198
1199
1200 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1201 5d/pop-to-EBP
1202 c3/return
1203
1204 test-scan-next-byte-handles-Eof:
1205
1206
1207 55/push-EBP
1208 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1209
1210
1211
1212 68/push _test-stream/imm32
1213
1214 e8/call clear-stream/disp32
1215
1216 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1217
1218
1219 b8/copy-to-EAX _test-buffered-file/imm32
1220 05/add-to-EAX 4/imm32
1221 50/push-EAX
1222
1223 e8/call clear-stream/disp32
1224
1225 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1226
1227
1228 68/push _test-error-stream/imm32
1229
1230 e8/call clear-stream/disp32
1231
1232 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1233
1234
1235 b8/copy-to-EAX _test-error-buffered-file/imm32
1236 05/add-to-EAX 4/imm32
1237 50/push-EAX
1238
1239 e8/call clear-stream/disp32
1240
1241 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1242
1243
1244
1245 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1246 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1247
1248
1249 68/push 0xc/imm32/nbytes-of-args-for-scan-next-byte
1250 51/push-ECX/ed
1251
1252 e8/call tailor-exit-descriptor/disp32
1253
1254 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1255
1256
1257 51/push-ECX/ed
1258 68/push _test-error-buffered-file/imm32
1259 68/push _test-buffered-file/imm32
1260
1261 e8/call scan-next-byte/disp32
1262
1263
1264
1265 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1266
1267 59/pop-to-ECX
1268
1269
1270
1271 68/push "F - test-scan-next-byte-handles-Eof: unexpected abort"/imm32
1272 68/push 0/imm32
1273
1274 ff 6/subop/push 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 .
1275
1276 e8/call check-ints-equal/disp32
1277
1278 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1279
1280 81 7/subop/compare 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 0/imm32
1281 75/jump-if-not-equal $test-scan-next-byte-handles-Eof:end/disp8
1282
1283
1284 68/push "F - test-scan-next-byte-handles-Eof"/imm32
1285 68/push 0xffffffff/imm32/Eof
1286 50/push-EAX
1287
1288 e8/call check-ints-equal/disp32
1289
1290 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1291 $test-scan-next-byte-handles-Eof:end:
1292
1293
1294 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1295 5d/pop-to-EBP
1296 c3/return
1297
1298 test-scan-next-byte-aborts-on-invalid-byte:
1299
1300
1301 55/push-EBP
1302 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1303
1304
1305
1306 68/push _test-stream/imm32
1307
1308 e8/call clear-stream/disp32
1309
1310 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1311
1312
1313 b8/copy-to-EAX _test-buffered-file/imm32
1314 05/add-to-EAX 4/imm32
1315 50/push-EAX
1316
1317 e8/call clear-stream/disp32
1318
1319 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1320
1321
1322 68/push _test-error-stream/imm32
1323
1324 e8/call clear-stream/disp32
1325
1326 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1327
1328
1329 b8/copy-to-EAX _test-error-buffered-file/imm32
1330 05/add-to-EAX 4/imm32
1331 50/push-EAX
1332
1333 e8/call clear-stream/disp32
1334
1335 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1336
1337
1338
1339 68/push "x"/imm32
1340 68/push _test-stream/imm32
1341
1342 e8/call write/disp32
1343
1344 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1345
1346
1347 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1348 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1349
1350
1351 68/push 0xc/imm32/nbytes-of-args-for-scan-next-byte
1352 51/push-ECX/ed
1353
1354 e8/call tailor-exit-descriptor/disp32
1355
1356 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1357
1358
1359 51/push-ECX/ed
1360 68/push _test-error-buffered-file/imm32
1361 68/push _test-buffered-file/imm32
1362
1363 e8/call scan-next-byte/disp32
1364
1365
1366
1367 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1368
1369 59/pop-to-ECX
1370
1371
1372
1373 68/push "F - test-scan-next-byte-aborts-on-invalid-byte"/imm32
1374 68/push 2/imm32
1375
1376 ff 6/subop/push 1/mod/*+disp8 1/rm32/ECX . . . . 4/disp8 .
1377
1378 e8/call check-ints-equal/disp32
1379
1380 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1381 $test-scan-next-byte-aborts-on-invalid-byte:end:
1382
1383
1384 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1385 5d/pop-to-EBP
1386 c3/return
1387
1388 skip-until-newline:
1389
1390
1391
1392
1393
1394
1395
1396
1397 55/push-EBP
1398 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1399
1400 50/push-EAX
1401 $skip-until-newline:loop:
1402
1403
1404 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1405
1406 e8/call read-byte/disp32
1407
1408 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1409
1410 3d/compare-EAX-and 0xffffffff/imm32/Eof
1411 74/jump-if-equal $skip-until-newline:end/disp8
1412
1413 3d/compare-EAX-and 0xa/imm32/newline
1414 75/jump-if-not-equal $skip-until-newline:loop/disp8
1415 $skip-until-newline:end:
1416
1417 58/pop-to-EAX
1418
1419 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1420 5d/pop-to-EBP
1421 c3/return
1422
1423 test-skip-until-newline:
1424
1425
1426
1427
1428 68/push _test-stream/imm32
1429
1430 e8/call clear-stream/disp32
1431
1432 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1433
1434
1435 b8/copy-to-EAX _test-buffered-file/imm32
1436 05/add-to-EAX 4/imm32
1437 50/push-EAX
1438
1439 e8/call clear-stream/disp32
1440
1441 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1442
1443
1444
1445 68/push "abc\n"/imm32
1446 68/push _test-stream/imm32
1447
1448 e8/call write/disp32
1449
1450 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1451
1452
1453 68/push "de"/imm32
1454 68/push _test-stream/imm32
1455
1456 e8/call write/disp32
1457
1458 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1459
1460
1461 68/push _test-buffered-file/imm32
1462
1463 e8/call skip-until-newline/disp32
1464
1465 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1466
1467
1468 68/push "F - test-skip-until-newline"/imm32
1469 68/push 4/imm32
1470 b8/copy-to-EAX _test-buffered-file/imm32
1471 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 8/disp8 .
1472
1473 e8/call check-ints-equal/disp32
1474
1475 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1476
1477 c3/return
1478
1479 == data
1480
1481 _test-error-stream:
1482
1483 0/imm32
1484
1485 0/imm32
1486
1487 0x80/imm32
1488
1489 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1490 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1491 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1492 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1493 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1494 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1495 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1496 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
1497
1498
1499 _test-error-buffered-file:
1500
1501 _test-error-stream/imm32
1502
1503 0/imm32
1504
1505 0/imm32
1506
1507 6/imm32
1508
1509 00 00 00 00 00 00
1510
1511