delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/02/15:16:40

From: Vic <tudor AT cam DOT org>
Newsgroups: comp.os.msdos.djgpp
Subject: ASM code Q:
Date: Tue, 02 Sep 1997 10:40:00 -0400
Organization: Communications Accessibles Montreal, Quebec Canada
Lines: 23
Message-ID: <340C2540.7B0@cam.org>
NNTP-Posting-Host: dynamicppp-200.hip.cam.org
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

Hi. I'm just starting in ASM, and I'd like to know if this piece of code
is correct (I know it works, I just wanna make sure)
(it's a putpixel routine for an Allegro memory bitmap)

gcc2_compiled.:
___gnu_compiled_c:
.text
.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

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