What is the following code trying to accomplish? LDR r1, =123 MVN r1, r1 ADD r1, r1, #1
Question 2 of 3. Big Endian: Save a number in big-endian format.
Write an assembly language program that saves a number. The number should be initialized as a 32-bit word value using the DCD directive in the CODE region of your program. By default, ARM saves values in little-endian format. Your program will load the number from memory and write it back to a READWRITE region in big-endian format. You would need to use rotate or shift instructions to achieve the result, and use byte versions of the load and store operations to save them to memory.
For example: Using the little-endian format, the number 0x123456789 is stored in contiguous memory locations as |78|56|34|12|. On the other hand, using the big-endian format, this number would have been stored as |12|34|56|78|. Make sure your code works for any input number, not just the example test case above. Your code will be tested on other test cases.
Please properly comment your code before submission.
Question 3 of 3. Matrix access: Accessing memory values as a matrix and loading a particular value given a row and a column index.
Modify the MatrixAccess.s file provided with this assignment. You will need to work with the predefined register names which hold the row and column size of the matrix, row and column index to be queried, and the register for loading the result.
For example: The following matrix would have MAT_ROW_SIZE = 4, MAT_COL_SIZE = 3. This matrix would be stored in memory as {2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24}. Matrices are stored in memory as arrays. The only difference is in the way they are accessed from memory. Where arrays are accessed with a single index, matrices need both a row index and a column index. The element in the 3rd row (ROW_IDX = 2) and the 2nd column (COL_IDX = 1) is 16. This element's location is (MATRIX_START).
4 10 16 22
6
8 14 20
12 18 24
Make sure your code works for any matrix size, not just the test cases. Your code will be tested on other test cases not listed here.