diff options
Diffstat (limited to 'subx')
-rw-r--r-- | subx/054string-equal.subx | 39 | ||||
-rwxr-xr-x | subx/apps/assort | bin | 24092 -> 24089 bytes | |||
-rwxr-xr-x | subx/apps/crenshaw2-1 | bin | 21319 -> 21316 bytes | |||
-rwxr-xr-x | subx/apps/crenshaw2-1b | bin | 21878 -> 21875 bytes | |||
-rwxr-xr-x | subx/apps/factorial | bin | 20235 -> 20232 bytes | |||
-rwxr-xr-x | subx/apps/handle | bin | 21041 -> 21038 bytes | |||
-rwxr-xr-x | subx/apps/hex | bin | 24328 -> 24325 bytes | |||
-rwxr-xr-x | subx/apps/pack | bin | 39743 -> 39740 bytes | |||
-rwxr-xr-x | subx/apps/survey | bin | 21850 -> 22055 bytes |
9 files changed, 17 insertions, 22 deletions
diff --git a/subx/054string-equal.subx b/subx/054string-equal.subx index caeb0ea0..daaaa936 100644 --- a/subx/054string-equal.subx +++ b/subx/054string-equal.subx @@ -15,22 +15,20 @@ Entry: # run all tests string-equal?: # s : (address string), benchmark : (address string) -> EAX : boolean # pseudocode: - # lens = s->length - # if (lens != benchmark->length) return false - # i = 0 + # if (s->length != benchmark->length) return false # currs = s->data # currb = benchmark->data - # while i < s->length + # maxs = s->data + s->length + # while currs < maxs # c1 = *currs # c2 = *currb # if (c1 != c2) return false - # ++i, ++currs, ++currb + # ++currs, ++currb # return true # # registers: - # i: ECX - # lens: EDX # currs: ESI + # maxs: ECX # currb: EDI # c1: EAX # c2: EBX @@ -41,40 +39,38 @@ string-equal?: # s : (address string), benchmark : (address string) -> EAX : bo # . save registers 51/push-ECX 52/push-EDX - 53/push-EBX 56/push-ESI 57/push-EDI # ESI = s 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 6/r32/ESI 8/disp8 . # copy *(EBP+8) to ESI # EDI = benchmark 8b/copy 1/mod/*+disp8 5/rm32/EBP . . . 7/r32/EDI 0xc/disp8 . # copy *(EBP+12) to EDI - # lens/EDX = s->length - 8b/copy 0/mod/indirect 6/rm32/ESI . . . 2/r32/EDX . . # copy *ESI to EDX + # ECX = s->length + 8b/copy 0/mod/indirect 6/rm32/ESI . . . 1/r32/ECX . . # copy *ESI to ECX $string-equal?:lengths: - # if (lens != benchmark->length) return false - 39/compare 0/mod/indirect 7/rm32/EDI . . . 2/r32/EDX . . # compare *EDI and EDX + # if (ECX != benchmark->length) return false + 39/compare 0/mod/indirect 7/rm32/EDI . . . 1/r32/ECX . . # compare *EDI and ECX 75/jump-if-not-equal $string-equal?:false/disp8 # currs/ESI = s->data 81 0/subop/add 3/mod/direct 6/rm32/ESI . . . . . 4/imm32 # add to ESI + # maxs/ECX = s->data + s->length + 01/add 3/mod/direct 1/rm32/ECX . . . 6/r32/ESI . . # add ESI to ECX # currb/EDI = benchmark->data 81 0/subop/add 3/mod/direct 7/rm32/EDI . . . . . 4/imm32 # add to EDI - # i/ECX = c1/EAX = c2/EBX = 0 - 31/xor 3/mod/direct 1/rm32/ECX . . . 1/r32/ECX . . # clear ECX + # c1/EAX = c2/EDX = 0 31/xor 3/mod/direct 0/rm32/EAX . . . 0/r32/EAX . . # clear EAX - 31/xor 3/mod/direct 3/rm32/EBX . . . 3/r32/EBX . . # clear EBX + 31/xor 3/mod/direct 2/rm32/EDX . . . 2/r32/EDX . . # clear EDX $string-equal?:loop: - # if (i >= lens) return true - 39/compare 3/mod/direct 1/rm32/ECX . . . 2/r32/EDX . . # compare ECX with EDX + # if (currs >= maxs) return true + 39/compare 3/mod/direct 6/rm32/ESI . . . 1/r32/ECX . . # compare ESI with ECX 7d/jump-if-greater-or-equal $string-equal?:true/disp8 # c1 = *currs 8a/copy-byte 0/mod/indirect 6/rm32/ESI . . . 0/r32/AL . . # copy byte at *ESI to AL # c2 = *currb - 8a/copy-byte 0/mod/indirect 7/rm32/EDI . . . 3/r32/BL . . # copy byte at *EDI to BL + 8a/copy-byte 0/mod/indirect 7/rm32/EDI . . . 2/r32/DL . . # copy byte at *EDI to DL # if (c1 != c2) return false - 39/compare 3/mod/direct 0/rm32/EAX . . . 3/r32/EBX . . # compare EAX and EBX + 39/compare 3/mod/direct 0/rm32/EAX . . . 2/r32/EDX . . # compare EAX and EDX 75/jump-if-not-equal $string-equal?:false/disp8 - # ++i - 41/increment-ECX # ++currs 46/increment-ESI # ++currb @@ -89,7 +85,6 @@ $string-equal?:end: # . restore registers 5f/pop-to-EDI 5e/pop-to-ESI - 5b/pop-to-EBX 5a/pop-to-EDX 59/pop-to-ECX # . epilog diff --git a/subx/apps/assort b/subx/apps/assort index b9ba016b..e6926dd8 100755 --- a/subx/apps/assort +++ b/subx/apps/assort Binary files differdiff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1 index 43fae481..d9b1a274 100755 --- a/subx/apps/crenshaw2-1 +++ b/subx/apps/crenshaw2-1 Binary files differdiff --git a/subx/apps/crenshaw2-1b b/subx/apps/crenshaw2-1b index 0a3c2c44..aa4a43ab 100755 --- a/subx/apps/crenshaw2-1b +++ b/subx/apps/crenshaw2-1b Binary files differdiff --git a/subx/apps/factorial b/subx/apps/factorial index 3439987b..f6636272 100755 --- a/subx/apps/factorial +++ b/subx/apps/factorial Binary files differdiff --git a/subx/apps/handle b/subx/apps/handle index b6b806d5..dc69f189 100755 --- a/subx/apps/handle +++ b/subx/apps/handle Binary files differdiff --git a/subx/apps/hex b/subx/apps/hex index 3eb6a5b7..b634eb31 100755 --- a/subx/apps/hex +++ b/subx/apps/hex Binary files differdiff --git a/subx/apps/pack b/subx/apps/pack index b8bd13aa..7d47ad2c 100755 --- a/subx/apps/pack +++ b/subx/apps/pack Binary files differdiff --git a/subx/apps/survey b/subx/apps/survey index 9578a1d6..477d476f 100755 --- a/subx/apps/survey +++ b/subx/apps/survey Binary files differ |