prime finder - assembly programproblem prime


Prime Finder - assembly program:

Problem:  Prime Finder
 
In this problem you will write a small program that tests whether a given integer is a prime number or not.  Let's call the number we are testing A and let's assume that it starts in R0 - at the end of your program R1 should contain 1 if the number is prime and 0 if it is not.
 
Here is the pseudo-code for the procedure
 
If (A <= 1) {
  PRIME_FLAG = 0;
  GOTO END
}
 
B = 2;
PRIME_FLAG = 1;  // we assume that the number is prime until we prove otherwise
 
While (B*B <= A) {
  If (A % B == 0) { // check if A is divisible by B
    PRIME_FLAG = 0;
    GOTO END
}
B = B+1
}
 
END
 
You should think about why this code works.
 
For this part you should turn in two files: prime.asm and prime_script.txt

Request for Solution File

Ask an Expert for Answer!!
Assembly Language: prime finder - assembly programproblem prime
Reference No:- TGS0203806

Expected delivery within 24 Hours