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