Re:“Hello World” in assembly language on Linux
by lokedhs on Thursday April 23, 2015 @12:30AM
(#9425024)
I can agree with most of that, except for the fact that Intel arguments are backwards. That throws me off every time. I don't know of any other assembler syntax that uses that argument order.
[ Parent
| on HN ]
Re:“Hello World” in assembly language on Linux
by oso2k on Thursday April 23, 2015 @01:44AM
(#9425171)
For me, I remember the notation by correlating it to its "high-level" equivalent.
mov eax, [ ptr ]
is like eax = *ptr; // or, eax = ptr[ 0 ];
The offset/multiplier memory addressing format for AT&T syntax was always more troubling for me. Coming from a TASM/MASM/NASM/PASCAL/x86 background first, it felt "icky" to put offsets outside of the "brackets" (or parenthesis, as it were) [0][1].[0] https://github.com/lpsantil/rt0/blob/master/src/lib/00_start...
[1] https://github.com/lpsantil/rt0/blob/master/src/lib/00_start...
Re:“Hello World” in assembly language on Linux
by userbinator on Thursday April 23, 2015 @06:26AM
(#9425779)
Standard ARM, MIPS, PowerPC, x86, and Z80 Asm syntax all have the destination on the far left.
68k, Alpha, PDP-11, SPARC, and VAX have the destination on the far right.
The order is probably as contentious as the great endianness debate, but I think one of the most awkward parts of having src, dst order is that subtraction looks backwards. I prefer dst, src because it corresponds closely with the direction of assignment in higher-level languages:
op a, b, c ; a = b op c
op a, b ; a op= b