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