The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: anniyan on August 25, 2006, 02:57:56 PM

Title: Printing 3-digit Numbers using MASM
Post by: anniyan on August 25, 2006, 02:57:56 PM
How can I print/display any 3-digit no. on the monitor using MASM ?
Title: Re: Printing 3-digit Numbers using MASM
Post by: Mark Jones on August 25, 2006, 07:03:26 PM
Hello Annian, what have you tried so far?
Title: Re: Printing 3-digit Numbers using MASM
Post by: PBrennick on August 25, 2006, 09:04:04 PM
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
Title: Re: Printing 3-digit Numbers using MASM
Post by: w0lfshad3 on August 26, 2006, 07:58:44 AM
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)
Title: Re: Printing 3-digit Numbers using MASM
Post by: Vortex on August 26, 2006, 08:45:54 AM
wsprintf also can do the job.
Title: Re: Printing 3-digit Numbers using MASM
Post by: PBrennick on August 26, 2006, 02:32:19 PM
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