ref: 566c0d9f7779de4fefb4a28117df43a003eb4a9d
parent: ebbcb610d3223a15ceb39b7fddc899b5012d8892
author: 9ferno <gophone2015@gmail.com>
date: Sat Jan 29 01:10:38 EST 2022
execute uses the macro CHECKADDRESS now
--- a/os/pc64/forth.h
+++ b/os/pc64/forth.h
@@ -2304,7 +2304,7 @@
{.type FromH0, {.p M_store}, .src = "dd M_store"}, /* dd M_store 18944 */
{.type FromH0, {.p MC_STDIN}, .src = "dd MC_STDIN"}, /* dd MC_STDIN 18952 */
{.type FromH0, {.p MV_Infd}, .src = "dd MV_Infd"}, /* dd MV_Infd 18960 */
- {.type FromH0, {.p M_store}, .src = "dd M_store ; stdin = 0"}, /* dd M_store ; stdin = 0 18968 */
+ {.type FromH0, {.p M_store}, .src = "dd M_store ; stdin = 0"}, /* dd M_store ; stdin = 0 18968 */
{.type FromH0, {.p MC_STDOUT}, .src = "dd MC_STDOUT"}, /* dd MC_STDOUT 18976 */
{.type FromH0, {.p MV_Outfd}, .src = "dd MV_Outfd"}, /* dd MV_Outfd 18984 */
{.type FromH0, {.p M_store}, .src = "dd M_store"}, /* dd M_store 18992 */
--- a/os/pc64/forth.s
+++ b/os/pc64/forth.s
@@ -186,14 +186,6 @@
MOVQ (IP),IP
NEXT
-TEXT execute(SB), 1, $-4 /* ( ... a -- ... ) */
- PUSH(TOP)
- CALL validateaddress(SB) /* a a -- a */
- MOVQ TOP, W
- POP(TOP)
- MOVQ (W), CX
- JMP* CX
-
TEXT deferred(SB), 1, $-4
MOVQ 8(W), W
MOVQ (W), CX
@@ -214,17 +206,18 @@
POP(TOP)
NEXT
-/*
- TODO replace the CALL to validateaddress with a macro
- using UM and UME masks or CMPQ with UM and UME in
- fetch, store, cfetch and cstore to speed up these words
- (a || UM) && ~UME
- */
#define CHECKADDRESS \
CMPQ TOP, UME; \
JGT aboveume; /* a > UME */\
CMPQ TOP, UM;\
JLT belowum; /* a < UM */
+
+TEXT execute(SB), 1, $-4 /* ( ... a -- ... ) */
+ CHECKADDRESS
+ MOVQ TOP, W
+ POP(TOP)
+ MOVQ (W), CX
+ JMP* CX
TEXT fetch(SB), 1, $-4 /* ( a -- n) */
CHECKADDRESS
--- a/os/pc64/words-nasm.s
+++ b/os/pc64/words-nasm.s
@@ -1158,7 +1158,6 @@
L172:
dd M_exitcolon
-
dd MC_STDOUT ; ( str -- str 1) ; debug code to show the word found
dd M_over ; ( str 1 str )
dd C_count ; ( str 1 a n)
@@ -1180,6 +1179,7 @@
dd L177
dd M_execute ; found in dictionary, execute
+
dd C_qstack
dd M_jump
dd L178
@@ -1813,6 +1813,7 @@
dd M_reset ; initialize return stack
dd M_clear ; SP = sstack_end initialize data stack
L253:
+
dd C_query
; dd MV_toLimit ; show the line read, for debugging
@@ -1933,7 +1934,7 @@
dd MC_STDIN
dd MV_Infd
-dd M_store ; stdin = 0
+dd M_store ; stdin = 0
dd MC_STDOUT
dd MV_Outfd
dd M_store