supermario/base/SuperMarioProj.1994-02-09/Toolbox/CommToolbox/CommToolboxStartup/CommToolboxFix.a
2019-06-29 23:17:50 +08:00

133 lines
3.7 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;
; File: CommToolboxFix.a
;
; Copyright: © 1991-1993 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <3> 8/12/93 kc <mb>: I deleted all of the "TheFuture" conditionals in all of
; the CommToolbox files per Mike Bell's instructions. I also had
; to delete some old code that was compiled under the "CubeE"
; conditional.
; <4> 6/8/92 JSM For TheFuture, check emProcessMgrExists instead of Gestalt to
; test for the existence of the Process Mgr. Doesnt really
; matter, since this file isnt used in any builds??
; <3> 7/10/91 BH better patch (all three rolled into a single patch)
; <2> 7/10/91 BH add fix to CRMGetHeader
; <1> 7/9/91 BH first checked in
;
print push,off
load 'StandardEqu.d'
include 'MFPrivate.a'
include 'LinkedPatchMacros.a'
include 'GestaltEqu.a'
include 'GestaltPrivateEqu.a'
include 'CommToolboxPriv.a'
include 'CommResources.a'
include 'CTBUtilities.a'
print pop
;====================================================================================================
;====================================================================================================
;====================================================================================================
ROMs Plus,SE,II,Portable,IIci
;====================================================================================================
; this fixes problems with
; CRMOpenRFPerm/CRMReleaseRF persistent connection problems
; CRMGetHeader not working in 7.0
;
;FixCommResourceMgr installproc
;
;@checkGestalt
; MOVE.L #gestaltCRMAttr,D0
; _Gestalt
; bne.s @done ; no gestalt so do nothing
; move.l A0,D0 ; get return value
; btst.l #gestaltCRMPersistentFix,D0 ; is it fixed?
; bne.s @done
;@patchIt
;
;@patchCRMOpenRFPerm
;
;@patchCRMReleaseRF
;
;@updateGestalt
;
;
;@done
; rts
; endproc
;----------------------------------------------------------------------------------
PatchCRM PatchProc _CommToolboxDispatch,(Plus,SE,II,Portable,IIci)
MOVEM.L A0/D0-D7,-(sp)
MOVE.W (A0),D0
move.w d0,d7 ; save please
CMP.W #$0512,D0 ; CRMOpenRFPerm
BEQ.S @checkprocessmgr
CMP.W #$0514,D0 ; CRMReleaseRF
BEQ.S @checkprocessmgr
CMP.W #$0502,D0 ; CRMGetHeader
BEQ.S @checkprocessmgr
BNE.S @notMine
@checkprocessmgr
move.l ExpandMem,a0 ; get ExpandMem <4>
tst.w ExpandMemRec.emProcessMgrExists(a0) ; is Process Mgr up yet? <4>
beq.s @notMine ; no <4>
@checkgestalt
MOVE.L #gestaltCRMAttr,D0
_Gestalt
bne.s @notMine
move.l A0,D0 ; get return value
btst.l #gestaltCRMPersistentFix,D0 ; is it fixed?
bne.s @notMine
CMP.W #$0502,D7 ; CRMGetHeader
BEQ.S @patchCRMGetHeader
;--------------------------------------------------------------------------------------
@patchCRMOpenRFPerm
@patchCRMReleaseRF
@beginsystemmode
subq.l #2,sp
_BeginSystemMode
addq.l #2,sp
@callthetrap
movem.l (sp)+,A0/D0-D7
jsrOld
MOVEM.L A0/D0-D7,-(sp)
@endsystemmode
subq.l #2,sp
_EndSystemMode
addq.l #2,sp
movem.l (sp)+,A0/D0-D7
rts
@notMine
movem.l (sp)+,A0/D0-D7
jmpOld
;--------------------------------------------------------------------------------------
@patchCRMGetHeader
movem.l (sp)+,A0/D0-D7
move.l CommToolboxGlobals,a0
with CTBBlock
move.l CRMQueue(a0),d0
endwith
rts
End