Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!husc6!rutgers!rochester!pt!nl.cs.cmu.edu!ralf From: ralf@nl.cs.cmu.edu (Ralf Brown) Newsgroups: comp.lang.c Subject: Re: Absolute addressing in Turbo-C Message-ID: <23@nl.cs.cmu.edu> Date: Fri, 14-Aug-87 16:08:22 EDT Article-I.D.: nl.23 Posted: Fri Aug 14 16:08:22 1987 Date-Received: Sun, 16-Aug-87 03:46:06 EDT References: <8766@brl-adm.ARPA> Organization: Carnegie-Mellon University, CS/RI Lines: 31 In article <8766@brl-adm.ARPA> BREEBAAR%HLERUL5.BITNET@wiscvm.wisc.EDU writes: >I have to use absolute addressing, because of various buffers and variables >that both the PGA and I need to access. To illustrate, some of the original >Turbo Pascal declarations: > > VAR outBuffer : ARRAY [0..255] OF BYTE ABSOLUTE $C000:$6000; > outHead : BYTE ABSOLUTE $C000:$6300; > outTail : BYTE ABSOLUTE $C000:$6301; > >My problem ofcourse is: how do I do this in C? (I am using Turbo-C, >but have no manual (yet).) >Firstly I would like to know if Turbo-C has something equivalent to the >'ABSOLUTE' keyword. Probably not. >So secondly, I'd like the proper C solution to this. > >Leo Breebaart (BREEBAART@HLERUL5.BITNET) >University of Leiden >The Netherlands The proper way to do this in C is to declare the type of the buffer, and then declare a pointer variable pointing to that type. The first thing to do before using the pointer variable is to assign it the address you need your buffers etc at. In Turbo C, the proper function is pointer = MK_FP( seg, ofs ) -- -=-=-=-=-=-=-=-= {harvard,seismo,ucbvax}!b.gp.cs.cmu.edu!ralf =-=-=-=-=-=-=-=- ARPAnet: RALF@B.GP.CS.CMU.EDU BITnet: RALF%B.GP.CS.CMU.EDU@CMUCCVMA AT&Tnet: (412) 268-3053 (school) FIDOnet: Ralf Brown at 129/31 DISCLAIMER? Who ever said I claimed anything? "I do not fear computers. I fear the lack of them..." -- Isaac Asimov