Mail Archives: djgpp/1995/07/22/04:13:47
In article <805952331 DOT 111snx AT techm DOT pl DOT my>, kenfoo AT techm DOT pl DOT my (Kenneth Foo) writes:
|> Hi...can anyone point out to me how I can make DJGPP 2
|> use a SELECTOR:OFFSET combination to address a memory space instead
|> of using internal pointers (which uses a fixed DS as the selector) ?
|>
|> Thanks!
You can do the following:
1. Use movedata (), which uses selectors (I think!).
2. Code up a far_mem_cpy () function in assmebler, like:
*Note* : This code has never been tested, so it might not work at all
(or even compile for that matter.)
static void
far_mem_cpy
(
int s_sel,
int s_off,
int d_sel,
int d_off,
int size
)
{
asm ("pushl %edi \n\
pushl %esi \n\
pushl %es \n\
pushl %ds \n\
movl 8(%ebp), %eax \n\
movw %ax, %ds \n\
movl 16(%ebp), %eax \n\
movw %ax, %es \n\
movl 12(%ebp), %esi \n\
movl 20(%ebp), %edi \n\
movl 24(%ebp), %ecx \n\
orl %ecx, %ecx \n\
jz L_far_mem_cpy_done \n\
rep \n\
movsb \n\
L_far_mem_cpy_done: \n\
popl %ds \n\
popl %es \n\
popl %esi \n\
popl %edi \n\
");
}
Hope that helps,
Long.
- Raw text -