Corey_819
asked on
New to assembly and having trouble with doing some math
Good evening, how are you doing? I am sorry to bother everyone, however I am new to programming in assembly and there seems to be to much magic going on in my text book I am reading. What I want to understand is if a user inputs lets say Width =2, Lenght =3, and Height=4 and I want to know what they entered in each indvidual one to do some math, such as multiplying adding and etc...... How would I do that in assembly. All the book keeps showing me is one input not more then one. Thanks
ASKER
Thanks for the help aib_42. What I am trying to do is the user will run it from a dos window type the compiled exe and then enter the length, height, and widht. What I am confused is in assembly how do you know what values the user entered in the height, width, and length. I mean in c++ you would have variables. How would you do that in assembly. I understand the registers. I am just having a hard time understanding this first part. Thanks again.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank aib_42 you gave me some ideas on what I need to do. Thanks for taking the time to help :)
I am sorry I couldn't be of any more help. Instruction decoding is a rather hard thing (which I'm inexperienced at), and we all know that even commercial debuggers don't get it right all the time.
Umm, ignore that last post. What it basically said is, "it's 7:20 in the morning and my mind has stopped working."
Now for doing math, you have the best source reserved for you: The CPU! Before/while learning assembly, you should also learn about the CPU and how to use it. For example, if you knew how it worked, you would know that it does standard integer arithmetic using _registers_ as temporary storage and _instructions_ for... well, instructing what arithmetic operation to do :). Here is a very basic x86 assembly program:
mov ax, 0010
add ax, 0010
This would load '10' - whatever that means, for for some assemblers, it means 10 decimal and for others, it means 10 hexadecimal, which is 16 decimal, check your assembler documentation for syntax details - to the register ax with the first instruction. It would then add 10 (decimal or hexadecimal depending on how your assembler sees and encodes it) to it with the second instruction, and you would have ax equaling 20. (again, 20 or 32)
I don't have any links to any assembly tutorials handy, but go give google a try. Other experts might give you links as well.