ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/BasiliskII/src/powerrom_cpu/cpu_emulation.h
Revision: 1.3
Committed: 2000-09-22T17:32:10Z (24 years, 1 month ago) by gbeauche
Content type: text/plain
Branch: MAIN
Changes since 1.2: +1 -0 lines
Log Message:
- added Host2MacAddr()

File Contents

# Content
1 /*
2 * cpu_emulation.h - Definitions for Basilisk II CPU emulation module (Apple PowerMac ROM 680x0 emulator version (BeOS/PPC))
3 *
4 * Basilisk II (C) 1997-2000 Christian Bauer
5 */
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 static inline uint32 Host2MacAddr(uint8 *addr) {return (uint32)addr;}
33
34
35 /*
36 * 680x0 emulation
37 */
38
39 // Initialization
40 extern bool Init680x0(void); // This routine may want to look at CPUType/FPUType to set up the apropriate emulation
41 extern void Exit680x0(void);
42
43 // 680x0 emulation functions
44 struct M68kRegisters;
45 extern void Start680x0(void); // Reset and start 680x0
46 extern "C" void Execute68k(uint32 addr, M68kRegisters *r); // Execute 68k code from EMUL_OP routine
47 extern "C" void Execute68kTrap(uint16 trap, M68kRegisters *r); // Execute MacOS 68k trap from EMUL_OP routine
48
49 // Interrupt functions
50 extern void TriggerInterrupt(void); // Trigger interrupt (InterruptFlag must be set first)
51
52 #endif