fix instruction loading i think
This commit is contained in:
@@ -84,7 +84,11 @@ void startEmulator(Emulator* emu) {
|
||||
|
||||
#define DISPATCH() if (emu->irq != 0) handleInterrupt(emu); \
|
||||
updateDevices(emu); \
|
||||
if (emu->halted) { \
|
||||
return; \
|
||||
} \
|
||||
inst = fetchInst(emu); \
|
||||
printf("%s\n", instructionToCStr(inst)); \
|
||||
goto *dispatchTable[inst.opcode]
|
||||
|
||||
DISPATCH();
|
||||
|
||||
@@ -35,9 +35,7 @@ int main(int argc, char** argv) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
memcpy(emu->mem + MEM_PROGRAM_START, rom->instructions, sizeof(SerializedInst) * rom->header.numInstructions);
|
||||
|
||||
printf("hi i exist\n");
|
||||
memcpy(emu->mem->data + MEM_PROGRAM_START, rom->instructions, sizeof(SerializedInst) * rom->header.numInstructions);
|
||||
|
||||
startEmulator(emu);
|
||||
freeEmulator(emu);
|
||||
|
||||
@@ -53,7 +53,6 @@ uint32_t memorySerializeInst(Memory* m, Instruction inst, uint32_t offset) {
|
||||
void memoryLoadProgram(Memory* m, Instruction program[], size_t numInstructions) {
|
||||
size_t offset = 0;
|
||||
for (size_t i = 0; i < numInstructions; i++) {
|
||||
printf("%zu. %s\n", i, instructionToCStr(program[i]));
|
||||
offset = memorySerializeInst(m, program[i], offset);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user