Composite numbers using micro processor and controllers, Study Guides, Projects, Research of Electronics

Project report on micro processor and micro controllers using 8081

Typology: Study Guides, Projects, Research

2017/2018

Uploaded on 10/28/2018

1999saiy
1999saiy 🇮🇳

1 document

1 / 18

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
PROJECT REPORT
ON
FINDING COMPOSITE NUMBER USING MASM
SUBMITTED
IN THE PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR
THE AWARD OF THE DEGREE OF
BACHELOR OF TECHNOLOGY
IN
ELECTRONICS AND COMMUNICATION
BY
Sushanth - 16311A0488
M.RAMESH - 16311A0489
Y.SAIKIRAN REDDY -16311A0493
DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING
SREENIDHI INSTITUTE OF SCIENCE & TECHNOLOGY
Yamnampet, Ghatkesar, Hyderabad – 501301
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12

Partial preview of the text

Download Composite numbers using micro processor and controllers and more Study Guides, Projects, Research Electronics in PDF only on Docsity!

PROJECT REPORT

ON

FINDING COMPOSITE NUMBER USING MASM

SUBMITTED

IN THE PARTIAL FULFILLMENT OF THE REQUIREMENTS FOR

THE AWARD OF THE DEGREE OF

BACHELOR OF TECHNOLOGY

IN

ELECTRONICS AND COMMUNICATION

BY

Sushanth - 16311A

M.RAMESH - 16311A

Y.SAIKIRAN REDDY -16311A

DEPARTMENT OF ELECTRONICS & COMMUNICATION ENGINEERING

SREENIDHI INSTITUTE OF SCIENCE & TECHNOLOGY

Yamnampet, Ghatkesar, Hyderabad – 501301

DECLARATION

We hereby declare that the project entitled FINDING COMPOSITE NUMBER

USING MASM submitted in partial fullfilment of the requirements for the award of

degree of Bachelor of Technology in Electronics and Communication Engineering. This dissertation is our original work and the project has not formed the basis for the award of any degree, associate ship, fellowship or any other similar titles and no part of it has been published or sent for the publication at the time of submission.

Sushanth - 16311A

M.RAMESH - 16311A

Y.SAIKIRAN REDDY -16311A

CONTENTS:

1.ABSTRACT

2.AIM

3.SOFTWARE REQUIRED

4.THEORY

5.PROCEDURE

6.ALGORITHM

7.PROGRAM CODE

8.OUTPUT

9.FLOW CHART

10.CONCLUSION

11.RESULT

Sreenidhi Institute Of Science and Technology

Yamnampet,Ghatkesar,Hyderabad-

Department Of Electronics & Communication Engineering

Title: FINDING COMPOSITE NUMBER USING MASM

Abstract :- Assembly language is a family of backward-compatible assembly languages, which provide some level of compatibility all the way back to the 8086. assembly languagesare used to produce object code for the x86 class of processors. Like all assembly languages, it uses short mnemonics to represent the fundamental instructions that the CPU in a computer can understand and follow.

A composite number is a positive integer that can be formed by multiplying together two smaller positive integers. Equivalently, it is a positive integer that has at least one divisor other than 1 and itself. Every positive integer is composite, prime, or the unit 1, so the composite numbers are exactly the numbers that are not prime and not a unit.

One way to classify composite numbers is by counting the number of prime factors. A composite number with two prime factors is a semiprime or 2-almost prime (the factors need not be distinct, hence squares of primes are included). A composite number with three distinct prime factors is a sphenic number. In some applications, it is necessary to differentiate between composite numbers with an odd number of distinct prime factors and those with an even number of distinct prime factors.

Submitted By

P.AKHIL YADAV (16311A04AG)

P.SHIVA KUMAR (16311A04AH)

AIM: Write an assembly language program for determining if a given number is composite

or not using 8086 microprocessor.

  • Mainly one-address and two-address instructions, that is to say, the first operand is also the destination.
  • Memory operands as both source and destination are supported (frequently used to read/write stack elements addressed using small immediate offsets).
  • (^) Both general and implicit register usage; although all seven (counting ebp) general registers in 32-bit mode, and all fifteen (counting rbp) general registers in 64-bit mode, can be freely used as accumulators or for addressing, most of them are also implicitly used by certain (more or less) special instructions; affected registers must therefore be temporarily preserved (normally stacked), if active during such instruction sequences.
  • Produces conditional flags implicitly through most integer ALU instructions.
  • Supports various addressing modes including immediate, offset, and scaled index but not PC-relative, except jumps (introduced as an improvement in the x86-64 architecture).
  • (^) Includes floating point to a stack of registers.
  • Contains special support for atomic read-modify-write instructions (xchg, cmpxchg/ cmpxchg8b, xadd, and integer instructions which combine with the lock prefix)
  • SIMD instructions (instructions which perform parallel simultaneous single instructions on many operands encoded in adjacent cells of wider registers).

A composite number is a positive integer that can be formed by multiplying together two smaller positive integers. Equivalently, it is a positive integer that has at least one divisor other than 1 and itself. Every positive integer is composite, prime, or the unit 1, so the composite numbers are exactly the numbers that are not prime and not a unit.

One way to classify composite numbers is by counting the number of prime factors. A composite number with two prime factors is a semiprime or 2-almost prime (the factors need not be distinct, hence squares of primes are included). A composite number with three distinct prime factors is a sphenic number. In some applications, it is necessary to differentiate between composite numbers with an odd number of distinct prime factors and those with an even number of distinct prime factors.

Composite numbers have also been called "rectangular numbers", but that name can also refer to the pronic numbers, numbers that are the product of two consecutive integers.

PROCEDURE:

  1. Load the data from the memory location into the accumulator
  2. Initialize register C with 00H. This stores the number of divisors of n
  3. Move the value in the accumulator in E. This will act as an iterator for the loop from n to 1.
  4. (^) Move the value in the accumulator in B. B permanently stores n because the value in the accumulator will change
  5. Move the value in E to D and perform division with the accumulator as the dividend and D as the divisor.
  6. Division: Keep subtracting D from A till the value in A either becomes 0 or less than
    1. After this, check the value in the accumulator. If it’s equal to 0, then increment the count of divisors by incrementing the value in C by one
  7. Restore the value of the accumulator by moving the value in B to A and continue with the loop till E becomes 0
  1. Now, move the number of divisors from C to A and check if it’s equal to 2 or not. If it is, then store 01H to 202AH (arbitrary), else store 00H.

ALGORITHM:

Step1 : Take n as input.

Step2 : Run a loop from i = n to 1. For each iteration, check if i divides n completely or not. If it does, then i is n’s divisor

Step3 : Keep a count of the total number of divisors of n

Step4 : If the count of divisors is not equal to 2, then the number is composite, else prime

Step5:Stop

PROGRAM:

assume cs:code,ds:data

data segment

const db 02h

list db 01h,02h,03h,04h,05h,06h,07h,10h,16h,11h

comp db?

data ends

code segment

start:mov ax,data

mov ds,ax

xor ax,ax

xor bx,bx

xor cx,cx

lea si,list

lea di,comp

dec cl

jnz up

int 03h

code ends

end start

FLOW CHART:

CONCLUSION: