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

Write the following programs in assembler. You can use Intel assembler or the as

ID: 3650431 • Letter: W

Question

Write the following programs in assembler. You can use Intel assembler or the assembler language for any other machine. The assembler can be embedded in a C or C++ program. Input and output can be done using C or C++, but the problems must be implemented in assembler. 1. Compute the square root of an integer, X, using the iterative equation guess = X / 2; // initial guess of square root of X do { oldGuess = guess; guess = (guess + X / guess) / 2; } while ((oldGuess - guess) > 0);

Explanation / Answer

int inline FixedPointMul (int a, int b) { long long a_long = a; // cast to 64 bit. long long product = a_long * b; // perform multiplication return (int) (product >> 16); // shift by the fixed point bias }