commit 38ac980799e346d86463a3c723e73fe2e3d3da0f
parent bf3a586ffb37f93776a2b024b2b5e90ac5d31530
Author: Virgil Dupras <hsoft@hardcoded.net>
Date: Mon, 5 Jun 2023 13:36:32 -0400
rpi: add compare, and associated flags
Diffstat:
2 files changed, 22 insertions(+), 3 deletions(-)
diff --git a/fs/xcomp/arm/rpi/kernel.fs b/fs/xcomp/arm/rpi/kernel.fs
@@ -433,6 +433,14 @@ HALBASE rPSP rn) xconst PSP)
HALBASE rSP rn) xconst RSP)
0 eq) xconst Z)
0 ne) xconst NZ)
+0 hs) xconst >=)
+0 lo) xconst <)
+0 hi) xconst >)
+0 ls) xconst <=)
+0 ge) xconst s>=)
+0 lt) xconst s<)
+0 gt) xconst s>)
+0 le) xconst s<=)
pc to lblhbank 0 le,
pc HALBASE $10 or le, \ b4 is set
@@ -566,10 +574,19 @@ xcode @!, pushret, ( operand -- )
bic) rTOP rdn) $04000000 i) ,) \ remove 32b flag
popret, L1 abs>rel b) ,)
+pc to L1 ( operand -- )
+ bic) rTOP rdn) $f000 i) ,) \ Rd=r0
+ wjmp, @,
+
pc add) rTOP rdn) r0 rm) ,)
xcode +, ( operand -- )
- bic) rTOP rdn) $f000 i) ,) \ Rd=r0
- pushret, wcall, @, popret,
+ pushret, L1 abs>rel bl) ,) popret,
+ ( pc ) r0 pc@>reg,
+ lbldwrite abs>rel b) ,)
+
+pc cmp) rTOP rn) r0 rm) ,)
+xcode compare, ( operand -- )
+ pushret, L1 abs>rel bl) ,) popret,
( pc ) r0 pc@>reg,
lbldwrite abs>rel b) ,)
diff --git a/fs/xcomp/rpiboot.fs b/fs/xcomp/rpiboot.fs
@@ -86,7 +86,9 @@ code ?dup W=0>Z, 0 Z) branchC, dup, then exit,
: begin HERE @ ; immediate
: again branch, drop ; immediate
: until W>A, drop, A=0>Z, Z) branchC, drop ; immediate
-: = - not ;
+: _ code PSP) compare, C>W, nip, exit, ;
+Z) _ = NZ) _ <> >) _ < <) _ > >=) _ <= <=) _ >=
+
: \ begin in< $0a = until ; immediate
uartinit \ see the (wnf) if comment is mishandled
\ hello, this is a comment!