
Writing ARM and Thumb Assembly Language
ARM DUI 0068B
Copyright © 2000, 2001 ARM Limited. All rights reserved.
2-53
2.10.2
Register-based maps
In many cases, you can use the same register as the base register every time you access
a data structure. You can include the name of the register in the base address of the map.
Example 2-17 shows such a
register-based map
. The labels defined in the map include
the register.
Example 2-17
MAP 0,r9
consta FIELD 4 ; consta uses four bytes, located at offset 0 (from r9)
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-17, you can access the data structure wherever it is:
ADR r9,datastart
LDR r4,constb ; => LDR r4,[r9,#4]
constb
contains the offset of the data item from the start of the data structure, and also
includes the base register. In this case the base register is r9, defined in the
MAP
directive.
Содержание 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 ...