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