Assembly language subroutine


Write a M68000 assembly language subroutine MULSUM which takes an array named A containing n bytes of positive numbers, and fills two arrays, array B having n words and array C containing n long words as follows:

Sum = 0;
for(i = 0; iSum = A[i] + Sum;
if(Sum is an EVEN number) then
B[i] = Sum;
else
C[i] = Sum * A[i];
 end if
end for

In calculating the expression Sum * A[i] you are NOT allowed to use the MULTU, or MULTS instructions, therefore, you are to find another way to compute this expression.  Main program along with data section is shown below. This program passes all the needed parameters to subroutine MULSUM by pushing them on stack.
Note: There is no overflow occurring during any operation.

i) Write the main program
ii) Write the subroutine MULSUM
iii) Show the stack frame for complete program and clearly label SP at different stages of program.

Request for Solution File

Ask an Expert for Answer!!
Assembly Language: Assembly language subroutine
Reference No:- TGS0381

Expected delivery within 24 Hours