wip: working on extern in VM

- Feat: add usage of vm reader instead of old way in vm.c
- Ref: update debug opcodes printing
This commit is contained in:
samsonium
2026-11-05 23:23:38 +03:00
parent 1db42c1e8e
commit d95ff88b66
19 changed files with 133 additions and 146 deletions
+30
View File
@@ -0,0 +1,30 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdlib.h>
#include <vm/internals/reader.h>
// Read opcodes
bool vm_rd_ops(fzl_vm_reader_t *reader, FILE *fd)
{
if (!reader || !fd)
return false;
size_t ops_count = reader->ops_count;
if (!ops_count)
return false;
reader->ops = malloc(sizeof(size_t) * ops_count);
if (!reader->ops)
return false;
for (size_t i = 0; i < ops_count; i++)
{
size_t opcode;
if (!vm_rd_word(fd, 1, &opcode))
return false;
reader->ops[i] = opcode;
}
return true;
}