about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--subx/054string-equal.subx53
-rwxr-xr-xsubx/apps/assortbin22506 -> 22646 bytes
-rwxr-xr-xsubx/apps/crenshaw2-1bin19675 -> 19815 bytes
-rwxr-xr-xsubx/apps/crenshaw2-1bbin20234 -> 20374 bytes
-rwxr-xr-xsubx/apps/factorialbin18591 -> 18731 bytes
-rwxr-xr-xsubx/apps/handlebin19418 -> 19558 bytes
-rwxr-xr-xsubx/apps/hexbin22684 -> 22824 bytes
-rwxr-xr-xsubx/apps/packbin37316 -> 37456 bytes
8 files changed, 53 insertions, 0 deletions
diff --git a/subx/054string-equal.subx b/subx/054string-equal.subx
index 6c23fccb..caeb0ea0 100644
--- a/subx/054string-equal.subx
+++ b/subx/054string-equal.subx
@@ -179,4 +179,57 @@ test-compare-inequal-strings-equal-lengths:
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
     c3/return
 
+# helper for later tests
+check-string-equal:  # s : (address string), expected : (address string), msg : (address string)
+    # . prolog
+    55/push-EBP
+    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
+    # . save registers
+    50/push-EAX
+    # EAX = string-equal?(s, expected)
+    # . . push args
+    ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0xc/disp8       .                 # push *(EBP+12)
+    ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           8/disp8         .                 # push *(EBP+8)
+    # . . call
+    e8/call  string-equal?/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # check-ints-equal(EAX, 1, msg)
+    # . . push args
+    ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0x10/disp8      .                 # push *(EBP+16)
+    68/push  1/imm32
+    50/push-EAX
+    # . . call
+    e8/call  check-ints-equal/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
+$check-string-equal:end:
+    # . restore registers
+    58/pop-to-EAX
+    # . epilog
+    89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
+    5d/pop-to-EBP
+    c3/return
+
+# test the helper
+test-check-string-equal:
+    # check-string-equal?("Abc", "Abc")
+    # . . push args
+    68/push  "Abc"/imm32
+    68/push  "Abc"/imm32
+    # . . call
+    e8/call  check-string-equal/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+    # check-ints-equal(EAX, 1, msg)
+    # . . push args
+    68/push  "F - test-check-string-equal"/imm32
+    68/push  0/imm32/false
+    50/push-EAX
+    # . . call
+    e8/call  check-ints-equal/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32         # add to ESP
+    c3/return
+
 # . . vim:nowrap:textwidth=0
diff --git a/subx/apps/assort b/subx/apps/assort
index 9a0c6bbe..20cef59b 100755
--- a/subx/apps/assort
+++ b/subx/apps/assort
Binary files differdiff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1
index 4c15f534..20110cc2 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 4f629ee2..b93d10c2 100755
--- a/subx/apps/crenshaw2-1b
+++ b/subx/apps/crenshaw2-1b
Binary files differdiff --git a/subx/apps/factorial b/subx/apps/factorial
index af0ddc65..b3aa69c5 100755
--- a/subx/apps/factorial
+++ b/subx/apps/factorial
Binary files differdiff --git a/subx/apps/handle b/subx/apps/handle
index fc09834c..c99743af 100755
--- a/subx/apps/handle
+++ b/subx/apps/handle
Binary files differdiff --git a/subx/apps/hex b/subx/apps/hex
index 5bf09dcc..1ac76865 100755
--- a/subx/apps/hex
+++ b/subx/apps/hex
Binary files differdiff --git a/subx/apps/pack b/subx/apps/pack
index c72f538a..002dbda7 100755
--- a/subx/apps/pack
+++ b/subx/apps/pack
Binary files differ