forth-riscv

My forth
git clone git://git.electrosoup.com/forth-riscv
Log | Files | Refs

commit 261b648b59dde9167f8e8bdb86bec8f62d624cbd
parent ce402afc91c6dbdcf9090e9ee74404279cc04876
Author: Christian Ermann <christianermann@gmail.com>
Date:   Wed,  4 Dec 2024 22:21:51 -0800

Add '(' as a stack comment prefix

Diffstat:
Msrc/forth.s | 23++++++++++++++++++++++-
1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/src/forth.s b/src/forth.s @@ -236,8 +236,13 @@ defvar "|", prefix_comment, 0xF90C4A3B .int _prefix_string .int token_to_comment -defvar "latest-prefix", latest_prefix, 0x86C823C5 +defvar "(", prefix_stack_comment, 0x2D0C9C17 + .int 0x28 .int _prefix_comment + .int token_to_stack_comment + +defvar "latest-prefix", latest_prefix, 0x86C823C5 + .int _prefix_stack_comment # ----------------------------------------------------------------------------- # constants and variables @@ -596,6 +601,22 @@ defword "token>comment", token_to_comment, 0x49ACBA31 li w, -1 exit +defword "token>stack-comment", token_to_stack_comment, 0x8B17CDB4 + # ( addr len -- addr len ) + addi psp, psp, 1*cell + # rewind to beginning of comment + la x, _source_offset + lw y, 0(x) + sub y, y, w + addi y, y, -1 + sw y, 0(x) + # skip comment + li w, 0x29 + jal parse_until + addi psp, psp, 1*cell + li w, -1 + exit + defcode ">number", to_number, 0x2F770E4C mv x, w pop w