This preview shows page 1. Sign up to view the full content.
Unformatted text preview: g the constant into a register and then using one of these instructions, but it is usually more efficient to use a short series of data processing instructions using shifts and adds or subtracts. For example, to multiply r0 by 35:
ADD RSB r0, r0, r0, r0, r0, r0, LSL #2; LSL #3; r0':= r0 r0" x r0' 5 x := 7 (= 35 x r0) 3.2 Data transfer instructions
Data transfer instructions move data between ARM registers and memory. There are three basic forms of data transfer instruction in the ARM instruction set: Single register load and store instructions. These instructions provide the most flexible way to transfer single data items between an ARM register and memory. The data item may be a byte, a 32-bit word, or a 16-bit half-word. (Older ARM chips may not support half-words.) 56 ARM Assembly Language Programming Multiple register load and store instructions. These instructions are less flexible than single register transfer instructions, but enable large quantities of data to be transferred more efficiently. They are used for procedure entry and exit, to save and restore workspace registers, and to copy blocks of data around memory. Single register swap instructions. These instructions allow a value in a register to be exchanged with a value in memory, effectively doing both a load and a store operation in one instruction. They are little used in user-level programs, so they will not be discussed further in this section. Their principal use is to implement semaphores to ensure mutual exclusion on accesses to shared data structures in multi-processor systems, but don't worry if this explanation has little meaning for you at the moment. It is quite possible to write any program for the ARM using only the single register load and store instructions, but there are situations where the multiple register transfers are much more efficient, so the programmer should be familiar with them. Register-indirect addressing Towards the end of Section 1.4 on page 14 there was a discussion of memory add...
View Full Document
- Spring '09