Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
805 views
in Technique[技术] by (71.8m points)

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...