Posted March 09, 2023 by Prestosilver
#assembly #virtual machine #sandeee #programming
As a quick note this post is just a mind dump so I dont ramble to people I know too much.
So ive been working on a programming game for a while now called SandeeeOs. In this game I wanted the focus on programming to be open to people who are advanced programmers and those who dont even know what a pointer is. So I decided on writing a vm to run a fake assembly language. I wanted Sandeee to stand out among all the other assembly programming games, so I had the crazy idea to allow strings to be pushed on to the stack as if they were numbers.
So the base VM is a structure containing the following:
Strings are an annoying structure to deal with, I had to decide on a system for embeding them into the executable files, I decided on null terminated strings (though I may switch to storing length).
You will also run into the issue of differentiating instructions that take in 1 value, no value or a string, this was a tough problem to get over. I decided the top 2 bits of each instruction will determine the data associated with it. For example if they are 0 in binary, then there is no value, and the assembler will assume the next instruction is 1 byte ahead.
But this problaby makes no sense, so I will follow up next week with a self hosted assembler.