home *** CD-ROM | disk | FTP | other *** search
- /*
- File: InterruptSafeDebug.h
-
- Contains: Library for logging directly to the screen.
-
- Written by: Quinn "The Eskimo!"
-
- Copyright: © 1998 by Apple Computer, Inc., all rights reserved.
-
- You may incorporate this Apple sample source code into your program(s) without
- restriction. This Apple sample source code has been provided "AS IS" and the
- responsibility for its operation is yours. You are not permitted to redistribute
- this Apple sample source code as "Apple sample source code" after having made
- changes. If you're going to re-distribute the source, we require that you make
- it clear in the source that the code was descended from Apple sample source
- code, but that you've made changes.
-
- Change History (most recent first):
-
- <1> 23/11/98 Quinn First checked in.
- */
-
- #pragma once
-
- /////////////////////////////////////////////////////////////////////
-
- #include "MoreSetup.h"
- #include <MacTypes.h>
-
- /////////////////////////////////////////////////////////////////////
-
- // WARNING
- // Once initialised, this library has a cached copy of the screen
- // base, bit depth, and row bytes. If the screen geometry
- // (ie resolution or bit depth) changes, this module is likely to
- // start writing over random bits of memory. You must be sure to
- // reinitialise the module before logging any text if the screen
- // geometry changes.
-
- /////////////////////////////////////////////////////////////////////
-
- // The following parameter can be twiddled to suit your particular
- // environment.
-
- enum {
-
- kISDebugNumberOfColumns = 64,
- kISDebugNumberOfRows = 32,
- // These values were chosen to fit on the smallest
- // Mac display. If you want, you can increase the size.
- // Be sure to always make them a power of 2, otherwise
- // the MOD of gCurrentCharIndex by kMaxCharIndex will do
- // weird things.
-
- kISDebugMaxCharIndex = kISDebugNumberOfColumns * kISDebugNumberOfRows,
-
- kISDebugXPixelOffset = 0,
- kISDebugYPixelOffset = 0
- // You can use these constants to position the debugging
- // output in an appropriate place on the screen for your
- // tests.
- };
-
- /////////////////////////////////////////////////////////////////////
-
- extern OSStatus InitInterruptSafeDebug(void);
- // You must call this routine before calling any of the following.
- // You may call this routine more than once, which is useful
- // is the display geometry has changed.
-
- extern void ISDebugChar(UInt8 ch);
- extern void ISDebugText(const UInt8 *text, ByteCount len);
- extern void ISDebugStr (ConstStr255Param str);
- extern void ISdebugstr (const char *str);
- // These routines write the supplied parameter directly to
- // the screen, bypassing QuickDraw and the rest of the OS.
- // The routines are completely interrupt-safe, including
- // when paging is unsafe (as long as you can guarantee that
- // the code and data sections are held resident).
-
- /////////////////////////////////////////////////////////////////////
-