Computes the integral square root:
Problem: Square Root:
For this problem you will write a short assembly program that computes the integral square root of an input number, A, which is initially stored in R0. When the program has terminated the square root should be stored in R1, if the input number is negative the output should be -1. A pseudo-code version of the required algorithm is shown below:
Input A: The number whose square root is to be computed
Output B: The approximate square root - the largest integer such that B*B <= A
B=0
If (A >= 0) {
While (B*B <= A) {
B = B+1
}
}
B = B-1
As part of your script function you should set R0 to the input number A. That way you can rerun your program on different inputs by just editing the script file and rerunning.
While this algorithm is quite simple, you must comment your assembly code. If you do not provide some minor comments, points will be taken off your work. It is best to learn to being using comment appropriately now when it is simple, before it gets complex. This is going to be true for all programs you author in this class.
For this part you should turn in two files: sqrt.asm and sqrt_script.txt