home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-05-04 | 1.0 KB | 50 lines | [TEXT/PJMM] |
- unit MCCompatibility;
- {from page 3-8 of IM VI}
- interface
-
- function NumToolboxTraps: integer;
- function GetTrapType (theTrap: integer): TrapType;
- function TrapAvailable (theTrap: integer): boolean;
- function WNEAvailable: boolean;
-
- implementation
-
- function NumToolboxTraps;
- begin
- if NGetTrapAddress($A86E, ToolTrap) = NGetTrapAddress($AA6E, Tooltrap) then
- NumToolBoxTraps := $200
- else
- NumToolBoxTraps := $400;
- end;
-
- function GetTrapType;
- const
- TrapMask = $0800;
- begin
- if BAnd(theTrap, TrapMask) > 0 then
- GetTrapType := ToolTrap
- else
- GetTrapType := OSTrap;
- end;
-
- function TrapAvailable;
- var
- tType: TrapType;
- begin
- tType := GetTrapType(theTrap);
- if tType = ToolTrap then
- begin
- theTrap := BAnd(theTrap, $07FF);
- if theTrap >= NumToolboxTraps then
- theTrap := $A89F; {Unimplemented}
- end;
- TrapAvailable := NGetTrapAddress(theTrap, tType) <> NGetTrapAddress($A89F, ToolTrap);
- end;
-
- function WNEAvailable;
- const
- _WaitNextEvent = $A860;
- begin
- WNEAvailable := TrapAvailable(_WaitNextEvent);
- end;
- end.