194k views
2 votes
Read the lab rules posted on the course page. Do not use assembler directives or loops in this session. Write ARM assembly programs to fulfill the tasks below:

1 - Load the number 123 to R9. Move this value to R7.
2 - Load the number 0×4400 to R5. Load the number 99 to R6. Store the contents of R6 to the memory at the address in R5.
3 - Continuing from 2, load the contents of the memory at the address 0×4400 to R5.
4 - Starting from the address 0x4400, store the numbers 11,22,33,44 to the memory as bytes. Mind the endian ordering.
5 - Continuing from 4 , add the numbers stored to the memory and store the result in R6.

User Amleszk
by
7.8k points

1 Answer

6 votes

Final answer:

ARM Assembly code snippets indicate the loading and storing of values in registers, memory operations, and addition of byte values from memory, respecting the specified rules and endian ordering.

Step-by-step explanation:

ARM Assembly Program Tasks

To complete the ARM assembly programming tasks, use the following code snippets:

  1. Load the number 123 to R9 and move to R7:
    MOV R9, #123
    MOV R7, R9
  2. Load 0x4400 into R5, store 99 from R6:
    MOV R5, #0x4400
    MOV R6, #99
    STR R6, [R5]
  3. Load the contents of memory at 0x4400 to R5:
    LDR R5, [R5]
  4. Store the numbers 11, 22, 33, 44 to memory as bytes:
    MOV R6, #11
    STRB R6, [R5]
    MOV R6, #22
    STRB R6, [R5, #1]
    MOV R6, #33
    STRB R6, [R5, #2]
    MOV R6, #44
    STRB R6, [R5, #3]
  5. Add the numbers from memory and store in R6:
    LDRB R6, [R5]
    LDRB R7, [R5, #1]
    ADD R6, R6, R7
    LDRB R7, [R5, #2]
    ADD R6, R6, R7
    LDRB R7, [R5, #3]
    ADD R6, R6, R7Note that you need to preserve endian ordering when storing the bytes, and the addition is cumulative, summing each number transferred from memory.
User Raghavendra
by
7.8k points