Ive got a problem. I send a pointer in function that replace 3 last elements of array to 3 first. I should use unsigned char array to send and it should work with ASM.
int main(int argc, char* argv[])
{
unsigned char arr[24]={
1,2,3,4,5,6,
7,8,9,10,11,12,
13,14,15,16,17,18,
19,20,21,22,23,24
};// example
AsmFlipVertical(arr);
};
void AsmFlipVertical(unsigned char *arr)
{
_asm
{
les esi,arr ; esi=adress of first elem
mov eax,esi
add eax,21
mov edi,eax ; edi=adress of first elem+21;edi is a adress of 21th elem of array
cld
mov ecx,3
rep movsb
}
}
movsb from esi to edi
Ive got error in “rep movsb” What’s wrong? If use this ASM code in main function that’s okay,but I have to use ASM code in function…
You should not use any instructions that affect the segment registers in
flatmemory models. So, replaceles esi,arrwithmov esi,arr