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
Modes of 8254 :   Mode 0 (Interrupt on Terminal Count)-GATE which value is 1 enables counting and GATE  which value is 0 disables counting, and GATE put not effect on

Write a program to calculate the first 20 numbers of Fibonacci series. Use the stack (memory) to store the calculated series. Your debugger output should look like the following sc

I am assigned to implement dijkstra algorithm in assembly language. I am not a novice in assembly. I need help implementing it.Kindly if anyone then please.

Assembling a program Microsoft Assembler MASM is one of the simple to use and famous assemblers.  All the references and discussions in this section are belonging to the MASM.

assempbly language routine that takes an array named A containing n bytes of postive numebrs and fills two arranys, array B containing n words and array C containing n long words

Instruction set of 8086 : The 8086/8088 instructions are categorized into the following major types. This section describes the function of each of the instructions with approp

I need to estimate the value of a definite integral using Riemann Sums and For our estimation let f(x) = x2 ,a=0, b=10 and n=5. Where a is the lower bound, b is the upper bound and

EVOLUTION OF MICROPROCESSOR : The digital circuits and systems may be broken into two part: 1) Sequential Circuit and 2) Combinational Circuits     Norm

CBW: Convert Signed Byte to Word: This instruction converts a signed byte to a signed word. In other terms, it copies the sign bit of a byte to be converted to all of the bits in

Addressing mode of 8086 : Addressing mode specify a way of locating operands or data. Depending on the data types used the memory  addressing  modes and in the instruction  ,