delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/10/01/05:20:04

Date: Wed, 1 Oct 1997 11:18:30 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Gustav Roder <gar_box AT vip DOT cybercity DOT dk>
cc: djgpp AT delorie DOT com
Subject: Re: Segment & Offset
In-Reply-To: <342FC820.DB745851@vip.cybercity.dk>
Message-ID: <Pine.SUN.3.91.971001111811.10422N-100000@is>
MIME-Version: 1.0

On Mon, 29 Sep 1997, Gustav Roder wrote:

> I'm writing a mouse-handler in DJGPP. I need to get the segment and
> offset of my handler-function.
> 
> How can I estimate the segment and offset of a function in DJGPP?

You cannot ``estimate'' the segment and an offset of a DJGPP function,
because they live in protected-mode memory, almost always above the
1MB mark, and real-mode seg:off addresses cannot address more than
1MB.

In addition, you cannot pass the address of your handler directly to
the mouse driver, because your function will then be called in real
mode (the driver itself is a real-mode software), and it won't work at
all.

What you need is to allocate a real-mode callback that will switch
into protected mode befoe calling your function, and pass the address
of that callback to the mouse driver.  The DJGPP FAQ list (available
as v2/faq210b.zip from the same place you get DJGPP) explains how to
do that in section 18.8; in fact, it actually uses the mouse handler
as example, so you even have some code there.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019