From 7aa1be070b7c4b45a47ac77324bdd18ba44aaf81 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Fri, 10 Apr 2020 09:55:58 -0400 Subject: [PATCH] emul: build boot binary in one pass ... instead of building boot.fs, and then z80c.fs/icore.fs in separate passes. This strengten xcomp by making it support 2 completely separate dicts (that is, the X dict is *not* connected to the system dict. The chain now stops at EXIT def in boot.fs). --- emul/Makefile | 15 ++++++++------- emul/forth/boot.bin | Bin 451 -> 0 bytes emul/forth/xcomp.fs | 4 +--- emul/forth/z80c.bin | Bin 1731 -> 2182 bytes forth/boot.fs | 3 +-- forth/xcomp.fs | 17 ++++++++++++++--- 6 files changed, 24 insertions(+), 15 deletions(-) delete mode 100644 emul/forth/boot.bin diff --git a/emul/Makefile b/emul/Makefile index 204c747..eda22c2 100644 --- a/emul/Makefile +++ b/emul/Makefile @@ -15,10 +15,10 @@ $(SLATEST): $(BIN2C): $(MAKE) -C ../tools -# z80c.bin and boot.bin are not in the prerequisites because they're bootstrap -# binaries that should be updated manually through make updatebootstrap. +# z80c.bin is not in the prerequisites because it's a bootstrap +# binary that should be updated manually through make updatebootstrap. forth/forth0.bin: $(SLATEST) - cat forth/boot.bin forth/z80c.bin > $@ + cp forth/z80c.bin $@ $(SLATEST) $@ cat forth/emul.fs >> $@ @@ -37,7 +37,7 @@ forth/core.bin: $(FORTHSRC_PATHS) forth/stage1 cat $(FORTHSRC_PATHS) ./forth/stop.fs | $(STRIPFC) | ./forth/stage1 | tee $@ > /dev/null forth/forth1.bin: forth/core.bin $(SLATEST) - cat forth/boot.bin forth/z80c.bin forth/core.bin > $@ + cat forth/z80c.bin forth/core.bin > $@ $(SLATEST) $@ forth/forth1-bin.h: forth/forth1.bin $(BIN2C) @@ -60,10 +60,11 @@ emul.o: emul.c $(CC) -c -o emul.o emul.c +forth/z80c.bin: forth/stage2 + cat ./forth/conf.fs ../forth/xcomp.fs ./forth/xcomp.fs ../forth/boot.fs ../forth/z80c.fs ../forth/icore.fs | ./forth/stage2 | tee $@ > /dev/null + .PHONY: updatebootstrap -updatebootstrap: forth/stage2 - cat ./forth/conf.fs ../forth/boot.fs | ./forth/stage2 | tee forth/boot.bin > /dev/null - cat ./forth/conf.fs ../forth/xcomp.fs ./forth/xcomp.fs ../forth/z80c.fs ../forth/icore.fs | ./forth/stage2 | tee forth/z80c.bin > /dev/null +updatebootstrap: forth/z80c.bin .PHONY: clean clean: diff --git a/emul/forth/boot.bin b/emul/forth/boot.bin deleted file mode 100644 index bb5b52c4063aacdf03c1f7485c6cb5cae940d1e6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 451 zcmX|-KS;ws6vp2*T7`oDsV4Jc*w~~IdBx=&`Tq}8}9gi?{V+@@EPDcs24s&*haV&VHJrF!1D+X zp%ZkD0*a#uAITSMoxgF$OJ@dYbxvaGi>2+L&glH>pV5*CR2ysitXOO>RZ@E)0dw z)=289GE8nAIexFa#A1%G%Toq_8#%rWehK-eZ#qV~w6QY)>3+nQBJA%|ngwRcy5gJU zA^GN0(hi?jeD)#vEFHMhvNy_#>+v|Bt0xgGDm}aHASkIj4_#8J3o64CRM-(wQm7!f c&{i^m9+8)B$1EH%Z;zt!13tB}G6pD6HZm1Sfgl;ZQj*c!m zRuK^wL4sh10|kpN2L_2mO2AQspzm6fA>sZ0kG%gswCNyNpr=6Zp}Ob+p*Eo{gocUw z1iC=z5IH7i#G_Or^bl`!R@B6JCYNT?0Cgd7Iv}PA8uo~p$qlr5#keL`j76)bM$A#H zcS3y#n9~RQSLPdX!zk2faw$2nkWThOLkN^7P&TM6QHC-;$5W{^Bz}J776>;AU-3qW z`9!QvRH7%~_@PXX;GW}XMR~C+Cr8Y|l*P+>_@i(W3F!KmZiR0nzSi$2W_EF1*UJ?g zi|t*SemPeuu*h?9nBA4I|H1zn2$Wm{cOKkrQgUr@v&6Mrt7PW0n>zy#?I&{CC;ngM zaS#@+Ynfw@-R~}ELHN3sbC2CGXu+95ttK)X?d@{DnuRwhx^{w~I5P~iuBNI!IReEo pKgE^pQ&~S(j5hx#=;_MHu#*?3Q}Ut~S@joIGwb$Rg4CZ=?GMP|vF88) delta 9 QcmZn@Jj}cKFymo1022fQr~m)} diff --git a/forth/boot.fs b/forth/boot.fs index 795a8cf..86f97e1 100644 --- a/forth/boot.fs +++ b/forth/boot.fs @@ -381,5 +381,4 @@ NOP, NOP, NOP, NOP, NOP, '_' A, 'b' A, 'e' A, 'n' A, 'd' A, PC L2 @ - A,, ( prev ) 5 A, - -H@ 256 /MOD 2 PC! 2 PC! +H@ XCURRENT ! ( set current tip of dict ) diff --git a/forth/xcomp.fs b/forth/xcomp.fs index 236b331..7b498b1 100644 --- a/forth/xcomp.fs +++ b/forth/xcomp.fs @@ -95,9 +95,20 @@ VARIABLE XOFF , THEN ELSE ( w a ) - ( maybe number ) - DROP ( w ) - (parse*) @ EXECUTE LITN + ( not found? it might be an immediate that isn't yet defined in our + cross-compiled dict. It's alright, we can find-and-execute it. ) + DROP ( w ) + ( system CURRENT ) + 0x02 RAM+ @ SWAP ( cur w ) + _find ( a f ) + IF + ( found. It *must* be an IMMED ) + DUP IMMED? NOT IF ABORT THEN + EXECUTE + ELSE + ( not found. maybe number ) + (parse*) @ EXECUTE LITN + THEN THEN AGAIN ;