Commit Graph

12 Commits

Author SHA1 Message Date
Aryadev Chavali
47c7d6baf7 Store the result of OP_POP in the last register as a word
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.
2023-10-22 17:34:30 +01:00
Aryadev Chavali
95723f36d2 Implemented vm routines for OP_EQ_* 2023-10-21 23:55:51 +01:00
Aryadev Chavali
50ce1b35cd Implemented vm routines for OP_XOR_* 2023-10-21 23:55:41 +01:00
Aryadev Chavali
c9b23b7b24 Implemented vm routines for OP_AND_* 2023-10-21 23:55:29 +01:00
Aryadev Chavali
6161a352e0 Implemented vm routines for OP_OR_* 2023-10-21 23:55:16 +01:00
Aryadev Chavali
ae7f0efc85 Implemented vm routines for OP_NOT_* 2023-10-21 23:54:59 +01:00
Aryadev Chavali
d2cdb211b2 Added vm_execute_all which executes an entire program
Handles OP_HALT
2023-10-21 23:31:48 +01:00
Aryadev Chavali
dcedb70a5c Switched from floats to halfword
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.
2023-10-21 22:57:43 +01:00
Aryadev Chavali
266b4e4572 Implemented vm_print_* routines
Prints each aspect of the vm, and vm_print_all does it all.
2023-10-16 12:55:19 +01:00
Aryadev Chavali
0f37a59940 MOV now uses the stack, removed register member in inst_t
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.
2023-10-16 01:05:42 +01:00
Aryadev Chavali
cd19f1e1d3 Better checking of opcode types
Introduced an enum (opcode_type_t) for the masks and values of each
opcode, which allows defining a single enum which checks an opcode by
a opcode_type_t.
2023-10-15 22:16:31 +01:00
Aryadev Chavali
639808a092 Moved vm_* code to its own file (runtime.(h|c)) 2023-10-15 21:41:16 +01:00