59 |
|
# endif |
60 |
|
#endif |
61 |
|
|
62 |
< |
// Are we using a PPC emulator or the real thing? |
63 |
< |
#ifdef __powerpc__ |
64 |
< |
#define EMULATED_PPC 0 |
65 |
< |
#else |
66 |
< |
#define EMULATED_PPC 1 |
67 |
< |
#endif |
62 |
> |
// Define for external components |
63 |
> |
#define SHEEPSHAVER 1 |
64 |
> |
|
65 |
> |
// Mac and host address space are the same |
66 |
> |
#define REAL_ADDRESSING 1 |
67 |
|
|
68 |
|
#define POWERPC_ROM 1 |
69 |
|
|
70 |
+ |
#if EMULATED_PPC |
71 |
+ |
// Mac ROM is write protected when banked memory is used |
72 |
+ |
#if REAL_ADDRESSING || DIRECT_ADDRESSING |
73 |
+ |
# define ROM_IS_WRITE_PROTECTED 0 |
74 |
+ |
# define USE_SCRATCHMEM_SUBTERFUGE 1 |
75 |
+ |
#else |
76 |
+ |
# define ROM_IS_WRITE_PROTECTED 1 |
77 |
+ |
#endif |
78 |
+ |
#else |
79 |
+ |
// Mac ROM is write protected |
80 |
+ |
#define ROM_IS_WRITE_PROTECTED 1 |
81 |
+ |
#define USE_SCRATCHMEM_SUBTERFUGE 0 |
82 |
+ |
#endif |
83 |
+ |
|
84 |
|
// Data types |
85 |
|
typedef unsigned char uint8; |
86 |
|
typedef signed char int8; |
125 |
|
#error "Unsupported size of pointer" |
126 |
|
#endif |
127 |
|
|
128 |
+ |
// Helper functions to byteswap data |
129 |
+ |
#ifdef HAVE_BYTESWAP_H |
130 |
+ |
#include <byteswap.h> |
131 |
+ |
#endif |
132 |
+ |
|
133 |
+ |
#ifndef bswap_16 |
134 |
+ |
#define bswap_16 generic_bswap_16 |
135 |
+ |
#endif |
136 |
+ |
|
137 |
+ |
static inline uint16 generic_bswap_16(uint16 x) |
138 |
+ |
{ |
139 |
+ |
return ((x & 0xff) << 8) | ((x >> 8) & 0xff); |
140 |
+ |
} |
141 |
+ |
|
142 |
+ |
#ifndef bswap_32 |
143 |
+ |
#define bswap_32 generic_bswap_32 |
144 |
+ |
#endif |
145 |
+ |
|
146 |
+ |
static inline uint32 generic_bswap_32(uint32 x) |
147 |
+ |
{ |
148 |
+ |
return (((x & 0xff000000) >> 24) | |
149 |
+ |
((x & 0x00ff0000) >> 8) | |
150 |
+ |
((x & 0x0000ff00) << 8) | |
151 |
+ |
((x & 0x000000ff) << 24) ); |
152 |
+ |
} |
153 |
+ |
|
154 |
+ |
#ifndef bswap_64 |
155 |
+ |
#define bswap_64 generic_bswap_64 |
156 |
+ |
#endif |
157 |
+ |
|
158 |
+ |
static inline uint64 generic_bswap_64(uint64 x) |
159 |
+ |
{ |
160 |
+ |
return (((x & UVAL64(0xff00000000000000)) >> 56) | |
161 |
+ |
((x & UVAL64(0x00ff000000000000)) >> 40) | |
162 |
+ |
((x & UVAL64(0x0000ff0000000000)) >> 24) | |
163 |
+ |
((x & UVAL64(0x000000ff00000000)) >> 8) | |
164 |
+ |
((x & UVAL64(0x00000000ff000000)) << 8) | |
165 |
+ |
((x & UVAL64(0x0000000000ff0000)) << 24) | |
166 |
+ |
((x & UVAL64(0x000000000000ff00)) << 40) | |
167 |
+ |
((x & UVAL64(0x00000000000000ff)) << 56) ); |
168 |
+ |
} |
169 |
+ |
|
170 |
+ |
#ifdef WORDS_BIGENDIAN |
171 |
+ |
static inline uint16 tswap16(uint16 x) { return x; } |
172 |
+ |
static inline uint32 tswap32(uint32 x) { return x; } |
173 |
+ |
static inline uint64 tswap64(uint64 x) { return x; } |
174 |
+ |
#else |
175 |
+ |
static inline uint16 tswap16(uint16 x) { return bswap_16(x); } |
176 |
+ |
static inline uint32 tswap32(uint32 x) { return bswap_32(x); } |
177 |
+ |
static inline uint64 tswap64(uint64 x) { return bswap_64(x); } |
178 |
+ |
#endif |
179 |
+ |
|
180 |
|
// Time data type for Time Manager emulation |
181 |
|
#ifdef HAVE_CLOCK_GETTIME |
182 |
|
typedef struct timespec tm_time_t; |