https://github.com/akkartik/mu/blob/master/subx/apps/pack.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 == code
19
20
21
22
23
24
25
26
27
28
29
30 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
31
32
33 81 7/subop/compare 1/mod/*+disp8 5/rm32/EBP . . . . 0/disp8 1/imm32
34 7e/jump-if-lesser-or-equal $run-main/disp8
35
36
37 68/push "test"/imm32
38 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
39
40 e8/call kernel-string-equal?/disp32
41
42 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
43
44 3d/compare-EAX 1/imm32
45 75/jump-if-not-equal $run-main/disp8
46
47 e8/call run-tests/disp32
48 8b/copy 0/mod/indirect 5/rm32/.disp32 . . 3/r32/EBX Num-test-failures/disp32
49 eb/jump $main:end/disp8
50 $run-main:
51
52
53 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
54 89/copy 3/mod/direct 0/rm32/EAX . . . 4/r32/ESP . .
55
56
57 c7 0/subop/copy 0/mod/direct 0/rm32/EAX . . . . . 0/imm32
58
59
60 50/push-EAX/ed
61 68/push Stderr/imm32
62 68/push Stdout/imm32
63 68/push Stdin/imm32
64
65 e8/call convert/disp32
66
67 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
68
69 bb/copy-to-EBX 0/imm32
70 $main:end:
71 b8/copy-to-EAX 1/imm32/exit
72 cd/syscall 0x80/imm8
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137 convert:
138
139
140
141
142
143
144
145
146
147
148 55/push-EBP
149 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
150
151
152
153 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
154 5d/pop-to-EBP
155 c3/return
156
157
158 next-word:
159
160 55/push-EBP
161 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
162
163 50/push-EAX
164 51/push-ECX
165 56/push-ESI
166 57/push-EDI
167
168 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
169
170 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 0xc/disp8 .
171
172
173 68/push 0x20/imm32/space
174 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
175
176 e8/call skip-chars-matching/disp32
177
178 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
179
180 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 .
181 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/EAX 0xc/disp8 .
182 89/copy 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . .
183
184
185 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
186 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0xc/disp8 .
187
188 3d/compare-EAX-with 0x23/imm32/pound
189 75/jump-if-not-equal $next-word:not-comment/disp8
190
191 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
192 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 0/index/EAX . 0/r32/EAX 0xc/disp8 .
193 89/copy 1/mod/*+disp8 7/rm32/EDI . . . 0/r32/EAX 4/disp8 .
194
195 89/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
196
197 eb/jump $next-word:end/disp8
198 $next-word:not-comment:
199
200
201 68/push 0x20/imm32/space
202 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
203
204 e8/call skip-chars-not-matching/disp32
205
206 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
207
208 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 .
209 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/EAX 0xc/disp8 .
210 89/copy 1/mod/*+disp8 7/rm32/EDI . . . 0/r32/EAX 4/disp8 .
211 $next-word:end:
212
213 5f/pop-to-EDI
214 5e/pop-to-ESI
215 59/pop-to-ECX
216 58/pop-to-EAX
217
218 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
219 5d/pop-to-EBP
220 c3/return
221
222 test-next-word:
223
224 55/push-EBP
225 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
226
227
228
229 68/push _test-stream/imm32
230
231 e8/call clear-stream/disp32
232
233 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
234
235 68/push 0/imm32/end
236 68/push 0/imm32/start
237 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
238
239
240 68/push " ab"/imm32
241 68/push _test-stream/imm32
242
243 e8/call write/disp32
244
245 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
246
247
248 51/push-ECX
249 68/push _test-stream/imm32
250
251 e8/call next-word/disp32
252
253 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
254
255
256
257 68/push "F - test-next-word: start"/imm32
258 68/push 0xe/imm32
259
260 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
261 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-stream/imm32
262 50/push-EAX
263
264 e8/call check-ints-equal/disp32
265
266 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
267
268
269
270 68/push "F - test-next-word: end"/imm32
271 68/push 0x10/imm32
272
273 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
274 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-stream/imm32
275 50/push-EAX
276
277 e8/call check-ints-equal/disp32
278
279 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
280
281 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
282 5d/pop-to-EBP
283 c3/return
284
285 test-next-word-returns-whole-comment:
286
287 55/push-EBP
288 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
289
290
291
292 68/push _test-stream/imm32
293
294 e8/call clear-stream/disp32
295
296 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
297
298 68/push 0/imm32/end
299 68/push 0/imm32/start
300 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
301
302
303 68/push " # a"/imm32
304 68/push _test-stream/imm32
305
306 e8/call write/disp32
307
308 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
309
310
311 51/push-ECX
312 68/push _test-stream/imm32
313
314 e8/call next-word/disp32
315
316 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
317
318
319
320 68/push "F - test-next-word-returns-whole-comment: start"/imm32
321 68/push 0xe/imm32
322
323 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
324 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-stream/imm32
325 50/push-EAX
326
327 e8/call check-ints-equal/disp32
328
329 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
330
331
332
333 68/push "F - test-next-word-returns-whole-comment: end"/imm32
334 68/push 0x11/imm32
335
336 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
337 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-stream/imm32
338 50/push-EAX
339
340 e8/call check-ints-equal/disp32
341
342 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
343
344 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
345 5d/pop-to-EBP
346 c3/return
347
348 has-metadata?:
349
350
351
352
353
354
355
356
357
358
359 55/push-EBP
360 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
361
362 51/push-ECX
363 52/push-EDX
364 56/push-ESI
365 57/push-EDI
366
367 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
368
369 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 2/r32/EDX 4/disp8 .
370
371 68/push 0/imm32/end
372 68/push 0/imm32/start
373 89/copy 3/mod/direct 7/rm32/EDI . . . 4/r32/ESP . .
374
375
376 57/push-EDI
377 68/push 0x2f/imm32/slash
378 52/push-EDX
379 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
380
381 e8/call next-token-from-slice/disp32
382
383 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
384
385 8b/copy 1/mod/*+disp8 7/rm32/EDI . . . 1/r32/ECX 4/disp8 .
386 $has-metadata?:loop:
387
388
389 57/push-EDI
390 68/push 0x2f/imm32/slash
391 52/push-EDX
392 51/push-ECX
393
394 e8/call next-token-from-slice/disp32
395
396 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
397
398
399
400 57/push-EDI
401
402 e8/call slice-empty?/disp32
403
404 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
405
406 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32
407 75/compare-if-not-equal $has-metadata?:false/disp8
408
409
410
411 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
412 57/push-EDI
413
414 e8/call slice-equal?/disp32
415
416 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
417
418 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32
419 75/compare-if-not-equal $has-metadata?:true/disp8
420
421 8b/copy 1/mod/*+disp8 7/rm32/EDI . . . 1/r32/ECX 4/disp8 .
422 eb/jump $has-metadata?:loop/disp8
423 $has-metadata?:true:
424 b8/copy-to-EAX 1/imm32/true
425 eb/jump $has-metadata?:end/disp8
426 $has-metadata?:false:
427 b8/copy-to-EAX 0/imm32/false
428 $has-metadata?:end:
429
430 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
431
432 5f/pop-to-EDI
433 5e/pop-to-ESI
434 5a/pop-to-EDX
435 59/pop-to-ECX
436
437 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
438 5d/pop-to-EBP
439 c3/return
440
441 test-has-metadata-true:
442
443 55/push-EBP
444 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
445
446 b8/copy-to-EAX "ab/c"/imm32
447 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
448 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
449 05/add-to-EAX 4/imm32
450
451 51/push-ECX
452 50/push-EAX
453 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
454
455
456 68/push "c"/imm32
457 56/push-ESI
458
459 e8/call has-metadata?/disp32
460
461 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x8/imm32
462
463
464 68/push "F - test-has-metadata-true"/imm32
465 68/push 1/imm32/true
466 50/push-EAX
467
468 e8/call check-ints-equal/disp32
469
470 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
471
472 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
473 5d/pop-to-EBP
474 c3/return
475
476 test-has-metadata-false:
477
478 55/push-EBP
479 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
480
481 b8/copy-to-EAX "ab/c"/imm32
482 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
483 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
484 05/add-to-EAX 4/imm32
485
486 51/push-ECX
487 50/push-EAX
488 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
489
490
491 68/push "d"/imm32
492 56/push-ESI
493
494 e8/call has-metadata?/disp32
495
496 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x8/imm32
497
498
499 68/push "F - test-has-metadata-false"/imm32
500 68/push 0/imm32/false
501 50/push-EAX
502
503 e8/call check-ints-equal/disp32
504
505 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
506
507 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
508 5d/pop-to-EBP
509 c3/return
510
511 test-has-metadata-ignore-name:
512
513 55/push-EBP
514 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
515
516 b8/copy-to-EAX "a/b"/imm32
517 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
518 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
519 05/add-to-EAX 4/imm32
520
521 51/push-ECX
522 50/push-EAX
523 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
524
525
526 68/push "a"/imm32
527 56/push-ESI
528
529 e8/call has-metadata?/disp32
530
531 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x8/imm32
532
533
534 68/push "F - test-has-metadata-ignore-name"/imm32
535 68/push 0/imm32/false
536 50/push-EAX
537
538 e8/call check-ints-equal/disp32
539
540 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
541
542 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
543 5d/pop-to-EBP
544 c3/return
545
546 test-has-metadata-multiple-true:
547
548 55/push-EBP
549 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
550
551 b8/copy-to-EAX "a/b/c"/imm32
552 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
553 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
554 05/add-to-EAX 4/imm32
555
556 51/push-ECX
557 50/push-EAX
558 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
559
560
561 68/push "c"/imm32
562 56/push-ESI
563
564 e8/call has-metadata?/disp32
565
566 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x8/imm32
567
568
569 68/push "F - test-has-metadata-multiple-true"/imm32
570 68/push 1/imm32/true
571 50/push-EAX
572
573 e8/call check-ints-equal/disp32
574
575 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
576
577 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
578 5d/pop-to-EBP
579 c3/return
580
581 test-has-metadata-multiple-false:
582
583 55/push-EBP
584 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
585
586 b8/copy-to-EAX "a/b/c"/imm32
587 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
588 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
589 05/add-to-EAX 4/imm32
590
591 51/push-ECX
592 50/push-EAX
593 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
594
595
596 68/push "d"/imm32
597 56/push-ESI
598
599 e8/call has-metadata?/disp32
600
601 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x8/imm32
602
603
604 68/push "F - test-has-metadata-multiple-false"/imm32
605 68/push 0/imm32/false
606 50/push-EAX
607
608 e8/call check-ints-equal/disp32
609
610 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
611
612 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
613 5d/pop-to-EBP
614 c3/return
615
616
617
618 emit:
619
620 55/push-EBP
621 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
622
623 50/push-EAX
624 56/push-ESI
625 57/push-EDI
626
627 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 0xc/disp8 .
628
629 68/push 0/imm32/end
630 68/push 0/imm32/start
631 89/copy 3/mod/direct 7/rm32/EDI . . . 4/r32/ESP . .
632
633
634 57/push-EDI
635 68/push 0x2f/imm32/slash
636 ff 6/subop/push 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 .
637 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
638
639 e8/call next-token-from-slice/disp32
640
641 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
642
643
644
645 57/push-EDI
646
647 e8/call is-hex-int?/disp32
648
649 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
650
651 81 7/subop/compare 3/mod/direct 0/rm32/EAX . . . . . 0/imm32
652 75/jump-if-not-equal $emit:hex-int/disp8
653
654
655 56/push-ESI
656 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
657
658 e8/call write-slice/disp32
659
660 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
661
662 eb/jump $emit:end/disp8
663
664 $emit:hex-int:
665
666
667 57/push-EDI
668
669 e8/call parse-hex-int/disp32
670
671 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
672
673
674 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
675 50/push-EAX
676 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
677
678 e8/call emit-hex/disp32
679
680 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
681 $emit:end:
682
683 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
684
685 5f/pop-to-EDI
686 5e/pop-to-ESI
687 58/pop-to-EAX
688
689 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
690 5d/pop-to-EBP
691 c3/return
692
693 test-emit-number:
694
695 55/push-EBP
696 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
697
698
699
700 68/push _test-stream/imm32
701
702 e8/call clear-stream/disp32
703
704 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
705
706
707 b8/copy-to-EAX _test-buffered-file/imm32
708 05/add-to-EAX 4/imm32
709 50/push-EAX
710
711 e8/call clear-stream/disp32
712
713 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
714
715 68/push _test-slice-negative-two-end/imm32/end
716 68/push _test-slice-negative-two/imm32/start
717 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
718
719
720 68/push 2/imm32
721 51/push-ECX
722 68/push _test-buffered-file/imm32
723
724 e8/call emit/disp32
725
726 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
727
728
729 68/push _test-buffered-file/imm32
730
731 e8/call flush/disp32
732
733 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
734
735
736
737 68/push "F - test-emit-number/1"/imm32
738 68/push 0x66206566/imm32
739
740 b8/copy-to-EAX _test-stream/imm32
741 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
742
743 e8/call check-ints-equal/disp32
744
745 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
746
747
748 68/push "F - test-emit-number/2"/imm32
749 68/push 0x2066/imm32
750
751 b8/copy-to-EAX _test-stream/imm32
752 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0x10/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 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
759 5d/pop-to-EBP
760 c3/return
761
762 test-emit-number-with-metadata:
763
764 55/push-EBP
765 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
766
767
768
769 68/push _test-stream/imm32
770
771 e8/call clear-stream/disp32
772
773 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
774
775
776 b8/copy-to-EAX _test-buffered-file/imm32
777 05/add-to-EAX 4/imm32
778 50/push-EAX
779
780 e8/call clear-stream/disp32
781
782 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
783
784 68/push _test-slice-negative-two-metadata-end/imm32/end
785 68/push _test-slice-negative-two/imm32/start
786 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
787
788
789 68/push 2/imm32
790 51/push-ECX
791 68/push _test-buffered-file/imm32
792
793 e8/call emit/disp32
794
795 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
796
797
798 68/push _test-buffered-file/imm32
799
800 e8/call flush/disp32
801
802 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
803
804
805
806
807 68/push "F - test-emit-number-with-metadata/1"/imm32
808 68/push 0x66206566/imm32
809
810 b8/copy-to-EAX _test-stream/imm32
811 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
812
813 e8/call check-ints-equal/disp32
814
815 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
816
817
818 68/push "F - test-emit-number-with-metadata/2"/imm32
819 68/push 0x2066/imm32
820
821 b8/copy-to-EAX _test-stream/imm32
822 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0x10/disp8 .
823
824 e8/call check-ints-equal/disp32
825
826 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
827
828 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
829 5d/pop-to-EBP
830 c3/return
831
832 test-emit-non-number:
833
834 55/push-EBP
835 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
836
837
838
839 68/push _test-stream/imm32
840
841 e8/call clear-stream/disp32
842
843 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
844
845
846 b8/copy-to-EAX _test-buffered-file/imm32
847 05/add-to-EAX 4/imm32
848 50/push-EAX
849
850 e8/call clear-stream/disp32
851
852 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
853
854 68/push _test-slice-non-number-word-end/imm32/end
855 68/push _test-slice-non-number-word/imm32/start
856 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
857
858
859 68/push 2/imm32
860 51/push-ECX
861 68/push _test-buffered-file/imm32
862
863 e8/call emit/disp32
864
865 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
866
867
868 68/push _test-buffered-file/imm32
869
870 e8/call flush/disp32
871
872 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
873
874
875
876 68/push "F - test-emit-non-number"/imm32
877 68/push 0x7a7978/imm32
878
879 b8/copy-to-EAX _test-stream/imm32
880 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
881
882 e8/call check-ints-equal/disp32
883
884 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
885
886 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
887 5d/pop-to-EBP
888 c3/return
889
890 test-emit-non-number-with-metadata:
891
892 55/push-EBP
893 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
894
895
896
897 68/push _test-stream/imm32
898
899 e8/call clear-stream/disp32
900
901 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
902
903
904 b8/copy-to-EAX _test-buffered-file/imm32
905 05/add-to-EAX 4/imm32
906 50/push-EAX
907
908 e8/call clear-stream/disp32
909
910 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
911
912 68/push _test-slice-non-number-word-metadata-end/imm32/end
913 68/push _test-slice-non-number-word/imm32/start
914 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
915
916
917 68/push 2/imm32
918 51/push-ECX
919 68/push _test-buffered-file/imm32
920
921 e8/call emit/disp32
922
923 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
924
925
926 68/push _test-buffered-file/imm32
927
928 e8/call flush/disp32
929
930 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
931
932
933
934 68/push "F - test-emit-non-number-with-metadata"/imm32
935 68/push 0x2f7a7978/imm32
936
937 b8/copy-to-EAX _test-stream/imm32
938 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
939
940 e8/call check-ints-equal/disp32
941
942 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
943
944 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
945 5d/pop-to-EBP
946 c3/return
947
948
949 emit-hex:
950
951 55/push-EBP
952 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
953
954 50/push-EAX
955 51/push-ECX
956 52/push-EDX
957 53/push-EBX
958 57/push-EDI
959
960 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 8/disp8 .
961
962 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 3/r32/EBX 0xc/disp8 .
963
964 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 2/r32/EDX 0x10/disp8 .
965
966 31/xor 3/mod/direct 1/rm32/ECX . . . 1/r32/ECX . .
967 $emit-hex:loop:
968
969 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
970 7d/jump-if-greater-or-equal $emit-hex:end/disp8
971
972
973 53/push-EBX
974 57/push-EDI
975
976 e8/call print-byte/disp32
977
978 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
979
980
981 68/push 0x20/imm32/space
982 57/push-EDI
983
984 e8/call write-byte/disp32
985
986 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
987
988 c1/shift 5/subop/logic-right 3/mod/direct 3/rm32/EBX . . . . . 8/imm8
989
990 41/increment-ECX
991 eb/jump $emit-hex:loop/disp8
992 $emit-hex:end:
993
994 5f/pop-to-EDI
995 5b/pop-to-EBX
996 5a/pop-to-EAX
997 59/pop-to-ECX
998 58/pop-to-EAX
999
1000 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1001 5d/pop-to-EBP
1002 c3/return
1003
1004 test-emit-hex-single-byte:
1005
1006
1007
1008 68/push _test-stream/imm32
1009
1010 e8/call clear-stream/disp32
1011
1012 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1013
1014
1015 b8/copy-to-EAX _test-buffered-file/imm32
1016 05/add-to-EAX 4/imm32
1017 50/push-EAX
1018
1019 e8/call clear-stream/disp32
1020
1021 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1022
1023
1024 68/push 1/imm32
1025 68/push 0xab/imm32
1026 68/push _test-buffered-file/imm32
1027
1028 e8/call emit-hex/disp32
1029
1030 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1031
1032
1033 68/push _test-buffered-file/imm32
1034
1035 e8/call flush/disp32
1036
1037 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1038
1039
1040 68/push "F - test-emit-hex-single-byte"/imm32
1041 68/push 0x206261/imm32
1042
1043 b8/copy-to-EAX _test-stream/imm32
1044 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
1045
1046 e8/call check-ints-equal/disp32
1047
1048 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1049
1050 c3/return
1051
1052 test-emit-hex-multiple-byte:
1053
1054
1055
1056 68/push _test-stream/imm32
1057
1058 e8/call clear-stream/disp32
1059
1060 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1061
1062
1063 b8/copy-to-EAX _test-buffered-file/imm32
1064 05/add-to-EAX 4/imm32
1065 50/push-EAX
1066
1067 e8/call clear-stream/disp32
1068
1069 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1070
1071
1072 68/push 2/imm32
1073 68/push 0x1234/imm32
1074 68/push _test-buffered-file/imm32
1075
1076 e8/call emit-hex/disp32
1077
1078 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1079
1080
1081 68/push _test-buffered-file/imm32
1082
1083 e8/call flush/disp32
1084
1085 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1086
1087
1088
1089 68/push "F - test-emit-hex-multiple-byte/1"/imm32
1090 68/push 0x31203433/imm32
1091
1092 b8/copy-to-EAX _test-stream/imm32
1093 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
1094
1095 e8/call check-ints-equal/disp32
1096
1097 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1098
1099
1100 68/push "F - test-emit-hex-multiple-byte/2"/imm32
1101 68/push 0x2032/imm32
1102
1103 b8/copy-to-EAX _test-stream/imm32
1104 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0x10/disp8 .
1105
1106 e8/call check-ints-equal/disp32
1107
1108 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1109
1110 c3/return
1111
1112 test-emit-hex-zero-pad:
1113
1114
1115
1116 68/push _test-stream/imm32
1117
1118 e8/call clear-stream/disp32
1119
1120 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1121
1122
1123 b8/copy-to-EAX _test-buffered-file/imm32
1124 05/add-to-EAX 4/imm32
1125 50/push-EAX
1126
1127 e8/call clear-stream/disp32
1128
1129 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1130
1131
1132 68/push 2/imm32
1133 68/push 0xab/imm32
1134 68/push _test-buffered-file/imm32
1135
1136 e8/call emit-hex/disp32
1137
1138 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1139
1140
1141 68/push _test-buffered-file/imm32
1142
1143 e8/call flush/disp32
1144
1145 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1146
1147
1148
1149 68/push "F - test-emit-hex-zero-pad/1"/imm32
1150 68/push 0x30206261/imm32
1151
1152 b8/copy-to-EAX _test-stream/imm32
1153 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/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
1160 68/push "F - test-emit-hex-zero-pad/2"/imm32
1161 68/push 0x2030/imm32
1162
1163 b8/copy-to-EAX _test-stream/imm32
1164 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0x10/disp8 .
1165
1166 e8/call check-ints-equal/disp32
1167
1168 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1169
1170 c3/return
1171
1172 test-emit-hex-negative:
1173
1174
1175
1176 68/push _test-stream/imm32
1177
1178 e8/call clear-stream/disp32
1179
1180 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1181
1182
1183 b8/copy-to-EAX _test-buffered-file/imm32
1184 05/add-to-EAX 4/imm32
1185 50/push-EAX
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 2/imm32
1193 68/push -1/imm32
1194 68/push _test-buffered-file/imm32
1195
1196 e8/call emit-hex/disp32
1197
1198 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1199
1200
1201 68/push _test-buffered-file/imm32
1202
1203 e8/call flush/disp32
1204
1205 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1206
1207
1208
1209 68/push "F - test-emit-hex-negative/1"/imm32
1210 68/push 0x66206666/imm32
1211
1212 b8/copy-to-EAX _test-stream/imm32
1213 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
1214
1215 e8/call check-ints-equal/disp32
1216
1217 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1218
1219
1220 68/push "F - test-emit-hex-negative/2"/imm32
1221 68/push 0x2066/imm32
1222
1223 b8/copy-to-EAX _test-stream/imm32
1224 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0x10/disp8 .
1225
1226 e8/call check-ints-equal/disp32
1227
1228 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1229
1230 c3/return
1231
1232 == data
1233
1234 _test-slice-negative-two:
1235 2d/- 32/2
1236 _test-slice-negative-two-end:
1237 2f/slash 66/f 6f/o 6f/o
1238 _test-slice-negative-two-metadata-end:
1239
1240 _test-slice-non-number-word:
1241 78/x 79/y 7a/z
1242 _test-slice-non-number-word-end:
1243 2f/slash
1244 _test-slice-non-number-word-metadata-end:
1245
1246