Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Z80 port (cleaned up version) #12

Open
wants to merge 41 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 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
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
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
*.bin
*.hlr
*.ihx
*.lst
*.map
*.o
*.rel
*.rst
*.seed
/common/crc10.forth
/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
6 changes: 6 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[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
16 changes: 16 additions & 0 deletions COPYRIGHT
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
preForth, seedForth, seedForthInteractive
Copyright 2018-2020 Ulrich Hoffman <[email protected]>
Copyright 2022 Nick Downing <[email protected]>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
30 changes: 30 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
.PHONY: all
all: asxv5pxx common emu_z80 i386 z80

.PHONY: asxv5pxx
asxv5pxx:
$(MAKE) $(MAKEFLAGS) -C asxv5pxx/asxmak/linux/build asz80 aslink

.PHONY: common
common:
$(MAKE) $(MAKEFLAGS) -C common

.PHONY: emu_z80
emu_z80: asxv5pxx
$(MAKE) $(MAKEFLAGS) -C emu_z80

.PHONY: i386
i386: common
$(MAKE) $(MAKEFLAGS) -C i386

.PHONY: z80
z80: emu_z80 common
$(MAKE) $(MAKEFLAGS) -C z80

clean:
$(MAKE) $(MAKEFLAGS) -C asxv5pxx/asxmak/linux/build clean
# avoid git complaining of changes in subrepo:
touch asxv5pxx/asxmak/linux/exe/_exe
$(MAKE) $(MAKEFLAGS) -C common clean
$(MAKE) $(MAKEFLAGS) -C emu_z80 clean
$(MAKE) $(MAKEFLAGS) -C i386 clean
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,6 @@ Inspect sources and generated files.

*Have fun. May the Forth be with you.*

# Copyright and license

Please see the files `COPYRIGHT` and `LICENSE` in the root of this repository.
1 change: 1 addition & 0 deletions asxv5pxx
Submodule asxv5pxx added at 6d5d12
File renamed without changes.
File renamed without changes.
15 changes: 15 additions & 0 deletions common/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Set HOSTFORTH to the Forth system that generates the initial preForth
# ------------------------------------------------------------------------
HOSTFORTH=gforth
# HOSTFORTH=sf # SwiftForth >3.7
# ------------------------------------------------------------------------

.PHONY: all
all: crc10.forth

crc10.forth: crc10_gen.forth
$(HOSTFORTH) $^ -e bye >$@

.PHONY: clean
clean:
rm -f crc10.forth
50 changes: 50 additions & 0 deletions common/crc10_gen.forth
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
\ run this as follows:
\ ./seedForth seedForthBoot.seed runtime.forth crc10_gen.forth >crc10.forth

817 Constant poly \ CRC-10/ATM, truncated polynomial 0x233, bit reversed 0x331

\ we don't want MS-DOS style line endings in the generated CRC table file
: lf 10 emit ;

: gen
." Create crc10_tab" lf
256 0 ?DO
I 8 0 ?DO
\ split into LSB and the remaining bits
\ in seedForth: 2 u/mod swap
\ in gForth: 2 /mod swap
dup 1 rshift swap 1 and

IF poly xor THEN
LOOP
. ',' emit
I 7 and 7 = IF lf ELSE space THEN
LOOP
lf
." : crc10 ( addr len crc -- crc )" lf
." swap 0 ?DO ( addr crc )" lf
." \ retrieve next character" lf
." over I + c@" lf
lf
." \ xor into low bits of crc" lf
." xor" lf
lf
." \ separate into table index and remaining bits" lf
." \ 256 u/mod swap" lf
." dup 8 rshift swap 255 and" lf
lf
." \ look up new bits from table" lf
." cells crc10_tab + @" lf
lf
." \ combine with remaining (shifted right) bits" lf
." xor" lf
." LOOP" lf
." nip" lf
." ;" lf
lf
." \ testing:" lf
." \ Create hello 104 c, 101 c, 108 c, 108 c, 111 c," lf
." \ hello 5 1023 crc10 . ;" lf
;

gen
Loading