forth-riscv

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

commit 3abcc45b2f613315ccec87132d66568fc11abd9d
parent bce487fa1663817912ed99d02a5d89f0d5675b71
Author: Christian Ermann <christianermann@gmail.com>
Date:   Wed,  6 Nov 2024 20:57:37 -0800

Change 'source-offset' and 'source-id' into variables

Diffstat:
Mforth.s | 32++++++++++++--------------------
1 file changed, 12 insertions(+), 20 deletions(-)

diff --git a/forth.s b/forth.s @@ -183,6 +183,12 @@ defvar "'source", tick_source, 0xEB4FEC0B .int 0 # address .int 0 # length +defvar "source-offset", source_offset, 0x7F8C1674 + .int 0 + +defvar "source-id", source_id, 0x965ED1E2 + .int 0 + # ----------------------------------------------------------------------------- # input and output # ----------------------------------------------------------------------------- @@ -252,16 +258,6 @@ _refill_failed: defword "source", source, 0x1BCF29D8 .int tick_source, two_fetch, exit -defcode "source-offset", source_offset, 0x7F8C1674 - la w, _input_offset - push w - next - -defcode "source-id", source_id, 0x965ED1E2 - la w, _source_id - push w - next - defcode "tib", tib, 0xC90B0194 # ( -- addr len ) la w, _tib @@ -284,7 +280,7 @@ defcode "parse-key", parse_key, 0xB78FDA4A la w, _tick_source load_cell x, cell(w) load_cell w, 0(w) - la y, _input_offset + la y, _source_offset load_cell y, 0(y) add w, w, y sub x, x, y @@ -292,7 +288,7 @@ defcode "parse-key", parse_key, 0xB78FDA4A 1: lb t0, 0(w) addi y, y, 1 - la t1, _input_offset + la t1, _source_offset store_cell y, 0(t1) push t0 next @@ -304,7 +300,7 @@ defcode "parse-char", parse_char, 0xDF4F729B la w, _tick_source load_cell x, cell(w) load_cell w, 0(w) - la y, _input_offset + la y, _source_offset load_cell y, 0(y) add w, w, y sub x, x, y @@ -319,7 +315,7 @@ defcode "parse-char", parse_char, 0xDF4F729B beq t0, s3, 1b # space? -> skip! 2: # done - la t1, _input_offset + la t1, _source_offset store_cell y, 0(t1) push t0 next @@ -333,7 +329,7 @@ defcode "parse-word", parse_word, 0xB218226F load_cell x, cell(w) load_cell w, 0(w) # buff addr # apply input offset - la y, _input_offset + la y, _source_offset load_cell y, 0(y) add w, w, y sub x, x, y @@ -358,7 +354,7 @@ defcode "parse-word", parse_word, 0xB218226F addi x, x, -1 # dec. len j 2b 3: # done - la t0, _input_offset + la t0, _source_offset store_cell y, 0(t0) sub x, w, s4 push s4 # word addr @@ -1013,10 +1009,6 @@ _bootstrap: .int __file_start _bootstrap_len: .int __file_len _bootstrap_offset: .int 0 -_source_id: .int 0 - -_input_offset: .int 0 - _tib: .space 255 _tib_len: .int 255