China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 12:16
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » Please look at this piece of code View 819 Replies 1
Original Poster Posted 2007-10-10 11:01 ·  中国 浙江 宁波 联通
初级用户
Credits 30
Posts 8
Joined 2007-10-07 17:44
18-year member
UID 99125
Gender Male
Status Offline
char XMS=0,HMA=0,UMB=0;

void (far *xms)(void);
void get_driver_address()
{
if (XMS)
{
asm {
mov ax,0x4310
int 0x2f
}
xms=(void (far *)())(((long)(_ES)<<16)+_BX);
}
}
typedef struct xms_mov {
unsigned long byte_count; //number of bytes to move
unsigned source_handle; //source handle
unsigned long source_offset; //source offset
unsigned destination_handle; //destination handle
unsigned long destination_offset; //destination offset
} xmm;
xmm xmove;

char move_xms(xmm *xmm_ptr)
{
char error_code=0xff;
if (XMS)
{
unsigned xseg=FP_SEG(xmm_ptr),xoff=FP_OFF(xmm_ptr);
asm {
mov ah,0x0b
mov si,xoff
mov ds,xseg
}
xms();//what does this statement do?
error_code=_BL;
}
return(error_code);
}

When moving conventional memory into extended memory, how is it actually done? What is the purpose of defining this structure? What exactly do registers SI and DS mean here? Do they refer to the offset address and segment base address in extended memory? How exactly is an address in extended memory located? If the amount of data in extended memory is very large, can the 32-bit address in extended memory be accessed through the offset address and segment base address? I hope the experts here can give me some guidance, thanks!
Floor 2 Posted 2007-10-10 14:33 ·  中国 河北 唐山 联通
银牌会员
★★★
Credits 1,148
Posts 514
Joined 2007-06-01 12:51
19-year member
UID 89959
Gender Male
From 河北
Status Offline
This is too deep. It seems some DOS software was written this way. You could check it with a DOS memory tool.
Forum Jump: