Open
Conversation
…to bss rather than text section which avoids the need to call mprotect(), rename things
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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 agforthwarning 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 GNUmakeextension. I am not sure if you were supporting BSDmakein the Darwin version. GNUmakeis well supported on Darwin, so I believe this change is worthwhile, as it makes the build process somewhat simpler._Oandlastwhich were never referenced, obviously they were used in a previous version.preForth-i386-rts.preandseedForth-i386.pre, improve consistency between these files. For instance, the0<was returning1for true in preForth but-1for true in seedForth. The changes were pretty minor though.cris emitted in generated preForth code, makeDB/DDlowercase. I madecrbe 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_dropXare defined that mark the start of the data field.bssrather thantextsection 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_memtopis also not needed. (fasmallows to define a label by itself, unlikemasmwhich requires a data label to be followed by a sizing directive likedb).seedForth-i386.preinto machine dependent/less machine dependent portions. This mirrors the structure of preForth to some extent.seedForth-i386.prefurther 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 theheadandmemsizes 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
dodoesand so on.