home *** CD-ROM | disk | FTP | other *** search
/ Reverse Code Engineering RCE CD +sandman 2000 / ReverseCodeEngineeringRceCdsandman2000.iso / RCE / LordLucifer / win32asm / tutorials / a_tut2.txt < prev    next >
Encoding:
Text File  |  2000-05-25  |  3.4 KB  |  90 lines

  1. Introduction to Registers
  2.  
  3. By Lord Lucifer
  4. May 10, 1998
  5.  
  6.  
  7. Introduction
  8. -----------------------------------------------------------------------------
  9.  
  10. Registers are located directly on the CPU.  They are used to store data for
  11. processing.  The general registers can be used to store anything needed, but
  12. some registers are specialized for certain functions.
  13.  
  14.  
  15. Registers
  16. -----------------------------------------------------------------------------
  17.  
  18. General Purpose Registers:
  19.   EAX  Accumulator:   Used for general purpose and slightly specialized for
  20.                       mathematical results
  21.   EBX  Base:          Used for general purpose and specialized for indexing
  22.   ECX  Counter:       Used for general purpose and specialized for counting
  23.   EDX  Data:          General purpose register
  24.  
  25.   Each of these registers are 32-bit. They each can be divided into a 16-bit
  26.   register: AX, BX, CX, DX.  They can also be furthur divided into two 8-bit
  27.   registers, AH (high) and AL (low).
  28.   EAX is 32-bit, therefore it is 4 bytes, called a DWORD.
  29.   AX is 16-bit, 2 bytes, called a WORD.
  30.   AL and AH are each 8-bit or 1 BYTE.
  31.  
  32. Offset Registers:
  33.   EBP  Base Pointer:        General purpose, holding offsets, and indexing
  34.   ESP  Stack Pointer:       Points to the top of the stack
  35.                             The next item pushed on the stack goes here
  36.   ESI  Source Index:        Used for general purpose as well as the source in
  37.                             data movement operations
  38.   EDI  Destination Index:   Used for general purpose as well as the destination
  39.                             in data movement operations
  40.   EIP  Instruction Pointer: Points to the instruction to be executed next
  41.  
  42.   Each of these registers asre 32-bit, but can also be accessed as a 16-bit
  43.   register (BP, SP, SI, DI, IP).
  44.  
  45. Segment Registers:
  46.   CS  Code Segment:  Segment containing the code of the current program
  47.   DS  Data Segment:  Segment containing the data of current program
  48.   ES  Extra Segment: Function depends upon program, may be unused
  49.   FS  Extra Segment:
  50.   GS  Extra Segment:
  51.   SS  Stack Segment: Segment which contains the stack memory
  52.  
  53.   These registers are each 16-bit.  Each locate the start of a 64K segment in
  54.   memory.  You cannot perform math on segment registers or use them to hold the
  55.   results of other operations.  Segments may be stored anywhere in memory.
  56.  
  57. Flags Register:
  58.   o  Overflow Flag
  59.   d  Direction Flag
  60.   i  Interrupt Enable Flag
  61.   t  Trap Flag
  62.   s  Sign Flag
  63.   z  Zero Flag
  64.   a  Auxillary Flag
  65.   p  Parity Flag
  66.   c  Carry Flag
  67.  
  68.   The flags usually represent the result of various instructions. In addition
  69.   to those listed there are several other flags which are not frequently used.
  70.  
  71. Other Registers:
  72.   CR0-CR3  Control Registers
  73.            These 32-bit registers handle things such as processor mode,
  74.            paging and so on.
  75.   DR0-DR7  Debug Registers
  76.            These are 32-bit registers which are used for debugging
  77.            purposes. DR0-DR3 are used to hold breakpoint addresses and
  78.            DR4-DR7 determine the results of a breakpoint.
  79.   TR6-TR7  Test Registers
  80.            These 32-bit registers are used to test memory paging.
  81.   IDTR     Interrupt Descriptor Table Register (52-bit)
  82.   GDTR     Global Descriptor Table Register (52-bit)
  83.   LDTR     Local Descriptor Table Register (68-bit)
  84.   TR       Task State Segment Register (68-bit)
  85.  
  86.  
  87. -----------------------------------------------------------------------------
  88. Copyright (C) 1998
  89. Lord Lucifer (lord-lucifer@usa.net)
  90.