www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/30/17:48:00

From: Gavin Sinclair <s2174215 AT cse DOT unsw DOT edu DOT au>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: How to use movedata with a pointer ?
Date: Sun, 28 Sep 1997 15:57:39 +1100
Organization: University of New South Wales
Lines: 55
Message-ID: <342DE3C3.763A@cse.unsw.edu.au>
References: <34269778 DOT 15B8 AT club-internet DOT fr>
Reply-To: s2174215 AT cse DOT unsw DOT edu DOT au
NNTP-Posting-Host: maxx15094.servers.unsw.edu.au
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

[posted and mailed]

ludvig wrote:
> 

	[snip gay banter :]

> So, I have a
> screen_buffer=malloc(416*416*2); in my init_graphics() function
> and I would be able to flush a selected part on 0xA0000+offset.
> like
> 
> for(n=0;n<208;n++)
>  _farpokew(_dos_ds,0xA0000+offset+n,screen_buffer[ibmp+n]);
> 
> where offset and ibmp is *eh* offsets.
> 
> But I want to use movedata.
> 
> How do I do? I have tried in vain to set the _my_ds selector to
> screen_buffer[ibmp] etc and well, it doesn't work. I think the solution
> might be really simple but as with problems, when you don't know the
> answers, they are always hard to solve.
> 
> Ludvig
> 
> ps. please send me a copy <ludvig AT club-internet DOT fr>


This is how I flush an entire buffer to the screen:

	short video = __dpmi_segment_to_descriptor(0xa000);
	_movedatal(_my_ds(), (unsigned int)buffer, video, 0, 16000);

Here, 'buffer' is a pointer to the beginning of the, well, buffer. 
Notice however that it is cast to (unsigned int).  movedata needs an
address, not a pointer.  Also, the 0 (4th argument) is an offset from
the 'video' selector created in the first statement, which I believe you
will be able to use to your advantage.

The most important thing about this function is the 'l' at the end of
_movedatal.  Copying 32-bit long words means it only takes 16000
transfers to copy the entire screen, instead of 64000 bytes!

Unfortunately I can't comment on the relative efficiency of movedata,
farpoke, dosmemput etc.  Hopefully someone else will be able to inform
us.

Good luck!

-- 
Gavin Sinclair
Sydney, Australia

Real mail address is s2174215 AT cse DOT unsw DOT edu DOT au

- Raw text -


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