--- BasiliskII/src/include/macos_util.h 1999/10/19 19:28:27 1.3 +++ BasiliskII/src/include/macos_util.h 2001/02/02 20:52:59 1.11 @@ -1,7 +1,7 @@ /* * macos_util.h - MacOS definitions/utility functions * - * Basilisk II (C) 1997-1999 Christian Bauer + * Basilisk II (C) 1997-2001 Christian Bauer * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -21,6 +21,8 @@ #ifndef MACOS_UTIL_H #define MACOS_UTIL_H +#include "cpu_emulation.h" + /* * Queues @@ -243,11 +245,37 @@ enum { // DeferredTask struct }; +// Definitions for DebugUtil() Selector +enum { + duDebuggerGetMax = 0, + duDebuggerEnter = 1, + duDebuggerExit = 2, + duDebuggerPoll = 3, + duGetPageState = 4, + duPageFaultFatal = 5, + duDebuggerLockMemory = 6, + duDebuggerUnlockMemory = 7, + duEnterSupervisorMode = 8 +}; + // Functions extern void EnqueueMac(uint32 elem, uint32 list); // Enqueue QElem in list extern int FindFreeDriveNumber(int num); // Find first free drive number, starting at "num" extern void MountVolume(void *fh); // Mount volume with given file handle (see sys.h) -extern bool HasMacStarted(void); // Test if basic MacOS initializations are done 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 +extern uint32 DebugUtil(uint32 Selector); // DebugUtil() Replacement + +// Construct four-character-code +#define FOURCC(a,b,c,d) (((uint32)(a) << 24) | ((uint32)(b) << 16) | ((uint32)(c) << 8) | (uint32)(d)) + +// Emulator identification codes (4 and 2 characters) +const uint32 EMULATOR_ID_4 = 0x62617369; // 'basi' +const uint16 EMULATOR_ID_2 = 0x6261; // 'ba' + +// Test if basic MacOS initializations (of the ROM) are done +static inline bool HasMacStarted(void) +{ + return ReadMacInt32(0xcfc) == FOURCC('W','L','S','C'); // Mac warm start flag +} #endif