Experiment Number 1

AIM :Write a program to add and subtract two 16-bit numbers with/ without carry using 8086


  1. To understand working of 8086 Based System.
  2. To draw flowchart of the 16-bit Addition
  3. To develop and execute program,
  4. To verify the result of two 16-bit long number.

System Requirement :

  • 8086 Trainer Kit with Key Board

Setting up the Trainer Kit:

  1. Ensure that standard IBM PC/AT system keyboard is connected
  2. System is Powered ON
  3. Student has a handy opcode table for programming
  4. Use data Address as :
    1. For Program Code

segment address : 1000            Offset address : 0200

  1. For Data

segment address 0000               offset address : 1300

Flowchart to Add two 16-bit numbers:

Figure 1.1: Flowchart to add two 16-bit numbers


  1. Start
  2. Initialize the BX, and SI Registers
  3. Read the contents of the memory pointer by SI register in register AX
  4. Increment the SI register content
  5. Read the contents of the memory pointer by SI register in register BX
  6. Add content of AX and BX
  7. Increment the SI register content
  8. Check if carry is generated
  9. If yes increment BL, SI and save carry
  10. End of the program

Explanation of the Code for Adding two 16-bit numbers:

Line Number Address Op-Code Mnemonic Code Explanation
1 1000: 0200 F8 CLC ; Clear the Carry Flag
2  1000:0201 B8 00 00 MOV BX, 0000h ; Initialize BX to hex 0000
3   1000:0204 BE 00 13 MOV SI, 1300 Initialize SI register to starting address of 16-bit data
4 10000207 8B 04 MOV AX, [SI] Move 1st 16-bit data pointed by SI into AX register
5 1000: 0209 46 INC SI ; Increment the address pointer (SI)
6 1000: 020A 8B 1C MOV BX, [SI] ; transfer 2nd 16-bit data into the register BX
7 1000: 020C 03 C3 ADD AX, BX ;Add content of register AX and BX
8 1000: 020E 46 INC SI ; Increment the address pointer (SI) to save 16-bit result
9 1000: 020F 89 04 MOV [SI], AX ; save 16-bit result at location pointed by SI register
10 1000: 0211 72 01 JC SaveCarry ; Check if carry was generated as a result of addition and if so, jump to location …….
11 1000: 0213 90 NOP ; do nothing
12 1000: 0214 FE C3 SaveCarry : INC BL ; increment BL to mean carry was generated
13 1000: 0216 46 INC SI ; ; Increment the address pointer (SI) to save Carry
14 1000: 0217 88 1C MOV [SI], BL ; Save carry at address pointed by SI
15  1000: 0219 F4 HLT ; Stop execution


Execution of Program on 8086 Kit

Address Map for DATA

Data Segment Address DATA
1st 16-bit DATA Segment  : Offset: 0000 : 1300 5678h
2nd 16-bit DATA Segment  : Offset: 0000 : 1302 6789h

Executing The Program

Key Pressed/Action Display on LCD
Press G  from Keyboard BURST
Press Enter Segm_Adr
1000 Press Enter Ofst
0200 Press Enter Wait


Do not press the Reset Key; Check the result by using ub_Mir Command

Verification of Result

DATA High Byte Low Byte
             1st Data
Address SegAdr: 0000 Ofst : 1301 Ofst : 1300
             2nd data
Address SegAdr: 0000 Ofst : 1303 Ofst : 1302


Carry High Byte Low Byte
Address SegAdr: 0000 Ofst : 1305 Ofst : 1304


Experiment-1 Viva Question:

Q.1 Why two address Segment Address and Offset is used)

Answer: Memory of 8086 microprocessor is divided into different segment. Each segment has its base address and the all address within that segment are the offsets. The segment address and the offset address combined together are used to provide 20-bit physical address

Q.2 What is the purpose of CLC mnemonic code

Answer: CLC stands for clear the carry flag. If for some reason the carry flag was previously set, this action will reset the carry flag to zero.

Q.3 What is the use of BX register in this experiment

Answer: When two numbers are added, carry may generate whose status is saved in flag register. A register BX is used to keep the count of the carry. If the carry get generated program jums to a location 0214 to and the register content is incremented. The carry (Content of BL) is then saved in memory pointed by SI register.

Q.4 What is the SI register used in this program

Answer: SI register is used as a source pointer register. It contains the address of the source data i.e. 0000:1300. The microprocessor reads the data pointed by the SI register content (Address)

Q.5 What is the purpose of the instruction MOV AX, [SI]?

Answer: [SI] means the content at the memory location whose address is given in register SI.  So, MOV AX, [SI] will transfer content of memory location given in SI into AX register


Updated: April 19, 2019 — 11:01 am

Leave a Reply

Your email address will not be published. Required fields are marked *

care4you © 2020 Connect On Facebook DMCA.com Protection Status