please read the instructions. and the value of f is 49026 and the value of g is
ID: 663635 • Letter: P
Question
please read the instructions. and the value of f is 49026 and the value of g is 13122.
You are tasked to use the same positive integers from Part A to also compute:
h = f/g;
i = (f+g) MOD h_quotient;
More formally, write MIPS code to output the result of above expression of h without using any built-inMIPS/MARS instructions for multiplication or division. The values already entered for Part A for a, b,c, and d shall be used. Output the value of h in {quotient with remainder} in a format as separatedecimal integers. Indicate the denominator for the remainder.Note: To receive credit, no multiplication, no division, and no shift instructions shall be used. Namely,none of {mul, mul.d, mul.s, mulo, mulou, mult, multu, mulu, div, divu,rem, sll, sllv, sra, srav, srl, srlv} or else a zero score will result. Thus, it is tocompose your own division technique. In addition, use of a loop is required for credit to realize thedivision code. It part of the project points to design a way to realize division using a loop.
Explanation / Answer
mov bl, 49026
mov dl, 13122
;starts from here
mov bh, 00H
mov dh, 00H
xor di, di
mov cx, 08H
L1:
shr dx, 1 ;multiplier shifting
jnc nxt
add di, bx ;result is adding to multiplicand
nxt:
shl bx, 1 ;multiplicand shifting
loop L1
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.