Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!purdue!haven!mimsy!mojo!russotto From: russotto@eng.umd.edu (Matthew T. Russotto) Newsgroups: comp.sys.mac.programmer Subject: Re: Speaking of Munger... Message-ID: <1990Jul13.135946.6664@eng.umd.edu> Date: 13 Jul 90 13:59:46 GMT References: <233@sun13.scri.fsu.edu> <42917@apple.Apple.COM> Sender: news@eng.umd.edu (The News System) Organization: College of Engineering, Maryversity of Uniland, College Park Lines: 26 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) -- Matthew T. Russotto russotto@eng.umd.edu russotto@wam.umd.edu ][, ][+, ///, ///+, //e, //c, IIGS, //c+ --- Any questions? Hey! Bush has NO LIPS!