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 bb5b52c..0000000 Binary files a/emul/forth/boot.bin and /dev/null differ diff --git a/emul/forth/xcomp.fs b/emul/forth/xcomp.fs index 84a250c..cb94468 100644 --- a/emul/forth/xcomp.fs +++ b/emul/forth/xcomp.fs @@ -14,7 +14,5 @@ CURRENT @ XCURRENT ! -( dummy entry for dict hook ) -(xentry) _ H@ 256 /MOD 2 PC! 2 PC! -H@ ' _bend - XOFF ! +H@ XOFF ! diff --git a/emul/forth/z80c.bin b/emul/forth/z80c.bin index 8ffdb2e..6746926 100644 Binary files a/emul/forth/z80c.bin and b/emul/forth/z80c.bin differ 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 ;