about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--067parse-hex.subx95
-rwxr-xr-xapps/assortbin40786 -> 40852 bytes
-rwxr-xr-xapps/bracesbin42480 -> 42546 bytes
-rwxr-xr-xapps/callsbin47141 -> 47207 bytes
-rwxr-xr-xapps/crenshaw2-1bin40194 -> 40260 bytes
-rwxr-xr-xapps/crenshaw2-1bbin40741 -> 40807 bytes
-rwxr-xr-xapps/dquotesbin44436 -> 44502 bytes
-rwxr-xr-xapps/factorialbin39213 -> 39279 bytes
-rwxr-xr-xapps/handlebin40111 -> 40177 bytes
-rwxr-xr-xapps/hexbin43033 -> 43099 bytes
-rwxr-xr-xapps/mubin175077 -> 175143 bytes
-rwxr-xr-xapps/packbin53178 -> 53244 bytes
-rwxr-xr-xapps/sigilsbin54865 -> 54931 bytes
-rwxr-xr-xapps/surveybin50027 -> 50093 bytes
-rwxr-xr-xapps/testsbin39584 -> 39650 bytes
15 files changed, 78 insertions, 17 deletions
diff --git a/067parse-hex.subx b/067parse-hex.subx
index 0524609a..afbd6d6c 100644
--- a/067parse-hex.subx
+++ b/067parse-hex.subx
@@ -351,6 +351,39 @@ test-is-hex-int-handles-negative-0x-prefix:
     5d/pop-to-ebp
     c3/return
 
