Mail Archives: djgpp/1998/03/13/01:45:42
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 -