home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / sys / mac / programm / 20584 < prev    next >
Encoding:
Text File  |  1993-01-04  |  2.8 KB  |  53 lines

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