1 |
|
/* |
2 |
|
* basilisk_glue.cpp - Glue UAE CPU to Basilisk II CPU engine interface |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-2000 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2002 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 |
28 |
|
#include "memory.h" |
29 |
|
#include "readcpu.h" |
30 |
|
#include "newcpu.h" |
31 |
– |
#include "compiler.h" |
31 |
|
|
32 |
|
|
33 |
|
// RAM and ROM pointers |
34 |
< |
uint32 RAMBaseMac; // RAM base (Mac address space) |
34 |
> |
uint32 RAMBaseMac = 0; // RAM base (Mac address space) gb-- init is important |
35 |
|
uint8 *RAMBaseHost; // RAM base (host address space) |
36 |
|
uint32 RAMSize; // Size of RAM |
37 |
|
uint32 ROMBaseMac; // ROM base (Mac address space) |
45 |
|
int MacFrameLayout; // Frame buffer layout |
46 |
|
#endif |
47 |
|
|
48 |
+ |
#if DIRECT_ADDRESSING |
49 |
+ |
uintptr MEMBaseDiff; // Global offset between a Mac address and its Host equivalent |
50 |
+ |
#endif |
51 |
+ |
|
52 |
|
// From newcpu.cpp |
53 |
|
extern int quit_program; |
54 |
|
|
63 |
|
// Mac address space = host address space |
64 |
|
RAMBaseMac = (uint32)RAMBaseHost; |
65 |
|
ROMBaseMac = (uint32)ROMBaseHost; |
66 |
+ |
#elif DIRECT_ADDRESSING |
67 |
+ |
// Mac address space = host address space minus constant offset (MEMBaseDiff) |
68 |
+ |
// NOTE: MEMBaseDiff is set up in main_unix.cpp/main() |
69 |
+ |
RAMBaseMac = 0; |
70 |
+ |
ROMBaseMac = Host2MacAddr(ROMBaseHost); |
71 |
|
#else |
72 |
|
// Initialize UAE memory banks |
73 |
|
RAMBaseMac = 0; |
90 |
|
#endif |
91 |
|
|
92 |
|
init_m68k(); |
85 |
– |
#ifdef USE_COMPILER |
86 |
– |
compiler_init(); |
87 |
– |
#endif |
93 |
|
return true; |
94 |
|
} |
95 |
|
|
100 |
|
|
101 |
|
void Exit680x0(void) |
102 |
|
{ |
103 |
+ |
exit_m68k(); |
104 |
|
} |
105 |
|
|
106 |
|
|
107 |
|
/* |
108 |
+ |
* Initialize memory mapping of frame buffer (called upon video mode change) |
109 |
+ |
*/ |
110 |
+ |
|
111 |
+ |
void InitFrameBufferMapping(void) |
112 |
+ |
{ |
113 |
+ |
#if !REAL_ADDRESSING && !DIRECT_ADDRESSING |
114 |
+ |
memory_init(); |
115 |
+ |
#endif |
116 |
+ |
} |
117 |
+ |
|
118 |
+ |
/* |
119 |
|
* Reset and start 680x0 emulation (doesn't return) |
120 |
|
*/ |
121 |
|
|
122 |
|
void Start680x0(void) |
123 |
|
{ |
124 |
|
m68k_reset(); |
125 |
< |
m68k_go(true); |
125 |
> |
m68k_execute(); |
126 |
|
} |
127 |
|
|
128 |
|
|
132 |
|
|
133 |
|
void TriggerInterrupt(void) |
134 |
|
{ |
135 |
< |
regs.spcflags |= SPCFLAG_INT; |
135 |
> |
SPCFLAGS_SET( SPCFLAG_INT ); |
136 |
> |
} |
137 |
> |
|
138 |
> |
void TriggerNMI(void) |
139 |
> |
{ |
140 |
> |
//!! not implemented yet |
141 |
|
} |
142 |
|
|
143 |
|
|
179 |
|
m68k_setpc(m68k_areg(regs, 7)); |
180 |
|
fill_prefetch_0(); |
181 |
|
quit_program = 0; |
182 |
< |
m68k_go(true); |
182 |
> |
m68k_execute(); |
183 |
|
|
184 |
|
// Clean up stack |
185 |
|
m68k_areg(regs, 7) += 4; |
226 |
|
m68k_setpc(addr); |
227 |
|
fill_prefetch_0(); |
228 |
|
quit_program = 0; |
229 |
< |
m68k_go(true); |
229 |
> |
m68k_execute(); |
230 |
|
|
231 |
|
// Clean up stack |
232 |
|
m68k_areg(regs, 7) += 2; |