	Three files have been changed:  TBServer.c, TBServer.a, and New-Mode.Lisp.
The changes are described in this document.  Many new slots in MacStateAcb
have been defined.  They are described where appropriate as well as being
summarized at the end of this document.  The changes are implemented to fix
two bugs and provide some optimizations.  The bugs fixed are the "hanging bug"
and the bug which occurs when the TBServer is used on a system with 32 Bit
Quickdraw.

	The "hanging bug", which occurs when the TBServer is brought to the
foreground, seems to have been caused by the server not calling WaitNextEvent.
It seems that EventAvail treats suspend and resume events just like any other
event type.  That is, the same suspend or resume event is returned every time
EventAvail is called until WaitNextEvent or GetNextEvent is called.  In
addition, when this happens, processing time is not distributed to other
applications in the Mac system.  This is why you cannot click from a "dead"
TBServer (one which is not receiving !WaitNextEvent commands from the mX) to
any other Mac applications.  This is not the way EventAvail is documented
in the MultiFinder Programmer's Guide, but it is the way it behaves.
Interestingly, this behavior only occurs when the acceptSuspendResume bit is
set in the SIZE resource.  If this bit is not set, EventAvail behaves as
documented.

	When the global variable async_events is 2, the function event_handler calls
UpdateMacStateAcb.  UpdateMacStateAcb in turn calls GetEventAvailMask to see
if there is an event pending.  GetEventAvailMask has been modified as follows:

	A new slot in MacStateAcb has been defined.  Word offset 12 in
MacStateAcb is a flag which if set means the TBServer should get and discard
any pending events.  This flag can be set to indicate that the mX is not going
to call !WaitNextEvent.
	GetEventAvailMask begins by calling EventAvail to see if an event is
pending, and if so does the following:  The event discard flag is checked, and
if it is set, WaitNextEvent is called to "eat" the event.  If instead the
event is not to be discarded, the event is checked to see if it is a suspend
or resume event, and if so is processed as before, with the exception that
word offset 13 is set with a flag indicating whether or not the server is
suspended or resumed.
	In the last case, in which the event is not to be discarded and
the event is not a suspend or resume event, WaitNextEvent is called with a
mask of 0, which distributes time to the other Mac applications without
removing the event.

	The 32 Bit Quickdraw bug is really a bug in CopyBits in 32 Bit Quickdraw.
If one of the rectangles passed to CopyBits lies in NuBus memory, it copies
garbage onto the screen and sometimes hangs.  All of the rectangles passed by
TBI are left in the acb, which is in NuBus space, causing the bug.  A
workaround was installed in TBServer.c and TBServer.a.

	In TBServer.c, two global variables have been defined.  RectStack is an
array of 5 rectangles, and rectStackPointer is an integer.  These two
variables implement a stack of rectangles.  This stack is used by the RectType
code in TBServer.a.  When a RectType is passed to TBServer.a, it is copied
from its location in NuBus space to the next available slot in the stack of
rectangles.  In TBServer.c, rectStackPointer is always reset to 0 in
handle_traps, so there are always five available slots in the stack for
rectangle parameters of any trap.  The VRectType code from was not modified
because it did not appear necessary.

	A new function has been added to New-Mode.Lisp.  Set-event-discard-flag
takes as a parameter a flag which is nil or non-nil and sets word offset 12
in MacStateAcb appropriately.

	A new function has been added to TBServer.c, SaveMacStateAcb.  This
function is called every time around the TBServer's main loop, and it fills
in most of the new slots in MacStateAcb.  These new slots are defined below:

Word Offset			Meaning
	12			Event discard flag (1 = discard, 0 = don't discard)
	13			Foreground flag (1 = foreground, 0 = background)
	22			Current grafPort's version number (see IM vol V)
	23			Current grafPort's pixel depth (only valid for color
					grafPorts)
	24			Current grafPort's portRect.top
	25			Current grafPort's portRect.left
	26			Current grafPort's portRect.bottom
	27			Current grafPort's portRect.right
	30			Current grafPort's pnLoc.v
	31			Current grafPort's pnLoc.h
	32			Current grafPort's pnSize.v
	32			Current grafPort's pnSize.h
	34			Current grafPort's pnMode
	35			Current grafPort's txFont
	36			Current grafPort's txFace
	37			Current grafPort's txMode
	38			Current grafPort's txSize
	39			Current grafPort's pen pattern type number (see IM vol V) 
	44			Current grafPort's backgound pattern type number
					(see IM vol V)
	45			Current grafPort's fill pattern type number (see IM vol V)
	54			Red component of current grafPort's foreground color
	55			Green component of current grafPort's foreground color
	56			Blue component of current grafPort's foreground color 
	57			Red component of current grafPort's background color 
	58			Green component of current grafPort's background color 
	59			Blue component of current grafPort's background color

Long Word Offset	Meaning
	4			Pointer to current grafPort
	7			Pointer to the front window
	14			Counter for the number of trap calls made.

In addition, the 4 words starting at word offset 40 contain the pen pattern of
the current port, the 4 words starting at word offset 46 contain the
background pattern of the current grafPort, and the 4 words starting at word
offset 50 contain the fill pattern of the current grafPort.

	These values are intended to be used by mX programs to examine the state
of the Macintosh without having to make explicit calls across the bus.
Currently, Action! examines these values before making many Quickdraw calls,
speeding up the code significantly.

	A last note about modifications is that the code has been reformatted
into a style more readable in MPW.  Also, all of the functions and some of the
variables have been marked.