Question C (30 Marks)
1. Write an ARM assembly language program to find the max...
Jun 7, 2024
Explanation
The student has provided an exam question about ARM assembly language programming. The task is to write two ARM assembly programs: one to find the maximum absolute value in an array, and another to shift bits in a register.
Step-by-step Instruction
▪
Choose to use ARM assembly language syntax and instructions
▪
Define concrete use cases and testing cases for the functions: for the first function, it should return the maximum absolute value; for the second function, it should shift the bits as described
Question 1: Find the Maximum Absolute Value
assembly
Main Function for Testing
assembly
Time Complexity
O(n), where n is the number of elements in the array
Space Complexity
O(1), as we are using a fixed amount of extra space
Question 2: Shift Bits in Register R9
assembly
Main Function for Testing
assembly
Time Complexity
O(1), as the operations are constant time
Space Complexity
O(1), as we are using a fixed amount of extra space