Age | Commit message (Collapse) | Author |
|
Registers for bytes, words and floats with routines to set them.
|
|
By default, a zero initialised set of instructions are NOOPs, which is
great.
Last two bits of a push opcode is always 01. Rest of the bits are
used to distinguish between differing types of push. This makes it
easier to inspect on the byte level what type of opcode we have.
|
|
|
|
op_t provides opcodes, inst_t provides a wrapper with operands. vm_t
carries around a pointer to a set of instructions, and vm_execute
attempts to execute that one. I do some weird stuff here, and it's
definitely not complete.
|
|
|
|
|
|
|
|
I wouldn't really want this to be malloc'd per se, you could make a
byte array on the stack then pass it into the VM?
|
|
|
|
|
|
Not machine independent, uses the underlying memcpy routine.
|
|
This ensures that if one wanted to pop a word byte by byte, they'd go
from least to most significance. Machine independent so that's nice.
|
|
Smaller number of changes necessary to change types.
|
|
|
|
|
|
Function dispatch
|
|
Maybe I should make a union for the type, so I can dispatch via
function pointers?
|
|
Currently just contains a "stack".
|
|
Nicer to refer to a byte as "byte" rather than "uint8_t"
|
|
This is a from the ground rework of an old project of the same name.
I'm hoping to be more concerned with runtime efficiency, bytecode size
and all those things that should actually matter for something that
may host time/space critical code.
|