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
LIST p=18f4550 #include org 0x0000 movlw 0x00 _________ movlw 0xFF movwf PORTB end .

Need help with 2 homework assignments

AND: Logical AND: This instruction bit by bit ANDs the source operand that might be an immediate, or a memory location or register to the destination operand that might be a memor

Fourth  Generation Microprocessor : The single chip 32-bit microprocessor was introduced in 1981 by Intel as iAPX 432. The other 4th generation  microprocessors  were;  Hewlett

errorlevel -302 ;prevents error code for this chipset __config 0x373A ;chip config PIC spec page 146 processor 16F877A ;chipset reset code

• To develop an assembly language program to control a "simulated" intelligent domestic lighting system with the intention of deterring burglary. • To produce a schematic circuit d

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

$NOMOD51 $NOSYMBOLS ;***************************************************************************** ; Spring 2013 Project ; ; FILE NAME : Project.ASM ; DATE : 3/30/20

Trying to convert small programs from C to 8086 assembly language using emu 8086 emulator. I converted to low level C, but struggling with converting to the Assembly language.