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
:'(
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
thanks you for your suggestions