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

Using straight line method for depreciation, Request a depreciation of the...

Request a depreciation of the item, year of purchase, cost of item, number of years to be depreciated (estimated life ) and,the method of depreciation . Method of depreciation sh

#procedure, #Write a function to calculate the following arithmetic operati...

#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

Microcontroller, bello need help with a final project , I have to do a pres...

bello need help with a final project , I have to do a presentation on a digital stop watch , but I have to use edsim51 to make it wondering if you guys can help me

More Sentence Sense, When Seen in the choir, Terry was the picture of an an...

When Seen in the choir, Terry was the picture of an angelic devil. I have to underline the predicate twice

Write an assembly program to design an array, 1- Write an assembly program ...

1- Write an assembly program that:   a- Defines an array of 10 (word type)elements;   b- Finds out the number of negative elements   c- Calculate the summation of the posi

Program, Write a program to separate out positive and negative numbers from...

Write a program to separate out positive and negative numbers from a given series of 16-bit hexadecimal numbers.

Nonrecursive Factorial, Write a nonrecursive version of the Factorial proce...

Write a nonrecursive version of the Factorial procedure (Section 8.3.2) that uses a loop. (A VideoNote for this exercise is posted on the Web site.) Write a short program that inte

Length-assemblers directive-microprocessor, LENGTH : Byte Length of a Labe...

LENGTH : Byte Length of a Label: This directive is not available in MASM. This is used to mention to the length of a data array or a string. MOV CX. LENGTH ARRAY This sta

Cobol, #I submitted my assignment this morning and it is still processing. ...

#I submitted my assignment this morning and it is still processing. How long does it take?

Write an assembly language program to fi nd the maximum, Write an assembly ...

Write an assembly language program to find the maximum of: y = x 6 - 14x 2 + 56x for the range -2 ≤ x ≤ 4, by stepping one by one through the range. The program should in

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