https://github.com/akkartik/mu/blob/master/067parse-hex.subx
1
2
3
4 == code
5
6
7
8
9 is-hex-int?:
10
11 55/push-ebp
12 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
13
14 51/push-ecx
15 52/push-edx
16 53/push-ebx
17
18 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
19
20 8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 .
21
22 8b/copy 0/mod/indirect 1/rm32/ecx . . . 1/r32/ecx . .
23
24 b8/copy-to-eax 0/imm32/false
25 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
26 73/jump-if-addr>= $is-hex-int?:end/disp8
27
28
29 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
30 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 3/r32/BL . .
31 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x2d/imm32/-
32 75/jump-if-!= $is-hex-int?:initial-0/disp8
33
34 41/increment-ecx
35
36 $is-hex-int?:initial-0:
37
38 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
39 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 3/r32/BL . .
40 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x30/imm32/0
41 75/jump-if-!= $is-hex-int?:loop/disp8
42
43 41/increment-ecx
44 $is-hex-int?:initial-0x:
45
46 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
47 73/jump-if-addr>= $is-hex-int?:true/disp8
48
49 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
50 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 3/r32/BL . .
51 81 7/subop/compare 3/mod/direct 3/rm32/ebx . . . . . 0x78/imm32/x
52 75/jump-if-!= $is-hex-int?:loop/disp8
53
54 41/increment-ecx
55 $is-hex-int?:loop:
56
57 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
58 73/jump-if-addr>= $is-hex-int?:true/disp8
59
60
61 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
62 50/push-eax
63
64 e8/call is-hex-digit?/disp32
65
66 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
67
68 3d/compare-eax-and 0/imm32/false
69 74/jump-if-= $is-hex-int?:end/disp8
70
71 41/increment-ecx
72
73 eb/jump $is-hex-int?:loop/disp8
74 $is-hex-int?:true:
75
76 b8/copy-to-eax 1/imm32/true
77 $is-hex-int?:end:
78
79 5b/pop-to-ebx
80 5a/pop-to-edx
81 59/pop-to-ecx
82
83 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
84 5d/pop-to-ebp
85 c3/return
86
87 test-is-hex-int:
88
89 55/push-ebp
90 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
91
92 b8/copy-to-eax "34"/imm32
93 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
94 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
95 05/add-to-eax 4/imm32
96
97 51/push-ecx
98 50/push-eax
99 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
100
101
102 51/push-ecx
103
104 e8/call is-hex-int?/disp32
105
106 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
107
108
109 68/push "F - test-is-hex-int"/imm32
110 68/push 1/imm32/true
111 50/push-eax
112
113 e8/call check-ints-equal/disp32
114
115 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
116
117 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
118 5d/pop-to-ebp
119 c3/return
120
121 test-is-hex-int-handles-letters:
122
123 55/push-ebp
124 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
125
126 b8/copy-to-eax "34a"/imm32
127 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
128 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
129 05/add-to-eax 4/imm32
130
131 51/push-ecx
132 50/push-eax
133 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
134
135
136 51/push-ecx
137
138 e8/call is-hex-int?/disp32
139
140 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
141
142
143 68/push "F - test-is-hex-int-handles-letters"/imm32
144 68/push 1/imm32/true
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 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
152 5d/pop-to-ebp
153 c3/return
154
155 test-is-hex-int-with-trailing-char:
156
157 55/push-ebp
158 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
159
160 b8/copy-to-eax "34q"/imm32
161 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
162 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
163 05/add-to-eax 4/imm32
164
165 51/push-ecx
166 50/push-eax
167 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
168
169
170 51/push-ecx
171
172 e8/call is-hex-int?/disp32
173
174 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
175
176
177 68/push "F - test-is-hex-int-with-trailing-char"/imm32
178 68/push 0/imm32/false
179 50/push-eax
180
181 e8/call check-ints-equal/disp32
182
183 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
184
185 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
186 5d/pop-to-ebp
187 c3/return
188
189 test-is-hex-int-with-leading-char:
190
191 55/push-ebp
192 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
193
194 b8/copy-to-eax "q34"/imm32
195 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
196 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
197 05/add-to-eax 4/imm32
198
199 51/push-ecx
200 50/push-eax
201 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
202
203
204 51/push-ecx
205
206 e8/call is-hex-int?/disp32
207
208 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
209
210
211 68/push "F - test-is-hex-int-with-leading-char"/imm32
212 68/push 0/imm32/false
213 50/push-eax
214
215 e8/call check-ints-equal/disp32
216
217 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
218
219 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
220 5d/pop-to-ebp
221 c3/return
222
223 test-is-hex-int-empty:
224
225 55/push-ebp
226 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
227
228 68/push 0/imm32
229 68/push 0/imm32
230 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
231
232
233 51/push-ecx
234
235 e8/call is-hex-int?/disp32
236
237 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
238
239
240 68/push "F - test-is-hex-int-empty"/imm32
241 68/push 0/imm32/false
242 50/push-eax
243
244 e8/call check-ints-equal/disp32
245
246 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
247
248 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
249 5d/pop-to-ebp
250 c3/return
251
252 test-is-hex-int-handles-0x-prefix:
253
254 55/push-ebp
255 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
256
257 b8/copy-to-eax "0x3a"/imm32
258 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
259 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
260 05/add-to-eax 4/imm32
261
262 51/push-ecx
263 50/push-eax
264 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
265
266
267 51/push-ecx
268
269 e8/call is-hex-int?/disp32
270
271 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
272
273
274 68/push "F - test-is-hex-int-handles-0x-prefix"/imm32
275 68/push 1/imm32/true
276 50/push-eax
277
278 e8/call check-ints-equal/disp32
279
280 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
281
282 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
283 5d/pop-to-ebp
284 c3/return
285
286 test-is-hex-int-handles-negative:
287
288 55/push-ebp
289 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
290
291 b8/copy-to-eax "-34a"/imm32
292 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
293 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
294 05/add-to-eax 4/imm32
295
296 51/push-ecx
297 50/push-eax
298 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
299
300
301 51/push-ecx
302
303 e8/call is-hex-int?/disp32
304
305 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
306
307
308 68/push "F - test-is-hex-int-handles-negative"/imm32
309 68/push 1/imm32/true
310 50/push-eax
311
312 e8/call check-ints-equal/disp32
313
314 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
315
316 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
317 5d/pop-to-ebp
318 c3/return
319
320 test-is-hex-int-handles-negative-0x-prefix:
321
322 55/push-ebp
323 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
324
325 b8/copy-to-eax "-0x3a"/imm32
326 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
327 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
328 05/add-to-eax 4/imm32
329
330 51/push-ecx
331 50/push-eax
332 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
333
334
335 51/push-ecx
336
337 e8/call is-hex-int?/disp32
338
339 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
340
341
342 68/push "F - test-is-hex-int-handles-negative-0x-prefix"/imm32
343 68/push 1/imm32/true
344 50/push-eax
345
346 e8/call check-ints-equal/disp32
347
348 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
349
350 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
351 5d/pop-to-ebp
352 c3/return
353
354 parse-hex-int-from-slice:
355
356 55/push-ebp
357 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
358
359 51/push-ecx
360 52/push-edx
361 53/push-ebx
362 56/push-esi
363
364 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
365
366 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
367
368 8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 .
369
370 8b/copy 0/mod/indirect 1/rm32/ecx . . . 1/r32/ecx . .
371
372 31/xor 3/mod/direct 6/rm32/esi . . . 6/r32/esi . .
373 $parse-hex-int-from-slice:negative:
374
375 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
376 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
377 3d/compare-eax-and 0x2d/imm32/-
378 75/jump-if-!= $parse-hex-int-from-slice:initial-0/disp8
379
380 41/increment-ecx
381
382 be/copy-to-esi 1/imm32/true
383 $parse-hex-int-from-slice:initial-0:
384
385
386 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
387 3d/compare-eax-and 0x30/imm32/0
388 75/jump-if-!= $parse-hex-int-from-slice:loop/disp8
389
390 41/increment-ecx
391 $parse-hex-int-from-slice:initial-0x:
392
393 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
394 73/jump-if-addr>= $parse-hex-int-from-slice:end/disp8
395
396 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
397 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
398 3d/compare-eax-and 0x78/imm32/x
399 75/jump-if-!= $parse-hex-int-from-slice:loop/disp8
400
401 41/increment-ecx
402 $parse-hex-int-from-slice:loop:
403
404 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
405 73/jump-if-addr>= $parse-hex-int-from-slice:negate/disp8
406
407
408 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
409
410 e8/call from-hex-char/disp32
411
412 c1/shift 4/subop/left 3/mod/direct 3/rm32/ebx . . . . . 4/imm8
413 01/add 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
414
415 41/increment-ecx
416
417 eb/jump $parse-hex-int-from-slice:loop/disp8
418 $parse-hex-int-from-slice:negate:
419
420 81 7/subop/compare 3/mod/direct 6/rm32/esi . . . . . 0/imm32/false
421 74/jump-if-= $parse-hex-int-from-slice:end/disp8
422 f7 3/subop/negate 3/mod/direct 3/rm32/ebx . . . . . .
423 $parse-hex-int-from-slice:end:
424
425 89/copy 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
426
427 5e/pop-to-esi
428 5b/pop-to-ebx
429 5a/pop-to-edx
430 59/pop-to-ecx
431
432 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
433 5d/pop-to-ebp
434 c3/return
435
436 test-parse-hex-int-from-slice-single-digit:
437
438 55/push-ebp
439 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
440
441 b8/copy-to-eax "a"/imm32
442 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
443 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
444 05/add-to-eax 4/imm32
445
446 51/push-ecx
447 50/push-eax
448 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
449
450
451 51/push-ecx
452
453 e8/call parse-hex-int-from-slice/disp32
454
455 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
456
457
458 68/push "F - test-parse-hex-int-from-slice-single-digit"/imm32
459 68/push 0xa/imm32
460 50/push-eax
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-parse-hex-int-from-slice-multi-digit:
471
472 55/push-ebp
473 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
474
475 b8/copy-to-eax "34a"/imm32
476 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
477 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
478 05/add-to-eax 4/imm32
479
480 51/push-ecx
481 50/push-eax
482 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
483
484
485 51/push-ecx
486
487 e8/call parse-hex-int-from-slice/disp32
488
489 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
490
491
492 68/push "F - test-parse-hex-int-from-slice-multi-digit"/imm32
493 68/push 0x34a/imm32
494 50/push-eax
495
496 e8/call check-ints-equal/disp32
497
498 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
499
500 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
501 5d/pop-to-ebp
502 c3/return
503
504 test-parse-hex-int-from-slice-0x-prefix:
505
506 55/push-ebp
507 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
508
509 b8/copy-to-eax "0x34"/imm32
510 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
511 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
512 05/add-to-eax 4/imm32
513
514 51/push-ecx
515 50/push-eax
516 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
517
518
519 51/push-ecx
520
521 e8/call parse-hex-int-from-slice/disp32
522
523 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
524
525
526 68/push "F - test-parse-hex-int-from-slice-0x-prefix"/imm32
527 68/push 0x34/imm32
528 50/push-eax
529
530 e8/call check-ints-equal/disp32
531
532 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
533
534 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
535 5d/pop-to-ebp
536 c3/return
537
538 test-parse-hex-int-from-slice-zero:
539
540 55/push-ebp
541 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
542
543 b8/copy-to-eax "0"/imm32
544 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
545 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
546 05/add-to-eax 4/imm32
547
548 51/push-ecx
549 50/push-eax
550 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
551
552
553 51/push-ecx
554
555 e8/call parse-hex-int-from-slice/disp32
556
557 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
558
559
560 68/push "F - test-parse-hex-int-from-slice-zero"/imm32
561 68/push 0/imm32
562 50/push-eax
563
564 e8/call check-ints-equal/disp32
565
566 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
567
568 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
569 5d/pop-to-ebp
570 c3/return
571
572 test-parse-hex-int-from-slice-0-prefix:
573
574 55/push-ebp
575 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
576
577 b8/copy-to-eax "03"/imm32
578 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
579 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
580 05/add-to-eax 4/imm32
581
582 51/push-ecx
583 50/push-eax
584 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
585
586
587 51/push-ecx
588
589 e8/call parse-hex-int-from-slice/disp32
590
591 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
592
593
594 68/push "F - test-parse-hex-int-from-slice-0-prefix"/imm32
595 68/push 0x3/imm32
596 50/push-eax
597
598 e8/call check-ints-equal/disp32
599
600 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
601
602 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
603 5d/pop-to-ebp
604 c3/return
605
606 test-parse-hex-int-from-slice-negative:
607
608 55/push-ebp
609 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
610
611 b8/copy-to-eax "-03"/imm32
612 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
613 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
614 05/add-to-eax 4/imm32
615
616 51/push-ecx
617 50/push-eax
618 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
619
620
621 51/push-ecx
622
623 e8/call parse-hex-int-from-slice/disp32
624
625 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
626
627
628 68/push "F - test-parse-hex-int-from-slice-negative"/imm32
629 68/push -3/imm32
630 50/push-eax
631
632 e8/call check-ints-equal/disp32
633
634 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
635
636 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
637 5d/pop-to-ebp
638 c3/return
639
640 is-hex-digit?:
641
642 55/push-ebp
643 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
644
645 51/push-ecx
646
647 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
648
649 81 7/subop/compare 3/mod/direct 1/rm32/ecx . . . . . 0x30/imm32
650 7c/jump-if-< $is-hex-digit?:false/disp8
651
652 81 7/subop/compare 3/mod/direct 1/rm32/ecx . . . . . 0x39/imm32
653 7e/jump-if-<= $is-hex-digit?:true/disp8
654
655 25/and-eax-with 0x5f/imm32
656
657 81 7/subop/compare 3/mod/direct 1/rm32/ecx . . . . . 0x66/imm32
658 7f/jump-if-> $is-hex-digit?:false/disp8
659
660 81 7/subop/compare 3/mod/direct 1/rm32/ecx . . . . . 0x61/imm32
661 7d/jump-if->= $is-hex-digit?:true/disp8
662
663 $is-hex-digit?:false:
664 b8/copy-to-eax 0/imm32/false
665 eb/jump $is-hex-digit?:end/disp8
666 $is-hex-digit?:true:
667 b8/copy-to-eax 1/imm32/true
668 $is-hex-digit?:end:
669
670 59/pop-to-ecx
671
672 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
673 5d/pop-to-ebp
674 c3/return
675
676 test-hex-below-0:
677
678
679 68/push 0x2f/imm32
680
681 e8/call is-hex-digit?/disp32
682
683 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
684
685
686 68/push "F - test-hex-below-0"/imm32
687 68/push 0/imm32/false
688 50/push-eax
689
690 e8/call check-ints-equal/disp32
691
692 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
693 c3/return
694
695 test-hex-0-to-9:
696
697
698 68/push 0x30/imm32
699
700 e8/call is-hex-digit?/disp32
701
702 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
703
704
705 68/push "F - test-hex-at-0"/imm32
706 68/push 1/imm32/true
707 50/push-eax
708
709 e8/call check-ints-equal/disp32
710
711 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
712
713
714 68/push 0x39/imm32
715
716 e8/call is-hex-digit?/disp32
717
718 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
719
720
721 68/push "F - test-hex-at-9"/imm32
722 68/push 1/imm32/true
723 50/push-eax
724
725 e8/call check-ints-equal/disp32
726
727 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
728 c3/return
729
730 test-hex-above-9-to-a:
731
732
733 68/push 0x3a/imm32
734
735 e8/call is-hex-digit?/disp32
736
737 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
738
739
740 68/push "F - test-hex-above-9-to-a"/imm32
741 68/push 0/imm32/false
742 50/push-eax
743
744 e8/call check-ints-equal/disp32
745
746 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
747 c3/return
748
749 test-hex-a-to-f:
750
751
752 68/push 0x61/imm32
753
754 e8/call is-hex-digit?/disp32
755
756 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
757
758
759 68/push "F - test-hex-at-a"/imm32
760 68/push 1/imm32/true
761 50/push-eax
762
763 e8/call check-ints-equal/disp32
764
765 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
766
767
768 68/push 0x66/imm32
769
770 e8/call is-hex-digit?/disp32
771
772 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
773
774
775 68/push "F - test-hex-at-f"/imm32
776 68/push 1/imm32/true
777 50/push-eax
778
779 e8/call check-ints-equal/disp32
780
781 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
782 c3/return
783
784 test-hex-above-f:
785
786
787 68/push 0x67/imm32
788
789 e8/call is-hex-digit?/disp32
790
791 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
792
793
794 68/push "F - test-hex-above-f"/imm32
795 68/push 0/imm32/false
796 50/push-eax
797
798 e8/call check-ints-equal/disp32
799
800 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
801 c3/return
802
803 from-hex-char:
804 $from-hex-char:check0:
805
806 3d/compare-eax-with 0x30/imm32/0
807 7c/jump-if-< $from-hex-char:abort/disp8
808 $from-hex-char:check1:
809
810 3d/compare-eax-with 0x66/imm32/f
811 7f/jump-if-> $from-hex-char:abort/disp8
812 $from-hex-char:check2:
813
814 3d/compare-eax-with 0x39/imm32/9
815 7f/jump-if-> $from-hex-char:check3/disp8
816 $from-hex-char:digit:
817
818 2d/subtract-from-eax 0x30/imm32/0
819 c3/return
820 $from-hex-char:check3:
821
822 3d/compare-eax-with 0x61/imm32/a
823 7c/jump-if-< $from-hex-char:abort/disp8
824 $from-hex-char:letter:
825
826 2d/subtract-from-eax 0x57/imm32/a-10
827 c3/return
828
829 $from-hex-char:abort:
830
831
832 68/push "invalid hex char: "/imm32
833 68/push 2/imm32/stderr
834
835 e8/call _write/disp32
836
837 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
838
839
840 50/push-eax
841
842 68/push $Stderr->buffer/imm32
843
844 e8/call clear-stream/disp32
845
846 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
847
848 58/pop-to-eax
849
850
851 50/push-eax
852 68/push Stderr/imm32
853
854 e8/call print-int32-buffered/disp32
855
856 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
857
858
859 68/push Stderr/imm32
860
861 e8/call flush/disp32
862
863 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
864
865
866 68/push Newline/imm32
867 68/push 2/imm32/stderr
868
869 e8/call _write/disp32
870
871 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
872
873 bb/copy-to-ebx 1/imm32
874 b8/copy-to-eax 1/imm32/exit
875 cd/syscall 0x80/imm8
876
877
878