News:

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

plz tell me whats wrong with the following code

Started by Vineel Kumar Reddy Kovvuri, May 03, 2007, 04:36:30 PM

Previous topic - Next topic

Vineel Kumar Reddy Kovvuri


I am a new to assembly language

plz tell me what is the error in the following program

include c:\masm32\include\masm32rt.inc

.data
a dw 0

.code
start:
cls

lea esi,a
mov eax,5
mov [esi],eax

print str$(a)
   

exit
end start


i am trying to change the value of a to 5 and trying to print the modified value

:'(

dsouza123

The code is fine, it is the variable type that is the problem change it from dw ( word)
to dd (dword) and assemble as a console program and it works.

It is fine to use print the way you did, at least with a 32 bit item,
print takes a dword value either a register or variable and does the conversion to a string itself.


include c:\masm32\include\masm32rt.inc

.data
  a dd 0   ; use dd (32 bit) instead of dw (16 bit)

.code
start:
  cls

  lea esi,a
  mov eax,5
  mov [esi],eax

  print str$(a)

  exit
end start

Vineel Kumar Reddy Kovvuri