rotemsith
rotemsith

Reputation: 21

in SRC assembly, what's the difference between "la" and "ld" commands?

i know "la" stands for "load address", but is there's a difference at the loaded value to the register?

for example:

"la r1,X"
"ld r1,20"

in:
    0 ld r1,30
...
X: 20 add r6,7

where X is in address 20.

Upvotes: 0

Views: 1351

Answers (2)

Khalid
Khalid

Reputation: 1

la r2,X means ....load dispalcemebt X to r2.....its opcode in SRC architecture is 5 while ld r1,20 means content of memory ie 20 is stored in r1...its opcode in SRC architecture is 1

Upvotes: 0

David Winant
David Winant

Reputation: 832

I'm not familiar with this assembler, but in general if you have a variable declared as X, then "la r1,X" will load the address of X and "ld r1,X" will load the contents of X. In this case, that means that ld r1,20 will read the memory at location 20 and put the contents into r1, where la r1,x will just put 20 into r1 without an additional memory read.

Upvotes: 2

Related Questions