Forth2Asm: A Companion to RetroForth
=========================================================================
Forth2Asm is intended for two primary tasks:

  1) Securing your source code
  2) Reducing bloat in RetroForth Applications

By converting your source code into assembly, you can easily compile
the results into a RetroForth kernel without worry about others seeing
your source code.

To reduce the bloat, Forth2Asm also eliminates the need for the
interpreter / compiler that is normally included with RetroForth.

There is another benifit in that the assembled code is faster than
running from withing RetroForth, though that doesn't matter much on
today's computers.
=========================================================================
Forth2Asm is not ready for general use! Please use with caution and
expect problems to abound!

Don't use strings, they break the code really badly. Also, prefix every interpreted statement by a single space to make sure they are 'call'ed or 'upsh'ed as neccessary.

If you make any improvements, please send them in!

Requires: sed, RetroForth 6, bash is helpful
=========================================================================
.log
6/26/2003
I started the project yesterday, coding a minimal skeleton. Today I'm
extending it and working to make it generate working programs.

Right now this will generate valid assembly, compile it, and link it.
There are problems: it can't run the outputted code. It always
segfaults, so I need to work out why, then fix it. I copied a few
primitives from Retro6-linux over. Even without them it segfaults. I'll
have to keep working to find out why.

>> The segfaults occur when values are PUSH'd to the stack. I'd like to
>> use the hardware stack (via the PUSH/POP instructions) if possible.
>> I'll have to look into why this occurs.

I'm now adding the ability to have comments (not on the same line as
code!)

>> Finished. This makes it easier to document the Forth code.

The primitives aren't quite working yet either... I'll have to fix the
stack bugs before I can correct them.


7/5/2003
Moved the entire SED part of the code into a separate file
Now store temporary files in /tmp, remove them when done
Decimal numbers no longer require prefixing
Reverted to RF6-style primitives (using macros, etc)
Will be adding call tables and easily changable register usage soon


7/12/2003
Fixed bug in prefixing code, extended documentation.


8/12/2003
Expanded the README with a short introduction. Included Forth2Asm in
RetroForth releases starting with 6.11
Comment filtering dropped for now.

8/13/2003
Replaced 'forthc' with a simple wrapper to the SED script that actually does the conversion. As long as you only use supported features, you can put the resulting code in user.asm to build an application.

Comment filtering works again.
