<<< Indirect Syntax Options     Index     Relation of Base Registers to Memory Segments >>>

6. Scaling Factors


  • You can use scaling to index into arrays with different sizes of elements.

  • For example, the scaling factor is

    • 1 for byte arrays (no scaling needed),

    • 2 for word arrays,

    • 4 for doubleword arrays,

    • and 8 for quadword arrays.

  • There is no performance penalty for using a scaling factor.

  • Scaling is illustrated in the following examples:

        mov     eax, darray[edx*4]     ; Load double of double array
        mov     eax, [esi*8][edi]      ; Load double of quad array
        mov     ax, wtbl[ecx+2][edx*2] ; Load word of word array
    
  •   base, scaling factor, and displacement generating a 32-bit address

<<< Indirect Syntax Options     Index     Relation of Base Registers to Memory Segments >>>