Age | Commit message (Collapse) | Author |
|
Changed folder names for sake of clarity (will be introducing a new
build target soon), and Makefile can now easily support more targets.
|
|
Checks if the operand given is a well defined program address, then
performs the jump.
|
|
Routines that use the stack for their operands i.e. aren't supplied
operands directly all have the same signature. We may as well stick
them all together in one array and one conditional, just reduces the
number of branches. Also looks nicer.
Implemented OP_PLUS_*. Pretty simple to implement.
Deleted vm_peek as it was only necessary to update the `ret` register.
|
|
Every vm routine now returns an err_t, which is an enumeration of
possible error states. ERR_OK represents the good state and is 0 so
error checking seems very natural in terms of language `if (err) ...`.
Errors bubble up the runtime, with any callers forced to check if an
error occurred.
This does mean that routines that call other routines cannot provide
an accurate trace of the subcaller (based on the fact that an error is
generated for the current instruction), but this should be a non issue
as no instruction should be complex enough to need proper traces.
|
|
Wasn't useful or necessary.
|
|
|
|
Wasn't very secure for endianness, and using these helpers abstracts
the details away a bit in case I want to enforce a certain system.
|
|
Instead of making routines to handle data in the `ret` register, just
store the result of POP into the last word register.
This means we are no longer using vm_pop_* or POP_ROUTINES for the
vm_execute script on OP_POP: instead we'll just use vm_mov_* which
automatically pops the datum for us, while moving the datum to the
last register.
|
|
|
|
|
|
|
|
|
|
|
|
Handles OP_HALT
|
|
Registers are now just words, with pushing from and moving to
registers with specified subtypes just pushing those types into the
word registers. That means there are 8 word registers which can act
as 16 half word registers, which themselves can act as 64 byte
registers.
|
|
Prints each aspect of the vm, and vm_print_all does it all.
|
|
Instead of taking an operand and a register, mov just uses the stack
for the operand. Therefore, there's no need for a register member in
inst_t.
As a result, PUSH_*_REGISTER now uses the operand for the register.
|
|
|