1. Write a subroutine that counts the number of negative numbers in an array of signed...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Write a subroutine that counts the number of negative numbers in an array of signed 32-bit integers. Inputs to the subroutine are the starting address of the array, passed in register RO, and the size (number of elements) of the array, passed in register R1. The subroutine output is the number of negative numbers, returned in register RO. 2. Write a main program that calls the subroutine twice. The first call should find the number of negative values in LIST1 and the second time in LIST2. The returned values should be written by the main program to variables NEGS1 and NEGS2, respectively, with each result written immediately to its respective variable after the subroutine returns to the main program. The two lists (LIST1 and LIST2) and results (NEGS1 and NEGS2) are to be stored in SRAM in the order shown below. Test data: LIST1: .word 5,-8,20,15,-20,83,125,-107,0,35,14,-19,-30,0,35,-8,-6,22,0,-1 NEGS1: .word 0 LIST2: .word 18,-200,-50,-25,123,5,-3,-2,0,0,-125,177 NEGS1: .word 0 3. Test your program in a debugger, with the arrays shown in a Memory view and the values of NPOS1 and NPOS2 in the Expressions view. 4. Submit: The source program • The debugger window showing the arrays in a Memory view (use signed integer rendering) and the values of NEGS1 and NEGS2 in the Expressions view. 1. Write a subroutine that counts the number of negative numbers in an array of signed 32-bit integers. Inputs to the subroutine are the starting address of the array, passed in register RO, and the size (number of elements) of the array, passed in register R1. The subroutine output is the number of negative numbers, returned in register RO. 2. Write a main program that calls the subroutine twice. The first call should find the number of negative values in LIST1 and the second time in LIST2. The returned values should be written by the main program to variables NEGS1 and NEGS2, respectively, with each result written immediately to its respective variable after the subroutine returns to the main program. The two lists (LIST1 and LIST2) and results (NEGS1 and NEGS2) are to be stored in SRAM in the order shown below. Test data: LIST1: .word 5,-8,20,15,-20,83,125,-107,0,35,14,-19,-30,0,35,-8,-6,22,0,-1 NEGS1: .word 0 LIST2: .word 18,-200,-50,-25,123,5,-3,-2,0,0,-125,177 NEGS1: .word 0 3. Test your program in a debugger, with the arrays shown in a Memory view and the values of NPOS1 and NPOS2 in the Expressions view. 4. Submit: The source program • The debugger window showing the arrays in a Memory view (use signed integer rendering) and the values of NEGS1 and NEGS2 in the Expressions view.
Expert Answer:
Answer rating: 100% (QA)
It seems youve provided the details of a programming assignment related to assembly language or a similar lowlevel programming language The task invol... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
You work in an economic consultancy and you are asked to analyse a duopoly with product differentiation. The demand for both goods are given by the system: 91a-bp + dp 92 a bp2+dp, where a, b > 0 and...
-
Problem #1- Write a subroutine (not a program) in 68000 assembly language that will count the number of 1 bits in a sequential series of bytes between two memory locations. The starting and ending...
-
In Exercise solve the given equations and check the results. F-3 12 2 3 || 1 - 3F 2
-
What common events lead to the creation of a process?
-
You are given a colorless liquid. Describe three chemical tests you would perform on the liquid to show that it is water.
-
Balancing a fan on a motor-driven machine has not dropped the overall vibration sufficiently. What is the next step?
-
Why is organizational diagnosis essential to the success of any change effort?
-
What are the six C's of the practice of Supervision Modelling?
-
Muscle Pro is a (fictional) public company engaged in selling protein powders and other performance-enhancing supplements. In 20x2, Muscle Pro was sued by a supplier alleging that Muscle Pro did not...
-
What will the following code fragment print? Assume all necessary header files have been included. float x; x = 5/2; printf("%.2f",x);
-
1) Discuss why you feel it is important for a business owner to understand the connections between the financial statements. 2) Give an example of how regular analysis of the information might assist...
-
Wheat Inc. has just paid its annual dividends of $2.10. The company is expected to pay the same $2.10 dividend for year 1 and 2. After that dividends is expected to grow at an annual rate of 18% for...
-
. A spring scale reads 2 0 N as it pulls a 5 . 0 kg mass across a table. What is the magnitude of the force exerted by the mass on the spring scale?
-
There are three different types of learning in psychology. They are as follows; Behaviorism- Associative Learning- Observational learning- Give an example of each
-
If a student graduated with a master's degree in mental health counseling, and they learned about positive psychology, how would the student learn to use posiitve psychology for their future therapy?...
-
In figure shown, the black is thrown up the inclined plane with some speed. If t, is time for upward motion and to is time for down- -ward mation, then find to p to
-
A glass manufacturer produces hand mirrors. Each mirror is supposed to meet company standards for such things as glass thickness, ability to reflect, size of handle, quality of glass, color of...
-
After using the statement p = n.indexOf('A');, if p contains 5, then _________________. a. n is a string with 5 characters b. There is no 'A' in the string n c. There is an 'A' in the string n d....
-
The remainder operator _____________. a. Is represented by a forward slash b. Must follow a division operation c. Provides the quotient of integer division d. Is represented by a percent sign
-
Create a game that generates a random number from 1 to 10. Include a loop that continually prompts the user for the number, indicating whether the guess is high or low, until the user enters the...
-
A crystal sample of bacteriorhodpsin, a light-sensitive protein found in halobacteria that responds to light energy, has crystal planes separated by 0.20 nm. If a beam of 11 keV x rays illuminates a...
-
A nickel crystals work function is measured to be 5.22 eV at 25C. As the temperature increases by 300C, the work function drops by 50 meV. By how much does this shift the threshold wavelength for...
-
Investigators have created structures consisting of linear chains of ionized atoms on a smooth surface. Electrons are restricted to travel along the chain. The energy levels of the electrons match...
Study smarter with the SolutionInn App