• Uncategorized

About assembly : How-do-I-print-an-integer-in-Assembly-Level-Programming-without-printf-from-the-c-library

Question Detail

Can anyone tell me the purely assembly code for displaying the value in a register in decimal format? Please don’t suggest using the printf hack and then compile with gcc.


Well, I did some research and some experimentation with NASM and figured I could use the printf function from the c library to print an integer. I did so by compiling the object file with the GCC compiler and everything works fair enough.

However, what I want to achieve is to print the value stored in any register in the decimal form.

I did some research and figured the interrupt vector 021h for DOS command line can display strings and characters whilst either 2 or 9 is in the ah register and the data is in the dx.


None of the examples I found showed how to display the content value of a register in decimal form without using the C library’s printf. Does anyone know how to do this in assembly?

Question Answer

You may also like...

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.