Think Reference 2.0.1 has a statement in its sample code which states:
ADDENDUM: The above information seems to be incorrect in the reference manual. I have found through testing etc. that in both modes, the Flag Byte appears at location 0xBFF. The code reflects these findings.
This is because they confused running in 24 bit mode, running in 32 bit mode, and the _ability_ to run in 32 bit mode. It is the latter ability which you must test to determine the location of the debugger flags.
#include/* the 2 low memory locations you might need */ #define MacJmpByte (char *) 0x120 /* Macsbug flag on old machines */ #define MacJmpFlag (char *) 0xBFF /* MacsBug flag [byte] */ #define DebuggerInstalled 5 Boolean DebuggerIsPresent() { long addressingMode; short debugFlags; Gestalt(gestaltAddressingModeAttr, &addressingMode); if (addressingMode & (1 << gestalt32BitCapable)) debugFlags = *MacJmpFlag; else debugFlags = *MacJmpByte; return (debugFlags & (1 << DebuggerInstalled)); }