Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!tut.cis.ohio-state.edu!att!att!fang!ablnc!abcom!ncsc1!dcl From: dcl@ncsc1.ATT.COM (Dave Love) Newsgroups: comp.sys.amiga.tech Subject: Re: Pointer Initialization Message-ID: <717@ncsc1.ATT.COM> Date: 27 Dec 90 17:14:45 GMT References: <4241@mindlink.UUCP> Organization: National Customer Support Center Lines: 48 In article <4241@mindlink.UUCP> a976@mindlink.UUCP (Ron Tarrant) writes: >> kzyx@vax5.cit.cornell.edu writes: >> What is the correct way to initialize a structure pointer to access >> the hardware under ANSI (Aztec C 5.0d) >> > >It's not a good idea to access the hardware directly. It means you have to >update your code every time there is system software and makes it harder (if >I'm not mistaken) to go from one Amiga model to another. > Agreed. >> struct myblitterstruct *myblitterpointer; >> > >This initializes your structure pointer. If you already have a structure of >this type defined, that is. If you also have an actual >structure of this type declared, then make your pointer point to it like this: > > myblitterstruct = &OriginalBlitterStruct > >But when you point your pointer at something in the hardware you're asking for >trouble. In fact, I'm not sure it can even be done. >-Ron To get to the hardware you need something like the following line (assuming you want myblitterpointer to point to the actual blitter registers): struct myblitterstruct *myblitterpointer = (struct myblitterstruct *)(0x00000000L); where 0x00000000 is replaced by the appropriate hardware address (Sorry, I don't have my RKM's handy so I can't give the correct address). DISCLAIMER: Using techniques similar to this in production code will probably result in the end of the world as we know it. :) However, going straight to the hardware was, for me, the best way to learn about the blitter. Once I was comfortable with what the blitter did (and why), it was fairly simple to find "approved" ways to use it. -- Dave Love UUCP: dcl@ncsc1.att.com CI$: 75126,2223 bix: dlove -- "MS-DOS... The ultimate PC virus." --