Mail Archives: djgpp/1997/09/30/17:48:00
[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 -