mirror of
https://github.com/kanjitalk755/macemu.git
synced 2025-02-18 12:30:33 +00:00
EMUL_OP_BLOCK_MOVE is no longer used to replace the BlockMove() routine but
to implement more clever cache flushing for it
This commit is contained in:
parent
efc60c7f60
commit
82b38333f1
@ -523,8 +523,8 @@ void EmulOp(uint16 opcode, M68kRegisters *r)
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
case M68K_EMUL_OP_BLOCK_MOVE: // BlockMove() replacement
|
case M68K_EMUL_OP_BLOCK_MOVE: // BlockMove() cache flushing
|
||||||
memmove(Mac2HostAddr(r->a[1]), Mac2HostAddr(r->a[0]), r->d[0]);
|
FlushCodeCache(Mac2HostAddr(r->a[0]), r->a[1]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case M68K_EMUL_OP_DEBUGUTIL:
|
case M68K_EMUL_OP_DEBUGUTIL:
|
||||||
|
@ -1240,7 +1240,7 @@ static bool patch_rom_32(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !ROM_IS_WRITE_PROTECTED
|
#if !ROM_IS_WRITE_PROTECTED
|
||||||
#if defined(AMIGA) || defined(USE_SCRATCHMEM_SUBTERFUGE)
|
#if defined(USE_SCRATCHMEM_SUBTERFUGE)
|
||||||
// Set fake handle at 0x0000 to scratch memory area (so broken Mac programs won't write into Mac ROM)
|
// Set fake handle at 0x0000 to scratch memory area (so broken Mac programs won't write into Mac ROM)
|
||||||
extern uint8 *ScratchMem;
|
extern uint8 *ScratchMem;
|
||||||
const uint32 ScratchMemBase = Host2MacAddr(ScratchMem);
|
const uint32 ScratchMemBase = Host2MacAddr(ScratchMem);
|
||||||
@ -1462,12 +1462,14 @@ static bool patch_rom_32(void)
|
|||||||
if (ROMSize > 0x80000) {
|
if (ROMSize > 0x80000) {
|
||||||
|
|
||||||
// BlockMove()
|
// BlockMove()
|
||||||
static const uint8 ptest_dat[] = {0xa0, 0x8d, 0x0c, 0x81, 0x00, 0x00, 0x0c, 0x00, 0x6d, 0x06, 0x4e, 0x71, 0xf4, 0xf8};
|
static const uint8 bmove_dat[] = {0x20, 0x5f, 0x22, 0x5f, 0x0c, 0x38, 0x00, 0x04, 0x01, 0x2f};
|
||||||
base = find_rom_data(0x87000, 0x87800, ptest_dat, sizeof(ptest_dat));
|
base = find_rom_data(0x87000, 0x87800, bmove_dat, sizeof(bmove_dat));
|
||||||
D(bug("ptest %08lx\n", base));
|
D(bug("block_move %08lx\n", base));
|
||||||
if (base) { // ROM15/22/23/26/27/32
|
if (base) { // ROM15/22/23/26/27/32
|
||||||
wp = (uint16 *)(ROMBaseHost + base + 8);
|
wp = (uint16 *)(ROMBaseHost + base + 4);
|
||||||
*wp = htons(M68K_NOP);
|
*wp++ = htons(M68K_EMUL_OP_BLOCK_MOVE);
|
||||||
|
*wp++ = htons(0x7000);
|
||||||
|
*wp = htons(M68K_RTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SANE
|
// SANE
|
||||||
@ -1599,14 +1601,6 @@ static bool patch_rom_32(void)
|
|||||||
*wp++ = htons(base >> 16);
|
*wp++ = htons(base >> 16);
|
||||||
*wp = htons(base & 0xffff);
|
*wp = htons(base & 0xffff);
|
||||||
|
|
||||||
#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
|
|
||||||
|
|
||||||
// Look for double PACK 4 resources
|
// Look for double PACK 4 resources
|
||||||
if ((base = find_rom_resource(FOURCC('P','A','C','K'), 4)) == 0) return false;
|
if ((base = find_rom_resource(FOURCC('P','A','C','K'), 4)) == 0) return false;
|
||||||
if ((base = find_rom_resource(FOURCC('P','A','C','K'), 4, true)) == 0 && FPUType == 0)
|
if ((base = find_rom_resource(FOURCC('P','A','C','K'), 4, true)) == 0 && FPUType == 0)
|
||||||
|
@ -461,12 +461,14 @@ void CheckLoad(uint32 type, int16 id, uint8 *p, uint32 size)
|
|||||||
D(bug(" gpch 750 found\n"));
|
D(bug(" gpch 750 found\n"));
|
||||||
|
|
||||||
// Don't use PTEST instruction in BlockMove() (7.5, 7.6, 7.6.1, 8.0)
|
// Don't use PTEST instruction in BlockMove() (7.5, 7.6, 7.6.1, 8.0)
|
||||||
static const uint8 dat[] = {0xa0, 0x8d, 0x0c, 0x81, 0x00, 0x00, 0x0c, 0x00, 0x65, 0x06, 0x4e, 0x71, 0xf4, 0xf8};
|
static const uint8 dat[] = {0x20, 0x5f, 0x22, 0x5f, 0x0c, 0x38, 0x00, 0x04, 0x01, 0x2f};
|
||||||
base = find_rsrc_data(p, size, dat, sizeof(dat));
|
base = find_rsrc_data(p, size, dat, sizeof(dat));
|
||||||
if (base) {
|
if (base) {
|
||||||
p16 = (uint16 *)(p + base + 8);
|
p16 = (uint16 *)(p + base + 4);
|
||||||
*p16 = htons(M68K_NOP);
|
*p16++ = htons(M68K_EMUL_OP_BLOCK_MOVE);
|
||||||
FlushCodeCache(p + base + 8, 2);
|
*p16++ = htons(0x7000);
|
||||||
|
*p16 = htons(M68K_RTS);
|
||||||
|
FlushCodeCache(p + base + 4, 6);
|
||||||
D(bug(" patch 1 applied\n"));
|
D(bug(" patch 1 applied\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user