简体   繁体   English

`bx`和`bp`之间的区别?

[英]Difference between `bx` and `bp`?

What is the difference between bx and bp in assembly? 装配中bxbp什么区别? Example here: 这里的例子:

mov bx, 1h
mov bp, 1h

Do they reference to the same memory? 他们引用相同的内存吗? Is it the same with ss and sp ? sssp是一样的吗?

In x86 the registers bx and bp are totally unrelated. x86 ,寄存器bxbp完全不相关。 The only common thing about them is the word base . 关于它们的唯一常见问题是单词base

  • bx (base index) is a general-purpose register (like ax, cx and dx), typically used as a pointer to data (used for arrays and such) bx (基本索引)是一个通用寄存器(如ax,cx和dx),通常用作指向数据的指针(用于数组等)
  • bp (base pointer) is typically used to point at some place in the stack (for instance holding the address of the current stack frames) bp (基指针)通常用于指向堆栈中的某个位置(例如,保存当前堆栈帧的地址)

Again, ss and sp are different as well. 同样, sssp也是不同的。

  • ss (stack segment) is a segment register (like cs, ds and es). ss (堆栈段)是段寄存器(如cs,ds和es)。 It holds the segment used by the stack. 它包含堆栈使用的
  • sp (stack pointer) points at the top of the stack sp (堆栈指针)指向堆栈顶部

BP register mainly helps in referencing the parameter variables passed to a subroutine. BP寄存器主要有助于引用传递给子例程的参数变量。 The address in SS register is combined with the offset in BP to get the location of the parameter. SS寄存器中的地址与BP中的偏移量组合以获得参数的位置。 BP can also be combined with DI and SI as base register for special addressing. BP也可以与DI和SI组合作为特殊寻址的基址寄存器。

BX: used in index and indirect addressing BX:用于索引和间接寻址

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM