Path: utzoo!attcan!uunet!fernwood!decwrl!elroy.jpl.nasa.gov!ames!pacbell!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Finding the size of the screen under Multifinder/Color QD Message-ID: <9623@hoptoad.uucp> Date: 12 Jan 90 02:34:33 GMT References: <10139@saturn.ucsc.edu> <9429@hoptoad.uucp> <1102@urbana.mcd.mot.com> <10276@saturn.ucsc.edu> Organization: Eclectic Software, San Francisco Lines: 24 sirkm@ssyx.ucsc.edu (Greg Anderson) wrote: > The OpenPort method worked fine for me too, but for the reasons previously > mentioned, I'd like to try looking directly at the QuickDraw variables. > My question is, how do you reference the A5 register from MPW C? > Think's "CurrentA5" isn't recognized in MPW. To access low-memory globals from C, if you must, you use the macro preprocessor. For instance, you would say #define CurrentA5 (*(long *)0x904) However, when there's a way to avoid low-memory globals, you should do so, because they may go away in the future. In this case, it's better to write a small assembly-language routine that accesses the Quickdraw globals relative to the current value of the A5 register, and returns a pointer to their start. This avoids looking at CurrentA5. Note that if you're going to be doing any graphics, A5 must be set up correctly already, so you can count on it being set to CurrentA5 already in a desk accessory, XCMD, etc. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "Everything that gives us pleasure gives us pain to measure it by." -- The Residents, GOD IN THREE PERSONS