News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Printing 3-digit Numbers using MASM

Started by anniyan, August 25, 2006, 02:57:56 PM

Previous topic - Next topic

anniyan

How can I print/display any 3-digit no. on the monitor using MASM ?

Mark Jones

Hello Annian, what have you tried so far?
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

PBrennick

Annian,
Have you tried dwtoa?


.data
BinaryValue     dd  0                              ; Binary value
ASCIIValue      db  6 dup(0)                       ; ASCII value

.code
    invoke  dwtoa, BinaryValue, ADDR ASCIIValue    ; Convert double word Binary value value to ASCII


Once you have performed the above, if you are converting a 3 digit value to ASCII; you will wind up with a 3 digit ASCII value that is zero terminated and can be easily displayed depending upon how you wish to display it, console or window.  I would encourage you to use the data declarations just as is so that you can use this bit of code in a multitude of applications.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

w0lfshad3

invoking C function printf(),

look at this:

http://www.masm32.com/board/index.php?topic=5260.0 contains examples for download and a pasted code reply by Vortex(last reply currently)

Vortex


PBrennick

wolfshad3,
I like Vortex's method, also.  He has always been a good partner in our project and always contributes very important code.  I was just waiting to see what method of display Annian wants to use before further posting.

Paul
The GeneSys Project is available from:
The Repository or My crappy website