30 |
|
#include "disk.h" |
31 |
|
#include "cdrom.h" |
32 |
|
#include "video.h" |
33 |
+ |
#include "extfs.h" |
34 |
|
#include "prefs.h" |
35 |
|
#include "rom_patches.h" |
36 |
|
|
46 |
|
uint32 UniversalInfo; // ROM offset of UniversalInfo |
47 |
|
uint32 PutScrapPatch; // Mac address of PutScrap() patch |
48 |
|
|
49 |
< |
static uint32 sony_offset; // ROM offset of .Sony driver |
50 |
< |
static uint32 serd_offset; // ROM offset of SERD resource (serial drivers) |
51 |
< |
static uint32 microseconds_offset; // ROM offset of Microseconds() replacement routine |
49 |
> |
static uint32 sony_offset; // ROM offset of .Sony driver |
50 |
> |
static uint32 serd_offset; // ROM offset of SERD resource (serial drivers) |
51 |
> |
static uint32 microseconds_offset; // ROM offset of Microseconds() replacement routine |
52 |
|
static uint32 memory_dispatch_offset; // ROM offset of MemoryDispatch() replacement routine |
53 |
|
|
54 |
|
// Prototypes |
147 |
|
|
148 |
|
static const uint8 sony_driver[] = { // Replacement for .Sony driver |
149 |
|
// Driver header |
150 |
< |
SonyDriverFlags >> 8, SonyDriverFlags & 0xff, SonyDriverDelay >> 8, SonyDriverDelay & 0xff, 0x00, 0x00, 0x00, 0x00, |
150 |
> |
SonyDriverFlags >> 8, SonyDriverFlags & 0xff, 0, 0, 0, 0, 0, 0, |
151 |
|
0x00, 0x18, // Open() offset |
152 |
|
0x00, 0x1c, // Prime() offset |
153 |
|
0x00, 0x20, // Control() offset |
195 |
|
|
196 |
|
static const uint8 disk_driver[] = { // Generic disk driver |
197 |
|
// Driver header |
198 |
< |
DiskDriverFlags >> 8, DiskDriverFlags & 0xff, DiskDriverDelay >> 8, DiskDriverDelay & 0xff, 0x00, 0x00, 0x00, 0x00, |
198 |
> |
DiskDriverFlags >> 8, DiskDriverFlags & 0xff, 0, 0, 0, 0, 0, 0, |
199 |
|
0x00, 0x18, // Open() offset |
200 |
|
0x00, 0x1c, // Prime() offset |
201 |
|
0x00, 0x20, // Control() offset |
243 |
|
|
244 |
|
static const uint8 cdrom_driver[] = { // CD-ROM driver |
245 |
|
// Driver header |
246 |
< |
CDROMDriverFlags >> 8, CDROMDriverFlags & 0xff, CDROMDriverDelay >> 8, CDROMDriverDelay & 0xff, 0x00, 0x00, 0x00, 0x00, |
246 |
> |
CDROMDriverFlags >> 8, CDROMDriverFlags & 0xff, 0, 0, 0, 0, 0, 0, |
247 |
|
0x00, 0x1c, // Open() offset |
248 |
|
0x00, 0x20, // Prime() offset |
249 |
|
0x00, 0x24, // Control() offset |
556 |
|
uint32 dce = ReadMacInt32(r.a[0]); |
557 |
|
WriteMacInt32(dce + dCtlDriver, ROMBaseMac + sony_offset + 0x100); |
558 |
|
WriteMacInt16(dce + dCtlFlags, DiskDriverFlags); |
558 |
– |
WriteMacInt16(dce + dCtlDelay, DiskDriverDelay); |
559 |
|
|
560 |
|
// Open disk driver |
561 |
|
WriteMacInt32(pb + ioNamePtr, ROMBaseMac + sony_offset + 0x112); |
574 |
|
dce = ReadMacInt32(r.a[0]); |
575 |
|
WriteMacInt32(dce + dCtlDriver, ROMBaseMac + sony_offset + 0x200); |
576 |
|
WriteMacInt16(dce + dCtlFlags, CDROMDriverFlags); |
577 |
– |
WriteMacInt16(dce + dCtlDelay, CDROMDriverDelay); |
577 |
|
|
578 |
|
// Open CD-ROM driver |
579 |
|
WriteMacInt32(pb + ioNamePtr, ROMBaseMac + sony_offset + 0x212); |
647 |
|
r.a[0] = ROMBaseMac + memory_dispatch_offset; |
648 |
|
r.d[0] = 0xa05c; |
649 |
|
Execute68kTrap(0xa247, &r); // SetOSTrapAddress() |
650 |
+ |
|
651 |
+ |
#if SUPPORTS_EXTFS |
652 |
+ |
// Install external file system |
653 |
+ |
InstallExtFS(); |
654 |
+ |
#endif |
655 |
|
} |
656 |
|
|
657 |
|
|
668 |
|
// Real addressing mode requires a 32-bit clean ROM |
669 |
|
return ROMVersion == ROM_VERSION_32; |
670 |
|
#else |
671 |
< |
// Virtual addressing mode works with 32-bit clean Mac II ROMs and Classic ROMs (experimental) |
671 |
> |
// Virtual addressing mode works with 32-bit clean Mac II ROMs and Classic ROMs |
672 |
|
return (ROMVersion == ROM_VERSION_CLASSIC) || (ROMVersion == ROM_VERSION_32); |
673 |
|
#endif |
674 |
|
} |
841 |
|
// ROM patches for 32-bit clean Mac-II ROMs (version $067c) |
842 |
|
static bool patch_rom_32(void) |
843 |
|
{ |
844 |
+ |
uint32 *lp; |
845 |
|
uint16 *wp; |
846 |
|
uint8 *bp; |
847 |
|
uint32 base; |
1403 |
|
*wp++ = htons(M68K_EMUL_OP_MEMORY_DISPATCH); |
1404 |
|
*wp = htons(M68K_RTS); |
1405 |
|
|
1406 |
+ |
#if EMULATED_68K |
1407 |
+ |
// Replace BlockMove() |
1408 |
+ |
wp = (uint16 *)(ROMBaseHost + find_rom_trap(0xa02e)); // BlockMove() |
1409 |
+ |
*wp++ = htons(M68K_EMUL_OP_BLOCK_MOVE); |
1410 |
+ |
*wp++ = htons(0x7000); |
1411 |
+ |
*wp = htons(M68K_RTS); |
1412 |
+ |
#endif |
1413 |
+ |
|
1414 |
|
// Patch VIA interrupt handler |
1415 |
|
wp = (uint16 *)(ROMBaseHost + 0x9bc4); // Level 1 handler |
1416 |
|
*wp++ = htons(0x7002); // moveq #2,d0 (always 60Hz interrupt) |