News for hackers. Stuff that matters.
Re:Crash course to Amiga assembly programming by hota_mazi on Thursday May 11, 2017 @01:09PM (#14317630)
Indeed.

    mov esp, 0
"Move 0 into esp".

Seriously, X86? Who came up with that?

Re:Crash course to Amiga assembly programming by kazinator on Thursday May 11, 2017 @11:12PM (#14321146)
The same engineer who came up with

    dest := source;
and

    memcpy(dest, src, size);
as well as

    obj.set(0);
Numerous assembly languages have destinations on the left.

Some have load/store instructions where the memory is always on one side:

    load [r1], r3   ; --> direction
    store [r1], r3  ; <-- direction
it's a matter of assembler syntax; the "AT&T" syntax used by the GNU assembler and gcc for x86 has destination on the right.
Re:Crash course to Amiga assembly programming by GuB-42 on Thursday May 11, 2017 @01:43PM (#14317984)
Read it as "esp = 0". "add eax, 3" is like "eax += 3" in C.

This is the Intel syntax and it is the most popular for doing x86 assembly.

The other syntax, the AT&T syntax, works the other way ("mov $0, %esp" puts 0 into esp).

Re:Crash course to Amiga assembly programming by tmccrmck on Thursday May 11, 2017 @01:36PM (#14317910)
I'm not sure AT&T syntax is much better.

  movl $1, %esp
Re:Crash course to Amiga assembly programming by wolfgke on Thursday May 11, 2017 @04:02PM (#14319021)
What is wrong with that? Besides the fact that the canonical way to zero a register on x86 if flags are of no concern is

  xor reg,reg
(recommended way) or

  sub reg,reg
Re:Crash course to Amiga assembly programming by Jach on Thursday May 11, 2017 @04:11PM (#14319091)
It's wrong if you try to read it as "move 0 into esp" because the source and destination are reversed in code from how it's expressed in English. The way to fix that is to use the other syntax, or change how you think of the English. If read like Lisp, then it's "set esp to 0" and 'mov' is just a poor mnemonic.
Re:Crash course to Amiga assembly programming by hota_mazi on Thursday May 11, 2017 @04:17PM (#14319140)
I read "mov a,b" as "Move a into b".
Re:Crash course to Amiga assembly programming by wolfgke on Thursday May 11, 2017 @04:22PM (#14319167)
It is canonical in Intel syntax that the parameter order is always "destination, source" (in AT&T syntax it is "source,destination").