Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between `bx` and `bp`?

What is the difference between bx and bp in assembly? Example here:

mov bx, 1h
mov bp, 1h

Do they reference to the same memory? Is it the same with ss and sp?

like image 724
tina nyaa Avatar asked Sep 02 '11 04:09

tina nyaa


People also ask

What is BP Assembly?

Base Pointer (BP) − The 16-bit BP register mainly helps in referencing the parameter variables passed to a subroutine. The address in SS register is combined with the offset in BP to get the location of the parameter. BP can also be combined with DI and SI as base register for special addressing.

What is the difference between BX and BX ]?

BX is the value in the BX register. [BX] is the value at the address pointed to by BX.

What is BP stack?

bp (base pointer) is typically used to point at some place in the stack (for instance holding the address of the current stack frames)

What is the difference between SI and DI register?

The register SI and DI are called index registers. These registers are usually used to process arrays or strings. SI is called source index and DI is destination index. As the name follows, SI is always pointed to the source array and DI is always pointed to the destination.


1 Answers

In x86 the registers bx and bp are totally unrelated. The only common thing about them is the word 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)
  • bp (base pointer) is typically used to point at some place in the stack (for instance holding the address of the current stack frames)

Again, ss and sp are different as well.

  • ss (stack segment) is a segment register (like cs, ds and es). It holds the segment used by the stack.
  • sp (stack pointer) points at the top of the stack
like image 126
cnicutar Avatar answered Oct 20 '22 01:10

cnicutar