8086 CPU addressing mode
http://blog.csdn.net/daiyutage/article/details/9141251
The 8086 CPU has flexible addressing methods. There are the following
idata represents a constant
1. [ idata ] Use a constant to represent the address, which can be used to directly locate the memory unit, but in MASM, it is necessary to clearly describe the ds segment register, such as mov ax, ds:[0] , indicating that the segment in the ds register is located. The value in the memory unit at address + offset address 0 is assigned to ax, which cannot be used
mov ax, [0], in this way, it will be regarded as mov ax, 0 in masm. In debug and nasm of windows, the memory can be located in the way of mov ax, [..], and the segment address is placed in ds by default.
2. [bx] Use a variable to represent a memory address, which can be used to indirectly locate a memory location. For example, mov ax, [bx], the segment address is placed in ds by default
3. [bx+idata] A variable plus a constant is used to represent the memory address, and a variable can be used to indirectly locate a memory unit on the basis of an actual address.
for example:
mov ax, [bx+idata]
mov ax, [idata+bx]
mov ax, idata[bx]
All are equivalent, equivalent to the array representation method in high-level languages.
4. [bx+si] uses two variables to represent the address.
5. [bx+di] is equivalent to [bx+si].
6. [bx+si+idata] Use two variables and one constant to represent the address.
7 [bx+di+idata] is equivalent to [bx+si+idata].
About bx,si,di,bp
In the 8086 CPU, only these four registers can be used [...] for addressing memory locations, such as
mov ax, [bx]
mov ax, [bx+si]
mov ax, [bx+di]
mov ax,[ bp]
mov ax, [bp+si]
mov ax, [bp+di]
In [..], bx, di, si, bp, can appear singly, but only in four combinations
bx and si, bx and di, bp and si, bp and di
for example
mov ax,[bx+bp]
mov ax, [si + di]
These two instructions are wrong.
As long as the register bp is used in [...], and the segment address is not explicitly given in the instruction, the segment address defaults to ss
mov ax, [bp] segment address in ss
mov ax,[bp+idata] segment address is in ss
mov ax,[bp+si] segment address is in ss
mov ax, [bp+si+idata] segment address is in ss
You can also specify the segment register explicitly
mov ax, ds:[bp]
mov ax, es: [bx]
mov ax, ss:[bx]
mov ax ,cs:[bx+si]
-------------------------------------------------------------------------------------------------
Addressing Mode Summary
addressing mode name
[idata] direct addressing
[bx] Register indirect addressing
[si] register indirect addressing
[di] Register indirect addressing
[bp] Register Indirect Addressing
[bx+idata] Register-relative addressing
[ si+idata] Register-relative addressing
[di +idata] register relative addressing
[bp+ idata] register relative addressing
[bx+si] base index addressing
[bx+di] base index addressing
[bp+si] base index addressing
[bp+di] Base Indexed Addressing
[bx+si+idata] Base-relative indexed addressing
[bx+di+idata] Base-relative indexed addressing
[bp +si +idata] Base-relative indexed addressing
[bp+di+idata] Base-relative indexed addressing