Original Post
Hi, me again! Okay please not the following code is working correctly, the problem is i don't understand why! I will highlight the block i think is incorrect
unsigned int offset = (y2 * g_iScreenMultiple);
unsigned int *start = (g_puiScreen) + offset +x1;
{
__asm
{
mov ecx, x2 // Set ecx to x2
sub ecx, x1 // subtract x1 from ecx
jna end // (if x2-x1 is negative)
mov edi, start // Get address of buffer
mov ebx, color // Set ebx to color
drawloop: // While (ecx > 0) ecx--;
mov [edi], ebx //set memorylocation to pixel color
add edi,4
//inc edi //Increase the xposition
loop drawloop //loop until ecx is zero
end:
}
}
Okay now according to some online material js is the correct jump funciton to be used, js is a conditional jump that happends if the sign flag is set. The sign flag will be set if at sub ecx,x1 (ecx < x1 which means the new ecx should be a negative value). Now can someone please explain why jna (jump if not above) works and js doesnt!