1 |
|
/* |
2 |
|
* macos_util.h - MacOS definitions/utility functions |
3 |
|
* |
4 |
< |
* Basilisk II (C) 1997-1999 Christian Bauer |
4 |
> |
* Basilisk II (C) 1997-2008 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 |
21 |
|
#ifndef MACOS_UTIL_H |
22 |
|
#define MACOS_UTIL_H |
23 |
|
|
24 |
+ |
#include "cpu_emulation.h" |
25 |
+ |
|
26 |
|
|
27 |
|
/* |
28 |
|
* Queues |
70 |
|
closErr = -24, |
71 |
|
abortErr = -27, |
72 |
|
notOpenErr = -28, |
73 |
+ |
dskFulErr = -34, |
74 |
+ |
nsvErr = -35, |
75 |
|
ioErr = -36, |
76 |
+ |
bdNamErr = -37, |
77 |
+ |
fnOpnErr = -38, |
78 |
+ |
eofErr = -39, |
79 |
+ |
posErr = -40, |
80 |
+ |
tmfoErr = -42, |
81 |
+ |
fnfErr = -43, |
82 |
|
wPrErr = -44, |
83 |
+ |
fLckdErr = -45, |
84 |
+ |
fBsyErr = -47, |
85 |
+ |
dupFNErr = -48, |
86 |
|
paramErr = -50, |
87 |
+ |
rfNumErr = -51, |
88 |
+ |
permErr = -54, |
89 |
|
nsDrvErr = -56, |
90 |
+ |
extFSErr = -58, |
91 |
|
noDriveErr = -64, |
92 |
|
offLinErr = -65, |
93 |
|
noNybErr = -66, |
109 |
|
fmt1Err = -82, |
110 |
|
fmt2Err = -83, |
111 |
|
verErr = -84, |
112 |
< |
memFullErr = -108 |
112 |
> |
memFullErr = -108, |
113 |
> |
dirNFErr = -120 |
114 |
|
}; |
115 |
|
|
116 |
|
// Misc constants |
173 |
|
ioActCount = 40, |
174 |
|
ioPosMode = 44, |
175 |
|
ioPosOffset = 46, |
176 |
< |
ioWPosOffset = 46 // Wide positioning offset when ioPosMode has kWidePosOffsetBit set |
176 |
> |
ioWPosOffset = 46, // Wide positioning offset when ioPosMode has kWidePosOffsetBit set |
177 |
> |
SIZEOF_IOParam = 50 |
178 |
|
}; |
179 |
|
|
180 |
|
enum { // CntrlParam struct |
245 |
|
}; |
246 |
|
|
247 |
|
|
248 |
+ |
// Definitions for DebugUtil() Selector |
249 |
+ |
enum { |
250 |
+ |
duDebuggerGetMax = 0, |
251 |
+ |
duDebuggerEnter = 1, |
252 |
+ |
duDebuggerExit = 2, |
253 |
+ |
duDebuggerPoll = 3, |
254 |
+ |
duGetPageState = 4, |
255 |
+ |
duPageFaultFatal = 5, |
256 |
+ |
duDebuggerLockMemory = 6, |
257 |
+ |
duDebuggerUnlockMemory = 7, |
258 |
+ |
duEnterSupervisorMode = 8 |
259 |
+ |
}; |
260 |
+ |
|
261 |
|
// Functions |
262 |
< |
extern void Enqueue(uint32 elem, uint32 list); // Enqueue QElem in list |
263 |
< |
extern int FindFreeDriveNumber(int num); // Find first free drive number, starting at "num" |
264 |
< |
extern void MountVolume(void *fh); // Mount volume with given file handle (see sys.h) |
234 |
< |
extern bool HasMacStarted(void); // Test if basic MacOS initializations are done |
262 |
> |
extern void EnqueueMac(uint32 elem, uint32 list); // Enqueue QElem in list |
263 |
> |
extern int FindFreeDriveNumber(int num); // Find first free drive number, starting at "num" |
264 |
> |
extern void MountVolume(void *fh); // Mount volume with given file handle (see sys.h) |
265 |
|
extern void FileDiskLayout(loff_t size, uint8 *data, loff_t &start_byte, loff_t &real_size); // Calculate disk image file layout given file size and first 256 data bytes |
266 |
+ |
extern uint32 DebugUtil(uint32 Selector); // DebugUtil() Replacement |
267 |
+ |
extern uint32 TimeToMacTime(time_t t); // Convert time_t value to MacOS time |
268 |
+ |
|
269 |
+ |
// Construct four-character-code |
270 |
+ |
#define FOURCC(a,b,c,d) (((uint32)(a) << 24) | ((uint32)(b) << 16) | ((uint32)(c) << 8) | (uint32)(d)) |
271 |
+ |
|
272 |
+ |
// Emulator identification codes (4 and 2 characters) |
273 |
+ |
const uint32 EMULATOR_ID_4 = 0x62617369; // 'basi' |
274 |
+ |
const uint16 EMULATOR_ID_2 = 0x6261; // 'ba' |
275 |
+ |
|
276 |
+ |
// Test if basic MacOS initializations (of the ROM) are done |
277 |
+ |
static inline bool HasMacStarted(void) |
278 |
+ |
{ |
279 |
+ |
return ReadMacInt32(0xcfc) == FOURCC('W','L','S','C'); // Mac warm start flag |
280 |
+ |
} |
281 |
|
|
282 |
|
#endif |