Talk:LDR

From ARMwiki
Revision as of 21:13, 11 March 2012 by NoctiLucent (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

LDR offsets

Under "Immediate Offset" explanation you say: ""R3 points to the structure base, you can load the third element with: "", but I think it should read "eigth element". If not, you need to explain why. Then also the C equivalence for the same should read either:
a) "r0 = r1[4];" OR
b) "r0 = r1[3]; (as C arrays uses 0 as index 1)"
NoctiLucent 20:18, 6 March 2012 (CET)

Thank you for your comments. The reason why LDR R0, [R3, #8] loads the third element of the array (the third word) is that the offset given is specified in bytes; thus the first word is offset #0, the second #4, and #8 would be the third.
Likewise with the C equivalence, the ARM instruction LDR R0, [R1, #4] is asking that we load the second word (offset +4 bytes) from the array indicated, thus the equivalent r0 = r1[1]; is correct.
I shall edit the page to make this clearer.
Rick 05:18, 7 March 2012 (CET)
Excellent, now it all make sense! One more thing. If you could remove the "thick" borders in your tables, they would be much more clean and sexy looking. See here: http://en.wikipedia.org/wiki/Help:Table
NoctiLucent 21:13, 11 March 2012 (CET)
Personal tools
Namespaces

Variants
Actions
Navigation
Contents
Toolbox