4 |
|
* |
5 |
|
* $Id$ |
6 |
|
* |
7 |
< |
* Basilisk II (C) 1997-2002 Christian Bauer |
7 |
> |
* Basilisk II (C) 1997-2008 Christian Bauer |
8 |
|
* |
9 |
|
* This program is free software; you can redistribute it and/or modify |
10 |
|
* it under the terms of the GNU General Public License as published by |
24 |
|
#import "Emulator.h" |
25 |
|
#import "EmulatorView.h" |
26 |
|
|
27 |
– |
@implementation Emulator |
28 |
– |
|
27 |
|
#import "sysdeps.h" // Types used in Basilisk C++ code |
28 |
|
|
29 |
|
#import "main_macosx.h" // Prototypes for QuitEmuNoExit() and InitEmulator() |
30 |
|
#import "misc_macosx.h" // Some other prototypes |
31 |
|
#import "video_macosx.h" // Some window/view globals |
32 |
|
|
33 |
< |
#import <adb.h> |
34 |
< |
#import <main.h> |
35 |
< |
#import <prefs.h> |
36 |
< |
#import <timer.h> |
33 |
> |
#import "adb.h" |
34 |
> |
#import "main.h" |
35 |
> |
#import "prefs.h" |
36 |
> |
#import "timer.h" |
37 |
|
|
38 |
< |
#undef check() // memory.h defines a check macro, clashes with an OS X one? |
39 |
< |
#import <cpu_emulation.h> |
38 |
> |
#undef check // memory.h defines a check macro, clashes with an OS X one? |
39 |
> |
#import "cpu_emulation.h" |
40 |
|
|
41 |
|
#define DEBUG 0 |
42 |
< |
#import <debug.h> |
42 |
> |
#import "debug.h" |
43 |
> |
|
44 |
> |
@implementation Emulator |
45 |
|
|
46 |
|
// NSWindow method, which is invoked via delegation |
47 |
|
|
190 |
|
|
191 |
|
- (IBAction) Restart: (id)sender |
192 |
|
{ |
193 |
+ |
if ( ! running ) |
194 |
+ |
{ |
195 |
+ |
running = YES; // Start emulator |
196 |
+ |
[self runUpdate]; |
197 |
+ |
[self Resume: nil]; |
198 |
+ |
} |
199 |
+ |
|
200 |
|
if ( running ) |
201 |
< |
// reset680x0(); |
201 |
> |
#ifdef UAE_CPU_HAS_RESET |
202 |
> |
reset680x0(); |
203 |
> |
#else |
204 |
|
{ |
205 |
|
uaeCreated = NO; |
206 |
|
[redraw suspend]; |
228 |
|
if ( display_type != DISPLAY_SCREEN ) |
229 |
|
[redraw resume]; |
230 |
|
} |
231 |
+ |
#endif |
232 |
|
} |
233 |
|
|
234 |
|
- (IBAction) Resume: (id)sender |
353 |
|
#endif |
354 |
|
emul = [NNThread new]; |
355 |
|
RTC = [NNTimer new]; |
356 |
< |
redraw = [NNTimer new]; |
356 |
> |
redraw = [[NNTimer alloc] initWithAutoRelPool]; |
357 |
|
tick = [NNTimer new]; |
358 |
|
xPRAM = [NNTimer new]; |
359 |
|
|
424 |
|
|
425 |
|
- (void) RTCinterrupt |
426 |
|
{ |
427 |
< |
if ( uaeCreated ) |
428 |
< |
WriteMacInt32 (0x20c, TimerDateTime() ); // Update MacOS time |
427 |
> |
if ( ! uaeCreated ) |
428 |
> |
return; |
429 |
> |
|
430 |
> |
WriteMacInt32 (0x20c, TimerDateTime() ); // Update MacOS time |
431 |
> |
|
432 |
> |
SetInterruptFlag(INTFLAG_1HZ); |
433 |
> |
TriggerInterrupt(); |
434 |
|
} |
435 |
|
|
436 |
|
- (void) redrawScreen |