Ahh, Thank you.
My week was busy but I got around fixing it.
I also added the optimizations you suggested.
This is done for what ever calling convention Delphi(Pascal) uses.
asm Code:
test ecx,ecx; // Check If Zero
jnz @@Continue; //IF it is not Zero Go to @@Continue, Else go on
mov eax,edx; //Put second paramater as result
ret; //Return
@@Continue:
test edx,edx; //Begin of while loop
jz @@Wend; // If second paramater is zero go to the end
cmp ecx,edx; // Compare First and second paramater
jnbe @@Lower; //If First > second then go to @@Lower
sub edx,ecx; // second = second - first
jmp @@Continue;// next iteration of while loop
@@Lower:
sub ecx,edx; // first = first - second
jmp @@Continue; // next iteration of while loop
@@Wend: //While loop ended, need to return value.
mov eax,ecx;
Comments might not be valid anymore.