Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XMS Move function(AH = 0x0B)

9 views
Skip to first unread message

blk...@yahoo.com.tw

unread,
Nov 23, 2005, 11:19:34 PM11/23/05
to
i want to move data between real mode memory and my buffer
how can i to do this?

i built a structure(Move) to do this
what pamater should i fill

i got transfer lenght = length
destinational buff = BYTE databuf[100]
handle(from AH=0x09)
phy_addr(from AH=0x0C)

Move.length = length
Move.SHnd = ?
Move.Off = ?
Move.DHnd = ?
Move.Off = ?

DS = ?
SI = ?

Rod Pemberton

unread,
Nov 24, 2005, 5:19:29 AM11/24/05
to

<blk...@yahoo.com.tw> wrote in message
news:1132805974.5...@g14g2000cwa.googlegroups.com...

I'm not sure why you created structure "Move"...

Unlike OpenWATCOM, DJGPP has functions to transfer data between from RM to
PM, and/or from PM to RM. They are called "dosmemget" and "dosmemput",
respectively.

DJGPP also has pre-allocated RM memory called the "transfer buffer" which
can be used to transfer data between RM and PM. The transfer buffer is
designed for to setup the data for RM DOS calls, or get the returned data
from RM DOS calls. The transfer buffer's size varies whether you use
CWSDPMI or PMODEDJ (pmodetsr), but I believe it is about 32k. It's address
is __tb. It's offset is __tb_offset. And, It's segment iis __tb_segment.

Most of this information is in DJGPP's "libc.info".

e.g.,
To transfer RM memory of length "length" from RM "segment:offset" to PM
"buffer", use this:

offset32 = segment * 16 + offset;
dosmemget(int offset32, int length, void *buffer);

e.g.,
To transfer PM memory of length "length" from PM "buffer" to RM
"segment:offset", use this:

offset32 = segment * 16 + offset;
void dosmemput(const void *buffer, int length, int offset);

e.g.,
This function for detecting the LFN API, int 0x21, AX=71a0h could be a
template for using the transfer buffer.

int lfn_71A0(char *mpath) /* used to check if an LFN driver is installed */
{
#ifdef __DJGPP__

dosmemput(mpath, 32, __tb);
r.x.ax = 0x71a0;
r.x.ds = __tb_segment;
r.x.dx = __tb_offset;
r.x.es = r.x.ds;
r.x.di = r.x.dx+OFFS;
r.x.cx = 32;
r.x.flags |= 1;
__dpmi_int(0x21, &r);
dosmemget(__tb+OFFS, 32, mpath);
if (r.x.bx&0x4000)
return(1);
return(0);
#endif
// my OpenWATCOM 1.3. version deleted...
}

Don't reinvent the wheel. :)

Rod Pemberton


Rod Pemberton

unread,
Nov 24, 2005, 5:21:11 AM11/24/05
to

"Rod Pemberton" <dont...@bitbucket.cmm> wrote in message
news:dm442l$cp9$1...@domitilla.aioe.org...

Correction:
void dosmemput(const void *buffer, int length, int offset32);

blk...@yahoo.com.tw

unread,
Nov 24, 2005, 8:31:12 PM11/24/05
to
Thanks for the replay

i tried the _farpokel and _farpeekl to move buffer.
but it is too slow to met my require.

i try the dosmemputl and dosmemgetl.
it is really faster than _farpxxxl function.
thanks for your help

may i ask one more question
should i use the offset32 = r.x.dx * 16 + r.x.bx
(which r.x.dx and r.x.bx get from XMS function AH = 09)
finally, really thanks for your greatly help

Rod Pemberton

unread,
Nov 25, 2005, 8:57:49 AM11/25/05
to

<blk...@yahoo.com.tw> wrote in message
news:1132882272.0...@z14g2000cwz.googlegroups.com...

I'm not too familiar with XMS, but from the 2.0 and 3.0 specifications here:
http://www.nist.ru/hr/doc/spec/index.htm

After you call "Allocate Extended Memory Block (Function 09h)", 09h returns
a handle in r.x.dx. r.x.dx is passed to "Lock Extended Memory Block
(Function 0Ch)". 0Ch returns offset:segment as r.x.dx:r.x.bx. Pass these
as offset32=r.x.dx*16+r.x.bx. Then call "Unlock Extended Memory Block
(Function 0Dh)" after your dosmemput/get. Of course, each of those
functions need other registers to be setup and checked, before and after
being called.


Good Luck,

Rod Pemberton


blk...@yahoo.com.tw

unread,
Nov 27, 2005, 11:04:06 PM11/27/05
to
Thanks

0 new messages