I spend a fair amount of time tonight looking around at other VM's. The main blocking point(s) I've run into (more than once) with this stack based VM is how it talks to the outside world, to compile or interpret, to implement a Forth on the VM capable of interpreting for itself, C access, and native vs codewords. The only thing I really coded was to rename a define.
Missed a day :(
Did some cleanups and additions to a stack based VM I wrote a while back in C. One cleanup was to pull the frequent underflow checks into a C macro. I added some VM stack ops dealing with stack manipulation that corelate directly to the Forth words: ?DUP, OVER, TUCK, & NIP. I also simplified my implementation of ROT & -ROT to just do the top three items instead of taking a top item and doing an arbitrary rotate.
Overall: 7 files changed, 124 insertions(+), 137 deletions(-)
While simple, this was my first try at getting physical sound output with a microcontroller (MSP430 Launchpad) and an 8Ω speaker. This does a basic sweep-like sound (going from high to low.) This was a quick recreation of what I did last night since I only had 3 hours to submit for today and am still at work. However, the basic concept is still instilled in this code.