From 031bfc6d725b096bb16cee9c690e7ffae7b3c230 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Mon, 30 Mar 2020 21:48:56 -0400 Subject: [PATCH] forth: setup SYSVNXT in Forth code --- emul/forth/z80c.bin | Bin 1549 -> 1549 bytes forth/core.fs | 4 ++++ forth/forth.asm | 7 ++----- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/emul/forth/z80c.bin b/emul/forth/z80c.bin index 0133c1b74cf00c22843fa5fcd53201987da4d04d..2190a1db3602403b87ce76eaf653b1f5b85230e2 100644 GIT binary patch delta 18 ZcmeC>>E+pw!pu5H^c+Xn=1k@#OaM7j1@Qm? delta 18 ZcmeC>>E+pw!pyo(^Z`f4=1k@#OaMCq1}6Xj diff --git a/forth/core.fs b/forth/core.fs index 574b8ed..0c099a8 100644 --- a/forth/core.fs +++ b/forth/core.fs @@ -116,6 +116,10 @@ 2 50 @ +! ; +( Set up initial SYSVNXT value, which is 2 bytes after its + own address ) +50 @ DUP 2 + SWAP ! + : ." LIT BEGIN diff --git a/forth/forth.asm b/forth/forth.asm index 92fd968..394d729 100644 --- a/forth/forth.asm +++ b/forth/forth.asm @@ -36,8 +36,7 @@ ; that we can't compile a regular variable in it. SYSVNXT points to the next ; free space in SYSVBUF. Then, at the word level, it's a regular sysvarWord. .equ SYSVNXT @+WORD_BUFSIZE -.equ SYSVBUF @+2 -.equ RAMEND @+SYSV_BUFSIZE +.equ RAMEND @+SYSV_BUFSIZE+2 ; (HERE) usually starts at RAMEND, but in certain situations, such as in stage0, ; (HERE) will begin at a strategic place. @@ -179,9 +178,6 @@ forthMain: ld (CURRENT), hl ld hl, HERE_INITIAL ld (HERE), hl - ; Set up SYSVNXT - ld hl, SYSVBUF - ld (SYSVNXT), hl ld hl, .bootName call find push de @@ -531,6 +527,7 @@ litWord: ld (IP), hl jp next +.fill 6 ; *** Dict hook *** ; This dummy dictionary entry serves two purposes: ; 1. Allow binary grafting. Because each binary dict always end with a dummy