www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/12/16/20:48:18

From: Shawn Hargreaves <Shawn AT talula DOT demon DOT co DOT uk>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: pmode selectors
Date: Mon, 16 Dec 1996 21:10:57 +0000
Organization: None
Lines: 20
Distribution: world
Message-ID: <2V4eiFAhrbtyEwOQ@talula.demon.co.uk>
References: <19961216 DOT 052713 DOT 8263 DOT 0 DOT aclemmer AT juno DOT com>
NNTP-Posting-Host: talula.demon.co.uk
MIME-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Aaron m Clemmer writes:
>       How do you get the protected mode selector and offset of __tb, or
>any buffer in conventional memory?  I thought you could just use the
>address of __tb as a selector, and leave the offset as 0, but that just
>GPFed...  I tried looking in the faq, but it wasn't very clear about
>anything but getting rmode segs and offs...

You got that the wrong way round... The address of __tb is the protected
mode offset, and _dos_ds is the selector. For example, to write 0 to the
first byte of the transfer buffer, write:

   _farpokeb(_dos_ds, __tb & 0xFFFFF, 0);

I'm not 100% sure why it's neccessary to mask of the high bits of the
address, but that's what Eli's FAQ says you should do :-)

/*
 *  Shawn Hargreaves - shawn AT talula DOT demon DOT co DOT uk - http://www.talula.demon.co.uk/
 *  Ghoti: 'gh' as in 'enough', 'o' as in 'women', and 'ti' as in 'nation'.
 */

- Raw text -


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