中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-10-31 19:50
47,815 topics / 349,930 posts / today 0 new / 48,290 members
DOS开发编程 & 发展交流 (开发室) » Please look at this piece of code
Printable Version  970 / 1
Floor1 fengdou151 Posted 2007-10-10 11:01
初级用户 Posts 8 Credits 30
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!
Floor2 shanliang8008 Posted 2007-10-10 14:33
银牌会员 Posts 514 Credits 1,148 From 河北
This is too deep. It seems some DOS software was written this way. You could check it with a DOS memory tool.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023