Writing ARM and Thumb Assembly Language
2-52
Copyright © 2000, 2001 ARM Limited. All rights reserved.
ARM DUI 0068B
2.10.1
Relative maps
To access data more than 4KB away from the current instruction, you can use a
register-relative instruction, such as:
LDR r4,[r9,#offset]
offset
is limited to 4096, so r9 must already contain a value within 4KB of the address
of the data.
Example 2-16
MAP 0
consta FIELD 4 ; consta uses four bytes, located at offset 0
constb FIELD 4 ; constb uses four bytes, located at offset 4
x FIELD 8 ; x uses eight bytes, located at offset 8
y FIELD 8 ; y uses eight bytes, located at offset 16
string FIELD 256 ; string is up to 256 bytes long, starting at offset 24
Using the map in Example 2-16, you can access the data structure using the following
instructions:
MOV r9,#4096
LDR r4,[r9,#constb]
The labels are
relative
to the start of the data structure. The register used to hold the start
address of the map (r9 in this case) is called the
base register
.
There are likely to be many
LDR
or
STR
instructions accessing data in this data structure.
This map does not contain the location of the data structure. The location of the
structure is determined by the value loaded into the base register at runtime.
The same map can be used to describe many instances of the data structure. These can
be located anywhere in memory.
There are restrictions on what addresses can be loaded into a register using the
MOV
instruction. Refer to
Loading addresses into registers
on page 2-30 for details of how to
load arbitrary addresses.
Note
r9 is the
static base register
(sb) in the ARM-Thumb Procedure Call Standard. Refer to
the
Using the Procedure Call Standard
chapter in
ADS Developer Guide
for further
information.
Содержание Developer Suite
Страница 10: ...Preface x Copyright 2000 2001 ARM Limited All rights reserved ARM DUI 0068B ...
Страница 110: ...Assembler Reference 3 32 Copyright 2000 2001 ARM Limited All rights reserved ARM DUI 0068B ...
Страница 185: ...ARM Instruction Reference ARM DUI 0068B Copyright 2000 2001 ARM Limited All rights reserved 4 75 Example MSR CPSR_f r5 ...
Страница 238: ...Thumb Instruction Reference 5 44 Copyright 2000 2001 ARM Limited All rights reserved ARM DUI 0068B ...
Страница 282: ...Vector Floating point Programming 6 44 Copyright 2000 2001 ARM Limited All rights reserved ARM DUI 0068B ...
Страница 360: ...Index Index 6 Copyright 2000 2001 ARM Limited All rights reserved ARM DUI 0068B ...