Registers Flashcards
Details about general purpose registers.
EAX - The Accumulator Register
Primary register for storing common calculations (add, sub). Given preference for calcs by assigning it more efficient one-byte OP codes. Used to store a function’s return value.
EBX - The Base Register
Doesn’t really have a special purpose. Used as a catch-all for available storage.
ECX - The Counter Register
Used as a loop or function repetition counter.
EDX - The Data Register
Like a partner register with EAX. Often used in math operations (mul, div) to deal with the overflow, with the most significant bits stored in EDX and the least in EAX.
ESI - The Source Index
The counterpart to EDI. Often used to store the pointer to a read location. For ex. if a function reads a string, ESI would hold the pointer to the location of that string. Can only reference either the whole register by name, or the lower 16 bits with ‘SI’.
EDI - The Destination Index
Was primarily designed to store the storage pointer of functions, such as the write address of a string operation. Also used for general data storage. Can only reference either the whole register by name, or the lower 16 bits with ‘DI’.
EBP - The Base Pointer
Used to keep track of the base/bottom of the stack. Often used to reference variables on the stack with an offset to the current value of EBP. Can only reference either the whole register by name, or the lower 16 bits with ‘BP’.
ESP - The Stack Pointer
Tracks the top of the stack. As items are pushed and popped from the stack, ESP increments/decrements accordingly. Rarely used for anything other than this. Can only reference either the whole register by name, or the lower 16 bits with ‘SP’.
EIP - The Instruction Pointer
Points to the memory address of the next CPU instruction. Not among the general-purpose registers.