Writing ARM and Thumb Assembly Language
2-60 Copyright © 2000, 2001 ARM Limited. A ll 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 Example2-22.
Example2-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 Example2-22, the assembly language code can be as shown
in Example2-23.
Example2-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]
Example2-23 uses
LDR
pseudo-instructions. Refer to Loading with LDR Rd, =const on
page2-27 for an explanation of these.