MASM StdOut integer value instead of ASCII representation
I'm writing on of my first assembly programs in MASM, and am trying to print out a number using StdOut
. Here is my code (snippet):
.data
Su dword 0
.code
start:
mov Su, 65
invoke StdOut, addr Su
invoke ExitProcess, 0
end start
The problem is, instead of printing out 65
, i开发者_JS百科t prints out the ASCII representation A
. How can I make it print out an integral value?
StdOut
takes a string argument, so you'll need to convert the dword to a decimal string. This is not hard to do by hand, or you can look for a library function to do it. The discussion at http://www.masm32.com/board/index.php?topic=16316.0 would suggest one of dwtoa
, itoa
, or crt_itoa
, depending on what libraries you're linking with. (Note that the link is talking about ascii->integer, so it uses atoi and atodw.)
精彩评论