0% found this document useful (0 votes)
18 views

The Women University, Multan

The document contains instructions for writing assembly language programs to add 8-bit and 16-bit numbers. For 8-bit addition, the program loads two numbers from memory addresses 2050 and 2051 into registers, adds the registers together, and stores the result in memory address 2052. For 16-bit addition, the program loads two 16-bit numbers from memory addresses 3000 and 3002 into registers, adds them while tracking any carry in another register, and stores the results in memory addresses 3004 and 3006. The document provides the algorithm, instructions, and explanation for each addition program.

Uploaded by

Areej Fatima
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views

The Women University, Multan

The document contains instructions for writing assembly language programs to add 8-bit and 16-bit numbers. For 8-bit addition, the program loads two numbers from memory addresses 2050 and 2051 into registers, adds the registers together, and stores the result in memory address 2052. For 16-bit addition, the program loads two 16-bit numbers from memory addresses 3000 and 3002 into registers, adds them while tracking any carry in another register, and stores the results in memory addresses 3004 and 3006. The document provides the algorithm, instructions, and explanation for each addition program.

Uploaded by

Areej Fatima
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

THE WOMEN UNIVERSITY, MULTAN.

LAB WORK

Class: MCS-II (2019-2021)


Course: Microprocessor and Assembly Language
Course Instructor: Miss Rabea Saleem
ADDITION PROGRAM
PROBLEM

Write an assembly language program to sum two 8 bit numbers without using
carry operation in 8086 microprocessor.
ASSUMPTIONS

• The starting address of the program is 2000.


• Memory address of the first number is 2050.
• Memory address of the second number is 2051.
• Memory address of result is 2052.
ALGORITHM

• Load the first number to the accumulator through memory address 2050.
• Move the content of accumulator to the register B.
• Load the second number to the accumulator through memory address 2051.
• Add the content of accumulator and register B and result will be stored at the accumulator.
• Store the result from the accumulator to the memory address 2052.
• Terminate the program.
EXPLANATION
• LDA 2050: This instruction will load the number from memory to the accumulator.
• MOV B, A: This instruction will move the content of accumulator to the register B.
• LDA 2051: This instruction will load the number from memory to the accumulator.
• ADD B: This instruction will sum the content of the accumulator with the content of the
register B.

• STA 2052: This instruction will store the content of accumulator to the memory address
2052.

• HLT: This instruction will terminate the program.


16 BIT NUMBERS WITH AND WITHOUT
CARRY

Write a program to add two 16-bit numbers where starting address is 2000 and
the numbers are at 3000 and 3002 memory address and store result
into 3004 and 3006 memory address.
ALGORITHM

• Load 0000H into CX register (for carry)


• Load the data into AX(accumulator) from memory 3000
• Load the data into BX register from memory 3002
• Add BX with Accumulator AX
• Jump if no carry
• Increment CX by 1
• Move data from AX(accumulator) to memory 3004
• Move data from CX register to memory 3006
• Stop
EXPLANATION
• MOV is used to load and store data.
• ADD is used to add two numbers where their one number is in accumulator or not.
• JNC is a 2-bit command which is used to check whether the carry is generated from
accumulator or not.
• INC is used to increment an register by 1.
• HLT is used to stop the program.
• AX is an accumulator which is used to load and store the data.
• BX, CX are general purpose registers where BX is used for storing second number and CX is
used to store carry.
THANK
YOU!

You might also like