Path: utzoo!mnetor!uunet!lll-winken!lll-tis!ames!pasteur!ucbvax!dewey.soe.berkeley.edu!oster From: oster@dewey.soe.berkeley.edu (David Phillip Oster) Newsgroups: comp.sys.mac.programmer Subject: OpenResFile and high byte Message-ID: <23596@ucbvax.BERKELEY.EDU> Date: 13 Apr 88 16:47:46 GMT References: <128@dogie.edu> <1118@cadre.dsl.PITTSBURGH.EDU> <4367@husc6.harvard.edu> Sender: usenet@ucbvax.BERKELEY.EDU Reply-To: oster@dewey.soe.berkeley.edu.UUCP (David Phillip Oster) Organization: School of Education, UC-Berkeley Lines: 29 Keywords: debugger Recently, there was a discussion on Delphi about OpenResFile(), and the necessity of clearing the high byte of the pointer you pass to it. The correct way of doing this is: do a SysEnvirons(). If you are running on a 512KE or greater, and are under System 4.1 or greater, then do a StripAddress() system call to strip off the flags and get a pure address. If you are on some other configuration, just clear the byte. This will help your code keep working when apple goes to a true 32-bit address environment, or if you want to port to A/UX. --------- Getting the address of video memory: Remember that a MacII can have multiple display adapters installed. To find the address of their screen memeories, you must scan down the list of graphic devices. See the graphic devices chapter of Inside Macintosh Vol. 5. Writing directly into video memory will certainly cause you problems: Stars 1.8 does it, and I have not upgraded it since color quickdraw came out, so it only works right in 1-bit per pixel mode. (The fade-to-black and the drawing of the small stars are done with direct video memory access.) I haven't released an up updated version, because there are a lot of things I want to put in. I may just do a simple bug-fix release in the interim though. --- David Phillip Oster --When you asked me to live in sin with you Arpa: oster@dewey.soe.berkeley.edu --I didn't know you meant sloth. Uucp: {uwvax,decvax,ihnp4}!ucbvax!oster%dewey.soe.berkeley.edu