flat assembler
Message board for the users of flat assembler.

 Index > Main > What's the difference between passing "integer" an
Author
SomeoneNew

Joined: 12 Aug 2006
Posts: 54
SomeoneNew
Sorry for the stupid title, I couldn't fit my whole question in it :p

My question regards the following, one could do this:
Code:
`ADD EAX, 10    `

or this:
Code:
`AD EAX, 0A    `

Is there any real difference in between the two lines?; I mean obviously 0A is hex for 10, but what's happening in the background when FASM compiles the line?, is the base10 number in the first example converted to hex?, if so, using hex would ensure faster compilation times?, if I'm off please, PLEASE explain me!, I need to learn this

Thanks!

_________________
Im new, sorry if I bothered with any stupid question
03 Dec 2007, 04:24
shoorick

Joined: 25 Feb 2005
Posts: 1608
Location: Ukraine
shoorick
ADD EAX, 0A is incorrect. You have to write like this: 0xA or 0AH to present hex numbers. then 10 will be 10, and 10H will be 16.
03 Dec 2007, 05:57
kohlrak

Joined: 21 Jul 2006
Posts: 1421
kohlrak
I can't use AD... Never even heard of it. Must've been a typo on some one's part.
03 Dec 2007, 06:27
SomeoneNew

Joined: 12 Aug 2006
Posts: 54
SomeoneNew

_________________
Im new, sorry if I bothered with any stupid question
03 Dec 2007, 06:46
shoorick

Joined: 25 Feb 2005
Posts: 1608
Location: Ukraine
shoorick
there is no difference between ADD EAX,10 and ADD EAX,0Ah - it has sense only on prefered readability.

say, if you think about ASC codes of digits, 35h is more clear then 53 as ASCII code of "5", and 0Fh is more clear as mask for lower 4 bits, but if you wish to add 10 - it may appear 10 better then 0Ah, as it is more easy to find "10" in the text then "0A" if you are thinking about "10"
03 Dec 2007, 07:11
SomeoneNew

Joined: 12 Aug 2006
Posts: 54
SomeoneNew
Alright then theres no other difference than readability.

I thought there were some conversions going on during compile time...
03 Dec 2007, 07:19
LocoDelAssembly

Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Quote:

I thought there were some conversions going on during compile time...

Well, obviously the conversion is from ASCII to binary, and hex ASCII to binary is faster. Writing all in hex will give you an unnoticable speedup at compilation and the execution time of the program will be the same no matter what number base you have used for your inmmediate operands.
03 Dec 2007, 14:51
 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First

 Jump to: Select a forum Official----------------AssemblyPeripheria General----------------MainTutorials and ExamplesDOSWindowsLinuxUnixMenuetOS Specific----------------MacroinstructionsOS ConstructionIDE DevelopmentProjects and IdeasNon-x86 architecturesHigh Level LanguagesProgramming Language DesignCompiler Internals Other----------------FeedbackHeapTest Area

Forum Rules:
 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot vote in polls in this forumYou cannot attach files in this forumYou can download files in this forum