supermario/base/SuperMarioProj.1994-02-09/OS/PPC/PPCDispatcher.a
2019-06-29 23:17:50 +08:00

236 lines
7.9 KiB
Plaintext

;
; File: PPCDispatcher.a
;
; Contains: Dispatcher for the PPCToolbox
;
; Written by: Jeff Miller
;
; Copyright: © 1984-1992 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <SM3> 4/15/92 CSS Integrate changes from Reality:
; <16> 4/14/92 BBM <JSM>: Remove unfinished PPC code that is under the conditional
; “TheFuture”, and remove the conditional “CubeE” since that is
; reality. Remove conditionals, since all they do is confuse.
; <2> 2/13/92 PN Rewrite the dispatcher to make it work for ROM.
; <1> • Pre-SuperMario comments follow •
; <15> 10/4/91 JSM Change PsychoticFarmerOrLater conditionals to TheFuture.
; <14> 9/29/91 DTY Conditionalize <12> and <13> out of CubeE.
; <13> 6/10/91 EMT Optimize code for size
; <12> 6/4/91 EMT Roll in StoreAndForward Revisions
; <11> 10/30/90 EMT change ppcListPorts to ipcListPorts.
; <10> 10/24/90 EMT Add to PPCJumpTable for new internal calls PPCEnable and
; PPCDisable
; <9> 10/19/90 JSM <EMT> Completely rewritten.
; <8> 10/15/90 JSM <stb> Use ppcIdleCmd.
; <7> 10/10/90 gbm change cmdCode to ppcCmdCode and ApplA5 to ppcApplA5 per
; interface changes
; <6> 8/10/90 S Fix Dispatcher for CloseAcceptedSessions and
; CountAcceptedSessions.
; <5> 8/10/90 S Change jsr to jmp for CloseUserSessions and
; CountAcceptedSessions.
; <4> 8/6/90 S Included PPCCheckDupNBPName.
; <3> 5/31/90 EMT Added support to find out how many network sessions that this
; machine has currently active that were accepted, along with the
; ability to remove sessions for a particular user
; <2> 4/24/90 S Include a new trap to be called at system task time for PPC
; Internal use.
; <1.5> 11/28/89 CVC Added StartSecureSession call.
; <1.4> 11/6/89 CVC Removed imclude ""PPCEqu.a"
; <1.3> 11/2/89 CVC Added include "PPCEqu.a"
; <1.2> 10/12/89 CVC no change
; <1.1> 10/12/89 CVC Added Access Control
; <1.0> 9/18/89 CVC Adding PPC toolbox for the first time.
;
BLANKS ON
STRING ASIS
CASE OBJ
PRINT OFF
LOAD 'StandardEqu.d'
INCLUDE 'PPCToolBox.a'
INCLUDE 'PPCPriv.a'
INCLUDE 'LinkedPatchMacros.a'
PRINT ON
IF forROM THEN
;Rewrite the dispatcher to make it work for ROM
ppcDispatcher PROC EXPORT
EXPORT VPPCDISPATCHER
minPPCSelector EQU CheckDupNBPNameCmd ; smallest legal selector (-7)
maxPPCSelector EQU StartSecureCmd ; largest legal selector (14)
VPPCDISPATCHER
; Make sure the selector is in range
;
CMP.B #minPPCSelector,D0 ; is selector too small?
BLT.S @badSelector ; yes, return
CMP.B #maxPPCSelector,D0 ; is selector too big?
BGT.S @badSelector ; yes, return
;
; Calculate offset into jump table
EXT.W D0 ; ***temporary until b2
ASL.W #1,D0 ; each entry is 4 bytes
MOVE.W PPCJumpTable(D0.W),d0 ; get the address of the entry point
LEA PPCJumpTable(D0.W),A1 ;jump to it
; Call the routine and clean up
;
MOVE.L A0,-(SP) ; push the PB or pointer to stack parameters
JSR (A1) ; do the routine
MOVE.L (SP)+,A0 ; clean up stack
RTS ; return to caller
@badSelector
MOVE.W #paramErr,D0 ; selector out of range
ADD.W #28,SP ; Take off 7 long words from stack to get back
RTS
MACRO
JT &entry
IMPORT &entry
DC.W &entry - PPCJumpTable
ENDM
;-------------------------------------------------------------------------------------------------
; PPC Dispatch Table
;-------------------------------------------------------------------------------------------------
JumpStart
;
; private calls - at negative offsets before PPCJumpTable
;
JT PPCCheckDupNBPName ; CheckDupNBPNameCmd (-7)
JT PPCCloseUserSessions ; CloseUserSessionsCmd (-6)
JT PPCCountAcceptedNetworkSessions ; CountAcceptedNetworkSessionsCmd (-5)
JT DisableIncoming ; PPCDisableCmd (-4)
JT EnableIncoming ; PPCEnableCmd (-3)
JT PPCSystemTask ; ppcIdleCmd (-2)
JT KillPPC ; PPCRemoveCmd (-1) Called only by PPC Itself.
PPCJumpTable
;
; public calls
;
JT PPCSetUp ; PPCInit (no constant) (0)
;
; parameter block based calls
;
JT ppcOpen ; ppcOpenCmd (1)
JT ppcStart ; ppcStartCmd (2)
JT ppcInform ; ppcInformCmd (3)
JT ppcAccept ; ppcAcceptCmd (4)
JT ppcReject ; ppcRejectCmd (5)
JT ppcWrite ; ppcWriteCmd (6)
JT ppcRead ; ppcReadCmd (7)
JT ppcEnd ; ppcEndCmd (8)
JT ppcClose ; ppcCloseCmd (9)
JT ipcListPorts ; IPCListPortsCmd (10)
;
; stack based calls
;
JT ppcBadSelector ; unused (formerly PromptForUser) (11)
JT ppcDeleteUser ; DeleteUserCmd (12)
JT ppcGetDefaultUser ; GetDefaultUserCmd (13)
JT ppcStartSecure ; StartSecureCmd (14)
JumpEnd
ENDPROC ; ppcDispatcher
ppcBadSelector PROC EXPORT ; used in dispatch table for holes in selector range
MOVE.W #paramErr,D0 ; unused selector
ADD.W #28,SP ; Take off 7 long words from stack to get back
RTS
ENDPROC ; ppcBadSelector
ELSE ;•••• For System
ppcDispatcher PROC EXPORT
minPPCSelector EQU CheckDupNBPNameCmd ; smallest legal selector (-7) <SM3> CSS
maxPPCSelector EQU StartSecureCmd ; largest legal selector (14) <SM3> CSS
;
; Make sure the selector is in range
;
CMP.B #minPPCSelector,D0 ; is selector too small?
BLT.S @badSelector ; yes, return
CMP.B #maxPPCSelector,D0 ; is selector too big?
BGT.S @badSelector ; yes, return
;
; Calculate offset into jump table
;
EXT.W D0 ; ***temporary until b2
ASL.W #2,D0 ; each entry is 4 bytes
MOVE.L PPCJumpTable(D0.W),A1 ; get the address of the entry point
;
; Call the routine and clean up
;
MOVE.L A0,-(SP) ; push the PB or pointer to stack parameters
JSR (A1) ; do the routine
MOVE.L (SP)+,A0 ; clean up stack
RTS ; return to caller
@badSelector
MOVE.W #paramErr,D0 ; selector out of range
RTS
;-------------------------------------------------------------------------------------------------
; PPC Dispatch Table
;-------------------------------------------------------------------------------------------------
;
; private calls - at negative offsets before PPCJumpTable
;
;
dcImport PPCCheckDupNBPName ; CheckDupNBPNameCmd (-7)
dcImport PPCCloseUserSessions ; CloseUserSessionsCmd (-6)
dcImport PPCCountAcceptedNetworkSessions ; CountAcceptedNetworkSessionsCmd (-5)
dcImport DisableIncoming ; PPCDisableCmd (-4)
dcImport EnableIncoming ; PPCEnableCmd (-3)
dcImport PPCSystemTask ; ppcIdleCmd (-2)
dcImport KillPPC ; PPCRemoveCmd (-1) Called only by PPC Itself.
PPCJumpTable
;
; public calls
;
dcImport PPCSetUp ; PPCInit (no constant) (0)
;
; parameter block based calls
;
dcImport ppcOpen ; ppcOpenCmd (1)
dcImport ppcStart ; ppcStartCmd (2)
dcImport ppcInform ; ppcInformCmd (3)
dcImport ppcAccept ; ppcAcceptCmd (4)
dcImport ppcReject ; ppcRejectCmd (5)
dcImport ppcWrite ; ppcWriteCmd (6)
dcImport ppcRead ; ppcReadCmd (7)
dcImport ppcEnd ; ppcEndCmd (8)
dcImport ppcClose ; ppcCloseCmd (9)
dcImport ipcListPorts ; IPCListPortsCmd (10)
;
; stack based calls
;
dcImport ppcBadSelector ; unused (formerly PromptForUser) (11)
dcImport ppcDeleteUser ; DeleteUserCmd (12)
dcImport ppcGetDefaultUser ; GetDefaultUserCmd (13)
dcImport ppcStartSecure ; StartSecureCmd (14)
ENDPROC ; ppcDispatcher
ppcBadSelector PROC EXPORT ; used in dispatch table for holes in selector range
MOVE.W #paramErr,D0 ; unused selector
RTS
ENDPROC ; ppcBadSelector
ENDIF
END