From e79cdceb6cf07c4a1cf2506091cf9e217a04f9d6 Mon Sep 17 00:00:00 2001 From: Kelvin Sherlock Date: Tue, 12 Feb 2013 22:34:36 -0500 Subject: [PATCH] fix loader (quit when needed) --- bin/loader.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/loader.cpp b/bin/loader.cpp index 237af0a..9a52ce3 100644 --- a/bin/loader.cpp +++ b/bin/loader.cpp @@ -672,7 +672,7 @@ int main(int argc, char **argv) // -4 is for the return address. cpuSetAReg(7, address + Flags.stack - 4); // return address. - WriteLong(Memory, address + Flags.stack - 4, 0xffffffff); + WriteLong(Memory, address + Flags.stack - 4, 0x0a06); // MinusOne global :) } cpuSetALineExceptionFunc(ToolBox::dispatch); @@ -692,13 +692,15 @@ int main(int argc, char **argv) cpuSetInstructionLoggingFunc(InstructionLogger); } - for (unsigned i = 0; i < 20000; ++i) + for (;;) { uint32_t pc = cpuGetPC(); - if (pc == 0xffffffff) break; + if (pc == 0x00000000) break; + if (cpuGetStop()) break; cpuExecuteInstruction(); } + // return value in mpwblock + 0x0e? exit(0); } \ No newline at end of file