Assembler Syntax

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
B.E

Assembler Syntax

Post by B.E »

I prefere the intel Syntax because it is more logical than AT&T

For example:
with like syntax Intel syntax
when you assign somthing in C/C++ (or any language for that matter) you do sothing like this:

destination = source.
converted to assembly would be
mov destination,source

with AT&T syntax the same insruction would be

mov{size} {some prefix stuff)source, {some prefix stuff)destination

which when converted to C it would look like this

source = destintation

also the memory addressing is also not logical. in AT&T sytax it would look like this

immed32(basepointer,indexpointer,indexscale)

which in mathimatics would be interpreted as
immed32 * basepointer + indexpointer + indexscale
wich is totaly wrong
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Assembler Syntax

Post by Solar »

B.E wrote: I prefere the intel Syntax because it is more logical than AT&T
What a statement! If you think so, why are you doing this poll? To see how many people are so... stupid?... to use an "illogical" syntax?

Well OK, I'll bite.
For example:
with like syntax Intel syntax
when you assign somthing in C/C++ (or any language for that matter) you do sothing like this...
Yep. You use an operator that is defined to assign the right-hand-side value to the left-hand-side value. Nobody who has ever seen a '=' would ever think otherwise.

Only, in Assembler you don't use '=' ("let x be equal y..."), you use the opcode "mov", which stands for "move". In English, it's "moving from x to y". On shell, it's "mv src dest". In AT&T Assembler, it's "mov x, y" (on all supported platforms AFAIK). Only in Intel it's the other way round...
...also the memory addressing is also not logical.
You know what? I agree. ;D

But in the end...
wich is totaly wrong
...this isn't a poll to get some kind of information, it's poorly camouflaged flamebait. It's like making a poll "Which OO language do you prefer?", and then giving "C++" and "real OO languages" as options.

I hope you never make it into politics. 8)
Every good solution is obvious once you've found it.
B.E

Re:Assembler Syntax

Post by B.E »

Solar wrote: What a statement! If you think so, why are you doing this poll? To see how many people are so... stupid?... to use an "illogical" syntax?
I'm doing this poll to see how many people like the syntax and why they prefere one over the other. I was just commenting on a what I prefere.
Yep. You use an operator that is defined to assign the right-hand-side value to the left-hand-side value. Nobody who has ever seen a '=' would ever think otherwise.

Only, in Assembler you don't use '=' ("let x be equal y..."), you use the opcode "mov", which stands for "move". In English, it's "moving from x to y". On shell, it's "mv src dest". In AT&T Assembler, it's "mov x, y" (on all supported platforms AFAIK). Only in Intel it's the other way round...
I agree, but in a programming sence. many memory functions (ie memcpy, strcpy, strcat, memset,etc..) use the destination source, not the other way arround. So in that sence it is logical to use destination source.

also the documentation for the instruction set is in intel syntax.
User avatar
Solar
Member
Member
Posts: 7615
Joined: Thu Nov 16, 2006 12:01 pm
Location: Germany
Contact:

Re:Assembler Syntax

Post by Solar »

B.E wrote: I'm doing this poll to see how many people like the syntax and why they prefere one over the other. I was just commenting on a what I prefere.
Well, your post wasn't really inviting calm pointing out of differences. ;)
Many memory functions (ie memcpy, strcpy, strcat, memset,etc..) use the destination source, not the other way arround. So in that sence it is logical to use destination source.
Following that line of reasoning, having a GUI that looks like Windows and a command shell that works like bash is inherently a Good Thing (tm) and anything doing it differently - and perhaps better - a Bad Thing (tm).

Perhaps if the opcode had been named "let" or "load". But it is named "mov", and placing destination first is counter-intuitive to anyone not already "twisted" by habit.

It's a bit like placing the constant first in comparisons to avoid accidential assignment. The compiler can generate warnings to avoid the same mistake, and it's "readable" as hell - but people keep claiming that it's not so strange after all "once you're getting used to it"...
...also the documentation for the instruction set is in intel syntax.
Hardly surprising, that's why it's called "Intel syntax". I agree this is the second strong point (aside from the memory references) for the Intel syntax. But then, almost anyone who has learned his ASM on a different machine (like the 68k) gets mortbumps just from looking at it.

I'm someone who prefers verbose programming. I loved the AmigaDOS 'delete' and 'copy' as opposed to bash 'rm' / 'cp', I neatly do a [tt]if ( pointer == NULL )[/tt] instead of [tt]if ( ! pointer )[/tt], I really use [tt]size_t[/tt] for array indexing instead of [tt]int[/tt] - and I like stating long moves with [tt]movl[/tt] and writing registers with leading '%'. ;)
Every good solution is obvious once you've found it.
Post Reply