add file loading

This commit is contained in:
2026-07-16 12:04:17 +10:00
parent f84525fa3a
commit e1591e9810
5 changed files with 79 additions and 15 deletions

20
src/util.h Normal file
View File

@@ -0,0 +1,20 @@
#pragma once
#include "instruction.h"
#include <stdio.h>
#include <string.h>
// -- TYPES -- //
typedef struct {
char magic[4];
uint8_t version;
uint32_t numInstructions;
} ROMFileHeader;
typedef struct {
ROMFileHeader header;
Instruction* instructions;
} RomFile;
// -- FUNCTIONS -- //
RomFile* readProgramFromFile(char* path);