Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Kjell, Chapter 26, Exercise 1 Arithmetic Expression (mips assembly language). Fo

ID: 3685372 • Letter: K

Question

Kjell, Chapter 26, Exercise 1 Arithmetic Expression (mips assembly language). For any additional info click on textbooklink.(https://chortle.ccsu.edu/AssemblyTutorial/Chapter-26/ass26programs.html) Write a subroutine that takes three arguments, A, X, and Y. It then computes A*X*Y and returns it. Use the subroutine to evaluate the following for various values of u and v: 5u^2 - 12uv + 6v^2 The main method, in a loop, prompts the user for values of u and v and prints out the result. End the loop when the user enters zero for both u and v.

Explanation / Answer

.MODEL SMALL

.STACK 100H

.DATA

    PROMPT DB 'ENTER THE VALUES :$'

    INT DB 3 DUP(?)

   INT2 DB 3 DUP(?)

.CODE

MAIN PROC

    JNZ INT1,LOOP1

    JZ INT2,EXIT_LOOP

LOOP1:   A=CALL SUB_ROUTE(5,INT1,2)

                B=CALL SUN_ROUTE(12,INT1,INT2);

               C=A-B+CALL SUB_ROUTE(6,INT2,2);

         DISPLAY(A-B+C)

EXITLOOP:

        END

SUB_ROUTE(C,U,V) EXITSUM:

EXITSUM=C*U*V;

END