Use div
to divide edx:eax
by 10 and repeat.
x86 Assembly How to print a large number from two registers?
题
I have a number 8 717 809 4592 that is stored in the registers edx, eax. The values are as such edx = x14 eax = 4c382800 So basically edx has the high order and eax has the low order. How do I save this number as an ascii string '87178094592' without using function calls?
解决方案
其他提示
You can divide an extended precision dividend by a 32 bit divisor. Start with edx = 0, eax = high order dividend, divide by 10, high order dividend = eax, eax = low order dividend, divide by 10, low order dividend = eax, least significant digit = remainder = edx. Repeat until dividend = 0. You get the digits in reverse order, so you may want to push them onto a stack, the pop them off to get the digits in forward order, or store the digits into to a string array, starting at the end of the string (leaving room for a trailing zero).