--- SheepShaver/src/emul_op.cpp 2004/01/10 08:46:56 1.7 +++ SheepShaver/src/emul_op.cpp 2004/05/31 11:00:13 1.12 @@ -1,7 +1,7 @@ /* * emul_op.cpp - 68k opcodes for ROM patches * - * SheepShaver (C) 1997-2002 Christian Bauer and Marc Hellwig + * SheepShaver (C) 1997-2004 Christian Bauer and Marc Hellwig * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -288,13 +288,15 @@ void EmulOp(M68kRegisters *r, uint32 pc, MacOSUtilReset(); AudioReset(); #if 0 - printf("DR activated\n"); + // Enable DR emulator + D(bug("DR activated\n")); WriteMacInt32(KernelDataAddr + 0x17a0, 3); // Prepare for DR emulator activation WriteMacInt32(KernelDataAddr + 0x17c0, DR_CACHE_BASE); WriteMacInt32(KernelDataAddr + 0x17c4, DR_CACHE_SIZE); - WriteMacInt32(KernelDataAddr + 0x1b00, DR_CACHE_BASE + 0x10000); - memcpy((void *)(DR_CACHE_BASE + 0x10000), (void *)(ROM_BASE + 0x370000), 0x10000); - clear_caches((void *)(DR_CACHE_BASE + 0x10000), 0x10000, B_INVALIDATE_ICACHE | B_FLUSH_DCACHE); + WriteMacInt32(KernelDataAddr + 0x1b04, DR_CACHE_BASE); + WriteMacInt32(KernelDataAddr + 0x1b00, DR_EMULATOR_BASE); + memcpy((void *)DR_EMULATOR_BASE, (void *)(ROM_BASE + 0x370000), DR_EMULATOR_SIZE); + MakeExecutable(0, (void *)DR_EMULATOR_BASE, DR_EMULATOR_SIZE); #endif break; @@ -456,15 +458,19 @@ void EmulOp(M68kRegisters *r, uint32 pc, break; case OP_IDLE_TIME: -#if __BEOS__ // Sleep if no events pending - if (ReadMacInt32(0x14c) == 0) { - sleep(16667); - } -#endif + if (ReadMacInt32(0x14c) == 0) + Delay_usec(16667); r->a[0] = ReadMacInt32(0x2b6); break; + case OP_IDLE_TIME_2: + // Sleep if no events pending + if (ReadMacInt32(0x14c) == 0) + Delay_usec(16667); + r->d[0] = (uint32)-2; + break; + default: printf("FATAL: EMUL_OP called with bogus selector %08x\n", selector); QuitEmulator();