Posted by Ali Bhai on 1999-03-03
I have multiplied two 16 bit integers using IMUL. If the result is small (ie 16 bits or less), it is stored in AX alone and in that case, I display the result using the following algorithm: TOP: divide ax by 10 add ascii code of zero to the remainder of the division push the resulting number on stack ax is now ax/10, if ax = 0 then END else go to top END: for the number of times push performed, pop the values and display them for example, if the number is 958: 958 / 10 gives a remainder of 8. We store '8'. 95 / 10 gives a remainder of 5. We store '5', too. 9 / 10 gives a remainder of 9. We store '9', too. Now ax = 0. So we begin POP: Pop '9'. Display it. Pop '5'. Display it. Pop '8'. Display it. So far so good. The problem arises when the result of the multiplication is large. In that case, the result is stored in DX:AX. I am going nuts but cannot figure out a way to display a double word. How do high level languages give us this feature when the hardware provides no support for it? Ali Bhai BCS III - FAST Institute of Computer Science, Karachi email: mashah@xxxxx.xxx.xx web page: www.pak.org/mufta <-----------------------------------------> [To err is human but to really mess up the things you need a computer.]
Previous post | Next post | Timeline | Home