From 509f0a12ca3d2061b1555ded31dead23f00ed854 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 14 Jan 2019 17:06:10 -0800 Subject: 4926 --- html/subx/071hex.subx.html | 504 +++++++++++++++++++++++++-------------------- 1 file changed, 285 insertions(+), 219 deletions(-) (limited to 'html') diff --git a/html/subx/071hex.subx.html b/html/subx/071hex.subx.html index 40bc5e99..cfd2a132 100644 --- a/html/subx/071hex.subx.html +++ b/html/subx/071hex.subx.html @@ -121,7 +121,7 @@ if ('onhashchange' in window) { 60 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . . # copy byte at *ECX to AL 61 50/push-EAX 62 # . . call - 63 e8/call is-hex-digit?/disp32 + 63 e8/call is-hex-digit?/disp32 64 # . . discard args 65 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 66 # if EAX == false return false @@ -149,8 +149,8 @@ if ('onhashchange' in window) { 88 55/push-EBP 89 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP 90 # var slice/ECX = "34" - 91 68/push _test-slice-hex-int-end/imm32 - 92 68/push _test-slice-hex-int/imm32 + 91 68/push _test-slice-hex-int-end/imm32 + 92 68/push _test-slice-hex-int/imm32 93 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX 94 # EAX = is-hex-int?(slice) 95 # . . push args @@ -178,8 +178,8 @@ if ('onhashchange' in window) { 117 55/push-EBP 118 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP 119 # var slice/ECX = "34a" -120 68/push _test-slice-hex-int-letters-end/imm32 -121 68/push _test-slice-hex-int-letters/imm32 +120 68/push _test-slice-hex-int-letters-end/imm32 +121 68/push _test-slice-hex-int-letters/imm32 122 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX 123 # EAX = is-hex-int?(slice) 124 # . . push args @@ -207,8 +207,8 @@ if ('onhashchange' in window) { 146 55/push-EBP 147 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP 148 # var slice/ECX = "34q" -149 68/push _test-slice-digits-and-char-end/imm32 -150 68/push _test-slice-digits-and-char/imm32 +149 68/push _test-slice-digits-and-char-end/imm32 +150 68/push _test-slice-digits-and-char/imm32 151 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX 152 # EAX = is-hex-int?(slice) 153 # . . push args @@ -236,8 +236,8 @@ if ('onhashchange' in window) { 175 55/push-EBP 176 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP 177 # var slice/ECX = "q34" -178 68/push _test-slice-char-and-digits-end/imm32 -179 68/push _test-slice-char-and-digits/imm32 +178 68/push _test-slice-char-and-digits-end/imm32 +179 68/push _test-slice-char-and-digits/imm32 180 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX 181 # EAX = is-hex-int?(slice) 182 # . . push args @@ -265,8 +265,8 @@ if ('onhashchange' in window) { 204 55/push-EBP 205 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP 206 # var slice/ECX = "" -207 68/push _test-slice-empty-end/imm32 -208 68/push _test-slice-empty/imm32 +207 68/push _test-slice-empty-end/imm32 +208 68/push _test-slice-empty/imm32 209 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX 210 # EAX = is-hex-int?(slice) 211 # . . push args @@ -294,8 +294,8 @@ if ('onhashchange' in window) { 233 55/push-EBP 234 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP 235 # var slice/ECX = "0x3a" -236 68/push _test-slice-hex-int-with-0x-prefix-end/imm32 -237 68/push _test-slice-hex-int-with-0x-prefix/imm32 +236 68/push _test-slice-hex-int-with-0x-prefix-end/imm32 +237 68/push _test-slice-hex-int-with-0x-prefix/imm32 238 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX 239 # EAX = is-hex-int?(slice) 240 # . . push args @@ -363,7 +363,7 @@ if ('onhashchange' in window) { 302 8a/copy-byte 0/mod/indirect 1/rm32/ECX . . . 0/r32/AL . . # copy byte at *ECX to AL 303 50/push-EAX 304 # . . call -305 e8/call parse-hex-digit/disp32 +305 e8/call parse-hex-digit/disp32 306 # . . discard args 307 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP 308 # result = result * 16 + EAX @@ -389,8 +389,8 @@ if ('onhashchange' in window) { 328 55/push-EBP 329 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP 330 # var slice/ECX = "a" -331 68/push _test-slice-hex-int-single-letter-end/imm32 -332 68/push _test-slice-hex-int-single-letter/imm32 +331 68/push _test-slice-hex-int-single-letter-end/imm32 +332 68/push _test-slice-hex-int-single-letter/imm32 333 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX 334 # EAX = parse-hex-int(slice) 335 # . . push args @@ -418,8 +418,8 @@ if ('onhashchange' in window) { 357 55/push-EBP 358 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP 359 # var slice/ECX = "34a" -360 68/push _test-slice-hex-int-letters-end/imm32 -361 68/push _test-slice-hex-int-letters/imm32 +360 68/push _test-slice-hex-int-letters-end/imm32 +361 68/push _test-slice-hex-int-letters/imm32 362 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX 363 # EAX = parse-hex-int(slice) 364 # . . push args @@ -447,8 +447,8 @@ if ('onhashchange' in window) { 386 55/push-EBP 387 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP 388 # var slice/ECX = "0x34" -389 68/push _test-slice-hex-int-with-0x-prefix-end/imm32 -390 68/push _test-slice-hex-int-with-0x-prefix/imm32 +389 68/push _test-slice-hex-int-with-0x-prefix-end/imm32 +390 68/push _test-slice-hex-int-with-0x-prefix/imm32 391 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX 392 # EAX = parse-hex-int(slice) 393 # . . push args @@ -471,208 +471,274 @@ if ('onhashchange' in window) { 410 5d/pop-to-EBP 411 c3/return 412 -413 is-hex-digit?: # c : byte -> bool/EAX +413 test-parse-hex-int-zero: 414 # . prolog 415 55/push-EBP 416 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP -417 # . save registers -418 51/push-ECX -419 # ECX = c -420 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 1/r32/ECX 8/disp8 . # copy *(EBP+8) to ECX -421 # return false if c < '0' -422 b8/copy-to-EAX 0/imm32/false -423 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0x30/imm32 # compare ECX -424 7c/jump-if-lesser $is-hex-digit?:end/disp8 -425 # return false if c > 'f' -426 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0x66/imm32 # compare ECX -427 7f/jump-if-greater $is-hex-digit?:end/disp8 -428 # return true if c <= '9' -429 b8/copy-to-EAX 1/imm32/true -430 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0x39/imm32 # compare ECX -431 7e/jump-if-lesser-or-equal $is-hex-digit?:end/disp8 -432 # return true if c >= 'a' -433 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0x61/imm32 # compare ECX -434 7d/jump-if-greater-or-equal $is-hex-digit?:end/disp8 -435 # otherwise return false -436 b8/copy-to-EAX 0/imm32/false -437 $is-hex-digit?:end: -438 # . restore registers -439 59/pop-to-ECX -440 # . epilog -441 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP -442 5d/pop-to-EBP -443 c3/return -444 -445 test-hex-below-0: -446 # EAX = is-hex-digit?(0x2f) -447 # . . push args -448 68/push 0x2f/imm32 -449 # . . call -450 e8/call is-hex-digit?/disp32 -451 # . . discard args -452 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -453 # check-ints-equal(EAX, 0, msg) -454 # . . push args -455 68/push "F - test-hex-below-0"/imm32 -456 68/push 0/imm32/false -457 50/push-EAX -458 # . . call -459 e8/call check-ints-equal/disp32 -460 # . . discard args -461 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP -462 c3/return -463 -464 test-hex-0-to-9: -465 # EAX = is-hex-digit?(0x30) -466 # . . push args -467 68/push 0x30/imm32 -468 # . . call -469 e8/call is-hex-digit?/disp32 -470 # . . discard args -471 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -472 # check-ints-equal(EAX, 1, msg) -473 # . . push args -474 68/push "F - test-hex-at-0"/imm32 -475 68/push 1/imm32/true -476 50/push-EAX -477 # . . call -478 e8/call check-ints-equal/disp32 -479 # . . discard args -480 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP -481 # EAX = is-hex-digit?(0x39) -482 # . . push args -483 68/push 0x39/imm32 -484 # . . call -485 e8/call is-hex-digit?/disp32 -486 # . . discard args -487 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -488 # check-ints-equal(EAX, 1, msg) -489 # . . push args -490 68/push "F - test-hex-at-9"/imm32 -491 68/push 1/imm32/true -492 50/push-EAX -493 # . . call -494 e8/call check-ints-equal/disp32 -495 # . . discard args -496 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP -497 c3/return -498 -499 test-hex-above-9-to-a: -500 # EAX = is-hex-digit?(0x3a) -501 # . . push args -502 68/push 0x3a/imm32 -503 # . . call -504 e8/call is-hex-digit?/disp32 -505 # . . discard args -506 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -507 # check-ints-equal(EAX, 0, msg) -508 # . . push args -509 68/push "F - test-hex-above-9-to-a"/imm32 -510 68/push 0/imm32/false -511 50/push-EAX -512 # . . call -513 e8/call check-ints-equal/disp32 -514 # . . discard args -515 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP -516 c3/return -517 -518 test-hex-a-to-f: -519 # EAX = is-hex-digit?(0x61) -520 # . . push args -521 68/push 0x61/imm32 -522 # . . call -523 e8/call is-hex-digit?/disp32 -524 # . . discard args -525 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -526 # check-ints-equal(EAX, 1, msg) -527 # . . push args -528 68/push "F - test-hex-at-a"/imm32 -529 68/push 1/imm32/true -530 50/push-EAX -531 # . . call -532 e8/call check-ints-equal/disp32 -533 # . . discard args -534 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP -535 # EAX = is-hex-digit?(0x66) -536 # . . push args -537 68/push 0x66/imm32 -538 # . . call -539 e8/call is-hex-digit?/disp32 -540 # . . discard args -541 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -542 # check-ints-equal(EAX, 1, msg) -543 # . . push args -544 68/push "F - test-hex-at-f"/imm32 -545 68/push 1/imm32/true -546 50/push-EAX -547 # . . call -548 e8/call check-ints-equal/disp32 -549 # . . discard args -550 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP -551 c3/return -552 -553 test-hex-above-f: -554 # EAX = is-hex-digit?(0x67) -555 # . . push args -556 68/push 0x67/imm32 -557 # . . call -558 e8/call is-hex-digit?/disp32 -559 # . . discard args -560 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP -561 # check-ints-equal(EAX, 0, msg) -562 # . . push args -563 68/push "F - test-hex-above-f"/imm32 -564 68/push 0/imm32/false -565 50/push-EAX -566 # . . call -567 e8/call check-ints-equal/disp32 -568 # . . discard args -569 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP -570 c3/return -571 -572 parse-hex-digit: # in/EAX : byte -> out/EAX : num -573 # no error checking; accepts argument in EAX -574 # if EAX <= '9' return EAX - '0' -575 3d/compare-EAX 0x39/imm32/9 -576 7f/jump-if-greater $parse-hex-digit:else/disp8 -577 2d/subtract-from-EAX 0x30/imm32/0 -578 c3/return -579 $parse-hex-digit:else: -580 # otherwise return EAX - 'a' + 10 -581 2d/subtract-from-EAX 0x57/imm32/a-10 -582 c3/return -583 -584 == data -585 -586 _test-slice-empty: -587 # nothing -588 _test-slice-empty-end: -589 -590 _test-slice-hex-int: -591 33/3 34/4 -592 _test-slice-hex-int-end: -593 -594 _test-slice-hex-int-with-0x-prefix: -595 30/0 78/x 33/3 34/4 -596 _test-slice-hex-int-with-0x-prefix-end: -597 -598 _test-slice-hex-int-letters: -599 33/3 34/4 61/a -600 _test-slice-hex-int-letters-end: -601 -602 _test-slice-hex-int-single-letter: -603 61/a -604 _test-slice-hex-int-single-letter-end: -605 -606 _test-slice-char-and-digits: -607 71/q 33/3 34/4 -608 _test-slice-char-and-digits-end: -609 -610 _test-slice-digits-and-char: -611 33/3 34/4 71/q -612 _test-slice-digits-and-char-end: -613 -614 # . . vim:nowrap:textwidth=0 +417 # var slice/ECX = "0" +418 68/push _test-slice-hex-int-zero-end/imm32 +419 68/push _test-slice-hex-int-zero/imm32 +420 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX +421 # EAX = parse-hex-int(slice) +422 # . . push args +423 51/push-ECX +424 # . . call +425 e8/call parse-hex-int/disp32 +426 # . . discard args +427 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +428 # check-ints-equal(EAX, 0x34a, msg) +429 # . . push args +430 68/push "F - test-parse-hex-int-zero"/imm32 +431 68/push 0/imm32 +432 50/push-EAX +433 # . . call +434 e8/call check-ints-equal/disp32 +435 # . . discard args +436 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +437 # . epilog +438 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP +439 5d/pop-to-EBP +440 c3/return +441 +442 test-parse-hex-int-0-prefix: +443 # . prolog +444 55/push-EBP +445 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP +446 # var slice/ECX = "03" +447 68/push _test-slice-hex-int-with-0-prefix-end/imm32 +448 68/push _test-slice-hex-int-with-0-prefix/imm32 +449 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX +450 # EAX = parse-hex-int(slice) +451 # . . push args +452 51/push-ECX +453 # . . call +454 e8/call parse-hex-int/disp32 +455 # . . discard args +456 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +457 # check-ints-equal(EAX, 0x3, msg) +458 # . . push args +459 68/push "F - test-parse-hex-int-0-prefix"/imm32 +460 68/push 0x3/imm32 +461 50/push-EAX +462 # . . call +463 e8/call check-ints-equal/disp32 +464 # . . discard args +465 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +466 # . epilog +467 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP +468 5d/pop-to-EBP +469 c3/return +470 +471 is-hex-digit?: # c : byte -> bool/EAX +472 # . prolog +473 55/push-EBP +474 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . . # copy ESP to EBP +475 # . save registers +476 51/push-ECX +477 # ECX = c +478 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 1/r32/ECX 8/disp8 . # copy *(EBP+8) to ECX +479 # return false if c < '0' +480 b8/copy-to-EAX 0/imm32/false +481 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0x30/imm32 # compare ECX +482 7c/jump-if-lesser $is-hex-digit?:end/disp8 +483 # return false if c > 'f' +484 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0x66/imm32 # compare ECX +485 7f/jump-if-greater $is-hex-digit?:end/disp8 +486 # return true if c <= '9' +487 b8/copy-to-EAX 1/imm32/true +488 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0x39/imm32 # compare ECX +489 7e/jump-if-lesser-or-equal $is-hex-digit?:end/disp8 +490 # return true if c >= 'a' +491 81 7/subop/compare 3/mod/direct 1/rm32/ECX . . . . . 0x61/imm32 # compare ECX +492 7d/jump-if-greater-or-equal $is-hex-digit?:end/disp8 +493 # otherwise return false +494 b8/copy-to-EAX 0/imm32/false +495 $is-hex-digit?:end: +496 # . restore registers +497 59/pop-to-ECX +498 # . epilog +499 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . . # copy EBP to ESP +500 5d/pop-to-EBP +501 c3/return +502 +503 test-hex-below-0: +504 # EAX = is-hex-digit?(0x2f) +505 # . . push args +506 68/push 0x2f/imm32 +507 # . . call +508 e8/call is-hex-digit?/disp32 +509 # . . discard args +510 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +511 # check-ints-equal(EAX, 0, msg) +512 # . . push args +513 68/push "F - test-hex-below-0"/imm32 +514 68/push 0/imm32/false +515 50/push-EAX +516 # . . call +517 e8/call check-ints-equal/disp32 +518 # . . discard args +519 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +520 c3/return +521 +522 test-hex-0-to-9: +523 # EAX = is-hex-digit?(0x30) +524 # . . push args +525 68/push 0x30/imm32 +526 # . . call +527 e8/call is-hex-digit?/disp32 +528 # . . discard args +529 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +530 # check-ints-equal(EAX, 1, msg) +531 # . . push args +532 68/push "F - test-hex-at-0"/imm32 +533 68/push 1/imm32/true +534 50/push-EAX +535 # . . call +536 e8/call check-ints-equal/disp32 +537 # . . discard args +538 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +539 # EAX = is-hex-digit?(0x39) +540 # . . push args +541 68/push 0x39/imm32 +542 # . . call +543 e8/call is-hex-digit?/disp32 +544 # . . discard args +545 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +546 # check-ints-equal(EAX, 1, msg) +547 # . . push args +548 68/push "F - test-hex-at-9"/imm32 +549 68/push 1/imm32/true +550 50/push-EAX +551 # . . call +552 e8/call check-ints-equal/disp32 +553 # . . discard args +554 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +555 c3/return +556 +557 test-hex-above-9-to-a: +558 # EAX = is-hex-digit?(0x3a) +559 # . . push args +560 68/push 0x3a/imm32 +561 # . . call +562 e8/call is-hex-digit?/disp32 +563 # . . discard args +564 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +565 # check-ints-equal(EAX, 0, msg) +566 # . . push args +567 68/push "F - test-hex-above-9-to-a"/imm32 +568 68/push 0/imm32/false +569 50/push-EAX +570 # . . call +571 e8/call check-ints-equal/disp32 +572 # . . discard args +573 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +574 c3/return +575 +576 test-hex-a-to-f: +577 # EAX = is-hex-digit?(0x61) +578 # . . push args +579 68/push 0x61/imm32 +580 # . . call +581 e8/call is-hex-digit?/disp32 +582 # . . discard args +583 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +584 # check-ints-equal(EAX, 1, msg) +585 # . . push args +586 68/push "F - test-hex-at-a"/imm32 +587 68/push 1/imm32/true +588 50/push-EAX +589 # . . call +590 e8/call check-ints-equal/disp32 +591 # . . discard args +592 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +593 # EAX = is-hex-digit?(0x66) +594 # . . push args +595 68/push 0x66/imm32 +596 # . . call +597 e8/call is-hex-digit?/disp32 +598 # . . discard args +599 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +600 # check-ints-equal(EAX, 1, msg) +601 # . . push args +602 68/push "F - test-hex-at-f"/imm32 +603 68/push 1/imm32/true +604 50/push-EAX +605 # . . call +606 e8/call check-ints-equal/disp32 +607 # . . discard args +608 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +609 c3/return +610 +611 test-hex-above-f: +612 # EAX = is-hex-digit?(0x67) +613 # . . push args +614 68/push 0x67/imm32 +615 # . . call +616 e8/call is-hex-digit?/disp32 +617 # . . discard args +618 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32 # add to ESP +619 # check-ints-equal(EAX, 0, msg) +620 # . . push args +621 68/push "F - test-hex-above-f"/imm32 +622 68/push 0/imm32/false +623 50/push-EAX +624 # . . call +625 e8/call check-ints-equal/disp32 +626 # . . discard args +627 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32 # add to ESP +628 c3/return +629 +630 parse-hex-digit: # in/EAX : byte -> out/EAX : num +631 # no error checking; accepts argument in EAX +632 # if EAX <= '9' return EAX - '0' +633 3d/compare-EAX 0x39/imm32/9 +634 7f/jump-if-greater $parse-hex-digit:else/disp8 +635 2d/subtract-from-EAX 0x30/imm32/0 +636 c3/return +637 $parse-hex-digit:else: +638 # otherwise return EAX - 'a' + 10 +639 2d/subtract-from-EAX 0x57/imm32/a-10 +640 c3/return +641 +642 == data +643 +644 _test-slice-empty: +645 # nothing +646 _test-slice-empty-end: +647 +648 _test-slice-hex-int: +649 33/3 34/4 +650 _test-slice-hex-int-end: +651 +652 _test-slice-hex-int-letters: +653 33/3 34/4 61/a +654 _test-slice-hex-int-letters-end: +655 +656 _test-slice-hex-int-single-letter: +657 61/a +658 _test-slice-hex-int-single-letter-end: +659 +660 _test-slice-char-and-digits: +661 71/q 33/3 34/4 +662 _test-slice-char-and-digits-end: +663 +664 _test-slice-digits-and-char: +665 33/3 34/4 71/q +666 _test-slice-digits-and-char-end: +667 +668 _test-slice-hex-int-with-0x-prefix: +669 30/0 78/x 33/3 34/4 +670 _test-slice-hex-int-with-0x-prefix-end: +671 +672 _test-slice-hex-int-zero: +673 30/0 +674 _test-slice-hex-int-zero-end: +675 +676 _test-slice-hex-int-with-0-prefix: +677 30/0 33/3 +678 _test-slice-hex-int-with-0-prefix-end: +679 +680 # . . vim:nowrap:textwidth=0 -- cgit 1.4.1-2-gfad0