News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Help with IF Statement

Started by rodolfolopes, October 16, 2014, 05:10:36 AM

Previous topic - Next topic

rodolfolopes

Hi there guys again.
Im having problems with a program in MASM32 that I need to know if the number is greater than 10 or lower than 10 but for some reason i always get the number is greater than 10

Here's my code:


include \masm32\include\masm32rt.inc


.code
start:


mov esi, input("GIVE ME A NUMBER: ",62," ")
invoke atodw, esi

.if esi > 10
print "GREATER THAN 10! ", 13, 10

.elseif esi <10
print "LOWER THAN 10!", 13, 10

.elseif esi==10
print "THE NUMBER IS 10!", 13, 10

.endif



print "-----------------------------------------------------------", 13, 10
inkey "|END OF PROGRAM...|"

exit
end start




Thanks for your support guys!

TouEnMasm

You  are using macro.

To see what happen,put your code inside
Quote
.LISTALL

.........code

.NOLIST

generate a listing, I don't know what do the input MACRO or function

Quote
invoke atodw, esi ;???????????????? wait an adress   ex: offset truc ; truc db "1245",0
Fa is a musical note to play with CL

rodolfolopes

Thanks for your help..

But sorry im new to this... I dont get your answer....
:P

rodolfolopes

I FIXED THE PROBLEM!

I Was using esi instead of EAX registry

Thanks anyway ^_^!

qWord

Quote from: ToutEnMasm on October 16, 2014, 05:19:35 AM
Quote
invoke atodw, esi ;???????????????? wait an adress   ex: offset truc ; truc db "1245",0
ESI does contain an address (pointer to string).
MREAL macros - when you need floating point arithmetic while assembling!

TouEnMasm

Quote
a question to meditate:
give a fish or teach a sin
Fa is a musical note to play with CL

dedndave

Quotegive a fish or teach a sin

not sure if that's a language barrier or a new saying   :P

TouEnMasm


:biggrin:
It's not of my,it is google who had made the translate.
Fa is a musical note to play with CL

dedndave

 :biggrin:

QuoteGive a man a fish and you feed him for a day.
Teach a man to fish and you feed him for a lifetime.

QuoteDonnez à un homme un poisson et vous le nourrissez pour un jour.
Apprends-lui à pêcher et tu le nourriras pour la vie.

Give a fish or teach a sin.
QuoteDonner un poisson ou d'enseigner un péché.