Computes the integral square root - assembly program, Assembly Language

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
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

Posted Date: 2/11/2013 2:47:02 AM | Location : United States

Related Discussions:- Computes the integral square root - assembly program, Assignment Help, Ask Question on Computes the integral square root - assembly program, Get Answer, Expert's Help, Computes the integral square root - assembly program Discussions

Write discussion on Computes the integral square root - assembly program
Your posts are moderated
Related Questions
Convert 751 to hex and show what it would look like stored at TheNumber WORD ? (hint: answer in hex pairs)

init_lcd                        ;(this initialises a 2 row lcd)     bcf     TRISA,0             ;PORTA bit 0 as an output (lcd RS pin)     bcf     TRISA,1             ;PORTA bit 1

Data copy/transfer Instructions MOV: This data transfer instruction transfers data from one register or memory location to another register or memory location. The source can

DEC:  Decrement :- The decrement instruction subtracts 1 from the contents of the particular memory location or register. All the conditions code flags except carry flag are affec

Code for Reading Flow & Generating LED Output The code starts with the scanning of the PORT 3, for reading the flow status to check for various flow conditions and compare to

IMUL: Signed Multiplication: This instruction multiplies a signed byte by a signed bit in source operand e in the register AL or signed word in source operand by signed word in th

Internal Architecture of Microprocessor : The architecture of 8086 provides a number of improvements over 8085 architecture. It supports a, a set of 16-bit registers ,16-bit AL

Programming with an assembler The procedure of hand-coding 8086 programs is somewhat tiresome; hence generally a programmer may find it hard to get a correct listing of the mac

Compute the Fibonacci sequence - assembly program: Problem: Fibonacci   In this problem you will write a program that will compute the first 20 numbers in the Fibonacci sequ

Write a program that will input a number from the keyboard, and then display the number in binary form, as well as the number of one's in the number. Hint: Shift the value left (or