The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: zeeme on February 24, 2008, 03:40:57 PM

Title: how can i dsplay a variable in assemble
Post by: zeeme on February 24, 2008, 03:40:57 PM
i am new to assembly plz tell me that how can i dsplay or print any variable on screen...???...
plz tell me in simple  words...
Title: Re: how can i dsplay a variable in assemble
Post by: Brett Kuntz on February 24, 2008, 04:53:08 PM
I assume you mean in a Console Application? (like a DOS box)

There are some great tutorials found in the MASM directory:

/masm32/tutorial/console/demo1

Also, you can use a procedure called wsprintf to place varibles of any sorts into a text string to display:


.data

buffer db 128 dup(?)
my_value dd 123456
my_string db "The Value Is Equal To: %u", 0

.code

invoke wsprintf, addr buffer, addr my_string, my_value
invoke MessageBox, 0, addr buffer, 0, 0


http://msdn2.microsoft.com/en-us/library/ms647550.aspx