home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!spool.mu.edu!uwm.edu!ux1.cso.uiuc.edu!news.cso.uiuc.edu!alexia!cole
- From: cole@alexia.lis.uiuc.edu (Sandra Stewart-Cole)
- Subject: Re: using the A5 register (help wanted)
- References: <1993Jan3.180416.2891@mnemosyne.cs.du.edu>
- Message-ID: <C0BIvH.41r@news.cso.uiuc.edu>
- Sender: usenet@news.cso.uiuc.edu (Net Noise owner)
- Organization: University of Illinois at Urbana
- Date: Mon, 4 Jan 1993 07:16:27 GMT
- Keywords: Help wanted
- Lines: 40
-
- In <1993Jan4.051629.7363@mnemosyne.cs.du.edu> rduta@nyx.cs.du.edu (Radu)
- writes:
-
- >Ok, that's a start. So you say that A5 is used as a reference for the global
- >application variables. Is this an agreed standard? For example, if i wrote
- >a program strictly in asembly, would even need set up A5, from the description
- >you gave me it sounds as though the compiler creates and uses A5 for it's
- >own purposes, which i doubt. I think I heard somewhere that it's used to
- >store QuickDraw information that pertains to the current application.
-
- A5 contains the address of the boundary between the system-handled 'application
- parameters' and an application's global variables. AT that boundary is a
- pointer to the QuickDraw global GrafPtr ThePort. THAT pointer is at the bottom
- of the application globals, and the top of the QuickDraw private
- application-specific globals. Compilers for the Mac of any quality set that up
- for you. It is my understanding that even MPW Assembler has a built-in
- mechanism for establishing the 'A5 World' if you desire it (i.e. if you are
- writing an aplicatyion that will run under the Mac OS) Because QuickDraw calls
- rely on A5 to find data structures, it is imperative that at least the QD
- referenceability of A5 is maintained, as well as the applications parameters
- referenceabilty. If you rigght in raw unmediated 680x0 assembler, you will have
- to set it up at least to that extent yourself, or use an assembler that handles
- it for you. That does NOT just mean the SetUpA5 call, which is solely to enable
- disconnected pieces of code to finbd their parent's globals. It is not a matter
- of the compiler using A5, it is the operating system, which makes it also
- useable by compilers for globals, and facilitates this by preserving A5 thru
- every interrupt, every trap call, and every context switch.
-
-
- If you need clearer explanation, the most complete source again is Inside
- Macintosh. Sure, IM is Pascal-prejudiced, but it describes the operating system
- AS IT IS and you are most certain of easier coding and debugging if you rely
- only on what it says (supplemented by the Apple Tech Notes)
-
- (I always feel like that is the bottom line... a LOT of questions have very
- full answers in IM... I never understand why anyone thinks they could either
- work without it or find its equivalent on Usenet, CompuServe, or other
- electronic services. )
-
- Bill Stewart-Cole
-