I learned some x86 Assembly in fasm a while back. I am aware of the instruction named ADD. e.g.:
ADD eax,edx ; Precisely ADD destination,source .
The output gets stored in eax.
But today I read a book on Computer Organization by Carl Hamacher and it says:
Add LOCA,R0
"This instruction adds the operand at memory location LOCA to the operand in a register in the processor, R0, and places the sum into register R0."
ADD R1,R0
This instruction adds the contents of register R1 and R0 and places the sum in R0.
What is the meaning of this? It defies to whatever I studied before. The results get stored in the left placement. Is this book even correct, or am I mistaken? (Page 1.3).
First off there are many different instruction sets, x86 is only one and it has evolved over decades with instructions being added and the defintion of how older instructions worked being changed or re-interpreted.
Second, assembly language is defined by the assembler, the program that reads the assembly language. Unlike C or Python or JAVA or other where there is a clear definition that in particular everyone conforms to. Assembly language is and can be defined however the author of the assembler wants. No rules on the language, the only rules if any are governed by the hardware, for the tool to be useful you need to generate executable machine code.
Historically the chip vendor or in the case of IP cores, the core vendor provides their own documentation with the machine code defined and an assembly language there as well, someone somewhere be it that vendor or someone on their behalf has created an assembler that conforms to that language, and in the case of x86
add ah,bl
means ah = ah + bl
Someone else came along later (and this tool has a habit of doing this changing the assembly language to be incompatible with the chip/core vendors tools) and created/ported an assembler where
add ah,bl
means bl = bl + ah
The language differences are not just limited to destination first or last, the whole language including directives are part of the language, and even if you have AT&T syntax (destination last vs intel syntax remember intel created and makes these processors has destination first) on two or more different assemblers the rest of the syntax can be incompatible, as you should know from fasm.
Intel with its original definition made this more complicated by overloading the mov mnemonic rather than isolating register to register, memory to register, etc. Other instruction sets do things like
ldrb r0,[r1]
ldr r0,[r1]
to show this is an 8 or 32 bit read (load) from memory at some address. No other syntax is required, but for the x86, historically things like
mov [bx], 5
which instruction is that there is more than one
mov word ptr [bx], 5
okay that helps but some assemblers you had to use capital letters not lower case, etc.
So just like programming Python vs JAVA you need to know the syntax of the language you are programming. with x86 you can try things like
mov bx,5
mov 5,bx
and see which one if any it complains about or maybe it requires
mov %bx,5
mov 5,%bx
to get one of the errors to go away, another assembler another assembly language.
then you get into other targets like arm, mips, etc. and their syntax and/or instructions will be different from x86 in some way. then among the various assemblers for that target there can and will be language differences. For some reason the folks that port gnu assembler tend to create languages that are not compatible with the language defined by the chip/IP vendor. Its not one person doing it just a somewhat consistent theme.
Short answer, not broken, somewhat expected. Syntax is tied to the tool not the target.