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
Write a program on the assembly language to do the following: 1- Allocate array with 32bit 100 element 2- Prompt the user to enter the maximum or the upper bound of the rando

A good starting point for your program is the toupper.asm program shown in class. It already queries the user for input and sets up a loop that looks at each character of the input


Intel 8259 interrupt controller :  The 8088 processor has only two interrupt control inputs, and interrupt request (INTR) and non mask able interrupt (NMI). NMI are interrupts t

using 8086 assembly language that interchange upper four bits to lower four bits. assume that data store in byte memory and it written back to same location. and assume the data as

I need to generate a random number bby using 8086 assembly language

Memory Mapped I/O Memory I/O devices are mapped into the system memory map with ROM and RAM. To access a hardware  device, simply write or  read  to  those  'special'  addresse


Signal descriptions of 8086 : described below are common for the maximum andminimum mode bothdata lines AD15 -AD0: These are the time multiplexed andmemory I/O address. Addre

Write an assembly language program that defines symbolic constants for all seven days of the week