save and load compiled vmbl files
This commit is contained in:
19
src/main.c
19
src/main.c
@@ -4,21 +4,20 @@
|
||||
#define ARRAY_SIZE(array) (sizeof(array) / sizeof(array[0]));
|
||||
|
||||
VMBL_Instruction program[] = {
|
||||
MAKE_INST_PUSH(69),
|
||||
MAKE_INST_PUSH(420),
|
||||
MAKE_INST_PUSH(0),
|
||||
MAKE_INST_PUSH(1),
|
||||
MAKE_INST_DUP(1),
|
||||
MAKE_INST_DUP(1),
|
||||
MAKE_INST_ADD,
|
||||
MAKE_INST_JMP(2)
|
||||
};
|
||||
|
||||
int main() {
|
||||
VMBL_State vmblState = {};
|
||||
|
||||
for (size_t i = 0; i < ARRAY_SIZE(program) i++) {
|
||||
VMBL_Exception exception = VBML_ExecuteInstruction(&vmblState, program[i]);
|
||||
if (exception.type != EXCEPTION_NONE) {
|
||||
VMBL_Dump(vmblState, exception);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
VMBL_LoadExecutable(&vmblState, program, sizeof(program));
|
||||
//VMBL_SaveExecutable("fib.vmbl", program, sizeof(program));
|
||||
//VMBL_LoadExecutableFromFile(&vmblState, "fib.vmbl");
|
||||
VMBL_StartVM(&vmblState);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Reference in New Issue
Block a user