Write a 68000 assembly language program to find all prime


Write a 68000 assembly language program to find all prime numbers between 1 and a specified upper value, inclusive, using the Sieve of Erathosthenes. The specified upper value may be as low as 3 or as high as 1023. Proceed as follows:

1. The upper value of the search range should be initially stored in location $400 by means of an assembler directive. Your program will use this value during its run.

2. Your sieve data, the list of consecutive integers, starts at location $2000.

3. Fill the sieve list with consecutive integers, starting with 2 and ending with the specified upper value. Your program should begin at address $1000.

4. Now perform steps (2) through (5) of Erathosthenes' algorithm. Use testing and branching to implement the necessary loops. Use indirect addressing to traverse the list of numbers.

5. The resulting list of prime numbers is to be printed onto the screen. I suggest printing five numbers on each line, separated by several spaces. To go to the next line, you'll need to use TRAP #15 to output a carriage return (CR) and line feed (LF). CR is $0D or 13. LF is $0A or 10.

6. Finally, store the number of primes found (that is, their count) into location $404. If you wish to (not required), you can print a string on the screen with this information. Example output: "Found 73 prime numbers in the given range"

Solution Preview :

Prepared by a verified Expert
Assembly Language: Write a 68000 assembly language program to find all prime
Reference No:- TGS01142123

Now Priced at $15 (50% Discount)

Recommended (91%)

Rated (4.3/5)