EBP. Stack base pointer a register or memory. SEGMENT REGISTERS. INC dest>. Add 1 to. may be a register or memory. CS. Code segment. The GNU Assembler, gas, uses a different syntax from what you will likely find in For example, movl %edx, %eax means Move the contents of the edx register. Jump to Registers - The register names are mostly historical. For example, EAX used to be called the accumulator since it was used by a number of.


Author: Else Keeling
Country: Denmark
Language: English
Genre: Education
Published: 18 May 2014
Pages: 90
PDF File Size: 16.25 Mb
ePub File Size: 1.55 Mb
ISBN: 562-5-90102-266-8
Downloads: 30688
Price: Free
Uploader: Else Keeling


Example The code below shows a function call that follows the caller rules.

X86 Assembly/X86 Architecture

First parameter is in EAX, the second parameter is the constant ; the third parameter is in memory location var. Thus, to get rid of the parameters, we can simply add 12 to assembly language registers stack pointer. If the caller uses them after the call, it would have needed to save them on the stack before the call and restore them after it.

Callee Rules Assembly language registers definition of the subroutine should adhere to the following rules at the beginning of the subroutine: The base pointer is used by convention assembly language registers a point of reference for finding parameters and local variables on the stack.

When a subroutine is executing, the base pointer holds a copy of the stack pointer value from when the subroutine started executing.


Parameters and local variables will always assembly language registers located at known, constant offsets away from the base pointer value. We push the old base pointer value at the beginning of the subroutine so that we can later restore the appropriate base pointer value for the caller when the subroutine returns.

Remember, the caller is assembly language registers expecting the subroutine to change the value of the base pointer.

X86 Assembly/X86 Architecture - Wikibooks, open books for an open world

We then move the stack pointer into EBP to obtain our point assembly language registers reference for accessing parameters and local variables. Next, allocate local variables by making space on the stack. Recall, the stack grows down, so to make space on the top of the stack, the stack pointer should be decremented.

The amount by which the stack pointer is decremented depends on the number and size of local variables needed. For example, if 3 local integers 4 assembly language registers each were required, the stack pointer would need to be decremented by 12 to make space for these local variables i.

  • Programming Tutorial - Assembly Language : Registers
  • Guide to x86 Assembly
  • X86 Assembly Guide
  • Data Registers

As with parameters, local variables will be located at known offsets from the base pointer. Segments can be 4 gigabytes in length under the bit architecture.

To compute an absolute memory address, the i figures out which segment register is being used, and uses the value in that segment register as an index into the global descriptor table GDT. The entry in the GDT tells among other things what the assembly language registers address of the start of the segment is.

The processor takes this base address and adds on the offset to come up with the final absolute address for an operation. This flag is set according to the sign of a data item following the arithmetic operation. assembly language registers

Assembly - Registers

The sign is indicated by the high-order of leftmost bit. A positive result clears the value of SF to 0 and negative result sets it to 1.


A nonzero result clears the zero flag assembly language registers 0, and a zero result sets it to 1. The AF is set when a 1-byte arithmetic operation causes a carry from bit 3 into bit 4.

The instruction pointer, IP sometimes referred to as the program counter.

Related Articles: