According to book, register is a pl开发者_如何学Cace in CPU with small storage space (example 16 bit on 16 bits CPU). So how does CPU register have address? And how are we able to add displacement to it if it not in memory but on CPU?
Example for:
mov ax, [bx+1000h]
x86 Registers are only ever addressed by name. The expression bx+1000h
simply means, "the value in register bx plus 1000h" and the result is interpreted as an address into memory (via the [...]
notation), not into some register space.
The overall interpretation of the expression is, "Load into ax the 16-bits located 1000h bytes after the address bx points to."
It's done by interpreting the content of bx
as an address and then displacing that with the offset.
So if bx
is 1000h
then the content of ax
will be stored at memory location 2000h
精彩评论