forth-riscv

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

commit d0c0b881c2eb01971e8ba5043dc819d1f963b6ed
parent e4d4c4830c83cb88691a3474e8556e9f57f6635d
Author: Christian Ermann <christianermann@gmail.com>
Date:   Tue,  5 Nov 2024 22:27:49 -0800

Add 'sp@', 'rp@', and 'depth'

Diffstat:
Mforth.f | 1+
Mforth.s | 16++++++++++++++--
2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/forth.f b/forth.f @@ -53,3 +53,4 @@ swap ! then ; immediate +: depth sp@ sp0 swap - ; diff --git a/forth.s b/forth.s @@ -618,7 +618,13 @@ defcode "sp0", 3, 0, 0x0C41B8B2, sp_top, align push w next -defcode "sp!", 3, 0, 0x1D41D375, sp_store, sp_top +defcode "sp@", 3, 0, 0xFC419F82, sp_fetch, sp_top + # ( -- addr ) + mv w, psp + push w + next + +defcode "sp!", 3, 0, 0x1D41D375, sp_store, sp_fetch # ( addr -- ) pop w mv psp, w @@ -630,7 +636,13 @@ defcode "rp0", 3, 0, 0x8AD91EDD, rp_top, sp_store push w next -defcode "rp!", 3, 0, 0x99D9367A, rp_store, rp_top +defcode "rp@", 3, 0, 0x7AD905AD, rp_fetch, rp_top + # ( -- addr ) + mv w, rsp + push w + next + +defcode "rp!", 3, 0, 0x99D9367A, rp_store, rp_fetch # ( addr -- ) pop w mv rsp, w