0% found this document useful (0 votes)
98 views11 pages

1's & 2's Complement 16bit Number

This document discusses performing 1's and 2's complement on 16-bit numbers using an 8085 microprocessor. It provides algorithms and assembly code to: 1) Take the 1's complement of a 16-bit number stored in memory location AA00 and store it in AA02. 2) Take the 2's complement of a 16-bit number stored in AA00 by inverting each bit, adding 1 to the least significant bit, and storing the result in AA02. The student learned how to perform 1's and 2's complement of 16-bit data using an 8085 simulator, and about the microprocessor instructions needed to complete the tasks.

Uploaded by

Manish Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views11 pages

1's & 2's Complement 16bit Number

This document discusses performing 1's and 2's complement on 16-bit numbers using an 8085 microprocessor. It provides algorithms and assembly code to: 1) Take the 1's complement of a 16-bit number stored in memory location AA00 and store it in AA02. 2) Take the 2's complement of a 16-bit number stored in AA00 by inverting each bit, adding 1 to the least significant bit, and storing the result in AA02. The student learned how to perform 1's and 2's complement of 16-bit data using an 8085 simulator, and about the microprocessor instructions needed to complete the tasks.

Uploaded by

Manish Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

5.

1’s & 2’s complement 16bit number

Student Name: Manish Kumar UID: 20BCS7420


Branch: B.E. CSE Section/Group: PH20BCS-717_B
Semester: 4th Date of Performance: 20th Mar 2022
Subject Name: MPI Lab Subject Code: 20CSP-253

1. Aim:

a) 1’s complement of 16bit numbers.

b) 2’s complement of 16bit numbers.

2. Theory:

There is a simple algorithm to convert a binary number into 2’s complement. To


get 2’s complement of a binary number, simply invert the given number and add 1
to the least significant bit (LSB) of given result. Implementation of 4-bit 2’s
complementation number is given as following below.
Example-1 − Find 2’s complement of binary number 10101110.

Simply invert each bit of given binary number, which will be 01010001. Then add 1
to the LSB of this result, i.e., 01010001+1=01010010 which is answer.

Example-2 − Find 2’s complement of binary number 10001.001.

Simply invert each bit of given binary number, which will be 01110.110 Then add 1
to the LSB of this result, i.e., 01110.110+1=01110.111 which is answer.
3. Apparatus/Simulator used:

1. Jubin Application
2. 8085 Simulator
3. JDK
4.a. Algorithm:

1. Store value on AA00 memory location.


2. MOV A, M, move value of AA00 to accumulator.
3. CMA, complement accumulator value.
4. Store accumulator value in AA02.
5. Increment H by 1. (AA01)
6. MOV A, M, move value of AA01 to accumulator.
7. CMA, complement accumulator value.
8. Store accumulator value in AA03.
9. Halt

5.a. Code:

# BEGIN 0000H

LXI H,AA00

MOV A,M

CMA

STA AA02

INX H

MOV A,M

CMA

STA AA03

HLT
# ORG AA00

# DB 74H,20H# DB 74H,20H

6.a. Result:
4.b. Algorithm:

1. Store value of AA00 in the accumulator.


2. MVI B,00
3. Move to accumulator. MOV A,M
4. CMA (complement), the accumulator value.
5. ADI 01H, add 01 to accumulator.
6. store the result of accumulator on AA02 memory location.
7. Jump, if Not Carry, to GO
8. Else increment in B by 1.
9. In GO: increment H by 1.
10.Move to accumulator. MOV A,M
11.CMA (complement), the accumulator value.
12.store the result of accumulator on AA03 memory location.
13.HLT(Stop).

5.b. Code:

# BEGIN 0000H

LXI H,AA00

MVI B,00

MOV A,M

CMA

ADI 01

STA AA02

JNC GO
INR B

GO: INX H

MOV A,M

CMA

STA AA03

HLT

# ORG AA00

# DB 74H,20H
6.b. Result:
Learpning outcomes (What I have learnt):

1. Working of microprocessors.
2. Learn how to preform 1’s and 2’s complement of 16bits data in microprocessors.
3. Learn about 8085 simulator.
4. Learn about the different instructions that are needed to be given to the
memory to perform some tasks.
Evaluation Grid (To be created as per the SOP and Assessment guidelines by the faculty):

Sr. No. Parameters Marks Obtained Maximum Marks


1.
2.
3.

You might also like