about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-03-20 17:08:43 -0700
committerKartik Agaram <vc@akkartik.com>2019-03-20 17:33:42 -0700
commit4068f0ca5b3a380790794a986897815d8b6a45a8 (patch)
tree3549ac214d5f2dfe6321ec4bc81f45b8d79b925d /subx
parent5c21976b5837484264b26557013e3b9264b4ee89 (diff)
downloadmu-4068f0ca5b3a380790794a986897815d8b6a45a8.tar.gz
5011
New convention: compare 'with' for asymmetric comparisons (greater or lesser
than), and compare 'and' for symmetric comparisons. Worth making this distinction
even though the opcodes are identical; when we compare 'with', the order
of operands is significant.
Diffstat (limited to 'subx')
-rw-r--r--subx/052kernel-string-equal.subx2
-rw-r--r--subx/054string-equal.subx4
-rw-r--r--subx/072slice.subx4
-rw-r--r--subx/examples/ex10.subx2
-rw-r--r--subx/examples/ex11.subx2
5 files changed, 7 insertions, 7 deletions
diff --git a/subx/052kernel-string-equal.subx b/subx/052kernel-string-equal.subx
index 55d6c50a..dd2a406a 100644
--- a/subx/052kernel-string-equal.subx
+++ b/subx/052kernel-string-equal.subx
@@ -83,7 +83,7 @@ $kernel-string-equal?:loop:
     3d/compare-EAX  0/imm32
     74/jump-if-equal  $kernel-string-equal?:false/disp8
     # if (c1 != c2) return false
-    39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX with EBX
+    39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX and EBX
     75/jump-if-not-equal  $kernel-string-equal?:false/disp8
     # ++i
     41/inc-ECX
diff --git a/subx/054string-equal.subx b/subx/054string-equal.subx
index e2df6019..d85ec33d 100644
--- a/subx/054string-equal.subx
+++ b/subx/054string-equal.subx
@@ -52,7 +52,7 @@ string-equal?:  # s : (address string), benchmark : (address string) -> EAX : bo
     8b/copy                         0/mod/indirect  6/rm32/ESI    .           .             .           2/r32/EDX   .               .                 # copy *ESI to EDX
 $string-equal?:lengths:
     # if (lens != benchmark->length) return false
-    39/compare                      0/mod/indirect  7/rm32/EDI    .           .             .           2/r32/EDX   .               .                 # compare *EDI with EDX
+    39/compare                      0/mod/indirect  7/rm32/EDI    .           .             .           2/r32/EDX   .               .                 # compare *EDI and EDX
     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
@@ -71,7 +71,7 @@ $string-equal?:loop:
     # c2 = *currb
     8a/copy-byte                    0/mod/indirect  7/rm32/EDI    .           .             .           3/r32/BL    .               .                 # copy byte at *EDI to BL
     # if (c1 != c2) return false
-    39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX with EBX
+    39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX and EBX
     75/jump-if-not-equal  $string-equal?:false/disp8
     # ++i
     41/inc-ECX
diff --git a/subx/072slice.subx b/subx/072slice.subx
index 0e3d0c00..1e2a5db0 100644
--- a/subx/072slice.subx
+++ b/subx/072slice.subx
@@ -25,7 +25,7 @@ slice-empty?:  # s : (address slice) -> EAX : boolean
     # if (s->start == s->end) return true
     # . EAX = s->start
     8b/copy                         0/mod/indirect  1/rm32/ECX    .           .             .           0/r32/EAX   .               .                 # copy *ECX to EAX
-    # . compare EAX with s->end
+    # . compare EAX and s->end
     39/compare                      1/mod/*+disp8   1/rm32/ECX    .           .             .           0/r32/EAX   4/disp8         .                 # compare EAX and *(ECX+4)
     b8/copy-to-EAX  1/imm32/true
     74/jump-if-equal  $slice-empty?:end/disp8
@@ -144,7 +144,7 @@ slice-equal?:  # s : (address slice), p : (address string) -> EAX : boolean
     31/xor                          3/mod/direct    1/rm32/ECX    .           .             .           1/r32/ECX   .               .                 # clear ECX
 $slice-equal?:loop:
     # if (currs >= maxs) return true
-    39/compare                      3/mod/direct    2/rm32/EDX    .           .             .           6/r32/ESI   .               .                 # compare EDX and ESI
+    39/compare                      3/mod/direct    2/rm32/EDX    .           .             .           6/r32/ESI   .               .                 # compare EDX with ESI
     7d/jump-if-greater-or-equal  $slice-equal?:true/disp8
     # AL = *currp
     8a/copy-byte                    0/mod/indirect  3/rm32/EBX    .           .             .           0/r32/AL    .               .                 # copy byte at *EBX to AL
diff --git a/subx/examples/ex10.subx b/subx/examples/ex10.subx
index 7b88f582..72da1da0 100644
--- a/subx/examples/ex10.subx
+++ b/subx/examples/ex10.subx
@@ -48,7 +48,7 @@ $argv-equal:loop:
     3d/compare-EAX  0/imm32
     74/jump-if-equal  $argv-equal:break/disp8
     # if (c1 != c2) return false
-    39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX with EBX
+    39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX and EBX
     75/jump-if-not-equal  $argv-equal:false/disp8
     # ++s1, ++s2
     41/inc-ECX
diff --git a/subx/examples/ex11.subx b/subx/examples/ex11.subx
index 5f069ca8..8414351b 100644
--- a/subx/examples/ex11.subx
+++ b/subx/examples/ex11.subx
@@ -83,7 +83,7 @@ $kernel-string-equal?:loop:
     3d/compare-EAX  0/imm32
     74/jump-if-equal  $kernel-string-equal?:false/disp8
     # if (c1 != c2) return false
-    39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX with EBX
+    39/compare                      3/mod/direct    0/rm32/EAX    .           .             .           3/r32/EBX   .               .                 # compare EAX and EBX
     75/jump-if-not-equal  $kernel-string-equal?:false/disp8
     # ++i
     41/inc-ECX