Modos De Direccionamiento

Páginas: 13 (3058 palabras) Publicado: 26 de septiembre de 2011
Memory Access and Organization

Memory Access and Organization
2.1 Chapter Overview

Chapter Two

In earlier chapters you saw how to declare and access simple variables in an assembly language program. In this chapter you will learn how the 80x86 CPUs actually access memory (e.g., variables). You will also learn how to ef ciently organize your variable declarations so the CPU can accessthem faster. In this chapter you will also learn about the 80x86 stack and how to manipulate data on the stack with some 80x86 instructions this chapter introduces. Finally, you will learn about dynamic memory allocation.

2.2

The 80x86 Addressing Modes
The 80x86 processors let you access memory in many different ways. Until now, you’ve only seen a single way to access a variable, theso-called displacement-only addressing mode that you can use to access scalar variables. Now it’s time to look at the many different ways that you can access memory on the 80x86. The 80x86 memory addressing modes provide exible access to memory, allowing you to easily access variables, arrays, records, pointers, and other complex data types. Mastery of the 80x86 addressing modes is the rst step towardsmastering 80x86 assembly language. When Intel designed the original 8086 processor, they provided it with a exible, though limited, set of memory addressing modes. Intel added several new addressing modes when it introduced the 80386 microprocessor. Note that the 80386 retained all the modes of the previous processors. However, in 32-bit environments like Win32, BeOS, and Linux, these earlieraddressing modes are not very useful; indeed, HLA doesn’t even support the use of these older, 16-bit only, addressing modes. Fortunately, anything you can do with the older addressing modes can be done with the new addressing modes as well (even better, as a matter of fact). Therefore, you won’t need to bother learning the old 16-bit addressing modes on today’s high-performance processors. Do keep inmind, however, that if you intend to work under MS-DOS or some other 16-bit operating system, you will need to study up on those old addressing modes.

2.2.1 80x86 Register Addressing Modes
Most 80x86 instructions can operate on the 80x86’s general purpose register set. By specifying the name of the register as an operand to the instruction, you may access the contents of that register. Considerthe 80x86 MOV (move) instruction:
mov( source, destination );

This instruction copies the data from the source operand to the destination operand. The eight-bit, 16-bit, and 32-bit registers are certainly valid operands for this instruction. The only restriction is that both operands must be the same size. Now let’s look at some actual 80x86 MOV instructions:
mov( mov( mov( mov( mov( mov(bx, ax ); al, dl ); edx, esi ); bp, sp ); cl, dh ); ax, ax ); // // // // // // Copies the value from Copies the value from Copies the value from Copies the value from Copies the value from Yes, this is legal! BX into AX AL into DL EDX into ESI BP into SP CL into DH

Remember, the registers are the best place to keep often used variables. As you’ll see a little later, instructions using theregisters are shorter and faster than those that access memory. Throughout this chapter you’ll see the abbreviated operands reg and r/m (register/memory) used wherever you may use one of the 80x86’s general purpose registers.

Beta Draft - Do not distribute

© 2001, By Randall Hyde

Page 157

Chapter Two

Volume Two

2.2.2 80x86 32-bit Memory Addressing Modes
The 80x86 provides hundreds ofdifferent ways to access memory. This may seem like quite a bit at rst, but fortunately most of the addressing modes are simple variants of one another so they’re very easy to learn. And learn them you should! The key to good assembly language programming is the proper use of memory addressing modes. The addressing modes provided by the 80x86 family include displacement-only, base, displacement...
Leer documento completo

Regístrate para leer el documento completo.

Estos documentos también te pueden resultar útiles

  • modos de direccionamiento
  • Modos de direccionamiento
  • Modos De Direccionamiento
  • Modos de direccionamiento
  • Modos De Direccionamiento
  • modos direccionamiento
  • Modos de Direccionamiento
  • modos de direccionamiento

Conviértase en miembro formal de Buenas Tareas

INSCRÍBETE - ES GRATIS