News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Instruction Operands

Started by D1N, August 17, 2007, 03:22:58 PM

Previous topic - Next topic

D1N

I'm reading some information on Instruction Operands for x86 which is basically explaining the process in which Operands are parameters that are used with assembler mnemonics.

Quote:

mnemonic destination, source

Example:

mov eax, 1

MOV is the reserved name for a family of opcodes while EAX is the destination operand and 1 is the source operand. The operating copies the operand 1 into EAX.

Im still learning assembler so this is all very new to me!

Question, why do we move from right to left?

In intro to operands it says that " the right operand is the source and the left operand is the destination." Is this always true with x86? Do we always have to move from right to left and if so a short explanation would be wonderful.

hutch--

Right to left is comon in x86 assembler but it is a notation issue, not a hardware one. AT&T assembler for x86 is left to right.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

BogdanOntanu

Consider this:

x = 1

and compare to this:

eax = 1

mov eax, 1

Now you can see that "normal" human assumptions about assignments in programing languages are form right to left.
And MOV EAX,1 is an assignment. Data does not "move" from "1" to "EAX". Instead "EAX" is assigned a value of "1".

There are many "presumed" wrong notations in x86 syntax... but IF you think about it THEN you will realize they are in fact the  correct notations  :green
Ambition is a lame excuse for the ones not brave enough to be lazy.
http://www.oby.ro

D1N

BogdanOntanu and Hutch thanks a lot guys I'm starting to understand x86 assembly a lot better now its all starting to make since or at least the basics are! I've been a member here for over a year! I've been really trying to grasp everything and now its all starting to come together. I don't just want to code in asm... I want to truly understand everything without skipping over all the good stuff. :)