Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
hi, I've been hacking on this as instructed :)
It's mainly code cleanup, I did this because I created a Z80 port and in the process of writing the Z80 code I noticed various things that I wanted to change. You can see the Z80 port at https://github.com/nickd4/preForth/tree/z80_port and it works well but it also needs code cleanup which I will do soon. Eventually I'd like the master branch to build all ports under distinct filenames, and possibly build some other support files like the assembler and emulator (which are needed for bootstrapping).
So for the time being I'm simply submitting improvements to the i386 port. They are well summarized by the commit messages, which I have listed in the below list along with some further explanatory text about each change and why I wanted to make it.
.gitignore
, rationalizemake clean
, remove agforth
warning in tokenizer. To avoid the warning, in the tokenizer I renamednumber?
toprocess-number?
following the convention ofprocess-digit?
which is used byprocess-number?
..$(UNIXFLAVOUR)
extension and file copies in favour ofifeq
. Unfortunately this is a GNUmake
extension. I am not sure if you were supporting BSDmake
in the Darwin version. GNUmake
is well supported on Darwin, so I believe this change is worthwhile, as it makes the build process somewhat simpler._O
andlast
which were never referenced, obviously they were used in a previous version.preForth-i386-rts.pre
andseedForth-i386.pre
, improve consistency between these files. For instance, the0<
was returning1
for true in preForth but-1
for true in seedForth. The changes were pretty minor though.cr
is emitted in generated preForth code, makeDB
/DD
lowercase. I madecr
be emitted at the end of each line rather than the start. This allowed me to improve the appearance of the generated code a bit, e.g. where the symbols like_dropX
are defined that mark the start of the data field.bss
rather thantext
section which avoids the need to callmprotect()
, rename things. I also removed unnecessary padding, for instance there was 16 bytes of padding after each stack which does not appear to be needed, and the dummy word after_memtop
is also not needed. (fasm
allows to define a label by itself, unlikemasm
which requires a data label to be followed by a sizing directive likedb
).seedForth-i386.pre
into machine dependent/less machine dependent portions. This mirrors the structure of preForth to some extent.seedForth-i386.pre
further into header and body portions. This is basically so that when the common code is eliminated between seedForth and preForth (the interpreter and primitive asm words), seedForth can still have its own header comment, and can define thehead
andmem
sizes at the top of the file.seedForth-i386.pre
, take frompreForth-i386-rts.pre
. This saves a fair bit of code and avoids risk of them desynchronizing again.Thanks for creating preForth/seedForth, they are really brilliant. A while ago I was trying to port hForth (an MS-DOS Forth) or one of its relatives to Z80, but I became discouraged because of the large amount of hand-compiling of high-level Forth words I would need to do for initial bootstrap, plus the issue of retargeting the 8086 Forth assembler to Z80. Your ideas neatly solve both problems and meant I could get the Z80 Forth up and running within a day or two -- including the time taken to convert things from indirect threaded to direct threaded (good for Z80 but less good for i386) and experiment with
dodoes
and so on.