News for hackers. Stuff that matters.
Re:How to Read Assembly Language by titzer on Tuesday March 02, 2021 @11:38AM (#26317133)
The perennial problem for me is the bifurcation from "AT&T" and "Intel" syntax. I don't really care if register names have a $, a %, or no prefix at all. It's the reversal of source and destination operands that is absolutely maddening.

Personally I prefer that destination operands are on the left, because that tracks with assignments in normal programming languages. I don't really understand why you would want the opposite.

Re:How to Read Assembly Language by patrec on Tuesday March 02, 2021 @01:34PM (#26318664)
It becomes more natural/C-like if you think of

    ADD foo bar
not as

    foo + bar
but as

    foo += bar
And then apply a prefix syntax correction, to end up with

    += foo bar
(Or, equivalently, always mentally add the word "TO" to each operator that modifies an argument, which is most)

Also, most intel instructions use one or two arguments as input, and modify one of them as output. It sort of makes sense to have the output (or input/output) argument always be in the same position, regardless of whether an instruction takes 1 or 2 args. BTW, even in riscv where "add" takes three args, i.e. the form is a = b + c, the output-only argument a comes first.

Re:How to Read Assembly Language by titzer on Tuesday March 02, 2021 @02:43PM (#26319562)
> foo += bar

Yeah, this is how I think about it too. It's natural to have the destination operand always as the first one (i.e. left hand side). I think the GNU tools all use the AT&T syntax (destination is last), and I hate it.

Re:How to Read Assembly Language by gumby on Tuesday March 02, 2021 @12:31PM (#26317822)
AT&T simply adapted the assembly syntax of earlier machines, ultimately which reflected the architectures of even earlier hardware from a time when there weren't really higher level languages.

Some bizarre high level conventions, like using '=' for assignment, were also adopted from earlier languages but are now commonplace.

Re:How to Read Assembly Language by pjc50 on Tuesday March 02, 2021 @12:14PM (#26317605)
"MOV A, B" reads more naturally as "move A to B".

I agree that we should just pick a convention!

Re:How to Read Assembly Language by root on Tuesday March 02, 2021 @12:17PM (#26317641)
COBOL has MOVE ... TO ... which seems to be the logical order for a command named MOV/MOVE.