- #1
whitehorsey
- 192
- 0
1.
firstFunction (parameters has an input and an output){
(ebx holds the input, ecx holds the output)
...
mov eax, 1
push ebx
call factorial
pop ebx
...
}
factorial(unsigned int n){
push ebx
mul ebx
}
3. I understand that you push ebx in the first function because you want to pass the input number to the factorial function. However, why does factorial function need to push ebx again? In addition, the line mul ebx (multiplies with eax) how does it know to multiply with eax. I thought I had to do something like mul ebx, eax yet that causes the build to fail.
firstFunction (parameters has an input and an output){
(ebx holds the input, ecx holds the output)
...
mov eax, 1
push ebx
call factorial
pop ebx
...
}
factorial(unsigned int n){
push ebx
mul ebx
}
3. I understand that you push ebx in the first function because you want to pass the input number to the factorial function. However, why does factorial function need to push ebx again? In addition, the line mul ebx (multiplies with eax) how does it know to multiply with eax. I thought I had to do something like mul ebx, eax yet that causes the build to fail.