Write a M68000 assembly language subroutine MULSUM that takes an array named A containing n bytes of positive numbers, and fills two arrays, array B containing n words and array C containing n long words as follows:
Sum = 0;
for(i = 0; i) Sum = A[i] + Sum; if(Sum is an EVEN number) then
B[i] = Sum; else C[i] = Sum * A[i]; end if end for
In evaluating the expression Sum * A[i] you are NOT allowed to use the MULTU, or MULTS instructions, hence, you are to find another way to calculate this expression.
Main program along with data section is shown below. This program passes all the required parameters to subroutine MULSUM by pushing them on stack.
Note: There is no overflow occurring during any operation.
a) Write the main program
b) Write the subroutine MULSUM
c) Show the stack frame for entire program and clearly label SP at different stages of program.