Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- iAPx86 - <b>lea load effective address flags: not altered</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
LEA             Load Effective Address               Flags: Not altered

LEA destination,source

        Logic   destination . address(source)

    LEA transfers the offset of the source operand, rather than its
    value, to the destination register. The source must be a memory
    reference and the destination must be a general register.


    The operand-size attribute of the instruction is determined by the
    destination register. The address-size attribute is determined by
    the USE attribute of the segment containing the second operand.
    The operand-size and address-size attributes affect the action
    performed by LEA as follows:

        Operand  Address   Action
        size     size      performed
        16       16        16-bit effective address is calculated and
                           stored in 16-bit destination
        16       32        32-bit effective address is calculated. The
                           lower 16 bits of the address are stored in
                           16-bit destination
        32       16        16-bit effective address is calculated. The
                           16-bit address is zero-extended and stored
                           in 32-bit destination
        32       32        32-bit effective address is calculated and
                           stored in 32-bit destination


    Example:    lea     di,[string]     ; = mov di,offset DGROUP:string
                mov     al," "
                repne   scasb

    Example:    lea     bx,[cvt_table]
                xlatb

    Example:    p186
                proc    stack_vars
                local   tmp,element:word, array:dword:50 = LOCAL_SIZE
                enter   LOCAL_SIZE,0
                lea     bx,[array]
                mov     si,[element]
                shl     si,2
                mov     ax,[ss: bx + si]
                mov     dx,[ss: bx + si + 2]
                ;...

    Example:    p386n
                mov     ecx,offset bigarray
                lea     eax,[ecx + edx * 8 + 2]

    Example:    mov     bx,BASE_REG             ; bx = 03F8h
                lea     dx,[bx + 3]             ; dx = 03FBh
                in      al,dx

    Example:    p386n
                mov     ebx,eax
                lea     eax,[eax + ebx * 4]     ; Multiply eax by 5


    Opcode      Format
    8D /r       LEA  r16,m
    8D /r       LEA  r32,m


    Length and timing
    Operands    Bytes   8088    186     286     386     486     Pentium
    r16, mem    2+d(2)  2+EA     6       3       2      1-2      1   UV
    r32, mem    2+d(2)   -       -       -       2      1-2      1   UV

See Also: MOV LDS Addressing modes

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson