mac-rom/QuickDraw/PictUtilities/puDispatch.a
Elliot Nunn 4325cdcc78 Bring in CubeE sources
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included.

The Tools directory, containing mostly junk, is also excluded.
2017-12-26 09:52:23 +08:00

116 lines
3.3 KiB
Plaintext

;
; File: puDispatch.a
;
; Contains: Dispatch code for the picture utilities package.
;
; Written by: Dave Good. Some ideas stolen from Konstantin Othmer and Bruce Leak. Prototyped by Cris Rys.
;
; Copyright: © 1990, 1992 by Apple Computer, Inc. All rights reserved.
;
; Change History (most recent first):
;
; <SM2> 11/5/92 SWC Changed INCLUDEs to a LOAD of StandardEqu.d.
; <6> 9/21/90 gbm (Actually DDG) Fixed string problem. Also added code for the Non
; ProcHelper version to clear out the high byte of the selector
; (the number of parameters).
; <5> 9/21/90 DDG Made changes from code review. Changed the dispatch to use proc
; helper. I also left the old code conditionaled out, so that we
; can always do test builds if we need to.
; <4> 8/3/90 DDG Changed the selectors back to the by one scheme.
; <3> 7/31/90 DDG Fixed the check for the maximum selector to reflect the by-two
; scheme.
; <2> 7/29/90 DDG Fixed header.
; <1> 7/29/90 DDG First checked in using new structure.
;
MACHINE MC68000
CASE OBJ
LOAD 'StandardEqu.d'
STRING ASIS
;----------------------------------------------------------------------------------------------------
PictUtilEntry MAIN EXPORT
IMPORT __GETPICTINFO
IMPORT __GETPIXMAPINFO
IMPORT __NEWPICTINFO
IMPORT __RECORDPIXMAPINFO
IMPORT __RECORDPICTINFO
IMPORT __RETRIEVEPICTINFO
IMPORT __DISPOSPICTINFO
IF 0 THEN
and.w #$00FF,d0 ; clear the upper byte (number of parameters)
cmp.w #6,d0 ; if unsigned d0 > max selector,
bhi.s exit ; don't do anything
lsl.w #2,d0 ; multiply our selector by four to get the true jump table offset
jmp dispatchTable(d0.w) ; jump in jump table
dispatchTable
jmp __GETPICTINFO ; selector 0
jmp __GETPIXMAPINFO ; selector 1
jmp __NEWPICTINFO ; selector 2
jmp __RECORDPICTINFO ; selector 3
jmp __RECORDPIXMAPINFO ; selector 4
jmp __RETRIEVEPICTINFO ; selector 5
jmp __DISPOSPICTINFO ; selector 6
exit move.l (sp)+,a0 ; get return address
swap d0 ; get size of parameters in low word
add.w d0,sp ; get rid of parameters
moveq #paramErr,d0 ; return parameter error in D0
move.w d0,(sp) ; return parameter error in function result
jmp (a0) ; and return to caller
ELSE
;
; Macro to build jump table
;
MACRO
JT &entry
IMPORT &entry
dc.w &entry - MyDispatchTable
ENDM
;
; Header for ProcHelper
;
dc.w $A9FF ; package entry point (unused now)
dc.b 'PACK'
dc.w 15 ; package number
dc.w 1 ; version
;
; DispatchTable for DispatchHelper
;
MyDispatchTable
dc.w 0 ; dispatchFlags (always 0)
dc.b $00 ; first selector (0 for GetPictInfo)
dc.b $06 ; last selector (6 for DisposPictInfo)
JT __GETPICTINFO ; selector 0
JT __GETPIXMAPINFO ; selector 1
JT __NEWPICTINFO ; selector 2
JT __RECORDPICTINFO ; selector 3
JT __RECORDPIXMAPINFO ; selector 4
JT __RETRIEVEPICTINFO ; selector 5
JT __DISPOSPICTINFO ; selector 6
ENDIF
ENDPROC
;----------------------------------------------------------------------------------------------------
END