delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/07/22/04:13:47

Xref: news-dnh.mv.net comp.os.msdos.djgpp:1067
Newsgroups: comp.os.msdos.djgpp
Path: news-dnh.mv.net!mv!news.sprintlink.net!europa.chnt.gtegsc.com!howland.reston.ans.net!news-e1a.megaweb.com!newstf01.news.aol.com!uunet!in2.uu.net!psinntp!psinntp!psinntp!psinntp!netrixgw.netrix.com!jasmine!ld
From: ld AT jasmine DOT netrix DOT com (Long Doan)
Subject: Re: [Q] Making DJGPP use SEL:OFF
To: kenfoo AT techm DOT pl DOT my (Kenneth Foo)
Sender: ld AT jasmine (Long Doan)
Reply-To: ld AT netrix DOT com
Organization: Netrix Corporation
References: <805952331 DOT 111snx AT techm DOT pl DOT my>
Date: Fri, 21 Jul 1995 20:51:40 GMT
Lines: 51
Dj-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


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