aboutsummaryrefslogtreecommitdiff
path: root/src/runtime.c
AgeCommit message (Collapse)Author
2023-10-22Fix bug where accessing byte/hword registers > 8 wouldn't workAryadev Chavali
This is because we were checking them as if they were word registers.
2023-10-22When VEROBSE flag is set greater than 0, print traces in vm_execute_allAryadev Chavali
For each cycle, print the cycle and any changes. We track changes on the stack by remembering the previous stack pointer. For registers, I remember the previous array of registers and do a byte level compare of the current registers and the remembered ones. Produces pretty log messages and an easy way to track execution.
2023-10-22Changed formats for vm_print_(stack|program)Aryadev Chavali
Easier to read now
2023-10-22Store the result of OP_POP in the last register as a wordAryadev Chavali
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-21Implemented vm routines for OP_EQ_*Aryadev Chavali
2023-10-21Implemented vm routines for OP_XOR_*Aryadev Chavali
2023-10-21Implemented vm routines for OP_AND_*Aryadev Chavali
2023-10-21Implemented vm routines for OP_OR_*Aryadev Chavali
2023-10-21Implemented vm routines for OP_NOT_*Aryadev Chavali
2023-10-21Added vm_execute_all which executes an entire programAryadev Chavali
Handles OP_HALT
2023-10-21Switched from floats to halfwordAryadev Chavali
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-16Implemented vm_print_* routinesAryadev Chavali
Prints each aspect of the vm, and vm_print_all does it all.
2023-10-16MOV now uses the stack, removed register member in inst_tAryadev Chavali
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-15Better checking of opcode typesAryadev Chavali
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-15Moved vm_* code to its own file (runtime.(h|c))Aryadev Chavali