diff --git a/add.o b/add.o index 0e926ca..44f77e0 100644 Binary files a/add.o and b/add.o differ diff --git a/src/emu.c b/src/emu.c index fd3b65c..8f86cf3 100644 --- a/src/emu.c +++ b/src/emu.c @@ -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(); diff --git a/src/main.c b/src/main.c index b28c5f3..28ee566 100644 --- a/src/main.c +++ b/src/main.c @@ -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); diff --git a/src/memory.c b/src/memory.c index 2f1d2e9..c1c6614 100644 --- a/src/memory.c +++ b/src/memory.c @@ -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); } }