delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/08/29/04:15:58

Date: Fri, 29 Aug 1997 16:14:06 +0800 (GMT)
From: Orlando Andico <orly AT gibson DOT eee DOT upd DOT edu DOT ph>
To: Chris Frolik <frolikcc AT indy DOT net>
cc: djgpp AT delorie DOT com
Subject: Re: Real-mode pointers in real-mode interrupt
In-Reply-To: <3404EDA1.6C7F@indy.net>
Message-ID: <Pine.SGI.3.93.970829160149.29363A-100000@gibson>
MIME-Version: 1.0

On Wed, 27 Aug 1997, Chris Frolik wrote:

..
> is with the pointer (P) inside that struct (S).  Interrupt 0x7A expects
> that this will be a real-mode pointer to more data, but of course I
> don't think it is possible to get the segment:offset of a pointer or
> variable in DJGPP.  So, I thought about doing what the FAQ says --
> placing my data in conventional memory.  I can put the struct (S) there
> and have the ES:SI in the _dpmi_regs struct point to this conventional
> memory.  But, it is not enough just to put my struct in conventional
> memory, because the pointer in that struct still points to something in
> DJGPP's flat address space.  Since the interrupt expects this to be a
> real-mode pointer, and the FAQ says that conventional memory uses only
> 20-bit addresses, I am stuck.  If anyone knows how I can get this to
> work, please let me know.  Thanks,

What you need is a real-mode transfer buffer. Here's some pseudo-code
(N.B. it's been years since I did this sort of programming in DJGPP, but
I did something like this to interface DJGPP to a real-mode frame grabber
driver, so it's a valid approach..)

---
struct IPXBUF ipxb;   /* this holds your pointer */

/* you should probably bzero() the _go32_dpmi_seginfo's */
_go32_dpmi_seginfo buffer_info;
_go32_dpmi_seginfo ipxb_info;

/* get some dos memory for your transfer buffer */
buffer_info.size = 10000;  /* let's say you need this much - 160kb */
if (_go32_dpmi_allocate_dos_memory (&buffer_info)) abort ();

/* now, you can get the real-mode address of the transfer buffer */
/* (offset is zero) and construct a real-mode 20-bit address */
ipxb.pointer = buffer_info.rm_segment * 16;

/* initialize the rest of the stuff in the struct */
ipxb.var1 = 5;
ipxb.var2 = 6;

/* get some dos memory for struct IPXBUF and copy ipxb there */
ipxb_info.size = (sizeof (struct IPXBUF) + 15) / 16;
if (_go32_dpmi_allocate_dos_memory (&ipxb_info)) abort ();
dosmemput (&ipxb, sizeof (struct IPXBUF), ipxb_info.rm_segment * 16);
---

I'm not sure if this will work, but you do get the idea.  :)

-------------------------------------------------------------------
Orlando Alcantara Andico
WWW:   http://www2.mozcom.com/~orly/         Email: orly AT mozcom DOT com
ICBM:  14 30 00 N  120 59 00 E               POTS:  (+632) 932-2385

- Raw text -


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