instruction decoding

This commit is contained in:
2026-07-15 15:54:51 +10:00
parent 8e26d3e19d
commit 9d0c1de3f5
8 changed files with 195 additions and 46 deletions

View File

@@ -6,22 +6,15 @@
#include "memory.h"
// -- TYPES -- //
typedef enum {
REG_A, REG_B, REG_C,
REG_X, REG_Y, REG_Z,
REG_R,
REG_PC, REG_IHP, REG_SP, REG_F,
REG_MAX // all registers should come before this one, this is so we can
// automatically know the length of the registers array
} Register;
typedef struct {
uint16_t regs[REG_MAX];
Memory* mem;
uint32_t pc;
uint32_t ihp;
uint32_t sp;
} Emulator;
// -- FUNCTIONS -- //
Emulator* initEmulator(uint32_t memorySize);
Emulator* initEmulator(uint32_t memorySize);
void freeEmulator(Emulator* emu);