Question: 5.1 Problem Statement Given two integers X and Y compute the product XY (multiplication), the quotient X/Y (inte ger division), and the modulus X (mod

5.1 Problem Statement Given two integers X and Y compute the product XY (multiplication), the quotient X/Y (inte ger division), and the modulus X (mod Y) (remainder). 5.1.1 Inputs The integers X and Y are stored at locations 3100 and 3101, respectively 5.1.2 Outputs The product XY, the quotient X/Y, and modulus X (mod Y) are stored at locations 3102, 3103, and 3104. respectively. If X. Y inputs are invalid for X/Y and X (mod Y) (see section 5.2.5 on page 5-3) place 0 in both locations 3103 and 3104. 5.2 The program 5.2.1 Subroutines Subroutines in assembly language correspond to functions in C/C++ and other computer languages: they form a group of code that is intended to be used multiple times. They perform a logical task by operating on parameters passed to them, and at th example consider the simple subroutine in listing 5.1 on page S-2 which implements the function fn 2n+3. The integer n is located at 3120, and the result Fn is stored at location 3121. Register R0 is used to pass parameter n to the subroutine, and RI is used to pass the retum value fn from the subroutine to the calling program e end they return one or more results. As an Execution is transfered to the subroutine using the JSR ("jump to subroutine) instruction. This instruction also saves the return address, that is the address of the instruction that follows JSR, in register R7. See figure 5.I on page 5-2 for the steps taken during execution of terminates execution via the RET retum from subroutine" instruction. It simply assigns the return
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
