https://github.com/akkartik/mu/blob/main/linux/118parse-hex-int.subx
1
2
3
4 == code
5
6
7
8
9 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>= $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-!= $hex-int?:initial-0/disp8
33
34 41/increment-ecx
35
36 $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-!= $hex-int?:loop/disp8
42
43 41/increment-ecx
44 $hex-int?:initial-0x:
45
46 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
47 73/jump-if-addr>= $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-!= $hex-int?:loop/disp8
53
54 41/increment-ecx
55 $hex-int?:loop:
56
57 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
58 73/jump-if-addr>= $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 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-= $hex-int?:end/disp8
70
71 41/increment-ecx
72
73 eb/jump $hex-int?:loop/disp8
74 $hex-int?:true:
75
76 b8/copy-to-eax 1/imm32/true
77 $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-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 hex-int?/disp32
105
106 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
107
108
109 68/push "F - test-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-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 hex-int?/disp32
139
140 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
141
142
143 68/push "F - test-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-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 hex-int?/disp32
173
174 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
175
176
177 68/push "F - test-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-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 hex-int?/disp32
207
208 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
209
210
211 68/push "F - test-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-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 hex-int?/disp32
236
237 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
238
239
240 68/push "F - test-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-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 hex-int?/disp32
270
271 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
272
273
274 68/push "F - test-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-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 hex-int?/disp32
304
305 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
306
307
308 68/push "F - test-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-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 hex-int?/disp32
338
339 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
340
341
342 68/push "F - test-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:
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
362 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/eax 8/disp8 .
363
364 8d/copy-address 1/mod/*+disp8 0/rm32/eax . . . 1/r32/ecx 4/disp8 .
365
366
367 8b/copy 0/mod/indirect 0/rm32/eax . . . 2/r32/edx . .
368
369 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 2/index/edx . 2/r32/edx 4/disp8 .
370
371
372 52/push-edx
373 51/push-ecx
374
375 e8/call parse-hex-int-helper/disp32
376
377 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
378 $parse-hex-int:end:
379
380 5a/pop-to-edx
381 59/pop-to-ecx
382
383 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
384 5d/pop-to-ebp
385 c3/return
386
387 parse-hex-int-from-slice:
388
389 55/push-ebp
390 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
391
392 51/push-ecx
393 52/push-edx
394
395 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
396
397 8b/copy 1/mod/*+disp8 1/rm32/ecx . . . 2/r32/edx 4/disp8 .
398
399 8b/copy 0/mod/indirect 1/rm32/ecx . . . 1/r32/ecx . .
400
401
402 52/push-edx
403 51/push-ecx
404
405 e8/call parse-hex-int-helper/disp32
406
407 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
408 $parse-hex-int-from-slice:end:
409
410 5a/pop-to-edx
411 59/pop-to-ecx
412
413 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
414 5d/pop-to-ebp
415 c3/return
416
417 parse-hex-int-helper:
418
419 55/push-ebp
420 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
421
422 51/push-ecx
423 52/push-edx
424 53/push-ebx
425 56/push-esi
426
427 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
428
429 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 2/r32/edx 0xc/disp8 .
430
431 31/xor 3/mod/direct 3/rm32/ebx . . . 3/r32/ebx . .
432
433 31/xor 3/mod/direct 6/rm32/esi . . . 6/r32/esi . .
434 $parse-hex-int-helper:negative:
435
436 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
437 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
438 3d/compare-eax-and 0x2d/imm32/-
439 75/jump-if-!= $parse-hex-int-helper:initial-0/disp8
440
441 41/increment-ecx
442
443 be/copy-to-esi 1/imm32/true
444 $parse-hex-int-helper:initial-0:
445
446
447 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
448 3d/compare-eax-and 0x30/imm32/0
449 75/jump-if-!= $parse-hex-int-helper:loop/disp8
450
451 41/increment-ecx
452 $parse-hex-int-helper:initial-0x:
453
454 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
455 73/jump-if-addr>= $parse-hex-int-helper:end/disp8
456
457 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
458 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
459 3d/compare-eax-and 0x78/imm32/x
460 75/jump-if-!= $parse-hex-int-helper:loop/disp8
461
462 41/increment-ecx
463 $parse-hex-int-helper:loop:
464
465 39/compare 3/mod/direct 1/rm32/ecx . . . 2/r32/edx . .
466 73/jump-if-addr>= $parse-hex-int-helper:negate/disp8
467
468
469 8a/copy-byte 0/mod/indirect 1/rm32/ecx . . . 0/r32/AL . .
470
471 e8/call from-hex-char/disp32
472
473 c1/shift 4/subop/left 3/mod/direct 3/rm32/ebx . . . . . 4/imm8
474 01/add 3/mod/direct 3/rm32/ebx . . . 0/r32/eax . .
475
476 41/increment-ecx
477
478 eb/jump $parse-hex-int-helper:loop/disp8
479 $parse-hex-int-helper:negate:
480
481 81 7/subop/compare 3/mod/direct 6/rm32/esi . . . . . 0/imm32/false
482 74/jump-if-= $parse-hex-int-helper:end/disp8
483 f7 3/subop/negate 3/mod/direct 3/rm32/ebx . . . . . .
484 $parse-hex-int-helper:end:
485
486 89/copy 3/mod/direct 0/rm32/eax . . . 3/r32/ebx . .
487
488 5e/pop-to-esi
489 5b/pop-to-ebx
490 5a/pop-to-edx
491 59/pop-to-ecx
492
493 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
494 5d/pop-to-ebp
495 c3/return
496
497 test-parse-hex-int-from-slice-single-digit:
498
499 55/push-ebp
500 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
501
502 b8/copy-to-eax "a"/imm32
503 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
504 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
505 05/add-to-eax 4/imm32
506
507 51/push-ecx
508 50/push-eax
509 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
510
511
512 51/push-ecx
513
514 e8/call parse-hex-int-from-slice/disp32
515
516 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
517
518
519 68/push "F - test-parse-hex-int-from-slice-single-digit"/imm32
520 68/push 0xa/imm32
521 50/push-eax
522
523 e8/call check-ints-equal/disp32
524
525 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
526
527 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
528 5d/pop-to-ebp
529 c3/return
530
531 test-parse-hex-int-from-slice-multi-digit:
532
533 55/push-ebp
534 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
535
536 b8/copy-to-eax "34a"/imm32
537 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
538 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
539 05/add-to-eax 4/imm32
540
541 51/push-ecx
542 50/push-eax
543 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
544
545
546 51/push-ecx
547
548 e8/call parse-hex-int-from-slice/disp32
549
550 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
551
552
553 68/push "F - test-parse-hex-int-from-slice-multi-digit"/imm32
554 68/push 0x34a/imm32
555 50/push-eax
556
557 e8/call check-ints-equal/disp32
558
559 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
560
561 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
562 5d/pop-to-ebp
563 c3/return
564
565 test-parse-hex-int-from-slice-0x-prefix:
566
567 55/push-ebp
568 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
569
570 b8/copy-to-eax "0x34"/imm32
571 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
572 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
573 05/add-to-eax 4/imm32
574
575 51/push-ecx
576 50/push-eax
577 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
578
579
580 51/push-ecx
581
582 e8/call parse-hex-int-from-slice/disp32
583
584 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
585
586
587 68/push "F - test-parse-hex-int-from-slice-0x-prefix"/imm32
588 68/push 0x34/imm32
589 50/push-eax
590
591 e8/call check-ints-equal/disp32
592
593 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
594
595 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
596 5d/pop-to-ebp
597 c3/return
598
599 test-parse-hex-int-from-slice-zero:
600
601 55/push-ebp
602 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
603
604 b8/copy-to-eax "0"/imm32
605 8b/copy 0/mod/indirect 0/rm32/eax . . . 1/r32/ecx . .
606 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 4/disp8 .
607 05/add-to-eax 4/imm32
608
609 51/push-ecx
610 50/push-eax
611 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
612
613
614 51/push-ecx
615
616 e8/call parse-hex-int-from-slice/disp32
617
618 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
619
620
621 68/push "F - test-parse-hex-int-from-slice-zero"/imm32
622 68/push 0/imm32
623 50/push-eax
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-parse-hex-int-from-slice-0-prefix:
634
635 55/push-ebp
636 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
637
638 b8/copy-to-eax "03"/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 51/push-ecx
644 50/push-eax
645 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
646
647
648 51/push-ecx
649
650 e8/call parse-hex-int-from-slice/disp32
651
652 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
653
654
655 68/push "F - test-parse-hex-int-from-slice-0-prefix"/imm32
656 68/push 0x3/imm32
657 50/push-eax
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-parse-hex-int-from-slice-negative:
668
669 55/push-ebp
670 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
671
672 b8/copy-to-eax "-03"/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 51/push-ecx
678 50/push-eax
679 89/copy 3/mod/direct 1/rm32/ecx . . . 4/r32/esp . .
680
681
682 51/push-ecx
683
684 e8/call parse-hex-int-from-slice/disp32
685
686 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
687
688
689 68/push "F - test-parse-hex-int-from-slice-negative"/imm32
690 68/push -3/imm32
691 50/push-eax
692
693 e8/call check-ints-equal/disp32
694
695 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
696
697 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
698 5d/pop-to-ebp
699 c3/return
700
701 hex-digit?:
702
703 55/push-ebp
704 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
705
706 51/push-ecx
707
708 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 1/r32/ecx 8/disp8 .
709
710 81 7/subop/compare 3/mod/direct 1/rm32/ecx . . . . . 0x30/imm32
711 7c/jump-if-< $hex-digit?:false/disp8
712
713 81 7/subop/compare 3/mod/direct 1/rm32/ecx . . . . . 0x39/imm32
714 7e/jump-if-<= $hex-digit?:true/disp8
715
716 25/and-eax-with 0x5f/imm32
717
718 81 7/subop/compare 3/mod/direct 1/rm32/ecx . . . . . 0x66/imm32
719 7f/jump-if-> $hex-digit?:false/disp8
720
721 81 7/subop/compare 3/mod/direct 1/rm32/ecx . . . . . 0x61/imm32
722 7d/jump-if->= $hex-digit?:true/disp8
723
724 $hex-digit?:false:
725 b8/copy-to-eax 0/imm32/false
726 eb/jump $hex-digit?:end/disp8
727 $hex-digit?:true:
728 b8/copy-to-eax 1/imm32/true
729 $hex-digit?:end:
730
731 59/pop-to-ecx
732
733 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
734 5d/pop-to-ebp
735 c3/return
736
737 test-hex-below-0:
738
739
740 68/push 0x2f/imm32
741
742 e8/call hex-digit?/disp32
743
744 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
745
746
747 68/push "F - test-hex-below-0"/imm32
748 68/push 0/imm32/false
749 50/push-eax
750
751 e8/call check-ints-equal/disp32
752
753 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
754 c3/return
755
756 test-hex-0-to-9:
757
758
759 68/push 0x30/imm32
760
761 e8/call hex-digit?/disp32
762
763 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
764
765
766 68/push "F - test-hex-at-0"/imm32
767 68/push 1/imm32/true
768 50/push-eax
769
770 e8/call check-ints-equal/disp32
771
772 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
773
774
775 68/push 0x39/imm32
776
777 e8/call hex-digit?/disp32
778
779 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
780
781
782 68/push "F - test-hex-at-9"/imm32
783 68/push 1/imm32/true
784 50/push-eax
785
786 e8/call check-ints-equal/disp32
787
788 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
789 c3/return
790
791 test-hex-above-9-to-a:
792
793
794 68/push 0x3a/imm32
795
796 e8/call hex-digit?/disp32
797
798 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
799
800
801 68/push "F - test-hex-above-9-to-a"/imm32
802 68/push 0/imm32/false
803 50/push-eax
804
805 e8/call check-ints-equal/disp32
806
807 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
808 c3/return
809
810 test-hex-a-to-f:
811
812
813 68/push 0x61/imm32
814
815 e8/call hex-digit?/disp32
816
817 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
818
819
820 68/push "F - test-hex-at-a"/imm32
821 68/push 1/imm32/true
822 50/push-eax
823
824 e8/call check-ints-equal/disp32
825
826 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
827
828
829 68/push 0x66/imm32
830
831 e8/call hex-digit?/disp32
832
833 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
834
835
836 68/push "F - test-hex-at-f"/imm32
837 68/push 1/imm32/true
838 50/push-eax
839
840 e8/call check-ints-equal/disp32
841
842 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
843 c3/return
844
845 test-hex-above-f:
846
847
848 68/push 0x67/imm32
849
850 e8/call hex-digit?/disp32
851
852 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
853
854
855 68/push "F - test-hex-above-f"/imm32
856 68/push 0/imm32/false
857 50/push-eax
858
859 e8/call check-ints-equal/disp32
860
861 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 0xc/imm32
862 c3/return
863
864 from-hex-char:
865 $from-hex-char:check0:
866
867 3d/compare-eax-with 0x30/imm32/0
868 7c/jump-if-< $from-hex-char:abort/disp8
869 $from-hex-char:check1:
870
871 3d/compare-eax-with 0x66/imm32/f
872 7f/jump-if-> $from-hex-char:abort/disp8
873 $from-hex-char:check2:
874
875 3d/compare-eax-with 0x39/imm32/9
876 7f/jump-if-> $from-hex-char:check3/disp8
877 $from-hex-char:digit:
878
879 2d/subtract-from-eax 0x30/imm32/0
880 c3/return
881 $from-hex-char:check3:
882
883 3d/compare-eax-with 0x61/imm32/a
884 7c/jump-if-< $from-hex-char:abort/disp8
885 $from-hex-char:letter:
886
887 2d/subtract-from-eax 0x57/imm32/a-10
888 c3/return
889
890 $from-hex-char:abort:
891
892
893 68/push "invalid hex char: "/imm32
894 68/push 2/imm32/stderr
895
896 e8/call _write/disp32
897
898 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
899
900
901 50/push-eax
902
903 68/push $Stderr->buffer/imm32
904
905 e8/call clear-stream/disp32
906
907 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
908
909 58/pop-to-eax
910
911
912 50/push-eax
913 68/push Stderr/imm32
914
915 e8/call write-int32-hex-buffered/disp32
916
917 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
918
919
920 68/push Stderr/imm32
921
922 e8/call flush/disp32
923
924 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 4/imm32
925
926
927 68/push Newline/imm32
928 68/push 2/imm32/stderr
929
930 e8/call _write/disp32
931
932 81 0/subop/add 3/mod/direct 4/rm32/esp . . . . . 8/imm32
933
934 bb/copy-to-ebx 1/imm32
935 e8/call syscall_exit/disp32
936
937
938