75 |
|
uint8 *ROMBaseHost; // ROM base (host address space) |
76 |
|
uint32 ROMSize; // Size of ROM |
77 |
|
|
78 |
– |
uint32 MacsBugFlags = 0xbff; |
79 |
– |
|
78 |
|
|
79 |
|
// CPU and FPU type, addressing mode |
80 |
|
int CPUType; |
97 |
|
struct Library *DiskBase = NULL; |
98 |
|
|
99 |
|
struct Task *MainTask; // Our task |
100 |
< |
uint32 ScratchMem = NULL; // Scratch memory for Mac ROM writes |
100 |
> |
uint8 *ScratchMem = NULL; // Scratch memory for Mac ROM writes |
101 |
|
APTR OldTrapHandler = NULL; // Old trap handler |
102 |
|
APTR OldExceptionHandler = NULL; // Old exception handler |
103 |
|
BYTE IRQSig = -1; // "Interrupt" signal number |
125 |
|
extern "C" void IllInstrHandler(trap_regs *regs); |
126 |
|
extern "C" void PrivViolHandler(trap_regs *regs); |
127 |
|
extern "C" void quit_emulator(void); |
128 |
+ |
extern "C" void AsmTriggerNMI(void); |
129 |
|
uint16 EmulatedSR; // Emulated SR (supervisor bit and interrupt mask) |
130 |
|
|
131 |
|
|
138 |
|
* Main program |
139 |
|
*/ |
140 |
|
|
141 |
< |
int main(void) |
141 |
> |
int main(int argc, char **argv) |
142 |
|
{ |
143 |
|
// Initialize variables |
144 |
|
RAMBaseHost = NULL; |
188 |
|
CyberGfxBase = OpenLibrary((UBYTE *)"cybergraphics.library", 2); |
189 |
|
|
190 |
|
// Read preferences |
191 |
< |
PrefsInit(); |
191 |
> |
PrefsInit(argc, argv); |
192 |
|
|
193 |
|
// Open AHI |
194 |
|
ahi_port = CreateMsgPort(); |
229 |
|
TimerBase = (struct Library *)timereq->tr_node.io_Device; |
230 |
|
|
231 |
|
// Allocate scratch memory |
232 |
< |
ScratchMem = (uint32)AllocMem(SCRATCH_MEM_SIZE, MEMF_PUBLIC); |
232 |
> |
ScratchMem = (uint8 *)AllocMem(SCRATCH_MEM_SIZE, MEMF_PUBLIC); |
233 |
|
if (ScratchMem == NULL) { |
234 |
|
ErrorAlert(GetString(STR_NO_MEM_ERR)); |
235 |
|
QuitEmulator(); |
244 |
|
RAMSize = 1024*1024; |
245 |
|
} |
246 |
|
RAMBaseHost = (uint8 *)AllocVec(RAMSize + 0x100000, MEMF_PUBLIC); |
247 |
< |
// if (RAMBaseHost == NULL) { |
249 |
< |
// ErrorAlert(GetString(STR_NO_MEM_ERR)); |
250 |
< |
// QuitEmulator(); |
251 |
< |
// } |
252 |
< |
if (RAMBaseHost == NULL) |
253 |
< |
{ |
247 |
> |
if (RAMBaseHost == NULL) { |
248 |
|
uint32 newRAMSize = AvailMem(MEMF_LARGEST) - 0x100000; |
249 |
|
char xText[120]; |
250 |
|
|
251 |
|
sprintf(xText, GetString(STR_NOT_ENOUGH_MEM_WARN), RAMSize, newRAMSize); |
252 |
|
|
253 |
< |
if (1 != ChoiceAlert(xText, "Use", "Quit")) |
253 |
> |
if (ChoiceAlert(xText, "Use", "Quit") != 1) |
254 |
|
QuitEmulator(); |
255 |
|
|
256 |
|
RAMSize = newRAMSize; |
259 |
|
ErrorAlert(GetString(STR_NO_MEM_ERR)); |
260 |
|
QuitEmulator(); |
261 |
|
} |
262 |
< |
} |
262 |
> |
} |
263 |
|
RAMBaseMac = (uint32)RAMBaseHost; |
264 |
|
D(bug("Mac RAM starts at %08lx\n", RAMBaseHost)); |
265 |
|
ROMBaseHost = RAMBaseHost + RAMSize; |
326 |
|
// Set task priority to -1 so we don't use all processing time |
327 |
|
SetTaskPri(MainTask, -1); |
328 |
|
|
329 |
< |
WriteMacInt32(MacsBugFlags, 0); |
329 |
> |
WriteMacInt32(0xbff, 0); // MacsBugFlags |
330 |
|
|
331 |
|
// Swap stack to Mac RAM area |
332 |
|
stack_swap.stk_Lower = RAMBaseHost; |