flynnwallace
11-24-2001, 07:15 PM
Can anyone tell me how does division work in the assembly language. I can do problems that involve addition, subtraction, and multiplication but division confuses me.
Flynn
Flynn
|
Click to See Complete Forum and Search --> : division in assembly flynnwallace 11-24-2001, 07:15 PM Can anyone tell me how does division work in the assembly language. I can do problems that involve addition, subtraction, and multiplication but division confuses me. Flynn tnordloh 11-25-2001, 09:45 AM div eax,ebx would put the ebx/eax in the eax register, I believe. At least I think so. It's been a while. ANyway, the problem is of cours that div treats everything as an integer and throws away the remainder. There is also fdiv, which you use on floats. I hope this helps. paulb 11-26-2001, 10:32 AM i dont know assembly so ill do this in C++ language. This is probably not a help to you, but I am board and I really feel like coding somthing. int numb1; // Numb 3 = Numb 1 / Numb 2 int numb2; int numb3; for (;numb1 >= numb2; numb3++, numb1 = numb1 - numb2){ } numb1 is the remainder. Edit: bugfix (Divisions with no remainder were messed up) [ 26 November 2001: Message edited by: paulb ] [ 26 November 2001: Message edited by: paulb ] JasonC 11-26-2001, 01:18 PM Check out the Art of Assembly Language programming at: http://webster.cs.ucr.edu/Page_asm/0_ArtOfAsm.html You can read all about it. Hope this helps Whipping Boy 11-26-2001, 06:24 PM Some things to remember: Addition is the only mathematical operation that can be performed by digital logic gates Subtraction is just addition of a negative number Multiplication is just repeated addition Division is just repeated subtraction with a count of the total number of subtractions performed All other mathematical operations are just a combination of two or more of these operations [ 26 November 2001: Message edited by: Whipping Boy ] justlinux.com
Copyright Internet.com Inc. All Rights Reserved. |