On my previous post about procedures I told you what a procedure is and what they do, on this post I'm going to show you something about them that allows you to use the same procedure to do 2,3,4,5,6 etc things it just depends on how much code you are willing to write,and sadly loops can't help with this,on my program I just did 2. Now I'm not saying you can do like you can do subtraction and addition in fact the "things" that I'm talking about are powers like: 3^3 + 2^4. Now I'm going to talk about input and output. So all an input is is a number so look at 3^3 the 3's are input and the answer (27) is the output. Example:if you put 2 different types of materials such as wool or thread into a sweater machine they come out as a sweater. Or 2^4 7^8 or even 10^9.
.model flat, c
count dword 0
total dword 0
Now we get to the part I've been talking about: the part where you switch between the 2 different powers! If you look at the top part of the program you will see that I'm calling the raiseToThePower proc twice and in between those calls I'm doing some mov's. The only thing I'm changing with those mov's is the base (ecx) and the exponent (ebx). Now ebx and ecx are the input's that we've been talking so much about. And That's all there is to it really in between the call's change the base and the exponent.
Post a Comment