寄存器怎么会有地址呢?
根据书上的说法,寄存器是CPU中存储空间较小的地方(例如16位CPU上的16位)。那么CPU寄存器是如何拥有地址的呢?如果它不是在内存中而是在 CPU 中,我们如何才能为其添加位移呢?
示例:
mov ax, [bx+1000h]
According to book, register is a place 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]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
x86 寄存器只能按名称寻址。表达式
bx+1000h
只是表示“寄存器 bx 中的值加上 1000h”,结果被解释为内存中的地址(通过[...]
表示法),而不是进入某些寄存器空间。该表达式的总体解释是“将位于 bx 指向的地址之后 1000h 字节的 16 位加载到 ax 中”。
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."
它是通过将
bx
的内容解释为地址,然后用偏移量替换它来完成的。因此,如果
bx
为1000h
,则ax
的内容将存储在内存位置2000h
It's done by interpreting the content of
bx
as an address and then displacing that with the offset.So if
bx
is1000h
then the content ofax
will be stored at memory location2000h