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

131 lines
4.3 KiB
Plaintext

;_______________________________________________________________________________________
;
; File: SlotMgrPatchHead.a
;
; Contains: slot manager patch for system 7.0
;
; Written by: David Wong
;
; Copyright: © 1989-1990 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <9> 9/12/90 JWK Added "notAUX" condition to avoid installing linked patch on Mac
; II's.
; <8> 8/17/90 DTY Converted to a linked patch. (Greg said that Darin said that I
; could check it in.)
; <7> 7/1/90 gbm take out ridiculous _Debugger trap @PatchStart
; <6> 6/29/90 djw Fix conditional assemblies so that only check for installation
; for 32bitQD INIT.
; <5> 3/15/90 djw Rewrote install code to take care of no install case and
; for system 7.0
; <4> 3/15/90 djw Rewrote install code to support 6.xx, bigbang, and 32bitQD patches
; <3> 1/17/90 djw Modifications to build slot mgr with 32bit QD INIT using BBS
; sources
; <2> 12/28/89 dba use MAIN instead of PROC to get dead code stripping
; <1.0> 10/10/89 djw slot manager patch for system 7.0
;
;_______________________________________________________________________________________
Machine MC68020
String Asis
Print Off
LOAD 'StandardEqu.d'
Include 'SlotEqu.a'
Print On
If (&TYPE('SeparateFile') = 'UNDEFINED') Then ; equ indicating whether we are <3>
SeparateFile Equ 0 ; ... building for 32bit QD INIT
Endif ; ... or as a system patch
If (&TYPE('forAUX') = 'UNDEFINED') Then ; equ indicating whether we are <4>
forAUX Equ 0 ; ... building for an A/UX patch
Endif
if not(forAUX) then
Include 'LinkedPatchMacros.a'
endif
;_______________________________________________________________________________________ <4>
;
; Start of patch
;
if SeparateFile then
Start Main Export
else
SlotMgrPatch InstallProc (II,notAUX) ; For Mac II, IIx, IIcx, & SE/30 under Mac OS <9>
endif
Import InstallSlot
If SeparateFile Then ; when built as a separate INIT file
Import CutBackPt
With spBlock
bra.s @PatchStart ; branch to slotmgr patch initialization code
dc.l ('ptch') ; resource type
dc.w 13 ; 'ptch' resource ID
dc.w 1 ; version number
@PatchStart
; So, Dave, what was this doing here?
; _Debugger
lea Start,a0 ; get the handle to this resource
_RecoverHandle ; return a0 = handle to resource
movea.l (sp)+,a1 ; get return addr off stack
move.l a0,-(sp) ; save handle rsrc for later
move.l a1,-(sp) ; reverse order on stack for later calling trap
; Check if we really need to install the slot manager patch
suba.w #spBlockSize,sp ; get spblock on stack
movea.l sp,a0 ; a0 = ptr to spBlock
_sVersion ; get slot manager version in spResult
adda.w #spBlockSize,sp ; get rid of spBlock
beq.s @NoInstall ; sVersion present - don't install patch
Endif ; <6>
movem.l d2-d7/a2-a6,-(sp)
lea InstallSlot,a0 ; get address of patch init
If SeparateFile then ; _StripAddress done by the linked patch loader in system patch
move.l a0,d0
_StripAddress ; make sure it's 32 bit clean
movea.l d0,a0
endif
jsr (a0) ; execute the init code
movem.l (sp)+,d2-d7/a2-a6
; Cut back the initialization code
If SeparateFile THEN
lea InstallSlot,a0 ; a0 = addr to cutback to
move.l a0,d0
_StripAddress ; clean the pointer
move.l d0,d1 ; d1 = ptr to cutback to
movea.l 4(sp),a1 ; a1 = handle to beginning of code
move.l (a1),d0 ; d0 = ptr to beginning
_StripAddress ; clean the pointer
sub.l d0,d1 ; d1 = size of resident code
move.l d1,d0
movea.l 4(sp),a0 ; restore a0 = handle to patch resource
_SetHandleSize ; cutback to resident code size
move.w #$192,d0 ; trap number for _DetachResource
bra.s @Exit
; No need to install this patch, so let us release this resource. (sp) = hndl to rsrc
@NoInstall move.w #$1a3,d0 ; trap number for _ReleaseResource
@Exit _GetTrapAddress ,newTool ; get the trap address
move.l a0,-(sp) ; put addr of trap routine on stack
Endif
@Done
rts ; execute trap then exit
End