Menu

Take The Following Program And Translate It Into PEP/9 Assembly Language: #Include Using Namespace Std;Int TheArray[] = { 5, 11, -29, 45, 9, -1}; Void SumPos(Int Ary[], Int Len, Int &Sum){ Sum = 0; For (Int I = 0; I < Len; I++) If (Ary[I] > 0) Sum = Sum + Ary[I];} Int Main(){ Int Total; SumPos(TheArray, 6,

Take The Following Program And Translate It Into PEP/9 Assembly Language: #Include <Iostream>Using Namespace Std;Int TheArray[] = { 5, 11, -29, 45, 9, -1}; Void SumPos(Int Ary[], Int Len, Int &Sum){ Sum = 0; For (Int I = 0; I < Len; I++) If (Ary[I] > 0) Sum = Sum + Ary[I];} Int Main(){ Int Total; SumPos(TheArray, 6,

Take the following program and translate it into PEP/9 assembly language:

 

#include <iostream>

using namespace std;

int theArray[] = { 5, 11, -29, 45, 9, -1};

 

void sumPos(int ary[], int len, int &sum)

{

sum = 0;

for (int i = 0; i < len; i++)

if (ary[i] > 0)

sum = sum + ary[i];

}

 

int main()

{

int total;

sumPos(theArray, 6, total);

for (int k=0; k < 6; k++)

cout << theArray[k] << endl;

cout << “Positive sum is ” << total << endl;

return 0;

}

You must use equates to access the stack and the index register in accessing the array. Remember, the sumPos array does NOT know about the global “theArray” – the address of the array must be passed via the parameter.make theArray a local array in main. Make sure to use this code as an example to translate exactly like this code

main: SUBSP 14,i

ldwa 0,i

stwa odd,s

stwa result,s

stwa f1,s

ldwa 1,i

stwa f2,s

stwa f3,s

STRO msg1,d

deci low,s

deci high,s

while: ldwa f1,s

cpwa high,s

BRGT endWh

if: ldwa f1,s

cpwa low,s

LDWA result,s

adda 1,i

stwa result,s

ldwa f1,s

adda f2,s

stwa f1,s

ldwa f2,s

adda f3,s

stwa f2,s

ldwa f3,s

adda f1,s

adda f2,s

stwa f3,s

br while

endWh: deco result,s

STOP

msg1: .ASCII “enter low and high limits:\x00”

.END

Expert Answer

Step 1

According to the given information, C program of stack is considered.

OR