1 |
|
/* |
2 |
|
* rom_patches.cpp - ROM patches |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-1999 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2000 Christian Bauer |
5 |
|
* |
6 |
|
* This program is free software; you can redistribute it and/or modify |
7 |
|
* it under the terms of the GNU General Public License as published by |
47 |
|
static uint32 sony_offset; // ROM offset of .Sony driver |
48 |
|
static uint32 serd_offset; // ROM offset of SERD resource (serial drivers) |
49 |
|
static uint32 microseconds_offset; // ROM offset of Microseconds() replacement routine |
50 |
– |
static uint32 memory_dispatch_offset; // ROM offset of MemoryDispatch() replacement routine |
50 |
|
|
51 |
|
// Prototypes |
52 |
|
uint16 ROMVersion; |
81 |
|
|
82 |
|
if (!cont) |
83 |
|
rsrc_ptr = x; |
84 |
+ |
else |
85 |
+ |
rsrc_ptr = ReadMacInt32(ROMBaseMac + rsrc_ptr + 8); |
86 |
|
|
87 |
|
for (;;) { |
88 |
|
lp = ROMBaseMac + rsrc_ptr; |
701 |
|
r.d[0] = 0xa093; |
702 |
|
Execute68kTrap(0xa247, &r); // SetOSTrapAddress() |
703 |
|
|
703 |
– |
// Install MemoryDispatch() replacement routine |
704 |
– |
r.a[0] = ROMBaseMac + memory_dispatch_offset; |
705 |
– |
r.d[0] = 0xa05c; |
706 |
– |
Execute68kTrap(0xa247, &r); // SetOSTrapAddress() |
707 |
– |
|
704 |
|
// Install disk driver |
705 |
|
r.a[0] = ROMBaseMac + sony_offset + 0x100; |
706 |
|
r.d[0] = (uint32)DiskRefNum; |
1455 |
|
static const uint8 memdisp_dat[] = {0x30, 0x3c, 0xa8, 0x9f, 0xa7, 0x46, 0x30, 0x3c, 0xa0, 0x5c, 0xa2, 0x47}; |
1456 |
|
base = find_rom_data(0x4f100, 0x4f180, memdisp_dat, sizeof(memdisp_dat)); |
1457 |
|
D(bug("memdisp %08lx\n", base)); |
1458 |
< |
if (base) { // ROM15/32 |
1458 |
> |
if (base) { // ROM15/22/23/26/27/32 |
1459 |
|
wp = (uint16 *)(ROMBaseHost + base + 10); |
1460 |
|
*wp = htons(M68K_NOP); |
1461 |
|
} |
1561 |
|
*wp++ = htons(base >> 16); |
1562 |
|
*wp = htons(base & 0xffff); |
1563 |
|
|
1568 |
– |
// Install MemoryDispatch() replacement routine (activated in PatchAfterStartup()) |
1569 |
– |
memory_dispatch_offset = sony_offset + 0xc20; |
1570 |
– |
wp = (uint16 *)(ROMBaseHost + memory_dispatch_offset); |
1571 |
– |
*wp++ = htons(M68K_EMUL_OP_MEMORY_DISPATCH); |
1572 |
– |
*wp = htons(M68K_RTS); |
1573 |
– |
|
1564 |
|
#if EMULATED_68K |
1565 |
|
// Replace BlockMove() |
1566 |
|
wp = (uint16 *)(ROMBaseHost + find_rom_trap(0xa02e)); // BlockMove() |
1569 |
|
*wp = htons(M68K_RTS); |
1570 |
|
#endif |
1571 |
|
|
1572 |
+ |
// Look for double PACK 4 resources |
1573 |
+ |
if ((base = find_rom_resource('PACK', 4)) == 0) return false; |
1574 |
+ |
if ((base = find_rom_resource('PACK', 4, true)) == 0 && FPUType == 0) |
1575 |
+ |
printf("WARNING: This ROM seems to require an FPU\n"); |
1576 |
+ |
|
1577 |
|
// Patch VIA interrupt handler |
1578 |
|
wp = (uint16 *)(ROMBaseHost + 0x9bc4); // Level 1 handler |
1579 |
|
*wp++ = htons(0x7002); // moveq #2,d0 (always 60Hz interrupt) |