commit fcf5a2102457bf094bb79b73900f078027d23c81
parent 04dc774e1722675da8b36c90e5f502fc96039a63
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Sun, 2 Jul 2023 14:27:57 -0400
hal i386: fix bug with <<, >>, and <>)
Still no luck with my ar/ungz failure...
Diffstat:
3 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/fs/doc/hal.txt b/fs/doc/hal.txt
@@ -248,7 +248,7 @@ Instructions:
[!+], op -- Write dest into indirect source and add 4 to source.
compare, op -- * Compare source to dest (all flags set)
+n, n op -- Z Add n to source without affecting dest
- Can't use with i)
+ Can't use with i) or <>)
ps+, n -- Add n to PSP
rs+, n -- Add n to RSP
diff --git a/fs/tests/hal.fs b/fs/tests/hal.fs
@@ -288,4 +288,10 @@ code test31 ( a b -- r q ) \ a / b
PSP) <>) /mod, PSP) A>) !, exit,
5 2 test31 2 #eq 1 #eq
+
+\ <<, and <>)
+code test32 ( a b -- a<<b )
+ PSP) <>) <<, drop, exit,
+
+$2a 4 test32 $2a0 #eq
testend
diff --git a/fs/xcomp/i386/kernel.fs b/fs/xcomp/i386/kernel.fs
@@ -472,7 +472,13 @@ xcode compare, ( operand -- )
\ Write SHL or SHR
pc to L1 ( operand -- ) \ dx=SHL/SHR regid
- ax HALIMM i) test, forward8 jnz, \ not an immediate
+ ax HALIMM i) test, forward jnz, \ not an immediate
+ ax HALINV i) test, forward8 jz, \ inverted, dst is going to CX
+ xdup, 3 cx al modrm!,
+ dx push, wcall, !, dx pop, \ mov cx, dst
+ 0 al reg!, al dl or,
+ $d3 i) cwrite, al cwrite,
+ xdrop, ret, forward!
xdup, cx al reg!, \ target CX
dx push, wcall, @, dx pop,
\ mod becomes 3, reg moves to rm and DL is orred into modrm