Another metacompiling question

  • Follow


With the links and help provided by all earlier, my metacompiler is coming 
along quite well. I can now code excellent Forth code for the ARM. Thank 
you again. I now have 2 last "hic-ups" that I hope past experience of 
others can help with.

Originally, the compiled code was written to memory, and then (when ready) 
written out to a file. This works well, but it leaves me with a downside 
which will be explained below.

The second problem I'm having is writing very specific code to the 
beginning of the ROM. The first 200 bytes (or so) of the ROM must be very 
specific for the image to even boot. I also want to add some code after the 
header that will be hidden from the end-user.

Right now, I have my binary being created at the end of the dictionary. I 
create new definitions for C, , ALLOT etc. and at the very end of my 
interpreter have a line much like:

HERE TO ROM-BEGINNING

When I'm ready to write the binary, I can just:

ROM-BEGINNING HERE OVER - FILEID WRITE-FILE

Simple, works, and allows for me to (while my source is compiling) include 
my "bootloader" code into the dictionary and have it written to the file 
without the end-user seeing it. The downside to this, is that since my 
implementation is ITC, I use DOES> quite often. Example:

: NEW-TOKEN ( <name> -- )
    HERE ROM-BEGINNING - CONSTANT DOES> @ , ;

: CREATE ( <name> -- ) NEW-TOKEN ;

So now, each time in my meta-compiler I use CREATE to define a word in the 
final binary, the CONSTANT will be added to the dictionary. I would hope 
that this isn't a side-effect of meta-compiling, and there is a way around 
this that I just haven't seen yet.

Of course, going back to using RAM to hold the compiled binary relieves 
this problem, but adds another: I can no longer include my bootloading code 
at compile-time (to hide it from the end user).

Any suggestions appreciated.

--
Best regards,
 Jeff Massung       jma[at]mfire.com

TIN/Dragon BASIC: http://www.simforth.com
leaf editor: http://www.simforth.com/leaf
0
Reply Jeff 10/14/2003 4:38:25 AM


0 Replies
34 Views

(page loaded in 0.021 seconds)

11/28/2012 2:17:16 AM


Reply: