Question: please answer using coldfire assembly language 2 (15 points) Design an assembly language subroutine that receives an array of longword- sized positive integers (in two's
2 (15 points) Design an assembly language subroutine that receives an array of longword- sized positive integers (in two's complement representation). The subroutine is to determine how many of the integers in the array are even but not multiples of 4. The input array is to be specified using two parameters: a longword-sized starting address of the array, and a longword-sized number of integers in the array. These two input parameters are to be pushed onto the stack (in that order: push address first, and then push the number of integers) before the subroutine is called. The output parameter (i.e., the number of integers that are even but not multiples of 4) of the subroutine is to be returned on the stack and should replace the first input parameter (i.e., starting address of the array). Also write a main program that puts input parameters for an array (which has starting address 0x0006000 and has 400 longword-sized positive integers) on the stack, calls the subroutine, and retrieves the output parameter from the stack after the subroutine ends. In the main program, the output parameter, which is retrieved from the stack, should be stored to dataeister D3. Note that at the beginning of your main program, you do not know the exact initial value in any data or address register All registers (except A7) used by the subroutine must be preserved. Hint: For an integer in two's complement representation, if the last two bits (Bit #1 and Bit #0) ofthe integer's binary format are both zeros, then the integer is a multiple of 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
