You are on page 1of 2

ARM INSTRUCTION SET

ARM Programming Examples


1. Write an ARM assembly program to move the uppermost byte from register R2 and
put it at the bottom of register R3.
2. Assume the following register and memory contents in an ARM computer: Register
R0 has address 1000 and Register R1 has address 2000. Register R6 contains 20 and
Register R7 contains 30.
The numbers 1, 2, 3 are stored in successive word locations starting at memory
address 1000. What is the effect of executing each of the following short instruction
blocks, starting each time from the given initial values?
A. LDR R8,[R0]

B. STR R6,[R1,#4]!STR

LDR R9,[R0,#4]

R7,[R1,#4]!

ADD R10,R8,R9

LDR R8,[R1],#4
LDR R9,[R1],#4
SUB R10,R8,R9

3. Which of the following ARM instructions would cause the assembler to issue a syntax
error message? Why?
A. ADD R2,R2,R2
B. SUB R0,R1,[R2,#4]
C. MOV R0,#2_1010101
D. MOV R0,#257
E. ADD R0,R1,R11,LSL #8
4. What is contents of R5 after execution of following instruction, assume R2 contains
0x34560701 and R3 contains 0x56745670
A. ADD R5, R2, R3
B. AND R5, R3, R2
C. XOR R5, R2,R3
D. ADD R5, R3, #0x45
5. What is contents of R1? Assume R2= 0x00001234
A. MOV R1, R2, LSL #4
B. MOV R1, R2, LSR #4

PREPARED BY SURABHI BOTHRA NARAYANAN

ARM INSTRUCTION SET

6. Consider the following assembly program:


AREA RESET, CODE, READONLY
LDR R0,=num
LDRSH R1,[R0]
LDRSB R2,[R0,#3]
ADD R3,R1,R2
num DCD 0x87654321
What is the value in register R3 at the end of execution?

7. Write an ARM assembly program to perform the function of Absolute value. Register
R0 will contain the initial value and R1 will contain the Absolute value.
8. Write an ARM assembly language program to count how many vowels are in the
following string.
"Embedded system design is an interesting subject!",0

PREPARED BY SURABHI BOTHRA NARAYANAN

You might also like