Writing ARM and Thumb Assembly Language
2-60
Copyright © 2000, 2001 ARM Limited. All rights reserved.
ARM DUI 0068B
Making faster access possible
To gain faster access to a section of memory:
1.
Describe the memory section as a structure.
2.
Use a register to address the structure.
For example, consider the definitions in Example 2-22.
Example 2-22
StartOfData EQU 0x1000
EndOfData EQU 0x2000
MAP StartOfData
Integer FIELD 4
String FIELD MaxStrLen
Array FIELD ArrayLen*8
BitMask FIELD 4
EndOfUsedData FIELD 0
ASSERT EndOfUsedData <= EndOfData
If you want the equivalent of the C code:
Integer = 1;
String = "";
BitMask = 0xA000000A;
With the definitions from Example 2-22, the assembly language code can be as shown
in Example 2-23.
Example 2-23
MOV r0,#1
LDR r1,=Integer
STR r0,[r1]
MOV r0,#0
LDR r1,=String
STRB r0,[r1]
MOV r0,#0xA000000A
LDR r1,=BitMask
STRB r0,[r1]
Example 2-23 uses
LDR
pseudo-instructions
. Refer to
Loading with LDR Rd, =const
on
page 2-27 for an explanation of these.