1

Possible Duplicate:
What’s the purpose of the LEA instruction?

Having just started assembly language I would like if someone could tell me the difference between using:

load R1,one[R0] rather than lea R1,1[R0]

when using the value in R1 only as an increment value. For the former, the data is given (one data 1) whereas for the latter data it is not.

Community
  • 1
  • 1
McGuile
  • 818
  • 1
  • 11
  • 29

1 Answers1

1

In the first case you are loading data, in the second case you are loading an address.

E.g. if R0 contains 0x1000:

      addr   data
R0 -> 0x1000 0x42
             0x48
             0x49
             0x43
             0x30

then load R1,1[R0] will load 0x4849 into R1 (assuming the load instruction is a 16 bit load, and the architecture is big endian), whereas lea R1,1[R0] will load 0x1001 into R1.

Paul R
  • 208,748
  • 37
  • 389
  • 560