54 |
|
|
55 |
|
|
56 |
|
/* |
57 |
+ |
* Convenience functions for retrieving a particular 16-bit word from |
58 |
+ |
* a 32-bit word value. |
59 |
+ |
* |
60 |
+ |
* gb-- probably put those elsewhere... |
61 |
+ |
*/ |
62 |
+ |
|
63 |
+ |
#define HiWord(X) (((X) >> 16) & 0xffff) |
64 |
+ |
#define LoWord(X) ((X) & 0xffff) |
65 |
+ |
|
66 |
+ |
|
67 |
+ |
/* |
68 |
|
* Search ROM for byte string, return ROM offset (or 0) |
69 |
|
*/ |
70 |
|
|
829 |
|
// Read version |
830 |
|
ROMVersion = ntohs(*(uint16 *)(ROMBaseHost + 8)); |
831 |
|
|
832 |
< |
#if REAL_ADDRESSING |
833 |
< |
// Real addressing mode requires a 32-bit clean ROM |
832 |
> |
#if REAL_ADDRESSING || DIRECT_ADDRESSING |
833 |
> |
// Real and direct addressing modes require a 32-bit clean ROM |
834 |
|
return ROMVersion == ROM_VERSION_32; |
835 |
|
#else |
836 |
|
// Virtual addressing mode works with 32-bit clean Mac II ROMs and Classic ROMs |
1232 |
|
|
1233 |
|
#if REAL_ADDRESSING |
1234 |
|
// Move system zone to start of Mac RAM |
1235 |
< |
lp = (uint32 *)(ROMBaseHost + 0x50a); |
1236 |
< |
*lp++ = htonl(RAMBaseMac); |
1237 |
< |
*lp = htonl(RAMBaseMac + 0x1800); |
1235 |
> |
wp = (uint16 *)(ROMBaseHost + 0x50a); |
1236 |
> |
*wp++ = htons(HiWord(RAMBaseMac + 0x2000)); |
1237 |
> |
*wp++ = htons(LoWord(RAMBaseMac + 0x2000)); |
1238 |
> |
*wp++ = htons(HiWord(RAMBaseMac + 0x3800)); |
1239 |
> |
*wp = htons(LoWord(RAMBaseMac + 0x3800)); |
1240 |
|
#endif |
1241 |
|
|
1242 |
|
#if !ROM_IS_WRITE_PROTECTED |
1243 |
< |
#if defined(AMIGA) |
1243 |
> |
#if defined(AMIGA) || defined(USE_SCRATCHMEM_SUBTERFUGE) |
1244 |
|
// Set fake handle at 0x0000 to scratch memory area (so broken Mac programs won't write into Mac ROM) |
1245 |
< |
extern uint32 ScratchMem; |
1245 |
> |
extern uint8 *ScratchMem; |
1246 |
> |
const uint32 ScratchMemBase = Host2MacAddr(ScratchMem); |
1247 |
|
wp = (uint16 *)(ROMBaseHost + 0xccaa); |
1248 |
|
*wp++ = htons(0x203c); // move.l #ScratchMem,d0 |
1249 |
< |
*wp++ = htons(ScratchMem >> 16); |
1250 |
< |
*wp = htons(ScratchMem); |
1249 |
> |
*wp++ = htons(ScratchMemBase >> 16); |
1250 |
> |
*wp = htons(ScratchMemBase); |
1251 |
|
#else |
1252 |
|
#error System specific handling for writable ROM is required here |
1253 |
|
#endif |
1259 |
|
*wp++ = htons(M68K_NOP); |
1260 |
|
*wp = htons(M68K_NOP); |
1261 |
|
#endif |
1262 |
< |
|
1262 |
> |
|
1263 |
> |
#if REAL_ADDRESSING && !defined(AMIGA) |
1264 |
> |
// gb-- Temporary hack to get rid of crashes in Speedometer |
1265 |
> |
wp = (uint16 *)(ROMBaseHost + 0xdba2); |
1266 |
> |
if (ntohs(*wp) == 0x662c) // bne.b #$2c |
1267 |
> |
*wp = htons(0x602c); // bra.b #$2c |
1268 |
> |
#endif |
1269 |
> |
|
1270 |
|
// Don't write to VIA in InitTimeMgr |
1271 |
|
wp = (uint16 *)(ROMBaseHost + 0xb0e2); |
1272 |
|
*wp++ = htons(0x4cdf); // movem.l (sp)+,d0-d5/a0-a4 |