From owner-freebsd-chat Tue Nov 28 14:37:47 1995 Return-Path: owner-chat Received: (from root@localhost) by freefall.freebsd.org (8.6.12/8.6.6) id OAA12251 for chat-outgoing; Tue, 28 Nov 1995 14:37:47 -0800 Received: from tubkom.prz.tu-berlin.de (root@tubkom.prz.tu-berlin.de [130.149.62.9]) by freefall.freebsd.org (8.6.12/8.6.6) with ESMTP id OAA12242 for ; Tue, 28 Nov 1995 14:37:36 -0800 From: wolf@prz.tu-berlin.de Received: from marvin.prz.tu-berlin.de (marvin.prz.tu-berlin.de [130.149.62.25]) by tubkom.prz.tu-berlin.de (8.6.11/8.6.9) with SMTP id XAA26907; Tue, 28 Nov 1995 23:37:01 +0100 Message-Id: <199511282237.XAA26907@tubkom.prz.tu-berlin.de> Received: by marvin.prz.tu-berlin.de (1.38.193.4/15.6) id AA06080; Tue, 28 Nov 1995 23:37:01 +0100 Subject: Re: Anybody with a Turbo C++ compiler able to answer a couple of questions? To: mrami@minerva.cis.yale.edu Date: Tue, 28 Nov 1995 23:37:00 +0100 (MEZ) Cc: sysseh@devetir.qld.gov.au, chat@freebsd.org In-Reply-To: from "Marc Ramirez" at Nov 28, 95 00:43:00 am X-Mailer: ELM [version 2.4 PL24 ME8b] Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Length: 1393 Sender: owner-chat@freebsd.org Precedence: bulk Marc Ramirez wrote: > > On Tue, 28 Nov 1995, Stephen Hocking wrote: > > > What do the macros FP_SEG & FP_OFF do? I think that they are for getting the > > segment number & offset respectively of a pointer, but am not sure. > > I believe you're right. Grep (TC comes with grep! I love that!) through > dos.h. If I remember correctly, it's in there (god, I haven't used Turbo > C since I was 15 or so). It should, of course, say something like > > #define FP_SEG(x) ((long)(x)<<16L) > #define FP_OFF(x) ((long)(x)&65535L) > At least in Borland C++ the definition is actually: #define FP_SEG( fp ) ( (unsigned) (void _seg *)(void far *)( fp )) #define FP_OFF( fp ) ( (unsigned) ( fp )) This is because a "far" pointer ("far" means more then 64k) is 32 bits long but not stored as any normal human expects, but instead with a 16 bit offset in the first two bytes and a 16 bit segment in the second two bytes, as in the 8086/8088 days (at least in the classical "memory models"). Thomas -- Thomas Wolfram Germany: 0 30 31421171 PRZ TU Berlin abroad: +49 30 31421171 EANTC WWW: http://www.prz.tu-berlin.de/~wolf _____________________________________________________________________________ _____S__I__C____T__R__A__N__S__I__T____G__L__O__R__I__A____M__U__N__D__I_____