Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- TASM 2.x / MASM 6.x Assembly Language - <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 . Addr(source)

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

  --------------------------------------------------------------------------
   Operands                  Clocks   Transfers  Bytes   Example
   reg16, mem16              2 + EA       -       2-4    LEA BX,MEM_ADDR
  --------------------------------------------------------------------------

       Notes:         This instruction has an advantage over using the
                      OFFSET operator with the MOV instruction, in that
                      the source operand can be subscripted. For example,
                      this is legal:

                              LEA  BX, TABLE[SI]                ;Legal

                      whereas

                              MOV  BX, OFFSET TABLE[SI]         ;Not legal

                      is illegal, since the OFFSET operator performs its
                      calculation at assembly time and this address is not
                      known until run time.

  -------------------------------- Example ---------------------------------

    The DOS print string routine, Function 09h, requires a pointer to the
    string to be printed in DS:DX. If the string you wished to print was
    at address "PRINT-ME" in the same data segment, you could load DS:DX
    with the required pointer using this instruction:

          LEA     DX, PRINT-ME

See Also: LDS LES OFFSET EA

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