Lea assembly instruction :: Assembly

Lea assembly instruction

Need assembly instructions

The 8086 has a large family of instructions which accept a register operand and an effective address, perform some computations to compute the offset part of that effective address, and perform some operation involving the register and the memory referred to by the computed address. It was fairly simple to have one of the instructions in that family behave as above except for skipping that actual memory operation. This, the instructions:

mov ax, [bx+si+5] lea ax, [bx+si+5]

were implemented almost identically internally. The difference is a skipped step. Both instructions work something like:

temp = fetched immediate operand (5) temp += bx temp += si address_out = temp (skipped for LEA) trigger 16-bit read (skipped for LEA) temp = data_in (skipped for LEA) ax = temp

As for why Intel thought this instruction was worth including, I'm not exactly sure, but the fact that it was cheap to implement would have been a big factor. Another factor would have been the fact that Intel's assembler allowed symbols to be defined relative to the BP register. If fnord was defined as a BP-relative symbol (e.g. BP+8), one could say:

mov ax, fnord ; Equivalent to "mov ax, [BP+8]"

If one wanted to use something like stosw to store data to a BP-relative address, being able to say

mov ax, 0 ; Data to store mov cx, 16 ; Number of words lea di, fnord rep movs fnord ; Address is ignored EXCEPT to note that it's an SS-relative word ptr

was more convenient than:

mov ax, 0 ; Data to store mov cx, 16 ; Number of words mov di, bp add di, offset fnord (i.e. 8) rep movs fnord ; Address is ignored EXCEPT to note that it's an SS-relative word ptr

You might also like

LC3 Instructions - LD, LDR, LDI, LEA
LC3 Instructions - LD, LDR, LDI, LEA
Assembly Tutorial 8 - Lea Instruction
Assembly Tutorial 8 - Lea Instruction
Variety Colorful Leaves Macro Shot 10" Quartz Plastic Wall Round Clock Classic Analog Setting Customized Inch Hand Needle Made to Order Support Ready Assembly Required Luxlady Dial Time Personalized Gift Battery Operated Accessories Graphic Designed Model HD Template Wallpaper Photo Image
Home (Luxlady)
  • Please search our Amazon Storefront Luxlady Round Clock for more design. This product is based on the latest High-resolution graphics printed by cutting-edge printing...
  • The surface is made with long-lasting durable finish.
  • With the opportunity to submit your own picture you can make your own unique product. We will make sure the product come out the way you want it. Please search our...
  • Designed in US, Ship from California within 1 or 2 business day to worldwide unlike competitor that take 3 to 5 day
  • Our friendly customer service and designer is online 7 day a week. We are happy to answer any question for you. So you will be 100% happy with our great product...
ComplianceSigns ComplianceSigns Plastic OSHA DANGER Sign, 10 x 7 in. with Ladder / Scaffold Info in English + Spanish, White
BISS (ComplianceSigns)
  • OSHA format DANGER sign makes your Ladder / Scaffold message clear with English + Spanish text
  • Semi-rigid, 1mm PVC sign has rounded corners and 0.20-in. mounting holes in each corner
  • Designed to meet OSHA specifications
  • Resists UV, chemicals, abrasion and moisture. Use indoors or out
  • Made in the USA. Ships fast from our plant in Chadwick, Illinois

Copyright © . All Rights Reserved