Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!sun-barr!cs.utexas.edu!uunet!mcvax!kth!sunic!liuida!prodix!jian From: jian@prodix.liu.se (Jian Hu) Newsgroups: comp.sys.ibm.pc Subject: Re: ABSOLUTE ADDRESSING IN C Message-ID: <107@prodix.liu.se> Date: 5 Jul 89 14:04:57 GMT References: <1344@sunset.MATH.UCLA.EDU> Organization: Dept of Mechanical Engineering, Univ of Linkoping, Sweden Lines: 31 In article <1344@sunset.MATH.UCLA.EDU> regwan@math.ucla.edu (Eliaho Regwan) writes: >A friend is working on a IBM PC with a 80186 and it has an eprom of some sort. >She needs to set a pointer to an ABSOLUTE ADDRESS (inside the eprom). She >is only able to get relative addresses with a block of memory. > >DOES ANYONE KNOW HOW TO DO THIS?? PLEASE. THANKS. > I think this question belongs to comp.lang.c. But anyway, in MSC5.0 () two macros are defined which should work under any compiler: #define FP_SEG(fp) (*((unsigned *) &(fp)+1)) #define FP_OFF(fp) (*((unsigned *) &(fp))) This is how to use it: #include /* Or simply define the above macros */ void far *fp; main () { char var; FP_SEG(fp)=0x????; /* EPROM seg. address */ FP_OFF(fp)=0x????; /* offset into the EPROM */ var=(char) *fp; } I hope this is what you want. -- J. H.