Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Objective: The objective of this lab is to have the students use the ARM Auto - Indexing to access array elements and to do nested

Objective: The objective of this lab is to have the students use the ARM Auto-Indexing to access array elements and to do nested subroutine calls. Reference text book sections 3.7,3.8 and 3.10. Students will also demonstrate they know how to use the GNU debugger by providing addresses for specific parts of the code.
Write an ARM assembly program that performs the following:
1. Declare three arrays that will contain integers. Array one will be initialized in the code. The values of array one will be determined by the student.
2. Array two will be populated with user inputs via the scanf C library function. The reading of these user input values must be performed using a for loop construct and auto-indexing.
3. Array three will be calculated to be equal to the Array one[i]* Array two[i] and must be performed using a for loop construct and auto-indexing.
4. The program is to print a welcome message with instructions to the user. The user is to be instructed to enter positive integers.
5. The array print must be performed by a subroutine and accessed by using the ARM Assembly instruction BL. The starting address of the array to be printed will be provided to the subroutine. The address may be passed via a register or the stack via the PUSH and POP commands. Since this print subroutine is not a leaf routine code must be in place to properly save and restore the link register (r14).
6. The array size has to be 10 elements.
7. Integer values should be selected to ensure positive, negative and zero results.
8. Assume all inputs are valid and no overflow conditions will occur.
Your code will be reviewed to ensure you are using the required Auto-Indexing modes and printing of arrays is performed using a subroutine.
The general outline for your code should look like:
main:
Print welcome message and instructions to start entering 10 numbers
For i=1 to 10 use scanf to read user input;
For i=1 to 10 mularray[i]= array1[i]* array2[i];
Printarray(array1)
Printarray(array2)
Printarray(mularray)
End main
Function Printarray(inarray)
For i =1 to 10 print inarray[i]
End function Printarray
To demonstrate students know how to use the GNU debugger the following information will be obtained about their running code and provided either in screen shots or routing the output to a text file.
- Provide the starting address for each of the three arrays.
- Provide the address for the array print routine.
- Provide the address for the last instruction in the array print routine. This should be the instruction used to return to the calling routine.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions