Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site brl-tgr.ARPA Path: utzoo!watmath!clyde!burl!ulysses!mhuxr!mhuxt!houxm!whuxl!whuxlm!akgua!gatech!seismo!brl-tgr!tgr!cottrell@nbs-vms.arpa From: cottrell@nbs-vms.arpa (COTTRELL, JAMES) Newsgroups: net.lang.c Subject: Position Independent Code Message-ID: <688@brl-tgr.ARPA> Date: Sat, 14-Dec-85 12:58:18 EST Article-I.D.: brl-tgr.688 Posted: Sat Dec 14 12:58:18 1985 Date-Received: Mon, 16-Dec-85 05:12:15 EST Sender: news@brl-tgr.ARPA Lines: 30 /* > >> > As far as relative code, the pdp is missing something. How do you > >> > load the address of a variable relative to the PC? This way: > >> > > >> > mov pc,r0 ; address of `here' > >> > here: add #foobar-here,r0 ; make relative > >> > > >> Bad example, now what are you going to do with this loaded > >> address? > > > >Bad example, now what can I do with that loaded question? You see, > >foobar just happens to be an array! What I need to do is get it's > >address into a register so I can auto-{in,de}crement the bugger. > > > > jim cottrell@nbs > >*/ > The most likely thing I would do with that loaded register is send > the value off to some external hardware, like a DMA controller, > which needs to know absolute addresses. > > carl lowenstein marine physical lab u.c. san diego That is one thing. Another is pass it to something like `strcpy'. Just because a program is position independent doesn't mean it doesn't use absolute addresses. Once PIC is loaded it may not be moved arbitrarily without its knowledge. jim cottrell@nbs */ ------