www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/10/22:49:21

From: Vic <tudor AT cam DOT org>
Newsgroups: comp.os.msdos.djgpp
Subject: [Q] ASM
Date: Sun, 07 Sep 1997 14:06:11 -0400
Organization: Communications Accessibles Montreal, Quebec Canada
Lines: 29
Message-ID: <3412ED13.2B25@cam.org>
NNTP-Posting-Host: dynamicppp-56.hip.cam.org
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

this is about referencing memory. I wrote a little putpixel routine that
goes like this
.globl _put_pixel
/*put_pixel(BITMAP*,x,y,color);must be memory bitmap!!*/
_put_pixel:
movl 4(%esp),%eax /*move BITMAP* in %eax     */
movl 12(%esp),%ebx /*move y in %ebx           */
movl 60(%eax,%ebx,4),%ecx /*move the addres of BITMAP->line[y] in %ecx*/
movl 8(%esp),%eax /*move x in %eax               */
movl 16(%esp),%ebx /*move color in %ebx           */
movb %ebx,(%ecx,%eax,1) /*put color in BITMAP->line[y][x]  */
ret
and after that I forgot how "movl 60(%eax,%ebx,4),%ecx " works. I know
it's pathetic, but I can't remember my logic (and the putpixel works
fine!).
I know %eax contains the pointer to the bitmap, and I know that 60(%eax)
is the start of the line array in the bitmap structure. How does this
addressing work?
is it like this: 60(%eax) is the start of the line array then it will do
something like 60 %eax+ %ebx * 4 (where %ebx is the "y" index and 4 is
the scale) ?
please help!
TIA,


-- 
--> http://www.cam.org/~tudor <--
Go ahead and build another Messiah
We dig another grave...

- Raw text -


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