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