Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
df227c7
Add .gitignore, rationalize make clean, remove a gforth warning in to…
nick-lifx Apr 22, 2022
56c4dcf
Remove .$(UNIXFLAVOUR) extension and file copies in favour of ifeq (G…
nick-lifx Apr 22, 2022
a2e4911
Remove redundant stuff in the preForth-generated asm code
nick-lifx Apr 22, 2022
cb3ba98
Use tabs in preForth-i386-rts.pre and seedForth-i386.pre, improve con…
nick-lifx Apr 22, 2022
fa4f0c2
Rationalize how cr is emitted in generated preForth code, make DB/DD …
nick-lifx Apr 22, 2022
927ca5a
Rationalize the sections in assembly output, make code be compiled in…
nick-lifx Apr 22, 2022
77b48fe
Split seedForth-i386.pre into machine dependent/less machine dependen…
nick-lifx Apr 22, 2022
f843d08
Split seedforth-i386.pre further into header and body portions
nick-lifx Apr 22, 2022
cdd8686
Remove duplicated code in seedForth-i386.pre, take from preForth-i386…
nick-lifx Apr 22, 2022
c962f42
Implement built-in "cat" functionality in preForth/seedForth for read…
nick-lifx Apr 23, 2022
ebf5bfa
Make key? use fdin instead of always STDIN_FILENO, and use poll() not…
nick-lifx Apr 23, 2022
d48d34a
Rationalize seedForth-tokenize.fs so that seedsource no longer has to…
nick-lifx Apr 23, 2022
375ab0f
Move most code from seedForthInteractive.seedsource into seedForthRun…
nick-lifx Apr 23, 2022
8da6c87
Rationalize how echo is handled during the seedForthInteractive loadi…
nick-lifx Apr 23, 2022
62bcae1
Split out control flow words and a few others from hi.forth into runt…
nick-lifx Apr 23, 2022
78426fc
Make ./seedForth-tokenizer self hosting (works, but hangs after token…
nick-lifx Apr 23, 2022
cbfdac8
Remap tokens so that EOT is no longer a seedForth token, detect EOT e…
nick-lifx Apr 24, 2022
caac682
Implement eot token similar to the old bye token (so we can compile b…
nick-lifx Apr 24, 2022
75138c3
Implement a new preForth/seedForth token eemit which is like emit but…
nick-lifx Apr 24, 2022
7115f49
Implement DO/?DO/LOOP, as experimental ?DO didn't have a correct comp…
nick-lifx Apr 24, 2022
03f5872
Add CRC10/ATM (bit reversed) table generator and evaluator
nick-lifx Apr 24, 2022
913f5dd
Modify tokenizer to use a 1024-entry symbol table with closed hashing…
nick-lifx Apr 24, 2022
4e4fa66
Move nonstandard words from preForth-rts.pre into preForth-rts-nonsta…
nick-lifx Apr 25, 2022
4add97d
Simplify bootstrapping by not creating a new wordlist and only defini…
nick-lifx Apr 25, 2022
12b1f58
Remove load-i386-preForth.fs, instead list the compiler sources on co…
nick-lifx Apr 25, 2022
afd9082
Separate /preForth directory into /common and /i386, add appropriate …
nick-lifx Apr 27, 2022
ee347d8
Add emu_z80 directory based on submodules https://github.com/nickd4/a…
nick-lifx Apr 27, 2022
3036d37
In emu_z80, add "cat" functionality for stdin, and non-blocking I/O f…
nick-lifx Apr 27, 2022
4df5731
Move 16/32 bit and ITC/DTC dependencies into extra sources in /i386 d…
nick-lifx Apr 27, 2022
65e486a
Rename seedForth-i386.pre to seedForth-i386-rts.pre, implement a new …
nick-lifx Apr 27, 2022
6134fa6
Copy /i386 to /z80 and rename files as appropriate
nick-lifx Apr 27, 2022
af0ef29
Insert z80-specific code in /z80, and change to 16-bit and from ITC t…
nick-lifx Apr 27, 2022
7ef4d88
Hack in /emu_z80 to make everything inline and multiple instructions …
nick-lifx Apr 27, 2022
baae866
Fix typo in /emu_z80/Makefile
nick-lifx Apr 27, 2022
1858907
Add accidentally .gitignored /emu_z80/test.asm
nick-lifx Apr 27, 2022
18b4cf3
Improve appearance of z80 generated code slightly
nick-lifx Apr 27, 2022
c3f211f
Fix asxxxx < > syntax in /z80/test.asm
nick-lifx Apr 27, 2022
83a8c33
Add preForthDemo build using host Forth (for debugging a new preForth…
nick-lifx Apr 28, 2022
ced4375
Fix some missing tests in seedForthDemo after separating machine depe…
nick-lifx Apr 28, 2022
9e622d7
In /z80 fix 32/16 bit divide bug and optimize multiply/divide, genera…
nick-lifx Apr 28, 2022
20f084d
Add copyright notice (required for the GPLv3 license to be effective)
nick-lifx Apr 28, 2022
a1821f9
Add /emu_65c02 directory, based on /emu_z80 with backend taken from h…
nick-lifx Apr 27, 2022
28d441f
Add /65c02 directory with working preForth and seedForth, add a sophi…
nick-lifx Apr 28, 2022
a0c8eb9
Hack in /emu_65c02 to make multiple instructions executed, and fix wa…
nick-lifx Apr 29, 2022
3627c1c
Change __hp to use .ds rather than .dw, removes padding from seedFort…
nick-lifx Apr 29, 2022
bbb04e4
Fix oops
nick-lifx Apr 29, 2022
f124591
Move h@ to directly after token everywhere, change compile, to ,
nick-lifx Apr 29, 2022
c459f85
In tokenizer, improve consistency between :-definitions and Definer-d…
nick-lifx Apr 30, 2022
298f5c8
Move the creation of heads out of "new" and "create" so it becomes th…
nick-lifx Apr 30, 2022
ba8d5de
Implement the Create macro in tokenizer, for a more Forth-like define…
nick-lifx Apr 30, 2022
30e3ba8
Fix a bug where hash table entry could be reused between Macro and en…
nick-lifx May 1, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
*.bin
*.hlr
*.ihx
*.lst
*.map
*.o
*.rel
*.rst
*.seed
/65c02/preForth.asm
/65c02/preForthDemo.asm
/65c02/seedForth.asm
/65c02/__temp__.fs
/common/crc10.forth
/emu_65c02/emu_65c02
/emu_z80/emu_z80
/i386/preForth
/i386/preForth.asm
/i386/preForthDemo
/i386/preForthDemo.asm
/i386/seedForth
/i386/seedForth.asm
/i386/__temp__.fs
/z80/preForth.asm
/z80/preForthDemo.asm
/z80/seedForth.asm
/z80/__temp__.fs
9 changes: 9 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[submodule "emu_z80/z80"]
path = emu_z80/z80
url = https://github.com/nickd4/z80.git
[submodule "asxv5pxx"]
path = asxv5pxx
url = https://github.com/nickd4/asxv5pxx.git
[submodule "emu_65c02/vrEmu6502"]
path = emu_65c02/vrEmu6502
url = https://github.com/nickd4/vrEmu6502.git
203 changes: 203 additions & 0 deletions 65c02/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
# Makefile for preForth and seedForth
#
# make bootstrap should produce two identical files: preForth1.$(ASM) and preForth.$(ASM)

# Set HOSTFORTH to the Forth system that generates the initial preForth
# ------------------------------------------------------------------------
HOSTFORTH=gforth
# HOSTFORTH=sf # SwiftForth >3.7
# ------------------------------------------------------------------------

AS6500=../asxv5pxx/asxmak/linux/exe/as6500
ASLINK=../asxv5pxx/asxmak/linux/exe/aslink

# need to install intelhex package in Python first:
# pip3 install --user intelhex
HEX2BIN=python3 $(HOME)/.local/bin/hex2bin.py

LOAD_ADDR=0x300

EMU_65C02=../emu_65c02/emu_65c02

.PHONY: all
all: \
preForthDemo.bin \
preForth.bin \
seedForth.bin \
seedForthDemo.seed \
seedForthBoot.seed \
seedForthInteractive.seed

.PHONY: test
test: runseedforthdemo runseedforthinteractive

.PHONY: runseedforthdemo
runseedforthdemo: seedForth seedForthDemo.seed
./seedForth seedForthDemo.seed

.PHONY: runseedfortinteractive
runseedforthinteractive: seedForth seedForthInteractive.seed
./seed

UNIXFLAVOUR=$(shell uname -s)
ASM=asm

# build preForthDemo via the host Forth first, so that it
# can be used for basic debugging of the preForth runtime
preForthDemo.$(ASM): \
../common/preForth-bootstrap.fs \
../common/preForth-cold.fs \
preForth-65c02-rts.pre \
../common/preForth-rts-nonstandard.pre \
../common/preForth-rts.pre \
preForth-65c02-backend.pre \
../common/preForth.pre \
../common/preForthDemo.pre
cat \
preForth-65c02-rts.pre \
../common/preForth-rts-nonstandard.pre \
../common/preForth-rts.pre \
../common/preForthDemo.pre \
|$(HOSTFORTH) \
../common/preForth-bootstrap.fs \
../common/preForth-rts-nonstandard.pre \
preForth-65c02-backend.pre \
../common/preForth.pre \
../common/preForth-cold.fs \
>$@

preForth.$(ASM): \
../common/preForth-bootstrap.fs \
../common/preForth-cold.fs \
preForth-65c02-rts.pre \
../common/preForth-rts-nonstandard.pre \
../common/preForth-rts.pre \
preForth-65c02-backend.pre \
../common/preForth.pre
cat \
preForth-65c02-rts.pre \
../common/preForth-rts-nonstandard.pre \
../common/preForth-rts.pre \
preForth-65c02-backend.pre \
../common/preForth.pre \
|$(HOSTFORTH) \
../common/preForth-bootstrap.fs \
../common/preForth-rts-nonstandard.pre \
preForth-65c02-backend.pre \
../common/preForth.pre \
../common/preForth-cold.fs \
>$@

%.$(ASM): \
%.pre \
preForth-65c02-rts.pre \
../common/preForth-rts-nonstandard.pre \
../common/preForth-rts.pre \
preForth.bin
$(EMU_65C02) preForth.bin \
preForth-65c02-rts.pre \
../common/preForth-rts-nonstandard.pre \
../common/preForth-rts.pre \
$< \
>$@

%.bin: %.$(ASM)
$(AS6500) -l -o $<
$(ASLINK) -n -m -u -i -b zpage=0 -b text=$(LOAD_ADDR) $(<:.$(ASM)=.ihx) $(<:.$(ASM)=.rel)
$(HEX2BIN) $(<:.$(ASM)=.ihx) $@

# run preForth on its own source code to perform a bootstrap
# should produce identical results
bootstrap: \
preForth-65c02-rts.pre \
../common/preForth-rts-nonstandard.pre \
../common/preForth-rts.pre \
preForth-65c02-backend.pre \
../common/preForth.pre \
preForth.bin \
preForth.$(ASM)
$(EMU_65C02) preForth.bin \
preForth-65c02-rts.pre \
../common/preForth-rts-nonstandard.pre \
../common/preForth-rts.pre \
preForth-65c02-backend.pre \
../common/preForth.pre \
>preForth1.$(ASM)
cmp preForth.$(ASM) preForth1.$(ASM)

# preForth connected to stdin - output to stdout
.PHONY: visible-bootstrap
visible-bootstrap: preForth.bin preForth-65c02-backend.pre ../common/preForth.pre
$(EMU_65C02) preForth.bin preForth-65c02-backend.pre ../common/preForth.pre

# ------------------------------------------------------------------------
# Docker support (for Linux version)
# ------------------------------------------------------------------------
# create a linux image based on Dockerfile
.PHONY: docker-image
docker-image: Dockerfile
docker build -t preforth .

# run the docker image
.PHONY: run
rundocker: docker-image
docker run -i -t --rm preforth /preForth/seed
# ------------------------------------------------------------------------

# ------------------------------------------------------------------------
# seedForth
# ------------------------------------------------------------------------
seedForth.$(ASM): \
seedForth-65c02-header.pre \
preForth-65c02-rts.pre \
seedForth-65c02-rts.pre \
seedForth-65c02.pre \
../common/seedForth16bit.pre \
../common/seedForth.pre \
preForth.bin
$(EMU_65C02) preForth.bin \
seedForth-65c02-header.pre \
preForth-65c02-rts.pre \
seedForth-65c02-rts.pre \
seedForth-65c02.pre \
../common/seedForth16bit.pre \
../common/seedForth.pre \
>seedForth.$(ASM)

# a little ugly, because gforth insists upon echoing anything read from
# stdin, and also does not allow parsing words to cross a file boundary,
# so we will concatenate the tokenizer and source into a *.fs file first
seedForthDemo.seed: \
../common/crc10.forth \
../common/../common/seedForth-tokenizer.fs \
../common/seedForthDemo.seedsource \
seedForthDemo65c02.seedsource
cat $^ >__temp__.fs
$(HOSTFORTH) __temp__.fs -e bye >$@
rm __temp__.fs

seedForthBoot.seed: \
../common/crc10.forth \
../common/../common/seedForth-tokenizer.fs \
../common/seedForthRuntime16bit.seedsource \
../common/seedForthRuntime.seedsource \
seedForthRuntime65c02.seedsource \
../common/seedForthBoot.seedsource
cat $^ >__temp__.fs
$(HOSTFORTH) __temp__.fs -e bye >$@
rm __temp__.fs

seedForthInteractive.seed: \
../common/crc10.forth \
../common/../common/seedForth-tokenizer.fs \
../common/seedForthRuntime16bit.seedsource \
../common/seedForthRuntime.seedsource \
seedForthRuntime65c02.seedsource \
../common/seedForthInteractive.seedsource
cat $^ >__temp__.fs
$(HOSTFORTH) __temp__.fs -e bye >$@
rm __temp__.fs

.PHONY: clean
clean:
rm -f *.$(ASM) *.o *.seed preForthDemo preForth seedForth __temp__.fs
Loading