From 2481ed4b66171d11523f9ca24a0a48bd770926c6 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Thu, 2 Apr 2020 11:29:23 -0400 Subject: [PATCH] forth: remove dummy.fs All "stop pings" are now explicitly made at appropriate places. This fixes a problem I've introduced in the last commit where RAM+ was unexpectedly part of a stable ABI because of "HERE" usage in dummy.fs. This system will, anyways, soon change because boot.bin and z80c.bin will be built during the same process (but there's a bit of retooling to do before I get there). --- emul/Makefile | 6 +++--- emul/forth/stop.fs | 2 ++ forth/dummy.fs | 13 ------------- forth/icore.fs | 5 +++++ forth/z80c.fs | 4 ++++ 5 files changed, 14 insertions(+), 16 deletions(-) create mode 100644 emul/forth/stop.fs delete mode 100644 forth/dummy.fs diff --git a/emul/Makefile b/emul/Makefile index cde198c..e055c93 100644 --- a/emul/Makefile +++ b/emul/Makefile @@ -7,7 +7,7 @@ AVRABIN = zasm/avra SHELLAPPS = zasm ed SHELLTGTS = ${SHELLAPPS:%=cfsin/%} # Those Forth source files are in a particular order -FORTHSRCS = core.fs str.fs parse.fs readln.fs fmt.fs z80a.fs dummy.fs +FORTHSRCS = core.fs str.fs parse.fs readln.fs fmt.fs z80a.fs FORTHSRC_PATHS = ${FORTHSRCS:%=../forth/%} CFSIN_CONTENTS = $(SHELLTGTS) cfsin/user.h OBJS = emul.o libz80/libz80.o @@ -42,7 +42,7 @@ forth/stage1dbg: forth/stage.c $(OBJS) forth/forth0-bin.h $(CC) -DDEBUG -DBOOT forth/stage.c $(OBJS) -o $@ forth/core.bin: $(FORTHSRC_PATHS) forth/stage1 - cat $(FORTHSRC_PATHS) | ./forth/stage1 | tee $@ > /dev/null + cat $(FORTHSRC_PATHS) ./forth/stop.fs | ./forth/stage1 | tee $@ > /dev/null forth/forth1.bin: forth/forth0.bin forth/core.bin cat forth/forth0.bin forth/core.bin > $@ @@ -104,7 +104,7 @@ updatebootstrap: $(ZASMBIN) .PHONY: fbootstrap fbootstrap: forth/stage2 cat ./forth/conf.fs ../forth/boot.fs | ./forth/stage2 > forth/boot.bin - cat ../forth/dummy.fs ../forth/z80c.fs forth/emul.fs ../forth/icore.fs ../forth/dummy.fs | ./forth/stage2 | tee forth/z80c.bin > /dev/null + cat ../forth/z80c.fs forth/emul.fs ../forth/icore.fs | ./forth/stage2 | tee forth/z80c.bin > /dev/null .PHONY: clean clean: diff --git a/emul/forth/stop.fs b/emul/forth/stop.fs new file mode 100644 index 0000000..c2777da --- /dev/null +++ b/emul/forth/stop.fs @@ -0,0 +1,2 @@ +(entry) _ +H@ 256 /MOD 2 PC! 2 PC! diff --git a/forth/dummy.fs b/forth/dummy.fs deleted file mode 100644 index bb4bae0..0000000 --- a/forth/dummy.fs +++ /dev/null @@ -1,13 +0,0 @@ -( When building a compiled dict, always include this unit at - the end of it so that Forth knows how to hook LATEST into - it. We don't use the word "(entry)" to avoid messing up - with icore setup. ) -CREATE _ -H@ 2 - HERE ! - -( After each dummy word like this, we poke IO port 2 with our - current HERE value. The staging executable needs it to know - what to dump. ) - -H@ 256 / 2 PC! -H@ 2 PC! diff --git a/forth/icore.fs b/forth/icore.fs index d0582a9..088202b 100644 --- a/forth/icore.fs +++ b/forth/icore.fs @@ -252,3 +252,8 @@ ':' ' X 4 - C! ';' ' Y 4 - C! +( Add dummy entry. we use CREATE because (entry) is, at this + point, broken. Adjust H@ durint port 2 ping. ) +CREATE _ +H@ 2 - 256 /MOD 2 PC! 2 PC! + diff --git a/forth/z80c.fs b/forth/z80c.fs index 36f752a..ee00d88 100644 --- a/forth/z80c.fs +++ b/forth/z80c.fs @@ -20,6 +20,10 @@ expected to be defined in platform-specific code. ) +( dummy entry for dict hook ) +(entry) _ +H@ 256 /MOD 2 PC! 2 PC! + ( a b c -- b c a ) CODE ROT HL POPqq, ( C )