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

Lab Assignment, 1) Write an 80x86 assembly language program in EXE file for...

1) Write an 80x86 assembly language program in EXE file format to do the following tasks: a) Open and read the contents of a file into memory (use at least 1 kB). b) Sort the li

Lds/les instruction execution-microprocessor, LDS/LES Instruction execution...

LDS/LES Instruction execution :  LAHF : Load AH from Lower Byte of Flag: - This instruction loads the AH register with the lower byte of the flag register. This instruction ca

Assembly language, Assembly Language: Inside the 8085, instructions ar...

Assembly Language: Inside the 8085, instructions are really stored like binary numbers, not a very good manner to look at them and very difficult to decipher. An assembler is

Hashing, what is double hashing

what is double hashing

Timing diagram of minimum mode, give the explaination of timing diagram min...

give the explaination of timing diagram minimum mode memory write cycle

Program that will compute and output tuition cost, Write an assembly progra...

Write an assembly program that will compute and output tuition cost: a. accept keyboard input of the number of credit hours taken b. accept keyboard input of the type of classes 1

Computes the integral square root - assembly program, Computes the integral...

Computes the integral square root: Problem: Square Root:   For this problem you will write a short assembly program that computes the integral square root of an input numb

Hand shaking-microprocessor, Hand shaking : Handshaking, or 2-way hand...

Hand shaking : Handshaking, or 2-way handshaking, is 1 type of strobe operation. It typically involves 2 handshaking lines: an output line to denote when the board is ready an

.., Sum of series of 10 numbers and store result in memory location total

Sum of series of 10 numbers and store result in memory location total

Logical instruction-microprocessor, Logical Instruction : This type of...

Logical Instruction : This type of instructions is utilized for carrying out the bit by bit shift, basic logical operations or rotate. All of the condition code flags are affe

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