Mail Archives: djgpp/1996/05/03/02:30:27
Lennart Steinke (steinke AT zeus DOT adv-boeblingen DOT de) writes:
> Hi!
>
> I need something like memcpy(),
> but with inverted direction flag. So that
> the dest. pointer points to the end of the used
> memory, not to the beginning. I need the
> same for memset(), too.
>
> This can't be that hard, but
> a) I'm not fluid in ASM, especially not with DJGPP,
> b) have no ASM books here at work, and
> c) have only the bins of DJGPP v2, so I can't look
> into the source of the above mentioned funcs.
>
> I need these funcs to blit an bitmap mirrored to the
> screen.
I wrote something that did that once. It copied the memory "manually" (but
fast) using a tight loop with a register char *sp counting the bytes
backward at one end and a register char *dp counting forward at the other end:
register *sp, register *dp;
int i;
[initialise them to respectively end of source block and start byte of end
block]
for (i=0; i<num_bytes; i++, sp--, dp++) {
*dp=*sp;
}
This rotates the image (on 320x200x256 byte=mapped VGA) around its center,
flipping it on both axes. To flip on one axis you need to loop a pointer
for x and y coordinates; and for other video modes even more complicated
things have to be done.
--
.*. "Clouds are not spheres, mountains are not cones, coastlines are not
-() < circles, and bark is not smooth, nor does lightning travel in a
`*' straight line." ,------------------------------------------------
-- B. Mandelbrot | Paul Derbyshire (PGD) ao950 AT freenet DOT carleton DOT ca
- Raw text -