delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/03/02:30:27

Xref: news2.mv.net comp.os.msdos.djgpp:3376
From: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Simple ASM question (direction flag)
Date: 2 May 1996 12:08:35 GMT
Organization: The National Capital FreeNet
Lines: 43
Sender: ao950 AT freenet5 DOT carleton DOT ca (Paul Derbyshire)
Message-ID: <4ma8k3$spj@freenet-news.carleton.ca>
References: <Pine DOT VUL DOT 3 DOT 91 DOT 960502095335 DOT 386D-100000 AT zeus DOT adv-boeblingen DOT de>
Reply-To: ao950 AT FreeNet DOT Carleton DOT CA (Paul Derbyshire)
NNTP-Posting-Host: freenet5.carleton.ca
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

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 -


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