Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MOV src, dest (or) MOV dest, src?

Tags:

MOV is probably the first instruction everyone learns while learning ASM.

Just now I encountered a book Assembly Language Programming in GNU/Linux for IA32 Architectures By Rajat Moona which says: (broken link removed)

But I learnt that it is MOV dest, src. Its like "Load dest with src". Even Wiki says the same.

I'm not saying that the author is wrong. I know that he is right. But what am I missing here?

btw.. he is using GCC's as to assemble these instructions. But that shouldn't change the instruction syntax right?

like image 237
claws Avatar asked Mar 07 '10 19:03

claws


People also ask

What is SRC in assembly language?

Description. The SRC directive creates an assembler source (. SRC) file instead of an object (. OBJ) file. The source file may be assembled with the assembler.

What does MOV mean in ASM?

(1) An assembly language instruction that copies data from one location to another. See move and machine instruction.

What does MOV command do?

The MOV instruction moves data bytes between the two specified operands. The byte specified by the second operand is copied to the location specified by the first operand.

What is the size of MOV instruction?

It is a 1-Byte instruction.


1 Answers

mov dest, src is called Intel syntax. (e.g. mov eax, 123)

mov src, dest is called AT&T syntax. (e.g. mov $123, %eax)

UNIX assemblers including the GNU assembler uses AT&T syntax, all other x86 assemblers I know of uses Intel syntax. You can read up on the differences on wikipedia.

like image 84
Martin Avatar answered Jan 03 '23 12:01

Martin