1 |
|
/* |
2 |
|
* basilisk_glue.cpp - Glue UAE CPU to Basilisk II CPU engine interface |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2002 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2005 Christian Bauer |
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 |
22 |
|
|
23 |
|
#include "cpu_emulation.h" |
24 |
|
#include "main.h" |
25 |
+ |
#include "prefs.h" |
26 |
|
#include "emul_op.h" |
27 |
|
#include "rom_patches.h" |
28 |
+ |
#include "timer.h" |
29 |
|
#include "m68k.h" |
30 |
|
#include "memory.h" |
31 |
|
#include "readcpu.h" |
32 |
|
#include "newcpu.h" |
33 |
+ |
#include "compiler/compemu.h" |
34 |
|
|
35 |
|
|
36 |
|
// RAM and ROM pointers |
37 |
< |
uint32 RAMBaseMac = 0; // RAM base (Mac address space) gb-- init is important |
37 |
> |
uint32 RAMBaseMac = 0; // RAM base (Mac address space) gb-- initializer is important |
38 |
|
uint8 *RAMBaseHost; // RAM base (host address space) |
39 |
|
uint32 RAMSize; // Size of RAM |
40 |
|
uint32 ROMBaseMac; // ROM base (Mac address space) |
52 |
|
uintptr MEMBaseDiff; // Global offset between a Mac address and its Host equivalent |
53 |
|
#endif |
54 |
|
|
55 |
+ |
#if USE_JIT |
56 |
+ |
bool UseJIT = false; |
57 |
+ |
#endif |
58 |
+ |
|
59 |
|
// From newcpu.cpp |
60 |
< |
extern int quit_program; |
60 |
> |
extern bool quit_program; |
61 |
|
|
62 |
|
|
63 |
|
/* |
68 |
|
{ |
69 |
|
#if REAL_ADDRESSING |
70 |
|
// Mac address space = host address space |
71 |
< |
RAMBaseMac = (uint32)RAMBaseHost; |
72 |
< |
ROMBaseMac = (uint32)ROMBaseHost; |
71 |
> |
RAMBaseMac = (uintptr)RAMBaseHost; |
72 |
> |
ROMBaseMac = (uintptr)ROMBaseHost; |
73 |
|
#elif DIRECT_ADDRESSING |
74 |
|
// Mac address space = host address space minus constant offset (MEMBaseDiff) |
75 |
|
// NOTE: MEMBaseDiff is set up in main_unix.cpp/main() |
97 |
|
#endif |
98 |
|
|
99 |
|
init_m68k(); |
100 |
+ |
#if USE_JIT |
101 |
+ |
UseJIT = compiler_use_jit(); |
102 |
+ |
if (UseJIT) |
103 |
+ |
compiler_init(); |
104 |
+ |
#endif |
105 |
|
return true; |
106 |
|
} |
107 |
|
|
112 |
|
|
113 |
|
void Exit680x0(void) |
114 |
|
{ |
115 |
+ |
#if USE_JIT |
116 |
+ |
if (UseJIT) |
117 |
+ |
compiler_exit(); |
118 |
+ |
#endif |
119 |
|
exit_m68k(); |
120 |
|
} |
121 |
|
|
138 |
|
void Start680x0(void) |
139 |
|
{ |
140 |
|
m68k_reset(); |
141 |
+ |
#if USE_JIT |
142 |
+ |
if (UseJIT) |
143 |
+ |
m68k_compile_execute(); |
144 |
+ |
else |
145 |
+ |
#endif |
146 |
|
m68k_execute(); |
147 |
|
} |
148 |
|
|
153 |
|
|
154 |
|
void TriggerInterrupt(void) |
155 |
|
{ |
156 |
+ |
idle_resume(); |
157 |
|
SPCFLAGS_SET( SPCFLAG_INT ); |
158 |
|
} |
159 |
|
|
200 |
|
// Execute trap |
201 |
|
m68k_setpc(m68k_areg(regs, 7)); |
202 |
|
fill_prefetch_0(); |
203 |
< |
quit_program = 0; |
203 |
> |
quit_program = false; |
204 |
|
m68k_execute(); |
205 |
|
|
206 |
|
// Clean up stack |
215 |
|
r->d[i] = m68k_dreg(regs, i); |
216 |
|
for (i=0; i<7; i++) |
217 |
|
r->a[i] = m68k_areg(regs, i); |
218 |
< |
quit_program = 0; |
218 |
> |
quit_program = false; |
219 |
|
} |
220 |
|
|
221 |
|
|
247 |
|
// Execute routine |
248 |
|
m68k_setpc(addr); |
249 |
|
fill_prefetch_0(); |
250 |
< |
quit_program = 0; |
250 |
> |
quit_program = false; |
251 |
|
m68k_execute(); |
252 |
|
|
253 |
|
// Clean up stack |
262 |
|
r->d[i] = m68k_dreg(regs, i); |
263 |
|
for (i=0; i<7; i++) |
264 |
|
r->a[i] = m68k_areg(regs, i); |
265 |
< |
quit_program = 0; |
265 |
> |
quit_program = false; |
266 |
|
} |