lea

i am a beginner, and i wanted to know what does lea actually

do and when do we use it and how.

thanx in advance


Comments

  • : i am a beginner, and i wanted to know what does lea actually

    : do and when do we use it and how.

    : thanx in advance


    lea(load effective adress) is used to load the offset

    adress of a memory reference into a register.

    You should use it if you need to compute "complex"

    offsets.


    example:

    ;with LEA

    lea bx, [buffer+bp+di+02]


    ;without LEA

    mov bx, offset buffer

    add bx, bp

    add bx, di

    add bx, 2




  • : : i am a beginner, and i wanted to know what does lea actually

    : : do and when do we use it and how.

    : : thanx in advance


    : lea(load effective adress) is used to load the offset

    : adress of a memory reference into a register.

    : You should use it if you need to compute "complex"

    : offsets.


    : example:

    : ;with LEA

    : lea bx, [buffer+bp+di+02]


    : ;without LEA

    : mov bx, offset buffer

    : add bx, bp

    : add bx, di

    : add bx, 2







  • hmm.. do these muls and adds in LEA take the

    same clock cycles as the actual instructions?


    : : : i am a beginner, and i wanted to know what does lea actually

    : : : do and when do we use it and how.

    : : : thanx in advance


    : : lea(load effective adress) is used to load the offset

    : : adress of a memory reference into a register.

    : : You should use it if you need to compute "complex"

    : : offsets.


    : : example:

    : : ;with LEA

    : : lea bx, [buffer+bp+di+02]


    : : ;without LEA

    : : mov bx, offset buffer

    : : add bx, bp

    : : add bx, di

    : : add bx, 2





Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories