Sie sind auf Seite 1von 7

# EXPT NO:

DATE: ARITHMETIC OPERATIONS IN 8086 MICROPROCESSOR (right hand side of your observation note)

AIM To write assembly language programs for performing arithmetic operations of two byte numbers. APPARATUS REQUIRED: SL.N O 1. 2 3. ITEM Microprocessor kit Keyboard Power Supply SPECIFICATION 8086 kit +5 V dc QUANTITY 1 1 1

ALGORITHM: 16-bit addition 1. Initialize the MSBs of sum to 0 2. Get the first number. 3. Add the second number to the first number. 4. If there is any carry, increment MSBs of sum by 1. 5. Store LSBs of sum. 6. Store MSBs of sum. 16-bit subtraction 1. Initialize the MSBs of difference to 0 2. Get the first number 3. Subtract the second number from the first number. 4. If there is any borrow, increment MSBs of difference by 1. 5. Store LSBs of difference 6. Store MSBs of difference. 16-bit Multiplication 1. Get the multiplier. 2. Get the multiplicand 3. Initialize the product to 0. 4. Product = product + multiplicand 5. Decrement the multiplier by 1 6. If multiplicand is not equal to 0, repeat from step (4) otherwise store the product. 16-bit Division of numbers. 1. Get the dividend 2. Get the divisor 3. Initialize the quotient to 0. 4. Dividend = dividend divisor 5. If the divisor is greater, store the quotient. Go to step (7). 6. If dividend is greater, quotient = quotient + 1. Repeat from step (4) 7. Store the dividend value as remainder.

START

START

## SUBTRACT SECOND OPERAND FROM MEMORY

A=A+B IS THERE ANY CY YES IS THERE ANY CARRY COUNTER COUNTER + NO STORE THE SUM NO

YES

COUNTER = COUNTER + 1

STOP

STOP

Start \Start

REGISTER=00

QUOTIENT = 0

## REGISTER = REGISTER + MULTIPLICAND

Multiplier=MULTIPLIER 1

QUOTIENT = QUOTIENT + 1

## YES STORE QUOTIENT STORE REMAINDER = DIVIDEND NOW

STOP

STOP

PROGRAM (right hand side of your observation note) ADDITION ADDRESS OPCODE LABEL MNEMONICS MOV CX, 0000H MOV AX,[1200] MOV BX, [1202] ADD AX,BX JNC L1 INC CX L1 : MOV [1206],CX MOV [1204], AX HLT COMMENTS Initialize counter CX Get the first data in AX reg Get the second data in BX reg Add the contents of both the regs AX & BX Check for carry If carry exists, increment the CX Store the carry Store the sum Stop the program

SUBTRACTION

LABEL

MNEMONICS
MOV CX, MOV MOV BX, SUB JNC INC L1 : MOV MOV [1204], Initialize counter Get the first data in AX Get the second data in BX Subtract the contents of BX from Check for If borrow exists, increment the Store the Store the Stop the

## MULTIPLICATION(right hand side of your observation note)

LABEL

MNEMONICS MOV AX,[1200] MOV BX, [1202] MUL BX MOV [1206],AX MOV [1208],DX HLT

COMMENTS Get the first data Get the second data Multiply both Store the lower order product Store the higher order product Stop the program

DIVISION

## MOV MOV DX, MOV BX, DIV MOV MOV MOV

Get the first data Initialize DX register with Get the second Divide the dividend by Store the Move the remainder to Store the content of AX to Stop the location.

MEMORY DATA

SUBTRACTION

MEMORY

DATA

MULTIPLICATION

MEMORY DATA

DIVISON

MEMORY

DATA

RESULT: