Assembly language style to be divided into two main categories, one is the Intel assembly, a class is the AT-and-t assembly, respectively, Windows and Linux as the mainstream style. Since my blog is based on the recommended Linux system, I will use Linux as the main description language later.
For a brief introduction, the "#" starts with a comment line, "." Commands that start with a point are generally pseudo-directives, the "$" dollar sign is decorated immediately, and the "%" modifier registers. For example:
Addressing mode (addrsing mode) refers to the way data is organized in a fixed format: address or offset (% base or offset register,% index register, Scale factor)
the Final address = address or offset +% base address or offset Register +% index Register * Scale Factor
This string of things is basically optional, not written items are basically 0 instead, different combinations become different addressing methods, as follows:
1) Direct addressing
MOVL ADDRESS,%eax
Address is actually the equivalent of "address or offset" in the addresses, anyway, is a number.
2) Register addressing
In fact, the above example also includes register addressing, as the name implies%eax is register addressing, representing the register itself to write or read out.
3) Immediate Addressing
MOVL,%EBX
I have always felt that immediate addressing is not an address, anyway it means to write 2 this number to the%EAX register, which is immediately addressed, in fact, the immediate number.
4) Indirect addressing
MOVL (%eax),%EBX
(%EAX) is an indirection, meaning access to the address represented by the value in the EAX register. Equivalent to the% base or offset register in the general formula.
5) Index Addressing (variable addressing)
Movl 0xffff0000 (,%eax,4),%EBX
0xffff0000 (,%eax,4) is index addressing, which means starting with the 0xffff0000 address, plus%EAX * 4 as the final address of the index. Please match the general formula above for yourself.
6) addressing the base address
MOVL 4 (%eax),%EBX
4 (%EAX) is the base address, meaning that the value in the EAX register is used as the base, plus 4 to get the final addresses. can also be matched to the general formula above, and this is a very common way of addressing.
Https://www.cnblogs.com/orlion/p/5765339.html
Http://blog.csdn.net/column/details/linuxcode.html
http://blog.csdn.net/jnu_simba/article/details/11747901
At-T assembly language and its addressing method