supermario/base/SuperMarioProj.1994-02-09/Internal/Asm/DispatchHelperPriv.a

101 lines
3.4 KiB
Plaintext
Raw Permalink Normal View History

2019-06-29 15:17:50 +00:00
;
; File: DispatchHelperPriv.a
;
; Written by: Jeff Miller
;
; Contains: Private interface file for DispatchHelper and ProcHelper.
;
; Copyright: © 1990-1991 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <6> 8/22/91 JSM Clean up header.
; <5> 1/30/91 gbm sab, #38: Change the already including this file variable to
; all uppercase (for security reasons)
; <4> 10/22/90 JSM Add dispatchFlags equates, remove obsolete sndIsLPtch equate,
; add DispatchUnimplementedRoutine macro.
; <3> 8/8/90 SAM Adding sndIsLPtch symbol that signals BBS to build
; DispatchHelper & ProcHelper as an old style ptch. •••-->
; Temporary <--••• Remove when sound is an Lptch.
; <2> 7/8/90 JSM Fix some comments in DispatchHelperTable.
; <1> 7/7/90 JSM First checked in.
;
IF &TYPE('__INCLUDINGDISPATCHHELPERPRIV__') = 'UNDEFINED' THEN
__INCLUDINGDISPATCHHELPERPRIV__ SET 1
;
; Bits defined for dispatchFlags. Note that even selectors are supported only when
; entries in the dispatch table are word offsets (i.e. you can't have both dhSelectorsEven
; and dhAbsoluteEntries set at the same time). The only reason for this is that nobody else
; currently uses even selectors besides the Edition Manager, which also uses word offsets.
;
dhSelectorsEven EQU 0 ; selectors are even
dhAbsoluteEntries EQU 1 ; entries in dispatch table are absolute addresses, not offsets (used in linked patches)
;
; Standard dispatch table format for DispatchHelper
;
DispatchHelperTable RECORD 0
dispatchFlags DS.W 1 ; use bits defined above (e.g. 1<<dhSelectorsEven)
firstSelector DS.B 1 ; first valid selector, can be negative
lastSelector DS.B 1 ; last valid selector
firstOffset DS.W 1 ; first offset from DispatchHelperTable
; other offsets follow
ORG firstOffset ; alternately, if dhAbsoluteEntries is set
firstAddress DS.L 1 ; first absolute address
; other addresses follow
ENDR
;
; Standard proc header format for ProcHelper
;
ProcHelperHeader RECORD 0
UnusedDebugger DS.W 1 ; used to branch to PACK entry, now set to $A9FF
ProcResType DS.L 1 ; resource type of proc: 'PACK', 'proc', etc.
ProcID DS.W 1 ; id of resource
ProcVers DS.W 1 ; proc version
ProcDispTable DS.W 1 ; start of DispatchHelperTable
ENDR
;
; The following trap words are for reference only, you should never
; call DispatchHelper or ProcHelper directly through them.
;
_DispatchHelperTrap OPWORD $A0EC
_ProcHelperTrap OPWORD $A09A
;
; Use these macros to invoke DispatchHelper and ProcHelper
;
MACRO
_DispatchHelper
MOVE.L $7B0,-(SP) ; go through vector for _DispatchHelperTrap
RTS
ENDM
MACRO
_ProcHelper
MOVE.L $668,-(SP) ; go through vector for _ProcHelperTrap
RTS
ENDM
;
; Use this macro to define an unimplemented routine for DispatchHelper and ProcHelper
; Cleans up the stack based on the words of parameters in the selector in D0 and
; returns to the caller with paramErr.
;
MACRO
DispatchUnimplementedRoutine
MOVE.L (SP)+,A0 ; A0 = return address
LSR.W #8,D0 ; D0.W = words of parameters
ADD.W D0,D0 ; D0.W = bytes of parameters
ADD.W D0,SP ; strip off parameters
MOVE.W #paramErr,(SP) ; return parameter error
JMP (A0) ; return to caller
ENDM
ENDIF ; ...already included