sys7.1-doc-wip/Patches/ProcessManagerSegmentTweaks.a

67 lines
2.0 KiB
Plaintext
Raw Normal View History

2020-03-22 08:44:21 +00:00
;
; Hacks to match MacOS (most recent first):
;
; <Sys7.1> 8/3/92 Removed code to preflight the system heap with ResrvMem
; 9/2/94 SuperMario ROM source dump (header preserved below)
;
2019-07-27 14:37:48 +00:00
;
; File: ProcessManagerSegmentTweaks.a
;
; Contains: Code to do smarter loading of Process Manager segments to reduce
; system heap fragmentation. Based on Gregs 7 Up code.
;
; Written by: Dean Yu
;
; Copyright: © 1991 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <1> 12/16/91 DTY first checked in
;
; To do: Take decompression slop into account (this doesnt happen yet, but it might)
;
load 'StandardEqu.d'
include 'LinkedPatchMacros.a'
;
; Loading these segments lower in the system heap helps reduce fragmentation of the
; system heap. Preloading resources from the System file doesnt work because they
; come in before the decompression hooks are installed. For each Process Manager
; segment in our list, find out its size, reserve enough space for it, and load
; it low in the heap.
;
kProcessManagerSegmentType equ 'scod' ; Process Manager segment resource type
LoadProcessManagerSegmentsLowerInSysHeap InstallProc (Plus,SE,II,IIci,Portable)
subq #2,sp
_CurResFile ; Remember the current resource file
clr.w -(sp)
_UseResFile ; Work on the System file
lea ProcessManagerSegmentTable,a4 ; Table of Process Manager segments to load low
@loadLoop
move.w (a4)+,d7 ; Get the segment number
bz.s @doneWithSegments ; Did em all
2020-03-22 08:44:21 +00:00
; <Sys7.1> Don't preflight with Get1Resource/SizeRsrc/ResrvMem
2019-07-27 14:37:48 +00:00
subq #4,sp
move.l #kProcessManagerSegmentType,-(sp)
move.w d7,-(sp)
_Get1Resource ; Load it in
addq #4,sp ; We dont really care about the resource
bra.s @loadLoop
@doneWithSegments
_UseResFile ; The current resource file is on the stack
rts
ProcessManagerSegmentTable
dc.w $BFAC ; MiscSeg
dc.w $BFB0 ; KernelSeg
dc.w $BFB2 ; EPPCSeg
dc.w 0 ; End of table
EndProc
End