--- BasiliskII/src/rom_patches.cpp 1999/10/05 14:59:44 1.2 +++ BasiliskII/src/rom_patches.cpp 1999/10/22 15:08:12 1.7 @@ -30,6 +30,7 @@ #include "disk.h" #include "cdrom.h" #include "video.h" +#include "extfs.h" #include "prefs.h" #include "rom_patches.h" @@ -45,9 +46,9 @@ uint32 UniversalInfo; // ROM offset of UniversalInfo uint32 PutScrapPatch; // Mac address of PutScrap() patch -static uint32 sony_offset; // ROM offset of .Sony driver -static uint32 serd_offset; // ROM offset of SERD resource (serial drivers) -static uint32 microseconds_offset; // ROM offset of Microseconds() replacement routine +static uint32 sony_offset; // ROM offset of .Sony driver +static uint32 serd_offset; // ROM offset of SERD resource (serial drivers) +static uint32 microseconds_offset; // ROM offset of Microseconds() replacement routine static uint32 memory_dispatch_offset; // ROM offset of MemoryDispatch() replacement routine // Prototypes @@ -146,7 +147,7 @@ again: static const uint8 sony_driver[] = { // Replacement for .Sony driver // Driver header - SonyDriverFlags >> 8, SonyDriverFlags & 0xff, SonyDriverDelay >> 8, SonyDriverDelay & 0xff, 0x00, 0x00, 0x00, 0x00, + SonyDriverFlags >> 8, SonyDriverFlags & 0xff, 0, 0, 0, 0, 0, 0, 0x00, 0x18, // Open() offset 0x00, 0x1c, // Prime() offset 0x00, 0x20, // Control() offset @@ -194,7 +195,7 @@ static const uint8 sony_driver[] = { // static const uint8 disk_driver[] = { // Generic disk driver // Driver header - DiskDriverFlags >> 8, DiskDriverFlags & 0xff, DiskDriverDelay >> 8, DiskDriverDelay & 0xff, 0x00, 0x00, 0x00, 0x00, + DiskDriverFlags >> 8, DiskDriverFlags & 0xff, 0, 0, 0, 0, 0, 0, 0x00, 0x18, // Open() offset 0x00, 0x1c, // Prime() offset 0x00, 0x20, // Control() offset @@ -242,7 +243,7 @@ static const uint8 disk_driver[] = { // static const uint8 cdrom_driver[] = { // CD-ROM driver // Driver header - CDROMDriverFlags >> 8, CDROMDriverFlags & 0xff, CDROMDriverDelay >> 8, CDROMDriverDelay & 0xff, 0x00, 0x00, 0x00, 0x00, + CDROMDriverFlags >> 8, CDROMDriverFlags & 0xff, 0, 0, 0, 0, 0, 0, 0x00, 0x1c, // Open() offset 0x00, 0x20, // Prime() offset 0x00, 0x24, // Control() offset @@ -555,7 +556,6 @@ void InstallDrivers(uint32 pb) uint32 dce = ReadMacInt32(r.a[0]); WriteMacInt32(dce + dCtlDriver, ROMBaseMac + sony_offset + 0x100); WriteMacInt16(dce + dCtlFlags, DiskDriverFlags); - WriteMacInt16(dce + dCtlDelay, DiskDriverDelay); // Open disk driver WriteMacInt32(pb + ioNamePtr, ROMBaseMac + sony_offset + 0x112); @@ -574,7 +574,6 @@ void InstallDrivers(uint32 pb) dce = ReadMacInt32(r.a[0]); WriteMacInt32(dce + dCtlDriver, ROMBaseMac + sony_offset + 0x200); WriteMacInt16(dce + dCtlFlags, CDROMDriverFlags); - WriteMacInt16(dce + dCtlDelay, CDROMDriverDelay); // Open CD-ROM driver WriteMacInt32(pb + ioNamePtr, ROMBaseMac + sony_offset + 0x212); @@ -648,6 +647,11 @@ void PatchAfterStartup(void) r.a[0] = ROMBaseMac + memory_dispatch_offset; r.d[0] = 0xa05c; Execute68kTrap(0xa247, &r); // SetOSTrapAddress() + +#if SUPPORTS_EXTFS + // Install external file system + InstallExtFS(); +#endif } @@ -664,7 +668,7 @@ bool CheckROM(void) // Real addressing mode requires a 32-bit clean ROM return ROMVersion == ROM_VERSION_32; #else - // Virtual addressing mode works with 32-bit clean Mac II ROMs and Classic ROMs (experimental) + // Virtual addressing mode works with 32-bit clean Mac II ROMs and Classic ROMs return (ROMVersion == ROM_VERSION_CLASSIC) || (ROMVersion == ROM_VERSION_32); #endif } @@ -837,6 +841,7 @@ static bool patch_rom_classic(void) // ROM patches for 32-bit clean Mac-II ROMs (version $067c) static bool patch_rom_32(void) { + uint32 *lp; uint16 *wp; uint8 *bp; uint32 base; @@ -1398,6 +1403,14 @@ static bool patch_rom_32(void) *wp++ = htons(M68K_EMUL_OP_MEMORY_DISPATCH); *wp = htons(M68K_RTS); +#if EMULATED_68K + // Replace BlockMove() + wp = (uint16 *)(ROMBaseHost + find_rom_trap(0xa02e)); // BlockMove() + *wp++ = htons(M68K_EMUL_OP_BLOCK_MOVE); + *wp++ = htons(0x7000); + *wp = htons(M68K_RTS); +#endif + // Patch VIA interrupt handler wp = (uint16 *)(ROMBaseHost + 0x9bc4); // Level 1 handler *wp++ = htons(0x7002); // moveq #2,d0 (always 60Hz interrupt)