Prime finder - assembly program, Assembly Language

Assignment Help:

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


Related Discussions:- Prime finder - assembly program

Multiplication, how we can multiply two 8 bit number with rotation

how we can multiply two 8 bit number with rotation

Assembly language, how to find out the given number is positive or negative...

how to find out the given number is positive or negative?

Ddition, Write a program that performs the addition, subtraction, multiplic...

Write a program that performs the addition, subtraction, multiplications, division of the given operands. Perform BCD operation for addition and subtraction.

Flow chart and pseudocode, #question.flow chart for a program to find out t...

#question.flow chart for a program to find out the number of even and odd numbers from a given series of 16-bit hexadecimal numbers.

Write an assembly language program, Your assignment for this project is to ...

Your assignment for this project is to write an assembly language program that checks if the user's input is a valid ISBN number. A sample run of your program might look like:

Write a assembly language subroutine, Write a M68000 assembly language subr...

Write a M68000 assembly language subroutine MULSUM that takes an array named A containing n bytes of positive numbers, and fills two arrays, array B containing n

Program to move contents in memory-machine level programs, Example : Write...

Example : Write a program to move the contents of the memory location 0500H to BX and also to register CX. Add immediate byte 05H to the data residing in memory location, whose ad

Memory segmentation-microprocessor, Memory Segmentation : The  memory ...

Memory Segmentation : The  memory in an 8086/8088  based system is organized as segmented memory. In this scheme, the whole physically available memory can be divided into a n

Second generation microprocessor, IInd Generation Microprocessor : The ...

IInd Generation Microprocessor : The second generation microprocessor by using n MOS technology seemed in the market in 1973.   The Intel  8080, of nMOS  technology

Code, How to print strings in Right Triangle form?

How to print strings in Right Triangle form?

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd