View Single Post
Old 7th November 2019, 14:54   #14  |  Link
jpsdr
Registered User
 
Join Date: Oct 2002
Location: France
Posts: 2,309
You're not in C...
Code:
and edx,0ff0000h
and eax,0ffh
Also, i think it always needs to begin with a number. If i remember properly, this doesn't work :
Code:
and eax,ffh
but this will :
Code:
and eax,0ffh

Try this :
Code:
movd    mm0,dword ptr[esi+eax*4+(512*4)]
....
movd   dword ptr[edi],mm0
I think transfert default size is the operand, so, not specifying ptr size may probably result as if you've written this :
Code:
movd   qword ptr[edi],mm0
Which is inconsistant of course, movd with qword...

Also, i would write the begining like this (but maybe it will produce the same result).
Code:
mov     edi,dst
mov     esi,LUT
mov     ecx,psize
Your code is 32 bit only, so i will just state the 32 bits rules.

The only registers you can alter without saving them are : eax, ecx, edx and all the mm* and xmm* registers.
If you change esi, edi, ebx, ebp or esp, you'll need to backup and restore them.

Note that if you change ebp, after you'll not be able anymore to do things like this :
Code:
mov     edi,dst
I think the compiler add implicit save/restore code of ebp at the begining and end of function, and use it afterward when you acces to the stack parameters.
This is what all the .model flat, c and lut_isse proc ... are for.

So, the start of your function should be :
Code:
public lut_isse

push esi
push edi
push ebx

mov     edi,dst
...
and the end :
Code:
....
emms

pop ebx
pop edi
pop esi

ret
Also :
Code:
dec ecx
jnz GLoop
can be shorten to :
Code:
loop GLoop
I personnaly avoid the use of "int", as it's something with to much variation size possibility and no real "spec".
I always use data i'm sure of the size, like uint32_t for fixed size in both 32/64 bits, or size_t for 32 bits in 32 bits, 64 bits in 64 bits (unsigned), and ptrdiff_t for pointer offset, as it also adapt the size for 32/64 bits, but it's signed.
__________________
My github.

Last edited by jpsdr; 7th November 2019 at 15:06.
jpsdr is offline   Reply With Quote