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