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

@@ -8,6 +8,11 @@ Emulator* initEmulator(uint32_t memorySize) {
// zero out registers
memset(newEmu->regs, 0, sizeof(newEmu->regs));
// zero out special regs
newEmu->pc = 0;
newEmu->sp = 0;
newEmu->ihp = 0;
// init memory
newEmu->mem = initMemory(memorySize);
if (!newEmu->mem) {
@@ -16,4 +21,9 @@ Emulator* initEmulator(uint32_t memorySize) {
}
return newEmu;
}
void freeEmulator(Emulator* emu) {
freeMemory(emu->mem);
free(emu);
}