75 |
|
uint8 *ROMBaseHost; // ROM base (host address space) |
76 |
|
uint32 ROMSize; // Size of ROM |
77 |
|
|
78 |
+ |
uint32 MacsBugFlags = 0xbff; |
79 |
+ |
|
80 |
|
|
81 |
|
// CPU and FPU type, addressing mode |
82 |
|
int CPUType; |
244 |
|
WarningAlert(GetString(STR_SMALL_RAM_WARN)); |
245 |
|
RAMSize = 1024*1024; |
246 |
|
} |
247 |
< |
RAMBaseHost = (uint8 *)AllocMem(RAMSize + 0x100000, MEMF_PUBLIC); |
248 |
< |
if (RAMBaseHost == NULL) { |
249 |
< |
ErrorAlert(GetString(STR_NO_MEM_ERR)); |
250 |
< |
QuitEmulator(); |
251 |
< |
} |
247 |
> |
RAMBaseHost = (uint8 *)AllocVec(RAMSize + 0x100000, MEMF_PUBLIC); |
248 |
> |
// if (RAMBaseHost == NULL) { |
249 |
> |
// ErrorAlert(GetString(STR_NO_MEM_ERR)); |
250 |
> |
// QuitEmulator(); |
251 |
> |
// } |
252 |
> |
if (RAMBaseHost == NULL) |
253 |
> |
{ |
254 |
> |
uint32 newRAMSize = AvailMem(MEMF_LARGEST) - 0x100000; |
255 |
> |
char xText[120]; |
256 |
> |
|
257 |
> |
sprintf(xText, GetString(STR_NOT_ENOUGH_MEM_WARN), RAMSize, newRAMSize); |
258 |
> |
|
259 |
> |
if (1 != ChoiceAlert(xText, "Use", "Quit")) |
260 |
> |
QuitEmulator(); |
261 |
> |
|
262 |
> |
RAMSize = newRAMSize; |
263 |
> |
RAMBaseHost = (uint8 *)AllocVec(RAMSize + 0x100000, MEMF_PUBLIC); |
264 |
> |
if (RAMBaseHost == NULL) { |
265 |
> |
ErrorAlert(GetString(STR_NO_MEM_ERR)); |
266 |
> |
QuitEmulator(); |
267 |
> |
} |
268 |
> |
} |
269 |
|
RAMBaseMac = (uint32)RAMBaseHost; |
270 |
|
D(bug("Mac RAM starts at %08lx\n", RAMBaseHost)); |
271 |
|
ROMBaseHost = RAMBaseHost + RAMSize; |
332 |
|
// Set task priority to -1 so we don't use all processing time |
333 |
|
SetTaskPri(MainTask, -1); |
334 |
|
|
335 |
+ |
WriteMacInt32(MacsBugFlags, 0); |
336 |
+ |
|
337 |
|
// Swap stack to Mac RAM area |
338 |
|
stack_swap.stk_Lower = RAMBaseHost; |
339 |
|
stack_swap.stk_Upper = (ULONG)RAMBaseHost + RAMSize; |
396 |
|
|
397 |
|
// Delete RAM/ROM area |
398 |
|
if (RAMBaseHost) |
399 |
< |
FreeMem(RAMBaseHost, RAMSize + 0x100000); |
399 |
> |
FreeVec(RAMBaseHost); |
400 |
|
|
401 |
|
// Delete scratch memory area |
402 |
|
if (ScratchMem) |
474 |
|
Signal(MainTask, IRQSigMask); |
475 |
|
} |
476 |
|
|
477 |
+ |
void TriggerNMI(void) |
478 |
+ |
{ |
479 |
+ |
AsmTriggerNMI(); |
480 |
+ |
} |
481 |
+ |
|
482 |
|
|
483 |
|
/* |
484 |
|
* 60Hz thread |
636 |
|
EmulatedSR |= 0x0700; |
637 |
|
|
638 |
|
// Call opcode routine |
639 |
< |
EmulOp(*(uint16 *)(r->pc), (M68kRegisters *)r); |
639 |
> |
EmulOp(opcode, (M68kRegisters *)r); |
640 |
|
r->pc += 2; |
641 |
|
|
642 |
|
// Restore interrupts |