--- BasiliskII/src/emul_op.cpp 1999/10/05 14:59:43 1.2 +++ BasiliskII/src/emul_op.cpp 1999/11/03 10:56:12 1.12 @@ -39,8 +39,13 @@ #include "video.h" #include "audio.h" #include "ether.h" +#include "extfs.h" #include "emul_op.h" +#if ENABLE_MON +#include "mon.h" +#endif + #define DEBUG 0 #include "debug.h" @@ -63,6 +68,10 @@ void EmulOp(uint16 opcode, M68kRegisters r->d[0], r->d[1], r->d[2], r->d[3], r->d[4], r->d[5], r->d[6], r->d[7], r->a[0], r->a[1], r->a[2], r->a[3], r->a[4], r->a[5], r->a[6], r->a[7], r->sr); +#if ENABLE_MON + char *arg[2] = {"rmon", NULL}; + mon(1, arg); +#endif QuitEmulator(); break; } @@ -77,7 +86,7 @@ void EmulOp(uint16 opcode, M68kRegisters EtherReset(); // Create BootGlobs at top of memory - memset((void *)(RAMBaseHost + RAMSize - 4096), 0, 4096); + Mac_memset(RAMBaseMac + RAMSize - 4096, 0, 4096); uint32 boot_globs = RAMBaseMac + RAMSize - 0x1c; WriteMacInt32(boot_globs + 0x00, RAMBaseMac); // First RAM bank WriteMacInt32(boot_globs + 0x04, RAMSize); @@ -295,15 +304,15 @@ void EmulOp(uint16 opcode, M68kRegisters break; case M68K_EMUL_OP_VIDEO_OPEN: // Video driver functions - r->d[0] = VideoOpen(r->a[0], r->a[1]); + r->d[0] = VideoDriverOpen(r->a[0], r->a[1]); break; case M68K_EMUL_OP_VIDEO_CONTROL: - r->d[0] = VideoControl(r->a[0], r->a[1]); + r->d[0] = VideoDriverControl(r->a[0], r->a[1]); break; case M68K_EMUL_OP_VIDEO_STATUS: - r->d[0] = VideoStatus(r->a[0], r->a[1]); + r->d[0] = VideoDriverStatus(r->a[0], r->a[1]); break; case M68K_EMUL_OP_SERIAL_OPEN: // Serial driver functions @@ -401,43 +410,19 @@ void EmulOp(uint16 opcode, M68kRegisters break; } - case M68K_EMUL_OP_MEMORY_DISPATCH: { // MemoryDispatch() replacement routine - int16 sel = r->d[0]; - D(bug("MemoryDispatch(%d)\n", sel)); - switch (sel) { - case -6: // GetLogicalRAMSize - r->d[0] = RAMSize; - break; - case -3: - r->d[0] = 0x1000; - break; - case 0: // HoldMemory - case 1: // UnholdMemory - case 2: // LockMemory - case 3: // UnlockMemory - case 4: // LockMemoryContiguous - case 6: // ProtectMemory - case 7: // UnprotectMemory - r->d[0] = 0; - break; - default: - printf("FATAL: MemoryDispatch(%d): illegal selector\n", sel); - r->d[0] = (uint32)-502; - break; - } - break; - } - case M68K_EMUL_OP_IRQ: // Level 1 interrupt r->d[0] = 0; if (InterruptFlags & INTFLAG_60HZ) { ClearInterruptFlag(INTFLAG_60HZ); if (HasMacStarted()) { - // Mac has started, execute video, ADB and Time Manager interrupt functions + // Mac has started, execute all 60Hz interrupt functions ADBInterrupt(); TimerInterrupt(); VideoInterrupt(); + SonyInterrupt(); + DiskInterrupt(); + CDROMInterrupt(); // Call DoVBLTask(0) if (ROMVersion == ROM_VERSION_32) { @@ -489,6 +474,20 @@ void EmulOp(uint16 opcode, M68kRegisters r->d[0] = AudioDispatch(r->a[3], r->a[4]); break; +#if SUPPORTS_EXTFS + case M68K_EMUL_OP_EXTFS_COMM: // External file system routines + WriteMacInt16(r->a[7] + 14, ExtFSComm(ReadMacInt16(r->a[7] + 12), ReadMacInt32(r->a[7] + 8), ReadMacInt32(r->a[7] + 4))); + break; + + case M68K_EMUL_OP_EXTFS_HFS: + WriteMacInt16(r->a[7] + 20, ExtFSHFS(ReadMacInt32(r->a[7] + 16), ReadMacInt16(r->a[7] + 14), ReadMacInt32(r->a[7] + 10), ReadMacInt32(r->a[7] + 6), ReadMacInt16(r->a[7] + 4))); + break; +#endif + + case M68K_EMUL_OP_BLOCK_MOVE: // BlockMove() replacement + memmove(Mac2HostAddr(r->a[1]), Mac2HostAddr(r->a[0]), r->d[0]); + break; + default: printf("FATAL: EMUL_OP called with bogus opcode %08x\n", opcode); printf("d0 %08lx d1 %08lx d2 %08lx d3 %08lx\n" @@ -499,6 +498,10 @@ void EmulOp(uint16 opcode, M68kRegisters r->d[0], r->d[1], r->d[2], r->d[3], r->d[4], r->d[5], r->d[6], r->d[7], r->a[0], r->a[1], r->a[2], r->a[3], r->a[4], r->a[5], r->a[6], r->a[7], r->sr); +#if ENABLE_MON + char *arg[2] = {"rmon", NULL}; + mon(1, arg); +#endif QuitEmulator(); break; }