sys7.1-doc-wip/OS/PPC/PPCInstall.a
2019-07-27 22:37:48 +08:00

132 lines
3.8 KiB
Plaintext

;
; File: PPCInstall.a
;
; Contains: Initialization code for the PPC Toolbox.
;
; Written by: Jeff Miller
;
; Copyright: © 1990-1992 by Apple Computer, Inc. All rights reserved.
;
; Change History (most recent first):
;
; <SM3> 11/3/92 SWC Changed ShutdownEqu.a->Shutdown.a.
; <2> 6/29/92 DTY PPCPromptForUserGlobals needs to be a word longer to include
; IKeyScriptDone.
; <1> 6/9/92 JSM first checked in
; <0> 6/9/92 JSM Created from PPCPatch.a to factor out common code
; for both ROM and System. Also, in ROM builds or
; in TheFuture for System builds, allocate
; emPPCPromptForUserGlobals in setupGlobal. Change
; case of PPCInstall.
;
LOAD 'StandardEqu.d'
INCLUDE 'LinkedPatchMacros.a'
INCLUDE 'GestaltEqu.a'
INCLUDE 'ShutDown.a'
IF (forROM OR TheFuture) THEN
INCLUDE 'PromptForUserEqu.a'
ENDIF
CASE OBJ
STRING ASIS
;
; The PPCToolbox is installed on all ROM families
;
ROMs Plus,SE,II,Portable,IIci
;===============================================================================
;
; PPCINSTALL();
;
; InstallProc for PPC. Calls ppcLoader and installs the Gestalt and Shutdown
; routines. For this reason, both Gestalt and the Shutdown Manager must be
; installed before us. ppcLoader also calls FindFolder, so the Alias Manager
; must also be installed before us.
;
;===============================================================================
PPCINSTALL InstallProc
IMPORT ppcLoader
IMPORT PPCGESTALTFUNCTION ; Pascal function
IMPORT PPCSHUTDOWN ; Pascal function
JSR ppcLoader ; do initialization from C
leaResident PPCGESTALTFUNCTION,A0 ; get gestalt function
MOVE.L #gestaltPPCToolboxAttr,D0 ; stuff selector
_NewGestalt ; install Gestalt function
peaResident PPCSHUTDOWN ; get shutdown procedure
MOVE.W #sdOnPowerOff,-(SP) ; only for power off
_SDInstall ; install Shutdown procedure
RTS
ENDPROC ; end of PPCINSTALL
;===============================================================================
;
; PPCRemove();
;
; PPCRemove is provided in only in the INITVERSION case, so that PPC can
; kill the PPCToolBox previously installed.
;
;===============================================================================
PPCRemove PROC EXPORT
Move.L (SP)+,A1 ;get return address
Moveq #-1,D0
DC.W $A0DD
Jmp (A1)
ENDPROC
;===============================================================================
;
; Ptr setupGlobal(long length);
;
; Allocates the global area. Called from ppcLoader, needed only at
; install time.
;
;===============================================================================
setupGlobal PROC EXPORT
IF (forROM OR TheFuture) THEN
MOVE.L ExpandMem,A1 ; get expanded memory area
WITH ExpandMemRec
; allocate emPPCPromptForUserGlobals <SM4>
MOVE.L #PromptForUserGlobalsRec.pGlobalSize,D0 ; D0 = size of globals for PromptForUser <SM4> <SM2> RLM
_NewPtr SYS,CLEAR ; allocate them in system heap <SM4>
MOVE.L A0,emPPCPromptForUserGlobals(A1) ; stuff pointer in our global <SM4>
; allocate emPPCGlobals (which is returned to the caller)
MOVE.L 4(SP),D0 ; get size of globals
_NewPtr ,SYS,CLEAR ; allocate them in system heap
MOVE.L A0,emPPCGlobals(A1) ; stuff pointer in our global
ENDWITH
ELSE
MOVE.L 4(SP),D0 ; get size of globals
_NewPtr ,SYS,CLEAR ; allocate them in system heap
MOVE.L ExpandMem,A1 ; get expanded memory area
WITH ExpandMemRec
MOVE.L A0,emPPCGlobals(A1) ; stuff pointer in our global
ENDWITH
ENDIF ; forROM OR TheFuture
MOVE.L A0,D0 ; return pointer to caller
RTS
ENDPROC ; end of setupGlobal
END