1 |
|
/* |
2 |
|
* emul_op.cpp - 68k opcodes for ROM patches |
3 |
|
* |
4 |
< |
* SheepShaver (C) 1997-2004 Christian Bauer and Marc Hellwig |
4 |
> |
* SheepShaver (C) 1997-2008 Christian Bauer and Marc Hellwig |
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 |
51 |
|
#include "debug.h" |
52 |
|
|
53 |
|
|
54 |
– |
#if __BEOS__ |
55 |
– |
#define PRECISE_TIMING 1 |
56 |
– |
#else |
57 |
– |
#define PRECISE_TIMING 0 |
58 |
– |
#endif |
59 |
– |
|
60 |
– |
|
54 |
|
// TVector of MakeExecutable |
55 |
|
static uint32 MakeExecutableTvec; |
56 |
|
|
282 |
|
MacOSUtilReset(); |
283 |
|
AudioReset(); |
284 |
|
|
285 |
< |
// Enable DR emulator |
286 |
< |
if (PrefsFindBool("jit68k")) { |
285 |
> |
// Enable DR emulator (disabled for now) |
286 |
> |
if (PrefsFindBool("jit68k") && 0) { |
287 |
|
D(bug("DR activated\n")); |
288 |
|
WriteMacInt32(KernelDataAddr + 0x17a0, 3); // Prepare for DR emulator activation |
289 |
|
WriteMacInt32(KernelDataAddr + 0x17c0, DR_CACHE_BASE); |
290 |
|
WriteMacInt32(KernelDataAddr + 0x17c4, DR_CACHE_SIZE); |
291 |
|
WriteMacInt32(KernelDataAddr + 0x1b04, DR_CACHE_BASE); |
292 |
|
WriteMacInt32(KernelDataAddr + 0x1b00, DR_EMULATOR_BASE); |
293 |
< |
memcpy((void *)DR_EMULATOR_BASE, (void *)(ROM_BASE + 0x370000), DR_EMULATOR_SIZE); |
293 |
> |
memcpy((void *)DR_EMULATOR_BASE, (void *)(ROMBase + 0x370000), DR_EMULATOR_SIZE); |
294 |
|
MakeExecutable(0, DR_EMULATOR_BASE, DR_EMULATOR_SIZE); |
295 |
|
} |
296 |
|
break; |
409 |
|
r->d[0] = (uint32)-7887; |
410 |
|
break; |
411 |
|
|
412 |
+ |
case OP_CHECK_SYSV: { // Check we are not using MacOS < 8.1 with a NewWorld ROM |
413 |
+ |
r->a[1] = r->d[1]; |
414 |
+ |
r->a[0] = ReadMacInt32(r->d[1]); |
415 |
+ |
uint32 sysv = ReadMacInt16(r->a[0]); |
416 |
+ |
D(bug("Detected MacOS version %d.%d.%d\n", (sysv >> 8) & 0xf, (sysv >> 4) & 0xf, sysv & 0xf)); |
417 |
+ |
if (ROMType == ROMTYPE_NEWWORLD && sysv < 0x0801) |
418 |
+ |
r->d[1] = 0; |
419 |
+ |
break; |
420 |
+ |
} |
421 |
+ |
|
422 |
|
case OP_NTRB_17_PATCH: |
423 |
|
r->a[2] = ReadMacInt32(r->a[7]); |
424 |
|
r->a[7] += 4; |
473 |
|
case OP_IDLE_TIME: |
474 |
|
// Sleep if no events pending |
475 |
|
if (ReadMacInt32(0x14c) == 0) |
476 |
< |
Delay_usec(16667); |
476 |
> |
idle_wait(); |
477 |
|
r->a[0] = ReadMacInt32(0x2b6); |
478 |
|
break; |
479 |
|
|
480 |
|
case OP_IDLE_TIME_2: |
481 |
|
// Sleep if no events pending |
482 |
|
if (ReadMacInt32(0x14c) == 0) |
483 |
< |
Delay_usec(16667); |
483 |
> |
idle_wait(); |
484 |
|
r->d[0] = (uint32)-2; |
485 |
|
break; |
486 |
|
|