commit d428682410d8b2b51fca035754eec4046f89f566
parent 3d93c23397bc8b1cbdfb61fb6861a39704d59365
Author: Henry Wilson <m3henry@googlemail.com>
Date: Mon, 19 Jun 2017 15:36:01 +0100
indirect compare macro
Diffstat:
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/main.s b/main.s
@@ -322,7 +322,7 @@ quadcmp: forthword
endword
1: do pushret
do dup2
- cmpaddr nequal
+ do indeq
if 0f
do inc
do swap
@@ -618,7 +618,8 @@ divide: codeword
.macro cmpaddr op
codeword
mov (SP), ACC
- cmp (TOS), (ACC)
+ mov (ACC), ACC
+ cmp (TOS), ACC
\op truecmp
movq $0, (SP)
jmp _drop
@@ -628,17 +629,20 @@ truecmp:
movq $-1, (SP)
jmp _drop
-equal: compare je
+equal: compare je
nequal: compare jne
greater: compare jg
-less: compare jl
+less: compare jl
gequal: compare jge
lequal: compare jle
above: compare ja
-below: compare jb
+below: compare jb
aequal: compare jae
bequal: compare jbe
+indeq: cmpaddr je
+indneq: cmpaddr jne
+
# Kernel
exit: codeword