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

126 lines
3.7 KiB
Plaintext

;
; File: PPCUtil.a
;
; Copyright: © 1989-1992 by Apple Computer, Inc. All rights reserved.
;
; This file is used in these builds: BigBang
;
;
; Change History (most recent first):
;
; <SM2> 11/3/92 SWC Changed INCLUDEs to a LOAD of StandardEqu.d.
; <8> 6/12/91 LN added #include 'SysPrivateEqu.a'
; <7> 12/13/90 EMT <JSM> Move priviate equate into this file from the PPCToolbox.a
; file, remove APPCSleepEvent.
; <6> 11/28/90 EMT <VC> Add new routine FakeCompletion that calls a completion
; routine as if from the device manager.
; <5> 11/5/90 EMT Fix bug, so ppc checks to see if the Lap manager is installed
; befor placing itself into the AppleTalk Transition Queue
; <4> 10/10/90 gbm change ApplA5 to ppcAppleA5, and cmd<identifiers> to
; io<identifiers>
; <3> 8/8/90 S Included APPCSleepEvent.
; <1.1> 11/6/89 CVC Changed the include from PPCEqu.a to PPCToolbox.a
; <1.0> 9/18/89 CVC Adding PPC toolbox for the first time.
;
CASE OBJ
PRINT OFF
LOAD 'StandardEqu.d'
INCLUDE 'PPCToolbox.a'
PRINT ON
; Revision History
; Sangam 7/20/89 1.0d2 release today!
;
; Get the Gobal area.
;
getGlobal Proc Export
LEA ExpandMem,A1
MOVE.L (A1),A1
WITH ExpandMemRec
MOVE.L emPPCGlobals(A1),D0
ENDWITH
RTS
EndProc
; Added callCompletion routine Sangam 6/14/89
; This routine will set the A5 to the value of A5 when
; PPCToolBox was called and then calls the completion routine
;
; *int callCompletion(PMParamBlockPtr pb, int result);
ppcApplA5 EQU 22
callCompletion PROC EXPORT
MOVE.L 4(SP),A0 ; Pointer to Param block
MOVE.L 8(SP),D0 ; Result code
MOVE.W D0,ioResult(A0) ; store in PB
MOVE.L ioCompletion(A0),D1 ; check if there is a comp routine
BEQ.S @1 ; no, we're done
MOVE.L A5,-(SP) ; save current A5
MOVE.L ppcApplA5(A0),A5 ; set A5 to the value it had when the call was made
LINK A6,#0 ; to support Pascal and C conventions
MOVE.L A0,-(SP) ; push parameters in the stack
MOVE.L D1,A1 ; pointer to completion routine
TST.W D0 ; condition code for assembly
JSR (A1) ; execute the comp routine
UNLK A6 ; discard parameters
MOVE.L (SP)+,A5 ; restore A5 value
@1 RTS
ENDP
; Added Appletalk Transition routines Sangam 9/5/89
; AddtoAtalkQ(PB),
; PB is a pointer to appletalk transition que element
LAPMgrPtr EQU $B18
LAPMgrCall EQU 2
LAddAEQ EQU 23
LRmvAEQ EQU 24
AddtoAtalkQ PROC EXPORT
LINK A6, #0
MOVEQ #LAddAEQ, D0 ; D0=23 code for LAddAEQ
MOVE.L 8(A6), A0
MOVE.L LAPMgrPtr, A1 ; start of LAPMngr from ($B18)
CMPA.W #-1,A1
BEQ @1
JSR LAPMgrCall(A1) ; Call the Lap Manager at Entry Point
@1 UNLK A6
RTS
ENDP
; Added Appletalk Transition routines Sangam 9/5/89
; AddtoAtalkQ(PB),
; PB is a pointer to appletalk transition que element
RmvfromAtalkQ PROC EXPORT
LINK A6, #0
MOVEQ #LRmvAEQ, D0 ; D0=24 code for LRmvAEQ
MOVE.L 8(A6), A0
MOVE.L LAPMgrPtr, A1 ; start of LAPMngr from ($B18)
CMPA.W #-1,A1
BEQ @1
JSR LAPMgrCall(A1) ; Call the Lap Manager at Entry Point
@1 UNLK A6
RTS
ENDP
;---------------------------------------------------------------------------------------------------
; Call the completion routine as if from the device manager.
;---------------------------------------------------------------------------------------------------*/
Proc
Export FakeCompletion
FakeCompletion
Move.L 4(A7),A0 ; Get the PB off the stack.
Move.L 12(A0),A1 ; Get the address of the Completion Routine
Move.W 16(A0),D0 ; Get the IO Result;
JMP (A1) ; Call Completion Routine
Endp
END