Path: utzoo!attcan!uunet!peregrine!elroy!ames!amdahl!nsc!voder!apple!darin From: darin@Apple.COM (Darin Adler) Newsgroups: comp.sys.mac.programmer Subject: Re: Register saving conventions Message-ID: <15032@apple.Apple.COM> Date: 1 Aug 88 21:32:38 GMT References: <664@iraun1.ira.uka.de> Reply-To: darin@apple.apple.com.UUCP (Darin Adler) Organization: Apple Lines: 23 In article <664@iraun1.ira.uka.de> joachim@iraul1.ira.uka.de (Joachim Lindenberg) writes: > While writing some small patches to toolbox traps, I noticed that > MultiFinder doesn't conform to the register saving conventions stated > in Inside Macintosh. Some routines apparently assume, that registers > are not changed by the trap. The traps I patched are GetResource and > DrawMenuBar. Both of them work only if I save registers D0-D2/A0-A1. If you read page I-113 of Inside Macintosh, you will see the following note: "Assembly-language note: Except for LoadResource, all Resource Manager routine preserve all registers except A0 and D0. LoadResource preserves A0 and D0 as well." Thus, the Resource Manager is an exception to the normal rules for Toolbox register saving. If you patch a Resource Manager trap, you have to keep this in mind. I don't think that this is clear enough in Inside Macintosh, but it is definitely a documentation problem rather than a MultiFinder problem. -- Darin Adler AppleLink: Adler4 UUCP: {sun,voder,nsc,mtxinu,dual}!apple!darin CSNET: darin@Apple.com