I was pondering about it a while now and I've had questions as to how to handle the program counter and such. One solution might be to add another interpreter, but I was looking for other solutions.
One idea I had was to build chained application specific SYS functions. You would need an assembler that enforces that each block of native code takes a constant amount of cycles (so only very special jump instructions would be allowed). Each of such fixed blocks would be an application specific SYS function and they can chain to the next one by putting its address in the "sysFn" variable. In theory this should only require the RAM for the single syscall instruction. To be able to call "normal" SYS functions a bit more RAM would be needed, maybe something like this in vCPU assembler code (9 bytes if I counted correctly):
Code: Select all
SYS [external fn time] LDWI [next chain fn address] STW $22 ; set "sysFn" SYS [next chained time]
This would not allow directly using existing vCPU code, but I am not sure that is possible anyway as the memory map would be completely different between RAM and ROM.
But so far these are just wild thoughts that I wanted to pin down publicly, not something I intend to use very soon.