1

I'm trying to display a number that is stored in the edx:eax after multiplication. I have to use MASM and irvine.lib for this assignment. please help senpai

I have tried storing the values in edx:eax in a qword variable, but I'm not sure how to display it either as one decimal number

  • Can you pass it to printf with a `%lld` format? Irvine32 number output functions won't help you since they only accept 32-bit integers, and base 10 isn't a power of base 2 so you can't just output the decimal digits of each half separately. (Well you could, but it wouldn't be the decimal value of the whole 64-bit number). To do it yourself, you'd use extended precision division (with two `div` instructions being the easy but slow way to do 64 / 32-bit => 64-bit division) to repeatedly do `low_digit = % 10` and `num /= 10`, then print the string. – Peter Cordes Apr 04 '22 at 09:15
  • This is basically the same problem as a 32-bit mul result with 16-bit registers: see [Displaying numbers with DOS](https://stackoverflow.com/q/45904075) for code that handles that case. (Replace the DOS output calls with storing into a buffer you eventually pass to WriteString, naturally.) – Peter Cordes Apr 04 '22 at 09:19
  • Thank you so much Peter, solved my issue :D – Sahar Eljezoli Apr 13 '22 at 13:04

0 Answers0