www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/08/23/10:41:21

Date: Sun, 23 Aug 1998 17:41:09 +0300 (IDT)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: djgpp AT delorie DOT com
Subject: Re: Using a memory buffer in VGA mode 13h
In-Reply-To: <6riout$b8q@news1.snet.net>
Message-ID: <Pine.SUN.3.91.980823173637.1451o-100000@is>
MIME-Version: 1.0

On Thu, 20 Aug 1998, Mark Figura wrote:

> Don't know what the problem is really.  It seems to me that the structure
> "size_t" isn't being declared or something.  Either that or there's no comma
> before it in the function decleration for dosmemput().

You need to #include <sys/types.h>, which defines size_t.  (It's actually 
a bug in <sys/movedata.h> which will be corrected in the DJGPP v2.02.)

>     __djgpp_nearptr_enable();
> // ^^ this allows you do do stuff without using assembly
>     dest=(unsigned char *)__djgpp_conventional_base+0xA0000;
> // ^^ set dest to be 0xA0000 (video memory)
>     src=(unsigned char *)d_buffer;
>     memcpy(dest,src,64000);
>     __djgpp_nearptr_disable();
> // ^^ make sure you do that, or your program's more likely to take down the
> system if it crashes!
> }
> 
> This should also be faster than dosmemput().  (In general, the dos functions
> are slow).

This is plainly incorrect, at least in the context of the example that 
you used.  In fact, your way of doing this, with near pointers and memcpy 
instead of dosmemput, will be *slower*, not faster.  The reasons are two:

	1) dosmemput moves 32-bit dwords, and so is as fast as memcpy;
	2) the call to __djgpp_nearptr_enable is very slow.

- Raw text -


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