+parse-hex-int:  # in: (addr array byte) -> result/eax: int
+    # . prologue
+    55/push-ebp
+    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
+    # . save registers
+    51/push-ecx
+    52/push-edx
+    # eax = in
+    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           0/r32/eax   8/disp8         .                 # copy *(ebp+8) to eax
+    # var curr/ecx: (addr byte) = &in->data
+    8d/copy-address                 1/mod/*+disp8   0/rm32/eax    .           .             .           1/r32/ecx   4/disp8         .                 # copy eax+4 to ecx
+    # var max/edx: (addr byte) = &in->data[in->length]
+    # . edx = in->length
+    8b/copy                         0/mod/indirect  0/rm32/eax    .           .             .           2/r32/edx   .               .                 # copy *eax to edx
+    # . edx = in->data + in->length
+    8d/copy-address                 1/mod/*+disp8   4/rm32/sib    0/base/eax  2/index/edx   .           2/r32/edx   4/disp8         .                 # copy eax+edx+4 to edx
+    # return parse-hex-int-helper(curr, max)
+    # . . push args
+    52/push-edx
+    51/push-ecx
+    # . . call
+    e8/call  parse-hex-int-helper/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
+$parse-hex-int:end:
+    # . restore registers
+    5a/pop-to-edx
+    59/pop-to-ecx
+    # . epilogue
+    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
+    5d/pop-to-ebp
+    c3/return
+
 parse-hex-int-from-slice:  # in: (addr slice) -> result/eax: int
     # . prologue
     55/push-ebp
@@ -358,51 +391,79 @@ parse-hex-int-from-slice:  # in: (addr slice) -> result/eax: int
     # . save registers
     51/push-ecx
     52/push-edx
-    53/push-ebx
-    56/push-esi
-    # var result/ebx: int = 0
-    31/xor                          3/mod/direct    3/rm32/ebx    .           .             .           3/r32/ebx   .               .                 # clear ebx
     # ecx = in
     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   8/disp8         .                 # copy *(ebp+8) to ecx
     # edx = in->end
     8b/copy                         1/mod/*+disp8   1/rm32/ecx    .           .             .           2/r32/edx   4/disp8         .                 # copy *(ecx+4) to edx
     # var curr/ecx: (addr byte) = in->start
     8b/copy                         0/mod/indirect  1/rm32/ecx    .           .             .           1/r32/ecx   .               .                 # copy *ecx to ecx
+    # return parse-hex-int-helper(curr, max)
+    # . . push args
+    52/push-edx
+    51/push-ecx
+    # . . call
+    e8/call  parse-hex-int-helper/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
+$parse-hex-int-from-slice:end:
+    # . restore registers
+    5a/pop-to-edx
+    59/pop-to-ecx
+    # . epilogue
+    89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
+    5d/pop-to-ebp
+    c3/return
+
+parse-hex-int-helper:  # start: (addr byte), end: (addr byte) -> result/eax: int
+    # . prologue
+    55/push-ebp
+    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
+    # . save registers
+    51/push-ecx
+    52/push-edx
+    53/push-ebx
+    56/push-esi
+    # var curr/ecx: (addr byte) = start
+    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           1/r32/ecx   8/disp8         .                 # copy *(ebp+8) to ecx
+    # edx = max
+    8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           2/r32/edx   0xc/disp8       .                 # copy *(ebp+0xc) to edx
+    # var result/ebx: int = 0
+    31/xor                          3/mod/direct    3/rm32/ebx    .           .             .           3/r32/ebx   .               .                 # clear ebx
     # var negate?/esi: boolean = false
     31/xor                          3/mod/direct    6/rm32/esi    .           .             .           6/r32/esi   .               .                 # clear esi
-$parse-hex-int-from-slice:negative:
+$parse-hex-int-helper:negative:
     # if (*curr == '-') ++curr, negate = true
     31/xor                          3/mod/direct    0/rm32/eax    .           .             .           0/r32/eax   .               .                 # clear eax
     8a/copy-byte                    0/mod/indirect  1/rm32/ecx    .           .             .           0/r32/AL    .               .                 # copy byte at *ecx to AL
     3d/compare-eax-and  0x2d/imm32/-
-    75/jump-if-!=  $parse-hex-int-from-slice:initial-0/disp8
+    75/jump-if-!=  $parse-hex-int-helper:initial-0/disp8
     # . ++curr
     41/increment-ecx
     # . negate = true
     be/copy-to-esi  1/imm32/true
-$parse-hex-int-from-slice:initial-0:
+$parse-hex-int-helper:initial-0:
     # skip past leading '0x'
     # . if (*curr != '0') jump to loop
     8a/copy-byte                    0/mod/indirect  1/rm32/ecx    .           .             .           0/r32/AL    .               .                 # copy byte at *ecx to AL
     3d/compare-eax-and  0x30/imm32/0
-    75/jump-if-!=  $parse-hex-int-from-slice:loop/disp8
+    75/jump-if-!=  $parse-hex-int-helper:loop/disp8
     # . ++curr
     41/increment-ecx
-$parse-hex-int-from-slice:initial-0x:
+$parse-hex-int-helper:initial-0x:
     # . if (curr >= in->end) return result
     39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
-    73/jump-if-addr>=  $parse-hex-int-from-slice:end/disp8
+    73/jump-if-addr>=  $parse-hex-int-helper:end/disp8
     # . if (*curr != 'x') jump to loop  # the previous '0' is still valid so doesn't need to be checked again
     31/xor                          3/mod/direct    0/rm32/eax    .           .             .           0/r32/eax   .               .                 # clear eax
     8a/copy-byte                    0/mod/indirect  1/rm32/ecx    .           .             .           0/r32/AL    .               .                 # copy byte at *ecx to AL
     3d/compare-eax-and  0x78/imm32/x
-    75/jump-if-!=  $parse-hex-int-from-slice:loop/disp8
+    75/jump-if-!=  $parse-hex-int-helper:loop/disp8
     # . ++curr
     41/increment-ecx
-$parse-hex-int-from-slice:loop:
+$parse-hex-int-helper:loop:
     # if (curr >= in->end) break
     39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
-    73/jump-if-addr>=  $parse-hex-int-from-slice:negate/disp8
+    73/jump-if-addr>=  $parse-hex-int-helper:negate/disp8
     # var eax: int = from-hex-char(*curr)
     # . . copy arg to eax
     8a/copy-byte                    0/mod/indirect  1/rm32/ecx    .           .             .           0/r32/AL    .               .                 # copy byte at *ecx to AL
@@ -414,13 +475,13 @@ $parse-hex-int-from-slice:loop:
     # ++curr
     41/increment-ecx
     # loop
-    eb/jump  $parse-hex-int-from-slice:loop/disp8
-$parse-hex-int-from-slice:negate:
+    eb/jump  $parse-hex-int-helper:loop/disp8
+$parse-hex-int-helper:negate:
     # if (negate?) result = -result
     81          7/subop/compare     3/mod/direct    6/rm32/esi    .           .             .           .           .               0/imm32/false     # compare esi
-    74/jump-if-=  $parse-hex-int-from-slice:end/disp8
+    74/jump-if-=  $parse-hex-int-helper:end/disp8
     f7          3/subop/negate      3/mod/direct    3/rm32/ebx    .           .             .           .           .               .                 # negate ebx
-$parse-hex-int-from-slice:end:
+$parse-hex-int-helper:end:
     # return result
     89/copy                         3/mod/direct    0/rm32/eax    .           .             .           3/r32/ebx   .               .                 # copy ebx to eax
     # . restore registers
diff --git a/apps/assort b/apps/assort
index ad67e870..92ac1ca1 100755
--- a/apps/assort
+++ b/apps/assort
Binary files differdiff --git a/apps/braces b/apps/braces
index 75b5bb60..fcda2022 100755
--- a/apps/braces
+++ b/apps/braces
Binary files differdiff --git a/apps/calls b/apps/calls
index f3a19461..c7e2b758 100755
--- a/apps/calls
+++ b/apps/calls
Binary files differdiff --git a/apps/crenshaw2-1 b/apps/crenshaw2-1
index 42014298..ce6d02d7 100755
--- a/apps/crenshaw2-1
+++ b/apps/crenshaw2-1
Binary files differdiff --git a/apps/crenshaw2-1b b/apps/crenshaw2-1b
index 545f40dc..d429e9c6 100755
--- a/apps/crenshaw2-1b
+++ b/apps/crenshaw2-1b
Binary files differdiff --git a/apps/dquotes b/apps/dquotes
index c80d9a68..8f96f53b 100755
--- a/apps/dquotes
+++ b/apps/dquotes
Binary files differdiff --git a/apps/factorial b/apps/factorial
index a20ad54b..e21f6dfa 100755
--- a/apps/factorial
+++ b/apps/factorial
Binary files differdiff --git a/apps/handle b/apps/handle
index 90c03d05..76fd78ee 100755
--- a/apps/handle
+++ b/apps/handle
Binary files differdiff --git a/apps/hex b/apps/hex
index 53408364..92241075 100755
--- a/apps/hex
+++ b/apps/hex
Binary files differdiff --git a/apps/mu b/apps/mu
index 2683e057..38d0f2c0 100755
--- a/apps/mu
+++ b/apps/mu
Binary files differdiff --git a/apps/pack b/apps/pack
index 3aa8caa3..8e60d188 100755
--- a/apps/pack
+++ b/apps/pack
Binary files differdiff --git a/apps/sigils b/apps/sigils
index 808ddcb5..9dffa2a8 100755
--- a/apps/sigils
+++ b/apps/sigils
Binary files differdiff --git a/apps/survey b/apps/survey
index 0e38c0f8..516ee21b 100755
--- a/apps/survey
+++ b/apps/survey
Binary files differdiff --git a/apps/tests b/apps/tests
index 504595d7..9f0ea034 100755
--- a/apps/tests
+++ b/apps/tests
Binary files differ
707'>707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914