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