5.9.3. 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 5.17 shows such a register-based map. The labels defined in the map include the register.

Example 5.17. 

		MAP		0,r9
consta		#		4		; consta uses four bytes, located at offset 0 (from r9)
constb		#		4		; constb uses four bytes, located at offset 4
x		#		8		; x uses eight bytes, located at offset 8
y		#		8		; y uses eight bytes, located at offset 16
string		#		256		; string is up to 256 bytes long, starting at offset 24

Using the map in Example 5.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.

Copyright © 1997, 1998 ARM Limited. All rights reserved.ARM DUI 0040D
Non-Confidential