Understanding x86 Addressing Modes

addressing mode existed in hardware although n.w
1 / 122
Embed
Share

Explore the various x86 addressing modes, including register operands, immediate values, indirect addressing, and more. Learn how these modes impact operation complexity and support different operand types in x86 processors.

  • x86 addressing
  • register operands
  • hardware complexity
  • memory schemes
  • instruction set

Uploaded on | 0 Views


Download Presentation

Please find below an Image/Link to download the presentation.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author. If you encounter any issues during the download, it is possible that the publisher has removed the file from their server.

You are allowed to download the files provided on this website for personal or commercial use, subject to the condition that they are used lawfully. All files are the property of their respective owners.

The content on the website is provided AS IS for your information and personal use only. It may not be sold, licensed, or shared on other websites without obtaining consent from the author.

E N D

Presentation Transcript


  1. addressing mode existed in hardware (although there is a trade-off that slows down all operations to allow for more complexity). The x86 instructions use five different operand types: registers, constants, and three memories addressing schemes. Each form is called an addressing mode. The x86 processors support the register addressing mode, the immediate addressing mode, the indirect addressing mode, the indexed

  2. modes can be created by combining two or more basic addressing modes, although building the combination in software will usually take more time than if the combination addressing mode existed in hardware (although there is a trade-off that slows down all operations to allow for more complexity).

  3. In a purely othogonal instruction set, every addressing mode would be available for every instruction. In practice, this isn t the case.

  4. Virtual memory, memory pages, and other hardware mapping methods may be layered on top of the addressing modes.

  5. 7.1 ADDRESSING MODES WITH REGISTER OPERANDS

  6. Register operands are the easiest to understand. Consider the following forms of the mov instruction:

  7. mov ax,ax

  8. mov ax,bx

  9. mov ax,cx

  10. mov ax, dx

  11. remaining three instructions copy the value of bx,cx, and dx into ax. Note that the original values of bx, cx and dx remain the same. The first operand (the destination register) is not limited to ax; you can move values to any of these registers. This mode of addressing is the register addressing mode

  12. 7.2 ADDRESSING MODES WITH CONSTANTS

  13. Constants are also pretty easy to deal with. Consider the following instructions:

  14. mov ax,25

  15. mov bx, 195

  16. mov cx,2056

  17. mov dx,1000

  18. straightforward; they load their respective registers with the specified hexadecimal constant. This mode of addressing is called the immediate addressing mode.

  19. 7.3 ADDRESSING MODES WITH MEMORY STRUCTURES

  20. addressing mode found in this category; the direct addressing mode, the indirect addressing mode and the index addressing mode. These addressing modes take the following forms:

  21. mov ax, [1000]

  22. mov ax, [bx]

  23. mov ax, [1000+bx]

  24. The first instruction uses the direct addressing mode to load ax with the 16 bit value stored in memory starting at location 1000hex.

  25. contents of the bx register. This is an indirect addressing mode. Rather than using the value bx, the instruction accesses the memory location whose address appears in bx.

  26. example of this memory addressing mode is mov ax, [1000+bx]. The instruction adds the contents of bx with 1000 to produce the address of the memory value to fetch. This instruction is useful for accessing elements of arrays, records and other data structures.

  27. 7.4 ADDRESSING MODE WITH STACK MEMORY

  28. stack with the PUSH instruction and removed with a POP instruction. The stack memory is maintained by two registers (the stack pointer SP or ESP and the stack segment)s. The stack pointer register always points to an area of memory located within the stack segment. The stack pointer adds to (ss*10h) to form the stack memory address in the real mode.

  29. PUSH ax: Copies ax into the stack

  30. POP cx: Removes a word from the stack and places it in cx

  31. PUSH dx: Copies dx into the stack

  32. PUSH 123: Copies 123 into the stack

  33. PUSH A: Copies the word content of all the registers into the stack (AX,BX,CX,DX,SI,DI,SP,BP)

  34. POP A: Removes data from the stack and places it in the 16 bit registers.

  35. Example

  36. .code

  37. start:

  38. mov ax,23

  39. mov bx,44

  40. mov cx,13

  41. push ax; copies 23 into the stack

  42. push bx; copies 44 into the stack

  43. push cx; copies 13 into the stack

  44. pop cx; removes 13 from the stack and places it back into cx

  45. pop bx; removes 44 from the stack and places it back into bx

  46. pop ax; removes 23 from the stack and places it back into ax

Related


More Related Content