This commit is contained in:
2024-11-21 09:32:53 +05:00
parent 1cae800a66
commit 1729070b80
12 changed files with 425 additions and 160 deletions

View File

@@ -6,7 +6,7 @@ void VM_init(VM* vm){
vm->state = VMState_Initialized;
}
void _VM_setError(VM* vm, const char* context, const char* format, ...){
void _VM_setError(VM* vm, cstr context, cstr format, ...){
va_list argv;
char position_str[32];
sprintf(position_str, "[at 0x%x][", (u32)vm->current_pos);
@@ -23,7 +23,7 @@ void _VM_setError(VM* vm, const char* context, const char* format, ...){
vm->state = VMState_InternalError;
}
bool VM_loadProgram(VM* vm, u8* data, size_t size){
bool VM_setMemory(VM* vm, u8* data, size_t size){
if(data == NULL){
VM_setError(vm, "data == NULL");
return false;
@@ -38,7 +38,7 @@ bool VM_loadProgram(VM* vm, u8* data, size_t size){
return true;
}
i32 VM_executeProgram(VM* vm){
i32 VM_boot(VM* vm){
if(vm->data == NULL){
VM_setError(vm, "data == null");
return -1;