Cleanup some stuff
This commit is contained in:
parent
a741a0c992
commit
f909071287
|
@ -6,8 +6,8 @@
|
||||||
typedef struct Code Code;
|
typedef struct Code Code;
|
||||||
struct Code {
|
struct Code {
|
||||||
Value *memory;
|
Value *memory;
|
||||||
VMFrame current;
|
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
Frame current;
|
||||||
};
|
};
|
||||||
|
|
||||||
Code* demo_add_compile ();
|
Code* demo_add_compile ();
|
||||||
|
|
|
@ -15,7 +15,7 @@ typedef union {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Value registers[MAX_REGS]; /* R0-R255 */
|
Value registers[MAX_REGS]; /* R0-R255 */
|
||||||
uint32_t pc; /* Program counter */
|
uint32_t pc; /* Program counter */
|
||||||
} VMFrame;
|
} Frame;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
OP_HALT, /* terminate execution */
|
OP_HALT, /* terminate execution */
|
||||||
|
|
2
src/vm.c
2
src/vm.c
|
@ -31,7 +31,7 @@ void mem_strcpy(Value *memory, const char *str, uint32_t length,
|
||||||
/**
|
/**
|
||||||
* Step to the next opcode in the vm.
|
* Step to the next opcode in the vm.
|
||||||
*/
|
*/
|
||||||
uint32_t step_vm(VMFrame *frame, Value *memory) {
|
uint32_t step_vm(Frame *frame, Value *memory) {
|
||||||
uint32_t instruction = memory[frame->pc].u;
|
uint32_t instruction = memory[frame->pc].u;
|
||||||
|
|
||||||
/* Extract 8-bit register indices from 32-bit instruction */
|
/* Extract 8-bit register indices from 32-bit instruction */
|
||||||
|
|
Loading…
Reference in New Issue