开发者

What type of addressing are these instructions?

I have problems to di开发者_开发百科stinguish the instructions.

mov [300], bl
mov [bx], cl


I think [300] means "the value stored at address 300. On the other hand, [bx] means "the value stored at the address stored in register BX". (Note that neither are constant values, which would just be a naked 300.)


Lets assume

bx = 0xF000
bl = 0x00   (duh)
cl = 0x10

Direct addressing

mov byte ptr [300], bl

Writes the contents of bl (0) into address 300.

Indirect addressing

mov byte ptr [bx], cl

Writes 0x10 into address 0xF000

Indirect addressing with direct offset

mov byte ptr[bx+300], cl

Writes 0x10 into address 0xF12C (300 decimal = 12C Hex)

x86 Has many more addressing modes, see: http://www.ic.unicamp.br/~celio/mc404s2-03/addr_modes/intel_addr.html

To further complicate matters, this explanation is valid for Intel assembler syntax, on AT&T aka GAS syntax, source and destination are reversed.
This should not concern you overmuch because sane people only use Intel syntax, it's much easier to work with.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