www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1998/03/13/01:45:42

From: patrickd AT cmdnet DOT lu (DOSTERT Patrick)
Newsgroups: comp.os.msdos.djgpp
Subject: Re: more NASM/DJGPP HELP please...
Date: Fri, 13 Mar 1998 06:30:35 GMT
Organization: All USENET -- http://www.Supernews.com
Lines: 33
Message-ID: <3508d128.432409694@news.supernews.com>
References: <MPG DOT f725cee3ea1c20298968b AT news DOT flash DOT net>
Reply-To: patrickd AT cmdnet DOT lu
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Thu, 12 Mar 1998 20:58:59 -0800, sochaxx AT flash DOT net (art socha) wrote:

>global _plot ;called from c    plot(int x; inty; char col);
>_plot:
>        push    ebp
>        mov     ebp,esp             ;point to stack
>        xor     eax,eax             ;eax=0
>        xor     ebx,ebx             ;ebx=0
>        mov     word eax,[ebp+10]   ;eax = y
>        mov     word ebx,[ebp+8]    ;ebx = x
>        xchg    ah,al               ;y * 256
>        add     bx,ax               ;bx = (y*256)+x
>        shr     ax,2                ;ax = (y*64)
>        add     bx,ax               ;bx = (y*320)+x
>        add     dword ebx,[_vid]    ;add our offset to the video pointer
>        mov     byte al,[ebp+12]    ;al = color
>        mov     byte [ebx],al       ;draw it!
>        pop     ebp
>        ret
>

ints and chars take 4 bytes so:

	x is at [ebp + 8]
	y is at [ebp + 12]
	color is at [ebp + 16], replace mov byte al,[ebp + 12] by mov eax,[ebp + 16]

in mov byte [ebx],al, byte is not needed since al is byte-sized


cu
P

- Raw text -


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