Path: utzoo!utgpu!news-server.csri.toronto.edu!rutgers!usc!zaphod.mps.ohio-state.edu!mips!pacbell.com!pacbell!att!mcdchg!laidbak!obdient!igloo!ddsw1!corpane!disk!mangor From: mangor@disk.UUCP (Darrell Kitchen) Newsgroups: comp.lang.pascal Subject: Re: help TP Pointers Keywords: pointer, pointers, ofs, seg Message-ID: <3973@disk.UUCP> Date: 24 Aug 90 06:22:33 GMT References: <24138@adm.BRL.MIL> Reply-To: mangor@disk.UUCP (Mangor) Organization: DISK, Louisville Ky Lines: 49 In article <24138@adm.BRL.MIL> SNYDER%UCLACH.BITNET@cornellc.cit.cornell.edu writes: >Dear Sir or Madam: > >We are having problems and hope we can get some help from someone >with more programming skill. > >We need to know how to get the address that a newly allocated pointer >(Turbo Pascal ver 4.0) points to for an application involving direct >memory access (DMA). In particular, we are using a software routine >for the DMA which requires the segment and offset of a variable and >we are forced to use dynamic memory allocation and pointers because >our sample density exceeds the 64K Turbo Pascal limit. If you know >how to get the address of the newly allocated memory that the pointer >points to we would greatly appreciate your assistance. > >Please send e-mail to snyder@uclac1.chem.ucla.edu or snyder@uclach.bitnet. >Thank you very much. Heres a very simple way to access any pointer that you may have. Type doesn't seem to differ. type ptype = record case byte of 0 : (p : pointer); 1 : (l : longint); 2 : (ofs, seg : word); end; var pt : pointer; lnv : longint; ofs : word; seg : word; (* access offset and seg of pt through Turbo Pascal's powerful typecasting as ofs := ptype(pt).ofs; seg := ptype(pt).seg; likewise ptype(pt).ofs := ofs; ptype(pt).seg := seg; also ptype(pt).l := lnv; and lnv := ptype(pt).l; *) Darrell (mangor@disk.uucp)