58 |
|
|
59 |
|
|
60 |
|
// Other ROM addresses |
61 |
< |
const uint32 CHECK_LOAD_PATCH_SPACE = 0x2f7f00; |
62 |
< |
const uint32 PUT_SCRAP_PATCH_SPACE = 0x2f7f80; |
63 |
< |
const uint32 GET_SCRAP_PATCH_SPACE = 0x2f7fc0; |
64 |
< |
const uint32 ADDR_MAP_PATCH_SPACE = 0x2f8000; |
61 |
> |
const uint32 CHECK_LOAD_PATCH_SPACE = 0x2fcf00; |
62 |
> |
const uint32 PUT_SCRAP_PATCH_SPACE = 0x2fcf80; |
63 |
> |
const uint32 GET_SCRAP_PATCH_SPACE = 0x2fcfc0; |
64 |
> |
const uint32 ADDR_MAP_PATCH_SPACE = 0x2fd000; |
65 |
|
|
66 |
|
// Global variables |
67 |
|
int ROMType; // ROM type |
131 |
|
(parcel_type >> 8) & 0xff, parcel_type & 0xff, &parcel_data[6])); |
132 |
|
if (parcel_type == FOURCC('r','o','m',' ')) { |
133 |
|
uint32 lzss_offset = ntohl(parcel_data[2]); |
134 |
< |
uint32 lzss_size = ((uint32)src + parcel_offset) - ((uint32)parcel_data + lzss_offset); |
134 |
> |
uint32 lzss_size = ((uintptr)src + next_offset) - ((uintptr)parcel_data + lzss_offset); |
135 |
|
decode_lzss((uint8 *)parcel_data + lzss_offset, dest, lzss_size); |
136 |
|
} |
137 |
|
parcel_offset = next_offset; |
725 |
|
else |
726 |
|
return false; |
727 |
|
|
728 |
+ |
// Check that other ROM addresses point to really free regions |
729 |
+ |
if (ntohl(*(uint32 *)(ROM_BASE + CHECK_LOAD_PATCH_SPACE)) != 0x6b636b63) |
730 |
+ |
return false; |
731 |
+ |
if (ntohl(*(uint32 *)(ROM_BASE + PUT_SCRAP_PATCH_SPACE)) != 0x6b636b63) |
732 |
+ |
return false; |
733 |
+ |
if (ntohl(*(uint32 *)(ROM_BASE + GET_SCRAP_PATCH_SPACE)) != 0x6b636b63) |
734 |
+ |
return false; |
735 |
+ |
if (ntohl(*(uint32 *)(ROM_BASE + ADDR_MAP_PATCH_SPACE)) != 0x6b636b63) |
736 |
+ |
return false; |
737 |
+ |
|
738 |
|
// Apply patches |
739 |
|
if (!patch_nanokernel_boot()) return false; |
740 |
|
if (!patch_68k_emul()) return false; |
1852 |
|
*wp = htons(M68K_RTS); |
1853 |
|
|
1854 |
|
// Don't install Time Manager task for 60Hz interrupt (Enable60HzInts, via 0x2b8) |
1855 |
< |
if (ROMType == ROMTYPE_NEWWORLD) { |
1855 |
> |
if (ROMType == ROMTYPE_NEWWORLD || ROMType == ROMTYPE_GOSSAMER) { |
1856 |
|
static const uint8 tm_task_dat[] = {0x30, 0x3c, 0x4e, 0x2b, 0xa9, 0xc9}; |
1857 |
< |
if ((base = find_rom_data(0x2e0, 0x320, tm_task_dat, sizeof(tm_task_dat))) == 0) return false; |
1857 |
> |
if ((base = find_rom_data(0x2a0, 0x320, tm_task_dat, sizeof(tm_task_dat))) == 0) return false; |
1858 |
|
D(bug("tm_task %08lx\n", base)); |
1859 |
< |
wp = (uint16 *)(ROM_BASE + base + 28); // FIXME: this is not right for all nw ROMs |
1859 |
> |
wp = (uint16 *)(ROM_BASE + base + 28); |
1860 |
|
*wp++ = htons(M68K_NOP); |
1861 |
|
*wp++ = htons(M68K_NOP); |
1862 |
|
*wp++ = htons(M68K_NOP); |
1863 |
|
*wp++ = htons(M68K_NOP); |
1864 |
|
*wp++ = htons(M68K_NOP); |
1865 |
|
*wp = htons(M68K_NOP); |
1856 |
– |
} else if (ROMType == ROMTYPE_GOSSAMER) { |
1857 |
– |
static const uint8 tm_task_dat[] = {0x30, 0x3c, 0x4e, 0x2b, 0xa9, 0xc9}; |
1858 |
– |
if ((base = find_rom_data(0x2a0, 0x2e0, tm_task_dat, sizeof(tm_task_dat))) == 0) return false; |
1859 |
– |
D(bug("tm_task %08lx\n", base)); |
1860 |
– |
wp = (uint16 *)(ROM_BASE + base + 22); |
1861 |
– |
*wp++ = htons(M68K_NOP); |
1862 |
– |
*wp++ = htons(M68K_NOP); |
1863 |
– |
*wp++ = htons(M68K_NOP); |
1866 |
|
} else { |
1867 |
|
static const uint8 tm_task_dat[] = {0x20, 0x3c, 0x73, 0x79, 0x73, 0x61}; |
1868 |
|
if ((base = find_rom_data(0x280, 0x300, tm_task_dat, sizeof(tm_task_dat))) == 0) return false; |
2240 |
|
uint8 pb[SIZEOF_IOParam]; |
2241 |
|
|
2242 |
|
// Install floppy driver |
2243 |
< |
if (ROMType == ROMTYPE_NEWWORLD) { |
2243 |
> |
if (ROMType == ROMTYPE_NEWWORLD || ROMType == ROMTYPE_GOSSAMER) { |
2244 |
|
|
2245 |
< |
// Force installation of floppy driver with NewWorld ROMs |
2245 |
> |
// Force installation of floppy driver with NewWorld and Gossamer ROMs |
2246 |
|
r.a[0] = ROM_BASE + sony_offset; |
2247 |
|
r.d[0] = (uint32)SonyRefNum; |
2248 |
|
Execute68kTrap(0xa43d, &r); // DrvrInstallRsrvMem() |