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
Using the windows32 framework, write a complete 80x86 program for Programming Exercises 4.3 number 3, on pages 130-131 of the textbook. Follow all coding conventions mentioned in

SHORT  : The  SHORT operator denoted to the assembler that only one byte is needed to code the displacement for a jump (for example displacement is within -128 to +127 bytes fr

DAS: Decimal Adjust after Subtraction:- This instruction converts the result of subtraction operation of 2 packed BCD numbers to a valid BCD number. The subtraction operation has

Cache components The cache sub-system may be divided into 3 functional blocks: Tag RAM, SRAM and theCache Controller. In real designs, these blocks can be implemented  by multi

External System Bus Architecture : This is a 16 bit processor with 40 pins. It has twenty address pins and out of which sixteen are utilized as data pins. This concept of by us

program to find negative and positive integers from given signed numbers with output and explanation of every instructions.

Can any one assist me with this program. I am not efficient with assembly language and I need assistance badly. I am not asking anyone to do my work I just need help step by step

i have trying to do the homework but there is a mistake. (Counting positive and negative numbers and computing the average of numbers) write a program that reads an unspecified nu

do you have experts that know 4 digit 7_Seg dispaly

Machine Coding the Programs So far we have describe five programs which were  written  for hand coding  by a programmer. In this, we will now have a deep look at how these prog