Author Topic: Help with IF Statement  (Read 2651 times)

rodolfolopes

  • Regular Member
  • *
  • Posts: 12
Help with IF Statement
« on: October 16, 2014, 05:10:36 AM »
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:


Code: [Select]
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

  • Member
  • *****
  • Posts: 1506
    • EditMasm
Re: Help with IF Statement
« Reply #1 on: October 16, 2014, 05:19:35 AM »
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

  • Regular Member
  • *
  • Posts: 12
Re: Help with IF Statement
« Reply #2 on: October 16, 2014, 05:25:53 AM »
Thanks for your help..

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

rodolfolopes

  • Regular Member
  • *
  • Posts: 12
Re: Help with IF Statement
« Reply #3 on: October 16, 2014, 05:34:36 AM »
I FIXED THE PROBLEM!

I Was using esi instead of EAX registry

Thanks anyway ^_^!

qWord

  • Member
  • *****
  • Posts: 1476
  • The base type of a type is the type itself
    • SmplMath macros
Re: Help with IF Statement
« Reply #4 on: October 16, 2014, 06:11:01 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

  • Member
  • *****
  • Posts: 1506
    • EditMasm
Re: Help with IF Statement
« Reply #5 on: October 16, 2014, 05:40:39 PM »
Quote
a question to meditate:
give a fish or teach a sin
Fa is a musical note to play with CL

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: Help with IF Statement
« Reply #6 on: October 16, 2014, 06:23:12 PM »
Quote
give a fish or teach a sin

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

TouEnMasm

  • Member
  • *****
  • Posts: 1506
    • EditMasm
Re: Help with IF Statement
« Reply #7 on: October 16, 2014, 06:52:19 PM »

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

dedndave

  • Member
  • *****
  • Posts: 8829
  • Still using Abacus 2.0
    • DednDave
Re: Help with IF Statement
« Reply #8 on: October 16, 2014, 07:24:33 PM »
 :biggrin:

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

Quote
Donnez à 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.
Quote
Donner un poisson ou d'enseigner un péché.