Adam Meyerowitz wrote:
> ;function: blitcrawl
> ;
> ;parameters
> ;
> ;[ebp+8] :pointer to destination
> ;[ebp+12] :pointer to pixels
> ;[ebp+16] :value to increment pixels after
> ; each interration
>
> global func:blitcrawl
> blitcrawl:
> align 4
> push ebp
> mov ebp,esp
>
> pushad
>
> mov edi,[ebp+8]
> mov eax,0xffffffff
> mov ecx,640
> rep stosd
>
> popad
>
> mov esp,ebp
> pop ebp
> ret
>
OK, I received your message to disregard this part of code. But just
little points to these codes :
- the pointer 'Destination' and 'Pixel' is not correct because pushad
has added 28 bytes on the stack.(28+4+4=36) then the 'Destination' is
now located at [ebp+36].
- And if this function is used as interrupt-handler, the stack is not
the same .
- the context is important du to the usage of 'rep stosd' which does :
([es:edi]<-eax,edi<-'edi+4') and loop until ecx=0. I don't know how 'es'
is initialised ... if 'es' contains a !=null value, then eax is written
to ((es<<1)+edi) location :((((
In my progs, I use inlined asm :
---------------------------------------------------
inline void _memset(const void *tab,int i,int count)
{
__asm__ __volatile__(
" cld \n"
" repe \n"
" stosl \n"
: /* no return datas */
:"a" (i),"D" (tab),"c" (count)) ; /* load eax<-i , (es:edi<-tab) ,
ecx<-count */
}
---------------------------------------------------
in this exemple the symbole "D" means 'edi' but take care of 'es'
segment ! ( idem for "S" with 'esi' )
( 'stosl' is 'stosd' but prefix 'long' is used in AT&T syntax while
'double' is used in Intel syntax)
- when using rep with 'strings operation' it's recommended to add 'cld'
or 'std' to be sure of the direction ( some progs may change this flag
!! )
think this will usefull ...
Good Luck.
--
Kumsta Christophe
<[EMAIL PROTECTED]>
Real-Time System developper
RT-Linux/RTAI ( Use the Source Luck !)
--- [rtl] ---
To unsubscribe:
echo "unsubscribe rtl" | mail [EMAIL PROTECTED] OR
echo "unsubscribe rtl <Your_email>" | mail [EMAIL PROTECTED]
----
For more information on Real-Time Linux see:
http://www.rtlinux.org/~rtlinux/