Skip to main content

ARM Instructions Part II and Instruction Formats

  • Chapter
  • First Online:
Computer Systems
  • 1000 Accesses

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.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 49.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 64.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD 89.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

Problems

Problems

  1. 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

    1. (a)

      LDR R1, [R0]

    2. (b)

      LDR R2, [R0, #4]!

    3. (c)

      LDRB R3, [R0], #1

    4. (d)

      LDRSB R5, [R0], #1

    5. (e)

      LDRSH R6, [R0]

    LIST DCB  0x34, 0xF5, 0x32, 0xE5, 0x01, 0x02, 0x8, 0xFE

  2. 2.

    Work problem #1 part a and b using Little Endian.

    1. (a)

      R1 = 0xE532F534

    2. (b)

      R2 = 0xFE080201

  3. 3.

    What is contents of register R7 after execution the following program?

  • ADRL R0, LIST

  • LDRSB R7, [R0]

  • LIST DCB 0xF5

  1. 4.

    What are the contents of register Ri for the following load Instructions? Assume R0 holds the address of list using Little Endian.

    1. (a)

      LDR R1, [R0]

    2. (b)

      LDRH R2, [R0]

    3. (c)

      LDRB R3, [R0], #1

    4. (d)

      LDRB R4, [R0]

    5. (e)

      LDRSB R5, [R0], #1

    6. (f)

      LDRSH R6, [R0]

    List DCB  0x34, 0xF5, 0x32, 0xE5, 0x01, 0x02.

  2. 5.

    The following memory is given, show the contents of each register , and assume R1 = 0x0001000 and R2 = 0x00000004 (use Little Endian).

    1. (a)

      LDR  R0, [R1]

    2. (b)

      LDR  R0, [R1, #4]

    3. (c)

      LDR  R0, [R1, R2]

    4. (d)

      LDR  R0, [R1, #4]!

1000

23

13

56

00

1004

45

11

21

88

1008

03

08

35

89

100C

44

93

  1. 6.

    What are the effective address and contents of R5 after executing the following instructions? Assume R5 contains 0x 18 and r6 contains 0X00000020.

    1. (a)

      STR  R4, [R5]

    2. (b)

      STR  R4, [R5, #4]

    3. (c)

      STR  R4, [R5, #8]

    4. (d)

      STR  R4, [R5, R6]

    5. (e)

      STR  R4, [R5], #4

  2. 7.

    Write a program to add elements of List1 and store in the List2.

    • List1 DCB 0x23, 0x45, 0x23, 0x11

    • List2 DCB 0x0

  3. 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

  4. 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

  1. 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

  2. 11.

    Write a program to add eight numbers using Indirect addressing.

    LIST DCB 0x5, 0x2,0x6,0x7 ,0x9,0x1,0x2,0x08

  3. 12.

    Write a program to add eight numbers using Post-index addressing.

    LIST DCB 0x5, 0x2,0x6,0x7 ,0x9,0x1,0x2,0x08

  4. 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

  5. 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

  6. 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

  7. 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

  8. 17.

    What are content of registers for the following load instructions, assume R0 hold the address of list

    ADRL R0, list

    1. (a)

      LDRB R1, [R0, #0x1] R1=

    2. (b)

      LDRH R2, [R0, # 0x1] R2=

    3. (c)

      LDRB R3, [R0] R3=

    4. (d)

      LDRB R4, [R0 , #4] R4=

    5. (e)

      LDRH R5, [R0, #2] R5=

    6. (f)

      LDRH R6, [R0,#4] R6=

    List DCB 0x04, 0x05, 0x32, 0xE5, 0x01, 0x02

  9. 18.

    Convert the following ARM instruction to machine code

    1. (a)

      ADD R5, R6, R8

    2. (b)

      ADDNE R2, R3, 0x25

    3. (c)

      BNE label

  10. 19.

    Convert the following ARM instruction to machine code by hand then check you result by u μVision debugger

    1. (a)

      SUB R1, R2, R3, LSR #4

    2. (b)

      MOV R5, R6

    3. (c)

      LDR R4, [R0]

Rights and permissions

Reprints and permissions

Copyright information

© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

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)

Publish with us

Policies and ethics