cvs.gedasymbols.org/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/02/23:01:00

Date: Tue, 2 Sep 1997 19:59:01 -0700 (PDT)
Message-Id: <199709030259.TAA10316@adit.ap.net>
Mime-Version: 1.0
To: dskrobo AT jagor DOT srce DOT hr (Daniel Skrobo), djgpp AT delorie DOT com
From: Nate Eldredge <eldredge AT ap DOT net>
Subject: Re: HELP me ...... !!!!!!

At 09:41  9/2/1997 GMT, Daniel Skrobo wrote:
>Ok, here it is :
>   I need source code for fliping allocated memory (using MALLOC) to VGA
>   MEM. The code should be in pure djgpp inline ASM ("A&T"). But, if that
>   can be done differently then please send your ideas anyway.!
dosmemput() should work fine for this. If you're always going to move even
multiples of 4 bytes you can use dosmemputl(). If you insist, however, my
attempt at writing it in inline asm follows. Please note, however:
- I don't use inline ASM much at all, so this is probably not the best or
most elegant way to do this. It does, however, generate the right code (as
far as I can tell) and should work.
- It assumes that `len' is an even multiple of 4. If you're always moving an
entire screen-full, that shouldn't be a problem. In fact, in that case, you
can optimize by removing the `offset' argument entirely. If not, you may be
better off using `dosmemput'
--cut--

#include <go32.h>

void move_to_screen(void *buf, unsigned len, unsigned offset)
{
  asm("pushw %%es\n\
       movw %w0,%%es\n\
       rep \n\
       movsl\n\
       popw %%es\n"
      :
      : "rm" ((unsigned short)_dos_ds),
        "c" (len / 4), "S" (buf), "D" (0xA0000 + offset)
      : "%ecx", "%esi", "%edi");
}
--cut--
You can make this a macro if you so desire, too.

HTH

Nate Eldredge
eldredge AT ap DOT net



- Raw text -


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