Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
57 views

Introduction About Microprocessor 8086

The document discusses 2's complement representation of signed binary numbers and how to perform subtraction using 2's complement. It explains that 2's complement is an unambiguous technique to represent negative numbers. It provides steps to subtract a smaller number from a larger number and vice versa using 2's complement. An example is given to illustrate subtracting 1010 from 1111. The algorithm and flowchart of 2's complement subtraction are also presented.

Uploaded by

bhumika
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
57 views

Introduction About Microprocessor 8086

The document discusses 2's complement representation of signed binary numbers and how to perform subtraction using 2's complement. It explains that 2's complement is an unambiguous technique to represent negative numbers. It provides steps to subtract a smaller number from a larger number and vice versa using 2's complement. An example is given to illustrate subtracting 1010 from 1111. The algorithm and flowchart of 2's complement subtraction are also presented.

Uploaded by

bhumika
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

 Introduction about microprocessor 8086

8086 Microprocessor is an enhanced version of 8085Microprocessor that was designed by


Intel in 1976.
It is a 16-bit Microprocessor having 20 address lines and16 data lines that provides up to
1MB storage.
It consists of powerful instruction set, which provides operations like multiplication and
division easily.
It supports two modes of operation, i.e. Maximum mode and Minimum mode. Maximum
mode is suitable for system having multiple processors and Minimum mode is suitable for
system having a single processor.

8086 s configuration
Introduction Of microproject
8086 is 16-bit register. we can simply take the numbers from memory to AX and BX
register ,then subtract then using SUB instruction .
When the borrow is present ,the CY flag will be1,so we store borrow into memory
otherwise only store AX into memory.

2's complement is used for representing signed numbers and performing arithmetic operations
such as subtraction, addition, etc.
The positive number is simply represented as a magnitude form. So there is nothing to do for
representing positive numbers. But if we represent the negative number, then we have to
choose either 1's complement or 2's complement technique.
The 1's complement is an ambiguous technique, and 2's complement is an unambiguous
technique. Let's see an example to understand how we can calculate the 2's complement in
signed binary number representation

Binary Subtraction Using 2's Complement


To learn how to subtract binary numbers using 2's complement, which is the subtraction of a
smaller number from a larger number using 2’s complement subtraction, the following steps
are to be followed:
 Step 1: Determine the 2’s complement of the smaller number
 Step 2: Add this to the larger number.
 Step 3: Omit the carry. Note that there is always a carry in this case.

The following example illustrates the above-mentioned steps:


Exampe: Subtract (1010)2(1010)2 from (1111)2(1111)2 using 2's complement method.
Ans:
 Step 1: 2's complement of (1010)2(1010)2 is (0110)2(0110)2.
 Step 2: Add (0110)2(0110)2 to (1111)2(1111)2.
This is shown below:
Subtract Using 2's Complement Method
To subtract a larger number from a smaller number using 2’s complement subtraction, the
following steps are to be followed:
 Step 1: Determine the 2’s complement of the smaller number.
 Step 2: Add this to the larger number.
 Step 3: There is no carry in this case. The result is in 2’s complement form and is
negative.
 Step 4: To get an answer in true form, take 2’s complement and change its sign.

Example: Subtract (1010)2(1010)2 from (1000)2(1000)2 using 2's complement.


Ans:
 Step 1: Find the 2's complement of (1010)2(1010)2. It is (0110)2(0110)2.
 Step 2: Add (0110)2(0110)2 to (1000)2(1000)2.

2’s complement

Step 3 and Step 4 have been explained in the above difference calculation.
 Algorithm of 2’s compliment subtraction
Step1: Start
Step2: Initialize data segment
Step3: Load smaller BCD number.
Step4: Determine the 2’s compliments of the smaller number.
Step5: Add this 2 larger number.
Step6: There is no carry in this case .the 2’s compliment form and is negative .
Step7: To get an answer into true from ,take 2’s compliment and change it’s sign .
Step8: Store result.
Step9:Stop.

Flowchart

Start

Initialize data segment

Load smaller BCD number

Determine the 2’s complement the smaller number


Add this to larger number

There is no carry in this case. The 2’s complement

Form and is negative

To get an answer in true form, take 2’s


complement and change it’s sign

Store result

Stop

Program of 2’s compliment subtraction

.model small
.data
Num1 dw -0320h;
Num2 dw 0640h;
Result dw 00h;
.code
Mov ax,@data; /Initialize data section
Mov ds,ax;
Mov ax,00h;
Mov ax,num1; /load num1 in ax
Mov bx,num2; /load num2 in bx
Sub ax,bx; /subtract data from reg bx in data in reg ax
Mov result ,ax; /result in reg ax
Ends
End /terminate program
 Inserted data : Number 1= -0320H
Number 2= 0640H
Subtraction of these two number is -0320H

 Step 1:binary of -0320H is =


0000 0011 0010 0000
 Step 2: 1’s complement of number
1111 1100 1101 1111

 Step 3 :Add 1 to this number = 1111 1100 1101 1111


+ 1
1111 1100 1110 0000

 Step 4 :convert binary number into hexadecimal number

1111 1101 1110 0000 1’s


complement
F D E 0 of number

 Conclusion

Two’s complement is a great way to stored signed values in memory. However, one still need

to pay attention with overflow. Adding 2 large numbers would lead to a carry-over falling in

the sign bit, and therefore yield a negative value.

You might also like