mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-11-24 17:32:59 +00:00
81 lines
3.6 KiB
Plaintext
81 lines
3.6 KiB
Plaintext
|
;
|
|||
|
; File: SegmentLoaderPatches.a
|
|||
|
;
|
|||
|
; Contains: Fixes to the Segment Loader
|
|||
|
;
|
|||
|
; Written by: Scott T Boyd
|
|||
|
;
|
|||
|
; Copyright: © 1990-1992 by Apple Computer, Inc., all rights reserved.
|
|||
|
;
|
|||
|
; Change History (most recent first):
|
|||
|
;
|
|||
|
; <SM2> 5/5/92 stb incorporate the ‘scod’-loading patch for the segment loader into
|
|||
|
; SegmentLoader.a.
|
|||
|
; <6> 2/10/92 JSM Moved this file to SegmentLoader folder, keeping all the old
|
|||
|
; revisions.
|
|||
|
; <5> 1/14/91 stb & VL; change Get1Resource to also use the limited range.
|
|||
|
; <4> 11/15/90 csd & fjs; Reduced the range where 'CODE' gets changed to 'scod'
|
|||
|
; from $BFFF-$8000 to $BFFF-$BF00.
|
|||
|
; <3> 6/12/90 JSM Add Get1Resource patch, we may take this out again if we decide
|
|||
|
; to change the ProcessMgr.
|
|||
|
; <2> 6/8/90 stb Forgot to add 4 for the return address.
|
|||
|
; <1> 6/7/90 stb first checked in
|
|||
|
;
|
|||
|
;
|
|||
|
|
|||
|
load 'StandardEqu.d'
|
|||
|
include 'LinkedPatchMacros.a'
|
|||
|
|
|||
|
;————————————————————————————————————————————————————————————————————————————————————————————————————
|
|||
|
; Force system code to load as 'scod' resources. The Process Mgr. is our distinguished first guest
|
|||
|
; of this mechanism. The segment loader thinks it’s loading a ‘CODE’ resource. This patch checks
|
|||
|
; whether the id is in the reserved range [$BFFF,$BF00]. If so, it replaces ‘CODE’ with ‘scod’ on
|
|||
|
; the stack and calls on through to _GetResource.
|
|||
|
; Rolled into SegmentLoader.a 3/30/92 by stb for SuperMario ROM.
|
|||
|
|
|||
|
LoadSystemCODE PatchProc _GetResource,(Plus,SE,II,Portable,IIci)
|
|||
|
|
|||
|
returnAddress EQU 0
|
|||
|
theResID EQU returnAddress+4
|
|||
|
theResType EQU theResID+2
|
|||
|
|
|||
|
cmp.l #'CODE',theResType(SP) ; Is LoadCode looking for a CODE resource?
|
|||
|
bne.s @GetOnWithIt
|
|||
|
cmp.w #$BFFF,theResID(SP) ; Is it in the BFFF - BF00 range reserved for sys code?
|
|||
|
bgt.s @GetOnWithIt
|
|||
|
cmp.w #$BF00,theResID(SP) ; is it really in the BFFF - BF00 range? <4>
|
|||
|
blt.s @GetOnWithIt ; <4>
|
|||
|
|
|||
|
move.l #'scod',theResType(SP) ; Change CODE to scod
|
|||
|
|
|||
|
@GetOnWithIt
|
|||
|
jmpOld ; Get on with loading the resource
|
|||
|
|
|||
|
EndProc
|
|||
|
|
|||
|
;————————————————————————————————————————————————————————————————————————————————————————————————————
|
|||
|
; Same as above patch to GetResource, needed because the ProcessMgr calls Get1Resource to unload segments.
|
|||
|
|
|||
|
Load1SystemCODE PatchProc _Get1Resource,(Plus,SE,II,Portable,IIci)
|
|||
|
|
|||
|
returnAddress EQU 0
|
|||
|
theResID EQU returnAddress+4
|
|||
|
theResType EQU theResID+2
|
|||
|
|
|||
|
cmp.l #'CODE',theResType(SP) ; Is ProcessMgr looking for a CODE resource?
|
|||
|
bne.s @GetOnWithIt
|
|||
|
cmp.w #$BFFF,theResID(SP) ; Is it in the BFFF - 8000 range reserved for sys code?
|
|||
|
bgt.s @GetOnWithIt
|
|||
|
cmp.w #$BF00,theResID(SP) ; is it really in the BFFF - BF00 range? <5>
|
|||
|
blt.s @GetOnWithIt ; <5>
|
|||
|
|
|||
|
move.l #'scod',theResType(SP) ; Change CODE to scod
|
|||
|
|
|||
|
@GetOnWithIt
|
|||
|
jmpOld ; Get on with loading the resource
|
|||
|
|
|||
|
EndProc
|
|||
|
|
|||
|
;————————————————————————————————————————————————————————————————————————————————————————————————————
|
|||
|
|
|||
|
END
|