; ; File: PackageMgr.a ; ; Contains: xxx put contents here (or delete the whole line) xxx ; ; Written by: xxx put name of writer here (or delete the whole line) xxx ; ; Copyright: © 1983-1992 by Apple Computer, Inc., all rights reserved. ; ; Change History (most recent first): ; ; 6/11/92 PN Roll in patchIIciROM.a the optimized package 4 and 5 in ; Startboot.a and delete Pack4 &5 in this file ; 5/20/92 TN Removed entry points for Packs 8, 9, 11, 13, 15. They are now ; with the corresponding Pack sources. ; <1.2> 8/22/89 SES Removed references to nFiles. ; <1.1> 11/10/88 CCH Fixed Header. ; <1.0> 11/9/88 CCH Adding to EASE. ; <•1.1> 9/23/88 CCH Got rid of inc.sum.d and empty nFiles ; <1.0> 2/11/88 BBM Adding file for the first time into EASE… ; 1/14/87 JTC Unrolled the Pack 4&5 code to expedite, so 881 wouldn’t be ; slowed any more than necessary. ; 10/14/86 RDC Removed check for FPU on NuMac - it is assumed to always be ; there and FPU packs replace packs 4 and 5 ; 10/9/86 bbm Modified to mpw aincludes. ; 9/23/86 JTC Cleanse pack address with _StripAddress rather than CLR.B before ; jumping into package. ; 7/28/86 RDC Added changes to allow install of new math packs if NuMac FPU ; chip is installed. ; 2/19/86 BBM Made some modifications to work under MPW ; 7/10/85 LAK Added set up of ROMMapInsert for ROM resources. ; 5/7/85 JTC Minor clean-up and extend to 16 packages. ; 4/16/85 SC NoPack code changed and called after _LoadResource (in case the ; load failed) ; 4/16/85 SC InitAllPacks now saves/restores resload state (directly to low ; memory too, no traps ; 3/6/85 LAK Clear high byte of address before dispatching (to be nice . . ; .). ; 1/28/85 LAK Uses new equates files. Changed InitMath to InitAllPacks. Added ; ram patches. ; 6/15/83 AJH Made it use deep shit errors defined in SysErr ; ; ;EASE$$$ READ ONLY COPY of file “PackageMgr.a” ; 1.2 SES 08/22/1989 Removed references to nFiles. ; 1.1 CCH 11/10/1988 Fixed Header. ; 1.0 CCH 11/ 9/1988 Adding to EASE. ; OLD REVISIONS BELOW ;•1.1 CCH 9/23/1988 Got rid of inc.sum.d and empty nFiles ; 1.0 BBM 2/11/88 Adding file for the first time into EASE… ; END EASE MODIFICATION HISTORY ; File: Packages.TEXT ;--------------------------------------------------------------------- ; ; Macintosh Application Package Dispatch Interface ; ; written by Jerome Coonen and Andy Hertzfeld 13-May-83 ; ; ROM-based interface to RAM-based package. The packages are ; resources of type "PACK", numbered 0 through 7. Packages 0 through ; 3 are for use by applications (presumably, several applications ; sharing the same resources); packages 4 through 7 are reserved for ; math routines such as floating point arithmetic, elementary ; functions, etc. ; ; PROCEDURE InitPack(PackNumber : integer); when passed a ; PackNumber between 0 and 7 performs a GetResource of the appropriate ; PACK resource, setting up the dispatch vector for subsequent ; invocations of the package from the application. InitPack turns off ; resource loading (via SetResLoad) so that the GetResource simply ; up the resource map. Thus the package is loaded into memory, and ; need only be available at all in the resource file, if and when it ; is used. Resource loading is turned back on after the GetResource. ; InitPack follows the Pascal register conventions. ; ; PROCEDURE InitMath; calls InitPack four times with the arguments ; 4, 5, 6, and 7 and then initializes the 3 word floating point state ; area. ; ; Labels PACK0, PACK1, ..., PACK7 receive the respective A-line traps. ; The in turn transfer control to the package whose handle was saved ; by InitPack; they preserve ALL registers. They must check the ; handle, in case GetResource failed to find the package, and then ; check the pointer, in case the package has been purged. ; ; Modification history: ; ; 15-Jun-83 AJH Made it use deep shit errors defined in SysErr ; ;--------------------------------------------------------------------- ; ; 28 Jan 85 LAK Uses new equates files. Changed InitMath to InitAllPacks. ; Added ram patches. ; 06 Mar 85 LAK Clear high byte of address before dispatching (to ; be nice . . .). ; 16 Apr 85 SC InitAllPacks now saves/restores resload state (directly ; to low memory too, no traps ; 16 Apr 85 SC NoPack code changed and called after _LoadResource (in case ; the load failed) ; 07 May 85 JTC Minor clean-up and extend to 16 packages. ; <10Jul85> LAK Added set up of ROMMapInsert for ROM resources. ;_______________________________________________________________________ ; ; Post Lonely Hearts ;_______________________________________________________________________ ; ; <19feb86> BBM Made some modifications to work under MPW ; RDC Added changes to allow install of new math packs ; if NuMac FPU chip is installed. ; JTC Cleanse pack address with _StripAddress rather than ; CLR.B before jumping into package. ; bbm Modified to mpw aincludes. ; RDC Removed check for FPU on NuMac - it is assumed to ; always be there and FPU packs replace packs 4 and 5 ; JTC Unrolled the Pack 4&5 code to expedite, so 881 wouldn’t ; be slowed any more than necessary. ;--------------------------------------------------------------------- BLANKS ON STRING ASIS LOAD 'StandardEqu.d' PackDispatcher PROC EXPORT EXPORT InitPack, InitAllPacks EXPORT Pack0, Pack1, Pack2, Pack3, Pack6, Pack7 EXPORT Pack10, Pack12, Pack14 EXPORT PackMgrEnd ; ; PROCEDURE InitPack(PackNumber : integer); ; ; Stack: return adrs < PackNumber ; InitPack SUBQ.L #4,SP ; room for handle from GetResource MOVE.L #'PACK',-(SP) ; resource type PACK ; Stack: "PACK" < handle slot < resLoad < return adrs < PackNumber MOVE.W 12(SP),-(SP) ; resource number = PackNumber <10Jul85> MOVE.W #MapFalse,ROMMapInsert ; check ROM map as well <10Jul85> _GetResource ; Stack: handle slot < resLoad < return adrs < PackNumber MOVE.W 8(SP),D0 ; PackNumber, beyond handle, ret adrs <10Jul85> BSR.S GetPHand ; point A0 to the saved handle <07May85> MOVE.L (SP)+,(A0) ; store resource handle <07May85> ; Stack: return adrs < PackNumber MOVEA.L (SP)+,A0 ; return address ADDQ.L #2,SP ; kill PackNumber JMP (A0) ; ; PROCEDURE InitAllPacks; ; InitAllPacks ; deleted FPU check for NuMac MOVE.L (SP)+,A0 ; get trap return MOVEQ #15,D0 ; 16 packages <07May85> @1 MOVE.W D0,-(SP) ; pack to init MOVE.L A0,-(SP) ; where to go LEA InitPack,A0 ; where to go from here DBRA D0,@1 MOVE.L A0,-(SP) ; push InitPack for RTS-style branch CLR.W FPState ; set default modes for arithmetic LEA FPException,A0 MOVE.L A0,FPState+2 ; default halt address RTS ; RTS, initing all packs ; deleted FPU check for NuMac ; ; Default floating point exception handler simply signals deep six alert. ; FPException MOVEQ #DSFPErr,D0 _SysError ; deleted NuMac FPU check routine ; deleted Pack4 and Pack5 since they are installed at boot time ; ; Given pack number 0..15 in D0.W, return A0 pointing to saved handle in low memory. <07May85> ; GetPHand LEA App2Packs,A0 ; presume it's the latter set <07May85> SUBQ.W #8,D0 ; < 0 for 0-7; >= 0 for 8-15 <07May85> BGE.S @1 ; Greater or Equal => App2Packs is right <07May85> LEA AppPacks,A0 ; <07May85> ADDQ.W #8,D0 ; <07May85> @1 LSL.W #2,D0 ; mult by four to index into longs <07May85> ADDA.W D0,A0 ; point to saved handle <07May85> RTS ; <07May85> ; ; Common jump routine. Must preserve values of all registers. ; Jump to address saved in location AppPacks + OFFSET, ; where OFFSET = 2 * ( - Pack1). ; PackCom MOVEM.L D0/A0,-(SP) ; need two work registers MOVE.L 8(SP),D0 ; get return address LEA Pack1,A0 SUB.L A0,D0 ; difference is 0,2,4,6,...,14,16,...,30 <07May85> LSR.W #1,D0 ; back to 0,1,2,...,15 <07May85> BSR.S GetPHand ; point A0 to saved handle <07May85> TST.L (A0) BEQ.S NoPack ; 0 handle means GetResource failed MOVEA.L (A0),A0 ; now dereference handle down to pointer TST.L (A0) ; 0 pointer means must reload resource BNE.S GoToPack MOVE.L A0,-(SP) ; push handle for LoadResource MOVE.W #MapTrue,ROMMapInsert ; use ROM map as well <10Jul85> _LoadResource ; Note: preserves ALL registers. TST.L (A0) ; Did load fail? BEQ.S NoPack ; if so, deep shit GoToPack ; Get here with A0=handle; want to cleanse ptr. MOVE.L (A0),D0 ; deref to dirty ptr _StripAddress ; true address in D0 MOVE.L D0,8(SP) ; pack adrs replaces old return adrs MOVEM.L (SP)+,D0/A0 ; restore work registers RTS ; into package ; Signal deep six alert if GetResource failed NoPack MOVE.L 8(SP),D0 ; get return address LEA Pack1,A0 SUB.L A0,D0 ; difference is 0,2,4,6,...,14 LSR #1,D0 ; shift to 0,1,2,3,...,7 ADD.W #DSNoPackErr,D0 ; error number for this NoPack _SysError ; ; Routines differ only in offset into handle table. So compute offset from ; the difference - Pack1 ; Pack0 BSR.S PackCom Pack1 BSR.S PackCom Pack2 BSR.S PackCom Pack3 BSR.S PackCom xPack4 BSR.S PackCom ; bogus name, to leave placeholder xPack5 BSR.S PackCom ; bogus name, to leave placeholder Pack6 BSR.S PackCom Pack7 BSR.S PackCom xPack8 BSR.S PackCom ; bogus name as placeholder. Entry in AEPackEntry.a xPack9 BSR.S PackCom ; bogus name as placeholder. Entry in PPCBrowserPackEntry.a Pack10 BSR.S PackCom xPack11 BSR.S PackCom ; bogus name as placeholder. Entry in dpPackEntry.a Pack12 BSR.S PackCom xPack13 BSR.S PackCom ; bogus name as placeholder. Entry in DataAccessPackEntry.a Pack14 BSR.S PackCom xPack15 BSR.S PackCom ; bogus name as placeholder. Entry in puPackEntry.a PackMgrEnd END