https://github.com/akkartik/mu/blob/master/apps/subx-common.subx
1
2
3
4 == data
5
6
7 Heap-size:
8 0x200000/imm32/2MB
9
10
11 Segment-size:
12 0x80000/imm32/512KB
13
14
15 Input-size:
16 0x100000/imm32/1MB
17
18
19 Max-labels:
20 0x10000/imm32/4K-labels/64KB
21
22 == code
23
24
25
26
27
28
29 next-word:
30
31 55/push-EBP
32 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
33
34 50/push-EAX
35 51/push-ECX
36 56/push-ESI
37 57/push-EDI
38
39 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
40
41 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 0xc/disp8 .
42
43
44 68/push 0x20/imm32/space
45 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
46
47 e8/call skip-chars-matching/disp32
48
49 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
50 $next-word:check0:
51
52
53 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
54
55 3b/compare 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
56 7c/jump-if-lesser $next-word:check-for-comment/disp8
57
58 c7 0/subop/copy 0/mod/direct 7/rm32/EDI . . . . . 0/imm32
59 c7 0/subop/copy 1/mod/*+disp8 7/rm32/EDI . . . . 4/disp8 0/imm32
60 eb/jump $next-word:end/disp8
61 $next-word:check-for-comment:
62
63 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 .
64 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/EAX 0xc/disp8 .
65 89/copy 0/mod/indirect 7/rm32/EDI . . . 0/r32/EAX . .
66
67
68 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
69 8a/copy-byte 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/AL 0xc/disp8 .
70
71 3d/compare-EAX-and 0x23/imm32/pound
72 75/jump-if-not-equal $next-word:regular-word/disp8
73 $next-word:comment:
74
75 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
76 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 0/index/EAX . 0/r32/EAX 0xc/disp8 .
77 89/copy 1/mod/*+disp8 7/rm32/EDI . . . 0/r32/EAX 4/disp8 .
78
79 89/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
80
81 eb/jump $next-word:end/disp8
82 $next-word:regular-word:
83
84
85 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
86
87 e8/call skip-chars-not-matching-whitespace/disp32
88
89 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
90
91 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 1/r32/ECX 4/disp8 .
92 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 1/index/ECX . 0/r32/EAX 0xc/disp8 .
93 89/copy 1/mod/*+disp8 7/rm32/EDI . . . 0/r32/EAX 4/disp8 .
94 $next-word:end:
95
96 5f/pop-to-EDI
97 5e/pop-to-ESI
98 59/pop-to-ECX
99 58/pop-to-EAX
100
101 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
102 5d/pop-to-EBP
103 c3/return
104
105 test-next-word:
106
107 55/push-EBP
108 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
109
110
111
112 68/push _test-stream/imm32
113
114 e8/call clear-stream/disp32
115
116 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
117
118 68/push 0/imm32/end
119 68/push 0/imm32/start
120 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
121
122
123 68/push " ab"/imm32
124 68/push _test-stream/imm32
125
126 e8/call write/disp32
127
128 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
129
130
131 51/push-ECX
132 68/push _test-stream/imm32
133
134 e8/call next-word/disp32
135
136 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
137
138
139
140 68/push "F - test-next-word: start"/imm32
141 68/push 0xe/imm32
142
143 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
144 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-stream/imm32
145 50/push-EAX
146
147 e8/call check-ints-equal/disp32
148
149 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
150
151
152
153 68/push "F - test-next-word: end"/imm32
154 68/push 0x10/imm32
155
156 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
157 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-stream/imm32
158 50/push-EAX
159
160 e8/call check-ints-equal/disp32
161
162 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
163
164 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
165 5d/pop-to-EBP
166 c3/return
167
168 test-next-word-returns-whole-comment:
169
170 55/push-EBP
171 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
172
173
174
175 68/push _test-stream/imm32
176
177 e8/call clear-stream/disp32
178
179 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
180
181 68/push 0/imm32/end
182 68/push 0/imm32/start
183 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
184
185
186 68/push " # a"/imm32
187 68/push _test-stream/imm32
188
189 e8/call write/disp32
190
191 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
192
193
194 51/push-ECX
195 68/push _test-stream/imm32
196
197 e8/call next-word/disp32
198
199 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
200
201
202
203 68/push "F - test-next-word-returns-whole-comment: start"/imm32
204 68/push 0xe/imm32
205
206 8b/copy 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
207 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-stream/imm32
208 50/push-EAX
209
210 e8/call check-ints-equal/disp32
211
212 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
213
214
215
216 68/push "F - test-next-word-returns-whole-comment: end"/imm32
217 68/push 0x11/imm32
218
219 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
220 81 5/subop/subtract 3/mod/direct 0/rm32/EAX . . . . . _test-stream/imm32
221 50/push-EAX
222
223 e8/call check-ints-equal/disp32
224
225 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
226
227 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
228 5d/pop-to-EBP
229 c3/return
230
231 test-next-word-returns-empty-string-on-eof:
232
233 55/push-EBP
234 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
235
236
237
238 68/push _test-stream/imm32
239
240 e8/call clear-stream/disp32
241
242 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
243
244 68/push 0/imm32/end
245 68/push 0/imm32/start
246 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
247
248
249
250 51/push-ECX
251 68/push _test-stream/imm32
252
253 e8/call next-word/disp32
254
255 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
256
257
258 68/push "F - test-next-word-returns-empty-string-on-eof"/imm32
259 68/push 0/imm32
260
261 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/EAX 4/disp8 .
262 2b/subtract 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
263 50/push-EAX
264
265 e8/call check-ints-equal/disp32
266
267 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
268
269 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
270 5d/pop-to-EBP
271 c3/return
272
273
274
275 skip-string:
276
277 55/push-EBP
278 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
279
280 50/push-EAX
281 51/push-ECX
282 52/push-EDX
283
284 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 1/r32/ECX 8/disp8 .
285
286
287 8b/copy 1/mod/*+disp8 1/rm32/ECX . . 2/r32/EDX 8/disp8 .
288 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ECX 2/index/EDX . 2/r32/EDX 0xc/disp8 .
289 52/push-EDX
290
291 8b/copy 1/mod/*+disp8 1/rm32/ECX . . 2/r32/EDX 4/disp8 .
292 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ECX 2/index/EDX . 2/r32/EDX 0xc/disp8 .
293 52/push-EDX
294
295 e8/call skip-string-in-slice/disp32
296
297 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
298
299 29/subtract 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
300 2d/subtract-from-EAX 0xc/imm32
301 89/copy 1/mod/*+disp8 1/rm32/ECX . . 0/r32/EAX 4/disp8 .
302 $skip-string:end:
303
304 5a/pop-to-EDX
305 59/pop-to-ECX
306 58/pop-to-EAX
307
308 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
309 5d/pop-to-EBP
310 c3/return
311
312 test-skip-string:
313
314 55/push-EBP
315 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
316
317
318
319 68/push _test-input-stream/imm32
320
321 e8/call clear-stream/disp32
322
323 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
324
325
326
327 68/push "\"abc\" def"/imm32
328 68/push _test-input-stream/imm32
329
330 e8/call write/disp32
331
332 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
333
334
335 68/push "F - test-skip-string/precondition"/imm32
336 68/push 0/imm32
337 b8/copy-to-EAX _test-input-stream/imm32
338 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
339
340 e8/call check-ints-equal/disp32
341
342 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
343
344
345 68/push _test-input-stream/imm32
346
347 e8/call skip-string/disp32
348
349 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
350
351
352 68/push "F - test-skip-string"/imm32
353 68/push 5/imm32
354 b8/copy-to-EAX _test-input-stream/imm32
355 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
356
357 e8/call check-ints-equal/disp32
358
359 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
360
361 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
362 5d/pop-to-EBP
363 c3/return
364
365 test-skip-string-ignores-spaces:
366
367 55/push-EBP
368 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
369
370
371
372 68/push _test-input-stream/imm32
373
374 e8/call clear-stream/disp32
375
376 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
377
378
379
380 68/push "\"a b\"/yz"/imm32
381 68/push _test-input-stream/imm32
382
383 e8/call write/disp32
384
385 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
386
387
388 68/push "F - test-skip-string-ignores-spaces/precondition"/imm32
389 68/push 0/imm32
390 b8/copy-to-EAX _test-input-stream/imm32
391 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
392
393 e8/call check-ints-equal/disp32
394
395 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
396
397
398 68/push _test-input-stream/imm32
399
400 e8/call skip-string/disp32
401
402 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
403
404
405 68/push "F - test-skip-string-ignores-spaces"/imm32
406 68/push 5/imm32
407 b8/copy-to-EAX _test-input-stream/imm32
408 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
409
410 e8/call check-ints-equal/disp32
411
412 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
413
414 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
415 5d/pop-to-EBP
416 c3/return
417
418 test-skip-string-ignores-escapes:
419
420 55/push-EBP
421 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
422
423
424
425 68/push _test-input-stream/imm32
426
427 e8/call clear-stream/disp32
428
429 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
430
431
432
433 68/push "\"a\\\"b\"/yz"/imm32
434 68/push _test-input-stream/imm32
435
436 e8/call write/disp32
437
438 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
439
440
441 68/push "F - test-skip-string-ignores-escapes/precondition"/imm32
442 68/push 0/imm32
443 b8/copy-to-EAX _test-input-stream/imm32
444 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
445
446 e8/call check-ints-equal/disp32
447
448 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
449
450
451 68/push _test-input-stream/imm32
452
453 e8/call skip-string/disp32
454
455 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
456
457
458 68/push "F - test-skip-string-ignores-escapes"/imm32
459 68/push 6/imm32
460 b8/copy-to-EAX _test-input-stream/imm32
461 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
462
463 e8/call check-ints-equal/disp32
464
465 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
466
467 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
468 5d/pop-to-EBP
469 c3/return
470
471 test-skip-string-works-from-mid-stream:
472
473 55/push-EBP
474 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
475
476
477
478 68/push _test-input-stream/imm32
479
480 e8/call clear-stream/disp32
481
482 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
483
484
485
486 68/push "0 \"a\\\"b\"/yz"/imm32
487 68/push _test-input-stream/imm32
488
489 e8/call write/disp32
490
491 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
492
493 c7 0/subop/copy 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 2/imm32
494
495
496 68/push _test-input-stream/imm32
497
498 e8/call skip-string/disp32
499
500 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
501
502
503 68/push "F - test-skip-string-works-from-mid-stream"/imm32
504 68/push 8/imm32
505 b8/copy-to-EAX _test-input-stream/imm32
506 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 4/disp8 .
507
508 e8/call check-ints-equal/disp32
509
510 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
511
512 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
513 5d/pop-to-EBP
514 c3/return
515
516 skip-string-in-slice:
517
518 55/push-EBP
519 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
520
521 51/push-ECX
522 52/push-EDX
523 53/push-EBX
524
525 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 1/r32/ECX 8/disp8 .
526
527 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 2/r32/EDX 0xc/disp8 .
528
529 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
530
531 41/increment-ECX
532 $skip-string-in-slice:loop:
533
534 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
535 73/jump-if-greater-unsigned-or-equal $skip-string-in-slice:return-curr/disp8
536
537 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
538 $skip-string-in-slice:dquote:
539
540 3d/compare-EAX-and 0x22/imm32/double-quote
541 74/jump-if-equal $skip-string-in-slice:break/disp8
542 $skip-string-in-slice:check-for-escape:
543
544 3d/compare-EAX-and 0x5c/imm32/backslash
545 75/jump-if-not-equal $skip-string-in-slice:continue/disp8
546 $skip-string-in-slice:escape:
547 41/increment-ECX
548 $skip-string-in-slice:continue:
549
550 41/increment-ECX
551 eb/jump $skip-string-in-slice:loop/disp8
552 $skip-string-in-slice:break:
553
554 41/increment-ECX
555 $skip-string-in-slice:return-curr:
556
557 89/copy 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
558 $skip-string-in-slice:end:
559
560 5b/pop-to-EBX
561 5a/pop-to-EDX
562 59/pop-to-ECX
563
564 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
565 5d/pop-to-EBP
566 c3/return
567
568 test-skip-string-in-slice:
569
570 55/push-EBP
571 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
572
573 b8/copy-to-EAX "\"abc\" def"/imm32
574 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
575 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
576 05/add-to-EAX 4/imm32
577
578
579 51/push-ECX
580 50/push-EAX
581
582 e8/call skip-string-in-slice/disp32
583
584 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
585
586
587 68/push "F - test-skip-string-in-slice"/imm32
588 68/push 4/imm32
589
590 29/subtract 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
591 51/push-ECX
592
593 e8/call check-ints-equal/disp32
594
595 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
596
597 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
598 5d/pop-to-EBP
599 c3/return
600
601 test-skip-string-in-slice-ignores-spaces:
602
603 55/push-EBP
604 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
605
606 b8/copy-to-EAX "\"a b\"/yz"/imm32
607 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
608 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
609 05/add-to-EAX 4/imm32
610
611
612 51/push-ECX
613 50/push-EAX
614
615 e8/call skip-string-in-slice/disp32
616
617 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
618
619
620 68/push "F - test-skip-string-in-slice-ignores-spaces"/imm32
621 68/push 3/imm32
622
623 29/subtract 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
624 51/push-ECX
625
626 e8/call check-ints-equal/disp32
627
628 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
629
630 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
631 5d/pop-to-EBP
632 c3/return
633
634 test-skip-string-in-slice-ignores-escapes:
635
636 55/push-EBP
637 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
638
639 b8/copy-to-EAX "\"a\\\"b\"/yz"/imm32
640 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
641 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
642 05/add-to-EAX 4/imm32
643
644
645 51/push-ECX
646 50/push-EAX
647
648 e8/call skip-string-in-slice/disp32
649
650 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
651
652
653 68/push "F - test-skip-string-in-slice-ignores-escapes"/imm32
654 68/push 3/imm32
655
656 29/subtract 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
657 51/push-ECX
658
659 e8/call check-ints-equal/disp32
660
661 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
662
663 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
664 5d/pop-to-EBP
665 c3/return
666
667 test-skip-string-in-slice-stops-at-end:
668
669 55/push-EBP
670 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
671
672 b8/copy-to-EAX "\"abc"/imm32
673 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
674 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
675 05/add-to-EAX 4/imm32
676
677
678 51/push-ECX
679 50/push-EAX
680
681 e8/call skip-string-in-slice/disp32
682
683 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
684
685
686 68/push "F - test-skip-string-in-slice-stops-at-end"/imm32
687 68/push 0/imm32
688
689 29/subtract 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
690 51/push-ECX
691
692 e8/call check-ints-equal/disp32
693
694 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
695
696 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
697 5d/pop-to-EBP
698 c3/return
699
700
701
702
703
704
705 write-stream-data:
706
707 55/push-EBP
708 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
709
710 50/push-EAX
711 51/push-ECX
712 56/push-ESI
713
714 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 0xc/disp8 .
715
716
717 8b/copy 0/mod/indirect 6/rm32/ESI . . . 0/r32/EAX . .
718 8d/copy-address 1/mod/*+disp8 4/rm32/sib 6/base/ESI 0/index/EAX . 0/r32/EAX 0xc/disp8 .
719 50/push-EAX
720
721 8d/copy-address 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 0xc/disp8 .
722 50/push-EAX
723
724 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
725
726
727 51/push-ECX
728 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
729
730 e8/call write-slice-buffered/disp32
731
732 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
733 $write-stream-data:end:
734
735 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
736
737 5e/pop-to-ESI
738 59/pop-to-ECX
739 58/pop-to-EAX
740
741 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
742 5d/pop-to-EBP
743 c3/return
744
745 test-write-stream-data:
746
747 55/push-EBP
748 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
749
750
751
752 68/push _test-output-stream/imm32
753
754 e8/call clear-stream/disp32
755
756 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
757
758
759 b8/copy-to-EAX _test-output-buffered-file/imm32
760 05/add-to-EAX 4/imm32
761 50/push-EAX
762
763 e8/call clear-stream/disp32
764
765 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
766
767
768 68/push _test-input-stream/imm32
769
770 e8/call clear-stream/disp32
771
772 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
773
774
775
776 68/push "abcd"/imm32
777 68/push _test-input-stream/imm32
778
779 e8/call write/disp32
780
781 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
782
783
784 68/push _test-input-stream/imm32
785 68/push _test-output-buffered-file/imm32
786
787 e8/call write-stream-data/disp32
788
789 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
790
791
792
793 68/push _test-output-buffered-file/imm32
794
795 e8/call flush/disp32
796
797 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
798
799
800 68/push "F - test-write-stream-data"/imm32
801 68/push "abcd"/imm32
802 68/push _test-output-stream/imm32
803
804 e8/call check-stream-equal/disp32
805
806 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
807
808 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
809 5d/pop-to-EBP
810 c3/return
811
812 has-metadata?:
813
814
815
816
817
818
819
820
821
822
823 55/push-EBP
824 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
825
826 51/push-ECX
827 52/push-EDX
828 56/push-ESI
829 57/push-EDI
830
831 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
832
833 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 2/r32/EDX 4/disp8 .
834
835 68/push 0/imm32/end
836 68/push 0/imm32/start
837 89/copy 3/mod/direct 7/rm32/EDI . . . 4/r32/ESP . .
838
839
840 57/push-EDI
841 68/push 0x2f/imm32/slash
842 52/push-EDX
843 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
844
845 e8/call next-token-from-slice/disp32
846
847 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
848
849 8b/copy 1/mod/*+disp8 7/rm32/EDI . . . 1/r32/ECX 4/disp8 .
850 $has-metadata?:loop:
851
852
853 57/push-EDI
854 68/push 0x2f/imm32/slash
855 52/push-EDX
856 51/push-ECX
857
858 e8/call next-token-from-slice/disp32
859
860 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
861
862
863
864 57/push-EDI
865
866 e8/call slice-empty?/disp32
867
868 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
869
870 3d/compare-EAX-and 0/imm32
871 75/jump-if-not-equal $has-metadata?:false/disp8
872
873
874
875 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
876 57/push-EDI
877
878 e8/call slice-equal?/disp32
879
880 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
881
882 3d/compare-EAX-and 0/imm32
883 75/jump-if-not-equal $has-metadata?:true/disp8
884
885 8b/copy 1/mod/*+disp8 7/rm32/EDI . . . 1/r32/ECX 4/disp8 .
886 eb/jump $has-metadata?:loop/disp8
887 $has-metadata?:true:
888 b8/copy-to-EAX 1/imm32/true
889 eb/jump $has-metadata?:end/disp8
890 $has-metadata?:false:
891 b8/copy-to-EAX 0/imm32/false
892 $has-metadata?:end:
893
894 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
895
896 5f/pop-to-EDI
897 5e/pop-to-ESI
898 5a/pop-to-EDX
899 59/pop-to-ECX
900
901 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
902 5d/pop-to-EBP
903 c3/return
904
905 test-has-metadata-true:
906
907 55/push-EBP
908 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
909
910 b8/copy-to-EAX "ab/imm32"/imm32
911 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
912 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
913 05/add-to-EAX 4/imm32
914
915 51/push-ECX
916 50/push-EAX
917 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
918
919
920 68/push "imm32"/imm32
921 56/push-ESI
922
923 e8/call has-metadata?/disp32
924
925 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
926
927
928 68/push "F - test-has-metadata-true"/imm32
929 68/push 1/imm32/true
930 50/push-EAX
931
932 e8/call check-ints-equal/disp32
933
934 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
935
936 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
937 5d/pop-to-EBP
938 c3/return
939
940 test-has-metadata-false:
941
942 55/push-EBP
943 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
944
945 b8/copy-to-EAX "ab/c"/imm32
946 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
947 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
948 05/add-to-EAX 4/imm32
949
950 51/push-ECX
951 50/push-EAX
952 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
953
954
955 68/push "d"/imm32
956 56/push-ESI
957
958 e8/call has-metadata?/disp32
959
960 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
961
962
963 68/push "F - test-has-metadata-false"/imm32
964 68/push 0/imm32/false
965 50/push-EAX
966
967 e8/call check-ints-equal/disp32
968
969 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
970
971 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
972 5d/pop-to-EBP
973 c3/return
974
975 test-has-metadata-ignore-name:
976
977 55/push-EBP
978 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
979
980 b8/copy-to-EAX "a/b"/imm32
981 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
982 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
983 05/add-to-EAX 4/imm32
984
985 51/push-ECX
986 50/push-EAX
987 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
988
989
990 68/push "a"/imm32
991 56/push-ESI
992
993 e8/call has-metadata?/disp32
994
995 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
996
997
998 68/push "F - test-has-metadata-ignore-name"/imm32
999 68/push 0/imm32/false
1000 50/push-EAX
1001
1002 e8/call check-ints-equal/disp32
1003
1004 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1005
1006 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1007 5d/pop-to-EBP
1008 c3/return
1009
1010 test-has-metadata-multiple-true:
1011
1012 55/push-EBP
1013 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1014
1015 b8/copy-to-EAX "a/b/c"/imm32
1016 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1017 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1018 05/add-to-EAX 4/imm32
1019
1020 51/push-ECX
1021 50/push-EAX
1022 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
1023
1024
1025 68/push "c"/imm32
1026 56/push-ESI
1027
1028 e8/call has-metadata?/disp32
1029
1030 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1031
1032
1033 68/push "F - test-has-metadata-multiple-true"/imm32
1034 68/push 1/imm32/true
1035 50/push-EAX
1036
1037 e8/call check-ints-equal/disp32
1038
1039 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1040
1041 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1042 5d/pop-to-EBP
1043 c3/return
1044
1045 test-has-metadata-multiple-false:
1046
1047 55/push-EBP
1048 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1049
1050 b8/copy-to-EAX "a/b/c"/imm32
1051 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1052 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1053 05/add-to-EAX 4/imm32
1054
1055 51/push-ECX
1056 50/push-EAX
1057 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . .
1058
1059
1060 68/push "d"/imm32
1061 56/push-ESI
1062
1063 e8/call has-metadata?/disp32
1064
1065 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1066
1067
1068 68/push "F - test-has-metadata-multiple-false"/imm32
1069 68/push 0/imm32/false
1070 50/push-EAX
1071
1072 e8/call check-ints-equal/disp32
1073
1074 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1075
1076 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1077 5d/pop-to-EBP
1078 c3/return
1079
1080
1081
1082
1083
1084 emit:
1085
1086 55/push-EBP
1087 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1088
1089 50/push-EAX
1090 56/push-ESI
1091 57/push-EDI
1092
1093 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 0xc/disp8 .
1094
1095 68/push 0/imm32/end
1096 68/push 0/imm32/start
1097 89/copy 3/mod/direct 7/rm32/EDI . . . 4/r32/ESP . .
1098
1099
1100 57/push-EDI
1101 68/push 0x2f/imm32/slash
1102 ff 6/subop/push 1/mod/*+disp8 6/rm32/ESI . . . . 4/disp8 .
1103 ff 6/subop/push 0/mod/indirect 6/rm32/ESI . . . . . .
1104
1105 e8/call next-token-from-slice/disp32
1106
1107 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0x10/imm32
1108
1109
1110
1111 57/push-EDI
1112
1113 e8/call is-valid-name?/disp32
1114
1115 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1116
1117 3d/compare-EAX-and 0/imm32
1118 74/jump-if-equal $emit:hex-int/disp8
1119 $emit:name:
1120
1121
1122 56/push-ESI
1123 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1124
1125 e8/call write-slice-buffered/disp32
1126
1127 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1128
1129
1130 68/push " "/imm32
1131 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1132
1133 e8/call write-buffered/disp32
1134
1135 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1136
1137 eb/jump $emit:end/disp8
1138
1139
1140
1141
1142
1143 $emit:hex-int:
1144
1145
1146 57/push-EDI
1147
1148 e8/call parse-hex-int/disp32
1149
1150 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1151
1152
1153 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0x10/disp8 .
1154 50/push-EAX
1155 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
1156
1157 e8/call emit-hex/disp32
1158
1159 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1160 $emit:end:
1161
1162 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1163
1164 5f/pop-to-EDI
1165 5e/pop-to-ESI
1166 58/pop-to-EAX
1167
1168 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1169 5d/pop-to-EBP
1170 c3/return
1171
1172 test-emit-number:
1173
1174 55/push-EBP
1175 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1176
1177
1178
1179 68/push _test-output-stream/imm32
1180
1181 e8/call clear-stream/disp32
1182
1183 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1184
1185
1186 b8/copy-to-EAX _test-output-buffered-file/imm32
1187 05/add-to-EAX 4/imm32
1188 50/push-EAX
1189
1190 e8/call clear-stream/disp32
1191
1192 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1193
1194 b8/copy-to-EAX "30"/imm32
1195 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1196 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1197 05/add-to-EAX 4/imm32
1198
1199 51/push-ECX
1200 50/push-EAX
1201 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1202
1203
1204 68/push 1/imm32
1205 51/push-ECX
1206 68/push _test-output-buffered-file/imm32
1207
1208 e8/call emit/disp32
1209
1210 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1211
1212
1213 68/push _test-output-buffered-file/imm32
1214
1215 e8/call flush/disp32
1216
1217 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1218
1219
1220 68/push "F - test-emit-number/1"/imm32
1221 68/push "30 "/imm32
1222 68/push _test-output-stream/imm32
1223
1224 e8/call check-stream-equal/disp32
1225
1226 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1227
1228 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1229 5d/pop-to-EBP
1230 c3/return
1231
1232 test-emit-negative-number:
1233
1234
1235 55/push-EBP
1236 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1237
1238
1239
1240 68/push _test-output-stream/imm32
1241
1242 e8/call clear-stream/disp32
1243
1244 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1245
1246
1247 b8/copy-to-EAX _test-output-buffered-file/imm32
1248 05/add-to-EAX 4/imm32
1249 50/push-EAX
1250
1251 e8/call clear-stream/disp32
1252
1253 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1254
1255 b8/copy-to-EAX "-2"/imm32
1256 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1257 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1258 05/add-to-EAX 4/imm32
1259
1260 51/push-ECX
1261 50/push-EAX
1262 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1263
1264
1265 68/push 2/imm32
1266 51/push-ECX
1267 68/push _test-output-buffered-file/imm32
1268
1269 e8/call emit/disp32
1270
1271 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1272
1273
1274 68/push _test-output-buffered-file/imm32
1275
1276 e8/call flush/disp32
1277
1278 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1279
1280
1281 68/push "F - test-emit-number/1"/imm32
1282 68/push "fe ff "/imm32
1283 68/push _test-output-stream/imm32
1284
1285 e8/call check-stream-equal/disp32
1286
1287 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1288
1289 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1290 5d/pop-to-EBP
1291 c3/return
1292
1293 test-emit-number-with-metadata:
1294
1295 55/push-EBP
1296 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1297
1298
1299
1300 68/push _test-output-stream/imm32
1301
1302 e8/call clear-stream/disp32
1303
1304 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1305
1306
1307 b8/copy-to-EAX _test-output-buffered-file/imm32
1308 05/add-to-EAX 4/imm32
1309 50/push-EAX
1310
1311 e8/call clear-stream/disp32
1312
1313 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1314
1315 b8/copy-to-EAX "-2/foo"/imm32
1316 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1317 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1318 05/add-to-EAX 4/imm32
1319
1320 51/push-ECX
1321 50/push-EAX
1322 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1323
1324
1325 68/push 2/imm32
1326 51/push-ECX
1327 68/push _test-output-buffered-file/imm32
1328
1329 e8/call emit/disp32
1330
1331 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1332
1333
1334 68/push _test-output-buffered-file/imm32
1335
1336 e8/call flush/disp32
1337
1338 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1339
1340
1341
1342 68/push "F - test-emit-number-with-metadata"/imm32
1343 68/push "fe ff "/imm32
1344 68/push _test-output-stream/imm32
1345
1346 e8/call check-stream-equal/disp32
1347
1348 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1349
1350 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1351 5d/pop-to-EBP
1352 c3/return
1353
1354 test-emit-non-number:
1355
1356 55/push-EBP
1357 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1358
1359
1360
1361 68/push _test-output-stream/imm32
1362
1363 e8/call clear-stream/disp32
1364
1365 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1366
1367
1368 b8/copy-to-EAX _test-output-buffered-file/imm32
1369 05/add-to-EAX 4/imm32
1370 50/push-EAX
1371
1372 e8/call clear-stream/disp32
1373
1374 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1375
1376 b8/copy-to-EAX "xyz"/imm32
1377 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1378 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1379 05/add-to-EAX 4/imm32
1380
1381 51/push-ECX
1382 50/push-EAX
1383 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1384
1385
1386 68/push 2/imm32
1387 51/push-ECX
1388 68/push _test-output-buffered-file/imm32
1389
1390 e8/call emit/disp32
1391
1392 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1393
1394
1395 68/push _test-output-buffered-file/imm32
1396
1397 e8/call flush/disp32
1398
1399 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1400
1401
1402 68/push "F - test-emit-non-number"/imm32
1403 68/push "xyz "/imm32
1404 68/push _test-output-stream/imm32
1405
1406 e8/call check-stream-equal/disp32
1407
1408 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1409
1410 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1411 5d/pop-to-EBP
1412 c3/return
1413
1414 test-emit-non-number-with-metadata:
1415
1416 55/push-EBP
1417 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1418
1419
1420
1421 68/push _test-output-stream/imm32
1422
1423 e8/call clear-stream/disp32
1424
1425 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1426
1427
1428 b8/copy-to-EAX _test-output-buffered-file/imm32
1429 05/add-to-EAX 4/imm32
1430 50/push-EAX
1431
1432 e8/call clear-stream/disp32
1433
1434 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1435
1436 b8/copy-to-EAX "xyz/"/imm32
1437 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1438 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1439 05/add-to-EAX 4/imm32
1440
1441 51/push-ECX
1442 50/push-EAX
1443 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1444
1445
1446 68/push 2/imm32
1447 51/push-ECX
1448 68/push _test-output-buffered-file/imm32
1449
1450 e8/call emit/disp32
1451
1452 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1453
1454
1455 68/push _test-output-buffered-file/imm32
1456
1457 e8/call flush/disp32
1458
1459 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1460
1461
1462 68/push "F - test-emit-non-number-with-metadata"/imm32
1463 68/push "xyz/ "/imm32
1464 68/push _test-output-stream/imm32
1465
1466 e8/call check-stream-equal/disp32
1467
1468 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1469
1470 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1471 5d/pop-to-EBP
1472 c3/return
1473
1474 test-emit-non-number-with-all-hex-digits-and-metadata:
1475
1476 55/push-EBP
1477 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1478
1479
1480
1481 68/push _test-output-stream/imm32
1482
1483 e8/call clear-stream/disp32
1484
1485 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1486
1487
1488 b8/copy-to-EAX _test-output-buffered-file/imm32
1489 05/add-to-EAX 4/imm32
1490 50/push-EAX
1491
1492 e8/call clear-stream/disp32
1493
1494 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1495
1496 b8/copy-to-EAX "abcd/xyz"/imm32
1497 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1498 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1499 05/add-to-EAX 4/imm32
1500
1501 51/push-ECX
1502 50/push-EAX
1503 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1504
1505
1506 68/push 2/imm32
1507 51/push-ECX
1508 68/push _test-output-buffered-file/imm32
1509
1510 e8/call emit/disp32
1511
1512 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1513
1514
1515 68/push _test-output-buffered-file/imm32
1516
1517 e8/call flush/disp32
1518
1519 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1520 +-- 26 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
1546
1547
1548 68/push "F - test-emit-non-number-with-all-hex-digits"/imm32
1549 68/push "abcd/xyz "/imm32
1550 68/push _test-output-stream/imm32
1551
1552 e8/call check-stream-equal/disp32
1553
1554 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1555
1556 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1557 5d/pop-to-EBP
1558 c3/return
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568 is-valid-name?:
1569
1570 55/push-EBP
1571 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1572
1573 51/push-ECX
1574 56/push-ESI
1575
1576 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 .
1577
1578 8b/copy 0/mod/indirect 6/rm32/ESI . . . 1/r32/ECX . .
1579
1580 8b/copy 1/mod/*+disp8 6/rm32/ESI . . . 0/r32/EAX 4/disp8 .
1581 $is-valid-name?:check0:
1582
1583 39/compare 3/mod/direct 1/rm32/ECX . . . 0/r32/EAX . .
1584 73/jump-if-greater-or-equal-unsigned $is-valid-name?:false/disp8
1585 $is-valid-name?:check1:
1586
1587 29/subtract 3/mod/direct 0/rm32/EAX . . . 1/r32/ECX . .
1588
1589 3d/compare-EAX-and 2/imm32
1590 74/jump-if-equal $is-valid-name?:false/disp8
1591 $is-valid-name?:check2:
1592
1593 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
1594 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
1595
1596 3d/compare-EAX-and 2d/imm32/-
1597 74/jump-if-equal $is-valid-name?:false/disp8
1598 $is-valid-name?:check3a:
1599
1600 3d/compare-EAX-with 30/imm32/0
1601 7c/jump-if-lesser $is-valid-name?:true/disp8
1602 $is-valid-name?:check3b:
1603
1604 3d/compare-EAX-with 39/imm32/9
1605 7f/jump-if-greater $is-valid-name?:true/disp8
1606 $is-valid-name?:false:
1607
1608 b8/copy-to-EAX 0/imm32/false
1609 eb/jump $is-valid-name?:end/disp8
1610 $is-valid-name?:true:
1611
1612 b8/copy-to-EAX 1/imm32/true
1613 $is-valid-name?:end:
1614
1615 5e/pop-to-ESI
1616 59/pop-to-ECX
1617
1618 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1619 5d/pop-to-EBP
1620 c3/return
1621
1622 test-is-valid-name-digit-prefix:
1623
1624 55/push-EBP
1625 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1626
1627 b8/copy-to-EAX "34"/imm32
1628 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1629 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1630 05/add-to-EAX 4/imm32
1631
1632 51/push-ECX
1633 50/push-EAX
1634 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1635
1636
1637 51/push-ECX
1638
1639 e8/call is-valid-name?/disp32
1640
1641 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1642
1643
1644 68/push "F - test-is-valid-name-digit-prefix"/imm32
1645 68/push 0/imm32/false
1646 50/push-EAX
1647
1648 e8/call check-ints-equal/disp32
1649
1650 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1651
1652 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1653 5d/pop-to-EBP
1654 c3/return
1655
1656 test-is-valid-name-negative-prefix:
1657
1658 55/push-EBP
1659 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1660
1661 b8/copy-to-EAX "-0x34"/imm32
1662 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1663 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1664 05/add-to-EAX 4/imm32
1665
1666 51/push-ECX
1667 50/push-EAX
1668 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1669
1670
1671 51/push-ECX
1672
1673 e8/call is-valid-name?/disp32
1674
1675 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1676
1677
1678 68/push "F - test-is-valid-name-negative-prefix"/imm32
1679 68/push 0/imm32/false
1680 50/push-EAX
1681
1682 e8/call check-ints-equal/disp32
1683
1684 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1685
1686 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1687 5d/pop-to-EBP
1688 c3/return
1689
1690 test-is-valid-name-0x-prefix:
1691
1692 55/push-EBP
1693 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1694
1695 b8/copy-to-EAX "0x34"/imm32
1696 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1697 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1698 05/add-to-EAX 4/imm32
1699
1700 51/push-ECX
1701 50/push-EAX
1702 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1703
1704
1705 51/push-ECX
1706
1707 e8/call is-valid-name?/disp32
1708
1709 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1710
1711
1712 68/push "F - test-is-valid-name-0x-prefix"/imm32
1713 68/push 0/imm32/false
1714 50/push-EAX
1715
1716 e8/call check-ints-equal/disp32
1717
1718 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1719
1720 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1721 5d/pop-to-EBP
1722 c3/return
1723
1724 test-is-valid-name-starts-with-pre-digit:
1725
1726 55/push-EBP
1727 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1728
1729 b8/copy-to-EAX "/03"/imm32
1730 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1731 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1732 05/add-to-EAX 4/imm32
1733
1734 51/push-ECX
1735 50/push-EAX
1736 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1737
1738
1739 51/push-ECX
1740
1741 e8/call is-valid-name?/disp32
1742
1743 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1744
1745
1746 68/push "F - test-is-valid-name-starts-with-pre-digit"/imm32
1747 68/push 1/imm32/true
1748 50/push-EAX
1749
1750 e8/call check-ints-equal/disp32
1751
1752 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1753
1754 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1755 5d/pop-to-EBP
1756 c3/return
1757
1758 test-is-valid-name-starts-with-post-digit:
1759
1760 55/push-EBP
1761 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1762
1763 b8/copy-to-EAX "q34"/imm32
1764 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1765 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1766 05/add-to-EAX 4/imm32
1767
1768 51/push-ECX
1769 50/push-EAX
1770 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1771
1772
1773 51/push-ECX
1774
1775 e8/call is-valid-name?/disp32
1776
1777 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1778
1779
1780 68/push "F - test-is-valid-name-starts-with-post-digit"/imm32
1781 68/push 1/imm32/true
1782 50/push-EAX
1783
1784 e8/call check-ints-equal/disp32
1785
1786 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1787
1788 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1789 5d/pop-to-EBP
1790 c3/return
1791
1792 test-is-valid-name-starts-with-digit:
1793
1794 55/push-EBP
1795 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1796
1797 b8/copy-to-EAX "0x34"/imm32
1798 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
1799 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
1800 05/add-to-EAX 4/imm32
1801
1802 51/push-ECX
1803 50/push-EAX
1804 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
1805
1806
1807 51/push-ECX
1808
1809 e8/call is-valid-name?/disp32
1810
1811 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1812
1813
1814 68/push "F - test-is-valid-name-starts-with-digit"/imm32
1815 68/push 0/imm32/false
1816 50/push-EAX
1817
1818 e8/call check-ints-equal/disp32
1819
1820 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1821
1822 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1823 5d/pop-to-EBP
1824 c3/return
1825
1826
1827 emit-hex:
1828
1829 55/push-EBP
1830 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
1831
1832 50/push-EAX
1833 51/push-ECX
1834 52/push-EDX
1835 53/push-EBX
1836 57/push-EDI
1837
1838 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 8/disp8 .
1839
1840 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 3/r32/EBX 0xc/disp8 .
1841
1842 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 2/r32/EDX 0x10/disp8 .
1843
1844 31/xor 3/mod/direct 1/rm32/ECX . . . 1/r32/ECX . .
1845 $emit-hex:loop:
1846
1847 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
1848 7d/jump-if-greater-or-equal $emit-hex:end/disp8
1849
1850
1851 53/push-EBX
1852 57/push-EDI
1853
1854 e8/call print-byte-buffered/disp32
1855
1856 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1857
1858
1859 68/push 0x20/imm32/space
1860 57/push-EDI
1861
1862 e8/call write-byte-buffered/disp32
1863
1864 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
1865
1866 c1/shift 5/subop/logic-right 3/mod/direct 3/rm32/EBX . . . . . 8/imm8
1867 $emit-hex:continue:
1868
1869 41/increment-ECX
1870 eb/jump $emit-hex:loop/disp8
1871 $emit-hex:end:
1872
1873 5f/pop-to-EDI
1874 5b/pop-to-EBX
1875 5a/pop-to-EDX
1876 59/pop-to-ECX
1877 58/pop-to-EAX
1878
1879 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
1880 5d/pop-to-EBP
1881 c3/return
1882
1883 test-emit-hex-single-byte:
1884
1885
1886
1887 68/push _test-output-stream/imm32
1888
1889 e8/call clear-stream/disp32
1890
1891 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1892
1893
1894 b8/copy-to-EAX _test-output-buffered-file/imm32
1895 05/add-to-EAX 4/imm32
1896 50/push-EAX
1897
1898 e8/call clear-stream/disp32
1899
1900 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1901
1902
1903 68/push 1/imm32
1904 68/push 0xab/imm32
1905 68/push _test-output-buffered-file/imm32
1906
1907 e8/call emit-hex/disp32
1908
1909 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1910
1911
1912 68/push _test-output-buffered-file/imm32
1913
1914 e8/call flush/disp32
1915
1916 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1917
1918
1919 68/push "F - test-emit-hex-single-byte"/imm32
1920 68/push 0x206261/imm32
1921
1922 b8/copy-to-EAX _test-output-stream/imm32
1923 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
1924
1925 e8/call check-ints-equal/disp32
1926
1927 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1928
1929 c3/return
1930
1931 test-emit-hex-multiple-byte:
1932
1933
1934
1935 68/push _test-output-stream/imm32
1936
1937 e8/call clear-stream/disp32
1938
1939 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1940
1941
1942 b8/copy-to-EAX _test-output-buffered-file/imm32
1943 05/add-to-EAX 4/imm32
1944 50/push-EAX
1945
1946 e8/call clear-stream/disp32
1947
1948 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1949
1950
1951 68/push 2/imm32
1952 68/push 0x1234/imm32
1953 68/push _test-output-buffered-file/imm32
1954
1955 e8/call emit-hex/disp32
1956
1957 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1958
1959
1960 68/push _test-output-buffered-file/imm32
1961
1962 e8/call flush/disp32
1963
1964 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1965
1966
1967 68/push "F - test-emit-hex-multiple-byte/1"/imm32
1968 68/push "34 12 "/imm32
1969 68/push _test-output-stream/imm32
1970
1971 e8/call check-stream-equal/disp32
1972
1973 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
1974
1975 c3/return
1976
1977 test-emit-hex-zero-pad:
1978
1979
1980
1981 68/push _test-output-stream/imm32
1982
1983 e8/call clear-stream/disp32
1984
1985 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1986
1987
1988 b8/copy-to-EAX _test-output-buffered-file/imm32
1989 05/add-to-EAX 4/imm32
1990 50/push-EAX
1991
1992 e8/call clear-stream/disp32
1993
1994 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
1995
1996
1997 68/push 2/imm32
1998 68/push 0xab/imm32
1999 68/push _test-output-buffered-file/imm32
2000
2001 e8/call emit-hex/disp32
2002
2003 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2004
2005
2006 68/push _test-output-buffered-file/imm32
2007
2008 e8/call flush/disp32
2009
2010 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2011
2012
2013 68/push "F - test-emit-hex-zero-pad/1"/imm32
2014 68/push "ab 00 "/imm32
2015 68/push _test-output-stream/imm32
2016
2017 e8/call check-stream-equal/disp32
2018
2019 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2020
2021 c3/return
2022
2023 test-emit-hex-negative:
2024
2025
2026
2027 68/push _test-output-stream/imm32
2028
2029 e8/call clear-stream/disp32
2030
2031 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2032
2033
2034 b8/copy-to-EAX _test-output-buffered-file/imm32
2035 05/add-to-EAX 4/imm32
2036 50/push-EAX
2037
2038 e8/call clear-stream/disp32
2039
2040 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2041
2042
2043 68/push 2/imm32
2044 68/push -1/imm32
2045 68/push _test-output-buffered-file/imm32
2046
2047 e8/call emit-hex/disp32
2048
2049 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2050
2051
2052 68/push _test-output-buffered-file/imm32
2053
2054 e8/call flush/disp32
2055
2056 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2057
2058
2059 68/push "F - test-emit-hex-negative/1"/imm32
2060 68/push "ff ff "/imm32
2061 68/push _test-output-stream/imm32
2062
2063 e8/call check-stream-equal/disp32
2064
2065 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2066
2067 c3/return
2068
2069
2070 emit-hex-array:
2071
2072 55/push-EBP
2073 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2074
2075 50/push-EAX
2076 51/push-ECX
2077 52/push-EDX
2078 57/push-EDI
2079
2080 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 8/disp8 .
2081
2082 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 2/r32/EDX 0xc/disp8 .
2083
2084 8d/copy-address 1/mod/*+disp8 2/rm32/EDX . . . 1/r32/ECX 4/disp8 .
2085
2086 8b/copy 0/mod/indirect 2/rm32/EDX . . . 2/r32/EDX . .
2087 01/add 3/mod/direct 2/rm32/EDX . . . 1/r32/ECX . .
2088
2089 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
2090 $emit-hex-array:loop:
2091
2092 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . .
2093 73/jump-if-greater-or-equal-unsigned $emit-hex-array:end/disp8
2094
2095
2096 68/push 1/imm32/width
2097 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . .
2098 50/push-EAX
2099 57/push-EDI
2100
2101 e8/call emit-hex/disp32
2102
2103 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2104
2105 41/increment-ECX
2106 eb/jump $emit-hex-array:loop/disp8
2107 $emit-hex-array:end:
2108
2109 5f/pop-to-EDI
2110 5a/pop-to-EDX
2111 59/pop-to-ECX
2112 58/pop-to-EAX
2113
2114 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2115 5d/pop-to-EBP
2116 c3/return
2117
2118 test-emit-hex-array:
2119
2120 55/push-EBP
2121 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2122
2123
2124
2125 68/push _test-output-stream/imm32
2126
2127 e8/call clear-stream/disp32
2128
2129 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2130
2131
2132 b8/copy-to-EAX _test-output-buffered-file/imm32
2133 05/add-to-EAX 4/imm32
2134 50/push-EAX
2135
2136 e8/call clear-stream/disp32
2137
2138 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2139
2140 68/push 0x00030201/imm32
2141 68/push 3/imm32/length
2142 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2143
2144
2145 51/push-ECX
2146 68/push _test-output-buffered-file/imm32
2147
2148 e8/call emit-hex-array/disp32
2149
2150 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2151
2152
2153 68/push _test-output-buffered-file/imm32
2154
2155 e8/call flush/disp32
2156
2157 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2158 +-- 33 lines: #? # dump output ---------------------------------------------------------------------------------------------------------------------------
2191
2192
2193 68/push "F - test-emit-hex-array"/imm32
2194 68/push "01 02 03 "/imm32
2195 68/push _test-output-stream/imm32
2196
2197 e8/call check-next-stream-line-equal/disp32
2198
2199 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2200
2201 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2202 5d/pop-to-EBP
2203 c3/return
2204
2205 compute-width:
2206
2207 55/push-EBP
2208 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2209
2210 51/push-ECX
2211
2212 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 0/r32/EAX 8/disp8 .
2213
2214 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2215 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2216
2217 05/add-to-EAX 4/imm32
2218
2219 51/push-ECX
2220 50/push-EAX
2221 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2222
2223
2224 51/push-ECX
2225
2226 e8/call compute-width-of-slice/disp32
2227
2228 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2229 $compute-width:end:
2230
2231 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2232
2233 59/pop-to-ECX
2234
2235 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2236 5d/pop-to-EBP
2237 c3/return
2238
2239 compute-width-of-slice:
2240
2241 55/push-EBP
2242 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2243
2244 51/push-ECX
2245
2246 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 1/r32/ECX 8/disp8 .
2247
2248
2249
2250 68/push "imm32"/imm32
2251 51/push-ECX
2252
2253 e8/call has-metadata?/disp32
2254
2255 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2256
2257 3d/compare-EAX-and 0/imm32
2258 b8/copy-to-EAX 4/imm32
2259 75/jump-if-not-equal $compute-width-of-slice:end/disp8
2260
2261
2262
2263 68/push "disp32"/imm32
2264 51/push-ECX
2265
2266 e8/call has-metadata?/disp32
2267
2268 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2269
2270 3d/compare-EAX-and 0/imm32
2271 b8/copy-to-EAX 4/imm32
2272 75/jump-if-not-equal $compute-width-of-slice:end/disp8
2273
2274
2275
2276 68/push "imm16"/imm32
2277 51/push-ECX
2278
2279 e8/call has-metadata?/disp32
2280
2281 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2282
2283 3d/compare-EAX-and 0/imm32
2284 b8/copy-to-EAX 2/imm32
2285 75/jump-if-not-equal $compute-width-of-slice:end/disp8
2286
2287
2288
2289 68/push "disp16"/imm32
2290 51/push-ECX
2291
2292 e8/call has-metadata?/disp32
2293
2294 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
2295
2296 3d/compare-EAX-and 0/imm32
2297 b8/copy-to-EAX 2/imm32
2298 75/jump-if-not-equal $compute-width-of-slice:end/disp8
2299
2300 b8/copy-to-EAX 1/imm32
2301 $compute-width-of-slice:end:
2302
2303 59/pop-to-ECX
2304
2305 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2306 5d/pop-to-EBP
2307 c3/return
2308
2309 test-compute-width:
2310
2311 55/push-EBP
2312 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2313 $test-compute-width:imm8:
2314
2315
2316 68/push "0x2/imm8"/imm32
2317
2318 e8/call compute-width/disp32
2319
2320 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2321
2322
2323 68/push "F - test-compute-width: 0x2/imm8"/imm32
2324 50/push-EAX
2325 68/push 1/imm32
2326
2327 e8/call check-ints-equal/disp32
2328
2329 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2330 $test-compute-width:imm16:
2331
2332
2333 68/push "4/imm16"/imm32
2334
2335 e8/call compute-width/disp32
2336
2337 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2338
2339
2340 68/push "F - test-compute-width: 4/imm16"/imm32
2341 50/push-EAX
2342 68/push 2/imm32
2343
2344 e8/call check-ints-equal/disp32
2345
2346 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2347 $test-compute-width:imm32:
2348
2349
2350 68/push "4/imm32"/imm32
2351
2352 e8/call compute-width/disp32
2353
2354 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2355
2356
2357 68/push "F - test-compute-width: 4/imm32"/imm32
2358 50/push-EAX
2359 68/push 4/imm32
2360
2361 e8/call check-ints-equal/disp32
2362
2363 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2364 $test-compute-width:disp8:
2365
2366
2367 68/push "foo/disp8"/imm32
2368
2369 e8/call compute-width/disp32
2370
2371 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2372
2373
2374 68/push "F - test-compute-width: foo/disp8"/imm32
2375 50/push-EAX
2376 68/push 1/imm32
2377
2378 e8/call check-ints-equal/disp32
2379
2380 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2381 $test-compute-width:disp16:
2382
2383
2384 68/push "foo/disp16"/imm32
2385
2386 e8/call compute-width/disp32
2387
2388 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2389
2390
2391 68/push "F - test-compute-width: foo/disp16"/imm32
2392 50/push-EAX
2393 68/push 2/imm32
2394
2395 e8/call check-ints-equal/disp32
2396
2397 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2398 $test-compute-width:disp32:
2399
2400
2401 68/push "foo/disp32"/imm32
2402
2403 e8/call compute-width/disp32
2404
2405 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2406
2407
2408 68/push "F - test-compute-width: foo/disp32"/imm32
2409 50/push-EAX
2410 68/push 4/imm32
2411
2412 e8/call check-ints-equal/disp32
2413
2414 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2415 $test-compute-width:no-metadata:
2416
2417
2418 68/push "45"/imm32
2419
2420 e8/call compute-width/disp32
2421
2422 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2423
2424
2425 68/push "F - test-compute-width: 45 (no metadata)"/imm32
2426 50/push-EAX
2427 68/push 1/imm32
2428
2429 e8/call check-ints-equal/disp32
2430
2431 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2432
2433 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2434 5d/pop-to-EBP
2435 c3/return
2436
2437 is-label?:
2438
2439 55/push-EBP
2440 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2441
2442 51/push-ECX
2443
2444 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 1/r32/ECX 8/disp8 .
2445
2446 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 1/r32/ECX 4/disp8 .
2447
2448
2449 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . .
2450
2451 8a/copy-byte 1/mod/*+disp8 1/rm32/ECX . . . 0/r32/AL -1/disp8 .
2452
2453 3d/compare-EAX-and 0x3a/imm32/colon
2454 b8/copy-to-EAX 1/imm32/true
2455 74/jump-if-equal $is-label?:end/disp8
2456 b8/copy-to-EAX 0/imm32/false
2457 $is-label?:end:
2458
2459 59/pop-to-ECX
2460
2461 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2462 5d/pop-to-EBP
2463 c3/return
2464
2465 test-is-label?:
2466
2467 55/push-EBP
2468 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
2469 $test-is-label?:true:
2470
2471 b8/copy-to-EAX "AAA:"/imm32
2472 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2473 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2474 05/add-to-EAX 4/imm32
2475
2476 51/push-ECX
2477 50/push-EAX
2478 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2479
2480
2481 51/push-ECX
2482
2483 e8/call is-label?/disp32
2484
2485 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2486
2487
2488 68/push "F - test-is-label?:true"/imm32
2489 68/push 1/imm32
2490 50/push-EAX
2491
2492 e8/call check-ints-equal/disp32
2493
2494 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2495 $test-is-label?:false:
2496
2497 b8/copy-to-EAX "AAA"/imm32
2498 8b/copy 0/mod/indirect 0/rm32/EAX . . . 1/r32/ECX . .
2499 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/EAX 1/index/ECX . 1/r32/ECX 4/disp8 .
2500 05/add-to-EAX 4/imm32
2501
2502 51/push-ECX
2503 50/push-EAX
2504 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . .
2505
2506
2507 51/push-ECX
2508
2509 e8/call is-label?/disp32
2510
2511 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
2512
2513
2514 68/push "F - test-is-label?:false"/imm32
2515 68/push 0/imm32
2516 50/push-EAX
2517
2518 e8/call check-ints-equal/disp32
2519
2520 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
2521
2522 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
2523 5d/pop-to-EBP
2524 c3/return
2525
2526 == data
2527
2528 _test-data-segment:
2529 64/d 61/a 74/t 61/a
2530 _test-data-segment-end:
2531
2532