Abstract
This chapter covers ARM data transfer instructions such as load and store, pseudo instructions, data transfer instruction format, data transfer addressing mode such as register indirect addressing and pre-indexed addressing, data representation in memory, and several examples related to data transfer instructions.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Problems
Problems
-
1.
Trace the following instructions; assume list starts at memory location 0x0000018 and using ARM Big Endian:
ADRL R0, LIST ; Load R0 with address of memory location list
MOV R10, #0x2
-
(a)
LDR R1, [R0]
-
(b)
LDR R2, [R0, #4]!
-
(c)
LDRB R3, [R0], #1
-
(d)
LDRSB R5, [R0], #1
-
(e)
LDRSH R6, [R0]
LIST DCB  0x34, 0xF5, 0x32, 0xE5, 0x01, 0x02, 0x8, 0xFE
-
(a)
-
2.
Work problem #1 part a and b using Little Endian.
-
(a)
R1Â =Â 0xE532F534
-
(b)
R2Â =Â 0xFE080201
-
(a)
-
3.
What is contents of register R7 after execution the following program?
-
ADRL R0, LIST
-
LDRSB R7, [R0]
-
LIST DCB 0xF5
-
4.
What are the contents of register Ri for the following load Instructions? Assume R0 holds the address of list using Little Endian.
-
(a)
LDR R1, [R0]
-
(b)
LDRH R2, [R0]
-
(c)
LDRB R3, [R0], #1
-
(d)
LDRB R4, [R0]
-
(e)
LDRSB R5, [R0], #1
-
(f)
LDRSH R6, [R0]
List DCB  0x34, 0xF5, 0x32, 0xE5, 0x01, 0x02.
-
(a)
-
5.
The following memory is given, show the contents of each register , and assume R1Â =Â 0x0001000 and R2Â =Â 0x00000004 (use Little Endian).
-
(a)
LDR  R0, [R1]
-
(b)
LDR  R0, [R1, #4]
-
(c)
LDR  R0, [R1, R2]
-
(d)
LDR  R0, [R1, #4]!
-
(a)
1000 | 23 |
13 | |
56 | |
00 | |
1004 | 45 |
11 | |
21 | |
88 | |
1008 | 03 |
08 | |
35 | |
89 | |
100C | 44 |
93 |
-
6.
What are the effective address and contents of R5 after executing the following instructions? Assume R5 contains 0x 18 and r6 contains 0X00000020.
-
(a)
STR  R4, [R5]
-
(b)
STR  R4, [R5, #4]
-
(c)
STR  R4, [R5, #8]
-
(d)
STR  R4, [R5, R6]
-
(e)
STR  R4, [R5], #4
-
(a)
-
7.
Write a program to add elements of List1 and store in the List2.
-
List1 DCB 0x23, 0x45, 0x23, 0x11
-
List2 DCB 0x0
-
-
8.
Write a program to find the largest number and store it in memory location List3.
-
List1 DCD 0x23456754
-
List2 DCD 0x34555555
-
List3 DCD 0x0
-
-
9.
Write a program, find the sum of data in memory location LIST, and store the SUM in memory location sum using loop.
-
List DCB 0x23, 0x24, 0x67, 0x22, 0x99
-
SUM DCD 0x0
-
10.
Write a program to read memory location LIST1 and LIST2 and store the sum in LIST3.
LIST1 DCD 0x00002345 LIST2 DCD 0X00011111 LIST3 DCD 0x0
-
11.
Write a program to add eight numbers using Indirect addressing.
LIST DCB 0x5, 0x2,0x6,0x7 ,0x9,0x1,0x2,0x08
-
12.
Write a program to add eight numbers using Post-index addressing.
LIST DCB 0x5, 0x2,0x6,0x7 ,0x9,0x1,0x2,0x08
-
13.
What are the contents of R4 after execution of the following program.
__main LDR R1, =0xFF00FF ADRL R0, LIST1 LDR R2, [R0] AND R4, R2, R1 LIST1 DCD 0X45073487
-
14.
Write a program to convert the following HLL to assembly language, assume R1Â =Â 0x9, R2Â =Â 0x6 and R3Â =Â 0x5
If R1=R2 then R3= R3+1 IF R1<R2 Then R3=R3-1 If R1>R2 Then R3=R3-5
-
15.
Write a subroutine to calculate value of Y where Y = X*2 + x + 5, assume x is represented by
LIST DCB 0x5 LIST1 DCB 0x5
-
16.
Write a program to compare two numbers and store largest number in a memory location LIST.
M1 EQU 5 N1 EQU 6 LIST2 DCB 0x0
-
17.
What are content of registers for the following load instructions, assume R0 hold the address of list
ADRL R0, list
-
(a)
LDRB R1, [R0, #0x1] R1=
-
(b)
LDRH R2, [R0, # 0x1] R2=
-
(c)
LDRB R3, [R0] R3=
-
(d)
LDRB R4, [R0 , #4] R4=
-
(e)
LDRH R5, [R0, #2] R5=
-
(f)
LDRH R6, [R0,#4] R6=
List DCB 0x04, 0x05, 0x32, 0xE5, 0x01, 0x02
-
(a)
-
18.
Convert the following ARM instruction to machine code
-
(a)
ADD R5, R6, R8
-
(b)
ADDNE R2, R3, 0x25
-
(c)
BNE label
-
(a)
-
19.
Convert the following ARM instruction to machine code by hand then check you result by u μVision debugger
-
(a)
SUB R1, R2, R3, LSR #4
-
(b)
MOV R5, R6
-
(c)
LDR R4, [R0]
-
(a)
Rights and permissions
Copyright information
© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG
About this chapter
Cite this chapter
Elahi, A. (2022). ARM Instructions Part II and Instruction Formats. In: Computer Systems. Springer, Cham. https://doi.org/10.1007/978-3-030-93449-1_10
Download citation
DOI: https://doi.org/10.1007/978-3-030-93449-1_10
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-93448-4
Online ISBN: 978-3-030-93449-1
eBook Packages: EngineeringEngineering (R0)