Question: 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
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.
Step by Step Solution
There are 3 Steps involved in it
It seems youve provided the details of a programming assignment related to assembly language or a similar lowlevel programming language The task invol... View full answer
Get step-by-step solutions from verified subject matter experts
