Path: utzoo!attcan!uunet!cs.utexas.edu!samsung!usc!apple!keith From: keith@Apple.COM (Keith Rollin) Newsgroups: comp.sys.mac.programmer Subject: Re: Speaking of Munger... Message-ID: <43017@apple.Apple.COM> Date: 16 Jul 90 01:28:34 GMT References: <233@sun13.scri.fsu.edu> <42917@apple.Apple.COM> <1990Jul13.135946.6664@eng.umd.edu> Organization: Apple Computer Inc, Cupertino, CA Lines: 35 In article <1990Jul13.135946.6664@eng.umd.edu> russotto@eng.umd.edu (Matthew T. Russotto) writes: >In article <42917@apple.Apple.COM> keith@Apple.COM (Keith Rollin) writes: >>When Munger needs some more memory, it calls SetHandleSize. If >>SetHandleSize returns an error (returned in register D0), Munger exits >>immediately. This means that the error result code is still in D0, and >>you can retrieve it with a little bit of glue code or inline assembly. >> >>The reason why MemError isn't set is because the Memory Manager doesn't >>set it; that's the function of the glue code provided for those calls >>by your development system. Your call to something like SetHandleSize >>is really a call to subroutine that takes your parameters off the stack, >>puts them in registers, calls the function, and puts the result code in >>MemError. Since Munger is written in assembly, it doesn't use this >>little subroutine. Hence, MemError never gets set with the result >>code. > >Says Inside Mac, Volume 4: >All Memory Manager routines (including the RecoverHandle function) return a >result code that you can examine by calling the MemError function. > >And a look at the SetHandleSize function reveals that it does indeed move >D0 to MemErr... Hmmmm. (Unless, of course, you are running under the 64K >Roms) Sigh. Again, I've thrown a walk concerning Munger. Eric eventually found the problem (he was making another Memory Manager call and erasing MemErr from the Munger call). I had assumed that the Memory Manager didn't actually set MemErr because there was glue that also did it. -- ------------------------------------------------------------------------------ Keith Rollin --- Apple Computer, Inc. --- Developer Technical Support INTERNET: keith@apple.com UUCP: {decwrl, hoptoad, nsc, sun, amdahl}!apple!keith "Argue for your Apple, and sure enough, it's yours" - Keith Rollin, Contusions