I'm just starting with this crazy language and in theory this is a function that calculates the factorial of an integer (I'm using inline assembly in VC++)
but it refuses to complile, it claims there is an error (illegal number of operands) on theCode:int factorial(int number) { int i; __asm { mov eax, 1 ; eax is the return value (start at 1) mov ebx, 0 ; ebx is the counter mov ecx, number ; ecx is the number we are counting to strt: ; Start of loop add ebx, 1 ; add 1 to the counter mul eax, ebx ; multiply by the counter (at this point eax = ebx!) cmp ebx, ecx ;************* jl strt ; If the counter is less than number go back to the start of the loop } }
cmp ebx, ecx
line (marked with a big load of stars)
i'm pretty sure it requires 2 operands, and I'm pretty sure I gave it 2 operands, so why won't it work




Reply With Quote