Writing ARM and Thumb Assembly Language

 

 

; Literal

Pool 1]

 

LDR

r1, =Darea + 12

; => LDR R1,[PC, #offset into

 

 

; Literal

Pool 1]

 

LDR

r2, =Darea + 6000

; => LDR R2, [PC,

#offset into

 

 

; Literal

Pool 1]

 

MOV

pc,lr

; Return

 

 

LTORG

 

; Literal

Pool 1

 

func2

 

 

 

 

LDR

r3, =Darea + 6000

; => LDR r3, [PC,

#offset into

 

 

; Literal

Pool 1]

 

 

 

; (sharing with previous literal)

; LDR

r4, =Darea + 6004

; If uncommented produces an error

 

 

; as Literal Pool

2 is out of range

MOV

pc, lr

; Return

 

 

Darea SPACE

8000

; Starting at the

current location,

 

 

; clears a 8000 byte area of memory

 

 

; to zero

 

 

END

 

; Literal

Pool 2 is out of range of

 

 

; the LDR

instructions above

 

 

 

 

 

2-36

Copyright © 2000, 2001 ARM Limited. All rights reserved.

ARM DUI 0068B

Page 48
Image 48
ARM VERSION 1.2 manual R1, =Darea + = LDR R1,PC, #offset into Literal Pool