Prime finder - assembly program, Assembly Language

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

Posted Date: 2/11/2013 2:51:31 AM | Location : United States







Related Discussions:- Prime finder - assembly program, Assignment Help, Ask Question on Prime finder - assembly program, Get Answer, Expert's Help, Prime finder - assembly program Discussions

Write discussion on Prime finder - assembly program
Your posts are moderated
Related Questions
Explain the basic method for implementing paging

The Intel Processors :         The Intel Corporation is the biggest manufacturer  of microchips  in the world,  in addition  to being  the leading provider of chips for PCs. I

IRET : Return from ISR:- When an interrupt service routine is called, before transferring control to it, the IP, CS  register and flag registers are stored in the stack to ment

You have to write a subroutine (assembly language code using NASM) for the following equation.

i want to develop traffic light system so which kind of software is needed to develop this project?


how o create the flow chart for scan ROW4, Column 1 and 3.tq

MOVSW/MOVSB : Move String Word or String Byte: Imagine a string of bytes, stored in a set  of consecutive memory locations is to be moved to another set of  the destination locati