Yarn – A small embeddable VM with a custom instruction set
github.com
github.com
It reminds the Moxie processor:
https://github.com/atgreen/moxiedev
The author even wrote a backend for GCC.
Your demo from Twitter should compile to JS with emscripten.
Yeah, it should compile to JS, I'll probably look into doing that at a later point in time.
https://kripken.github.io/emscripten-site/docs/tools_referen...
(The project is very cool! The instruction set reminds me a bit of the MIPS subset usually implemented in uni courses.)
I haven't decided on audio. It might be a set of sys calls that manipulate oscillators. The graphics interface is quite literally just manipulating the program memory. You can see the registers in the lower left corner of the video I linked.
I then just started listing off the registers I needed. I could try to make up my own method of keeping track of the stack, base and instruction pointers, but I didn't really care enough. I also liked the _cdecl method of function calling in assembly, so I kept with that design as well. This meant a return register. The rest were split between caller and callee save registers, and I tried to give them a decently easy to remember mnemonic. Compare that to x86! I also realized I needed a null register which would indicate no register was used for operations (ie a `mov *(0x0), %ret` where there is no register for the first argument). I think I'll enforce this convention to make %null a little more useful. Unless the user tries really hard, I'll prevent anything from changing the contents of null from 0, making it useful for comparisons, and popping unwanted data.
I think I'm okay with this name collision, but if there are any confusions I frequently refer to mine as YarnVM.