Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Standard File Question Message-ID: <7634@hoptoad.uucp> Date: 12 Jun 89 20:50:38 GMT References: <5739@hubcap.clemson.edu> <1101@umn-d-ub.D.UMN.EDU> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 31 In article <1101@umn-d-ub.D.UMN.EDU> gandreas@ub.d.umn.edu.UUCP (Glenn Andreas) writes: >532 happens to be the address of SFSaveDisk. 920 is probably the address of >CurDirStore (it's not in the back of Knaster, and I didn't bother to look >through the MPW assembler equates). > >What you need is to do is look at the word (or long word) stored there. >Remember, with the exception of Quickdraw "globals", globals are low memory >locations. Quite right. In case it's not clear to people how to access low memory globals in C, here is the syntax for SFSaveDisk and CurDirStore: #define SFSaveDisk (*(short *)0x214) #define CurDirStore (*(long *)0x398) You can find the address of low memory globals in Inside Macintosh, volume III, Appendix D. Globals added on the Mac Plus ROMs are in Inside Mac, volume IV, Appendix C, and yet later ones are in volume V, Appendix D. You don't need Knaster or MPW assembler to find them. Don't use low-memory globals if you can avoid it; Apple has been claiming for some time that they will be going away in the future, probably to make context switching faster. However, some times you need them, like finding the current directory inside Standard File. -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com Postal: 424 Tehama, SF CA 94103; Phone: (415) 495-2934 "I don't know that atheists should be considered citizens, nor should they be considered patriots. This is one nation under God." -- George Bush in FREE INQUIRY magazine, Fall 1988