www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/11/18/19:44:38

From: "J. Erickson" <joyerick AT menahga DOT polaristel DOT net>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: __dpmi_allocate_dos_memory(...)
Date: Mon, 18 Nov 1996 11:14:23 -0500
Organization: polaristel.net
Lines: 65
Message-ID: <32908B5F.60E8@menahga.polaristel.net>
References: <TCPSMTP DOT 16 DOT 11 DOT 17 DOT -14 DOT 59 DOT 8 DOT 3180191682 DOT 502274 AT formnet-svr DOT form-net DOT com>
Reply-To: joyerick AT menahga DOT polaristel DOT net
NNTP-Posting-Host: sebeka-8.dialup.polaristel.net
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

lnwdt AT form-net DOT com wrote:
> 
> >On Fri, 15 Nov 1996 lnwdt AT form-net DOT com wrote:
> 
> >> I am working on a sound blaster library, and I just want to make
> >> something sure:
> >>
> >> int segment, selector;
> >>
> >> segment = __dpmi_allocate_dos_memory(size, selector);
> >>
> >> Which variable must I put in the ES register, which in EDI?
> 
> >Where do ES or EDI come in for the above snippet?  Can you elaborate?
> 
> Ok, sorry.
> 
> I want to do the sound mixing in asm.  I want to use 'stosb' and 'movsb'
> etc. that needs es:edi.  The memory i am allocating is for the DMA transfers.
> 
> I have played around a bit, but something strange happens.
> I get the segment by doing this:
> 
>         long unsigned segment;
>         int selector;
>         segment = __dpmi_allocate_dos_memory(size, &selector) << 4;
> 
> but when I use:
> 
>         _farnspokeb(segment, 0);
> 
> I get a general fault protection error, but:
> 
>         _farpokeb(_dos_ds, segment, 0);
> 
> gives no error.  Is this correct?  Any reason?  (I am still getting the grips
> with protected mode etc.)
> 
> Secondly, what is the use for the 'selector' variable, other than using
> it in '__dpmi_free_dos_memory(selector)' ?
> 
> Or I going about this in totaly the wrong way?
> 
> Thanks.
> Leon
> 
> to: IN:eliz AT is DOT elta DOT co DOT il
> cc: IN:djgpp AT delorie DOT com

The reason _farnspokeb(segment, 0) gives a fault protection error is
because the selector is not set, whereas, _farpokeb(_dos_ds, segment, 0)
works because
you are providing the selector value (_dos_ds) in the function call. If
you want
to use _farnspokeb instead of using _farpokeb and having to specify the
selector
as _dos_ds every time, you must set the selector beforehand by calling
the
_farsetsel() function which, in your case, can be called with
"_farsetsel(_dos_ds);"
This will leave the selector set to _dos_ds unless you perform certain
memory
manipulations which I can't think of off the top of my head. And, of
course,
_farsetsel() is in "sys/farptr.h". Hope that helps a little.   -James

- Raw text -


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