I have a 704x640 8bit buffer and a 640x480 primary surface (two borders of 32x32 pixels) I have wrote a transfer routine in assembler but it doesn't seem to work.
Here is the code:
void buffer_to_backsurface(void){
_asm{
mov ecx,78600 //copy 4x76800=307200 (640x480) bytes
mov edi,backsurface //store pointer to the backsurface
mov esi,buffer //load pointer to the buffer
add esi,32 //add 32 pixels (screenborder)
xor edx,edx //counter edx to ZERO
};
Looper:
_asm{
inc edx //counting horizontal pixels
cmp edx,161 //hit a border(640/4=160)+1
jnz Store //if not jump to store
xor edx,edx //set the counter to ZERO
add esi,64 //skip 64 pixels (32+32 next line)
};
Store:
_asm{
movsd //store (esi->edi)
loop Looper //and loop
};
};
But it doesn't seem to work (programmed in VC++ 6.0 & directX).
Anyone has found an error in it?