1 |
cebix |
1.1 |
/* |
2 |
|
|
* cpu_emulation.h - Definitions for Basilisk II CPU emulation module (Apple PowerMac ROM 680x0 emulator version (BeOS/PPC)) |
3 |
|
|
* |
4 |
cebix |
1.2 |
* Basilisk II (C) 1997-2000 Christian Bauer |
5 |
cebix |
1.1 |
*/ |
6 |
|
|
|
7 |
|
|
#ifndef CPU_EMULATION_H |
8 |
|
|
#define CPU_EMULATION_H |
9 |
|
|
|
10 |
|
|
|
11 |
|
|
/* |
12 |
|
|
* Memory system |
13 |
|
|
*/ |
14 |
|
|
|
15 |
|
|
// RAM and ROM pointers (allocated and set by main_*.cpp) |
16 |
|
|
extern uint32 RAMBaseMac; // RAM base (Mac address space), does not include Low Mem when != 0 |
17 |
|
|
extern uint8 *RAMBaseHost; // RAM base (host address space) |
18 |
|
|
extern uint32 RAMSize; // Size of RAM |
19 |
|
|
|
20 |
|
|
extern uint32 ROMBaseMac; // ROM base (Mac address space) |
21 |
|
|
extern uint8 *ROMBaseHost; // ROM base (host address space) |
22 |
|
|
extern uint32 ROMSize; // Size of ROM |
23 |
|
|
|
24 |
|
|
// Mac memory access functions |
25 |
|
|
static inline uint32 ReadMacInt32(uint32 addr) {return ntohl(*(uint32 *)addr);} |
26 |
|
|
static inline uint32 ReadMacInt16(uint32 addr) {return ntohs(*(uint16 *)addr);} |
27 |
|
|
static inline uint32 ReadMacInt8(uint32 addr) {return *(uint8 *)addr;} |
28 |
|
|
static inline void WriteMacInt32(uint32 addr, uint32 l) {*(uint32 *)addr = htonl(l);} |
29 |
|
|
static inline void WriteMacInt16(uint32 addr, uint32 w) {*(uint16 *)addr = htons(w);} |
30 |
|
|
static inline void WriteMacInt8(uint32 addr, uint32 b) {*(uint8 *)addr = b;} |
31 |
|
|
static inline uint8 *Mac2HostAddr(uint32 addr) {return (uint8 *)addr;} |
32 |
|
|
|
33 |
|
|
|
34 |
|
|
/* |
35 |
|
|
* 680x0 emulation |
36 |
|
|
*/ |
37 |
|
|
|
38 |
|
|
// Initialization |
39 |
|
|
extern bool Init680x0(void); // This routine may want to look at CPUType/FPUType to set up the apropriate emulation |
40 |
|
|
extern void Exit680x0(void); |
41 |
|
|
|
42 |
|
|
// 680x0 emulation functions |
43 |
|
|
struct M68kRegisters; |
44 |
|
|
extern void Start680x0(void); // Reset and start 680x0 |
45 |
|
|
extern "C" void Execute68k(uint32 addr, M68kRegisters *r); // Execute 68k code from EMUL_OP routine |
46 |
|
|
extern "C" void Execute68kTrap(uint16 trap, M68kRegisters *r); // Execute MacOS 68k trap from EMUL_OP routine |
47 |
|
|
|
48 |
|
|
// Interrupt functions |
49 |
|
|
extern void TriggerInterrupt(void); // Trigger interrupt (InterruptFlag must be set first) |
50 |
|
|
|
51 |
|
|
#endif |