Here it is ! My Forth implementation is rather close to the end (as well as the instruction set for the CPU).
It is based on Bradford J Rodriguez's CamelForth for the Z80, so I called it PandaForth (don't ask why).
You can test it with this Java Applet.
Yes, it is written in Java, but don't be confused. It is not a Forth-in-Java implementation. Here, Java is used as an emulator for the processor, and as a macro assembler, so it is in fact a Forth written in assembly.
Fell free to test the applet, and drop me an message if you find some bugs :)
Like CamelForth, it is a 16-bits Direct-Threaded-Code implementation. All CPU opcodes are 8-bits, and the instruction set is the one of a "pure" stack-based processor.
Here are the main differences with CamelForth :
- Low-level routines have (of course) been rewritten.
- Parameter and Return stacks are internal, so Forth words dealing with them have been rewritten.
- All double-precision and division/modulo words have not been ported. Only two operations are implemented : * (signed 16b/16b multiplication) and U/MOD (unsigned 16b/16b division and modulo).
- Words dealing with numeric input/output using double precision have been rewritten to use single-precision instead.
The main reason why I didn't code all the arithmetic stuff is that this Forth implementation is temporary. As I will probably use the two banks of 16-bits RAM, I think the Forth implementation will become a 32-bit Subroutine-Threaded-Code one.
But this will be done later. I think I have spent enough time on Forth for the moment, and I'd like to make a break, by getting back "close to the metal" and start designing the CPU.