flat assembler
Message board for the users of flat assembler.

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

Author
Thread Post new topic Reply to topic
SomeoneNew



Joined: 12 Aug 2006
Posts: 54
SomeoneNew 03 Dec 2007, 04:24
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 Smile

Thanks!

_________________
Im new, sorry if I bothered with any stupid question Smile
Post 03 Dec 2007, 04:24
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 03 Dec 2007, 05:57
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.
Post 03 Dec 2007, 05:57
View user's profile Send private message Visit poster's website Reply with quote
kohlrak



Joined: 21 Jul 2006
Posts: 1421
Location: Uncle Sam's Pad
kohlrak 03 Dec 2007, 06:27
I can't use AD... Never even heard of it. Must've been a typo on some one's part.
Post 03 Dec 2007, 06:27
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger Reply with quote
SomeoneNew



Joined: 12 Aug 2006
Posts: 54
SomeoneNew 03 Dec 2007, 06:46
My bad, I meant ADD and also forgot the H - My question still unanswered though Sad

_________________
Im new, sorry if I bothered with any stupid question Smile
Post 03 Dec 2007, 06:46
View user's profile Send private message Reply with quote
shoorick



Joined: 25 Feb 2005
Posts: 1614
Location: Ukraine
shoorick 03 Dec 2007, 07:11
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"
Post 03 Dec 2007, 07:11
View user's profile Send private message Visit poster's website Reply with quote
SomeoneNew



Joined: 12 Aug 2006
Posts: 54
SomeoneNew 03 Dec 2007, 07:19
Alright then theres no other difference than readability.

I thought there were some conversions going on during compile time...
Post 03 Dec 2007, 07:19
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 03 Dec 2007, 14:51
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.
Post 03 Dec 2007, 14:51
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.