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) {
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;
B = B+1
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
Problems: 1. Write a single program. Each of the problems (2-4) should be written within a procedure. Your “main” procedure should call each procedure. Before calling each proc

Ask 2. Exchange higher byte of AX and higher byte of BX registers by using memory location 0160 in between the transfer. Then stores AX and BX registers onto memory location 0174 o

NEG: Negate:- The negate instruction forms the 2's complement of the particular destination in the instruction. For obtaining 2's complement, it subtracts the contents of destinat

hey ,, I need to know how to let a symbol moves with mouse ??

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

use"> use microsoft visual 2010 and http://www.asmirvine.c

#Write a function to calculate the following arithmetic operation and return the result. A = 2 + (3x)3 + y/2n (x, y and n are arguments of the function where x is an integer in the

LIST p=18f4550 #include org 0x0000 movlw 0x00 _________ movlw 0xFF movwf PORTB end .

Write an assembly language program that will display (print) a list of the Decades 2010, 2020, 2030... 2100 to the screen using a while loop.