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. FLOWCHART ADDITION (left hand side of your observation note) SUBTRACTION START START SET UP COUNTER (CY) SET UP COUNTER (CARRY) GET FIRST OPERAND GET FIRST OPERAND TO A GET SECOND OPERAND TO A 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 STORE THE DIFFERENCE STORE THE CARRY STORE THE CARRY STOP STOP . (left hand side of your observation note) MULTIPLICATION DIVISION Start \Start Load Divisor & Dividend Get Multiplier & Multiplicand REGISTER=00 QUOTIENT = 0 DIVIDEND = DIVIDEND .DIVISOR REGISTER = REGISTER + MULTIPLICAND Multiplier=MULTIPLIER – 1 QUOTIENT = QUOTIENT + 1 IS NO MULTIPLIER =0? YES STORE THE RESULT IS NO DIVIDEND < DIVISIOR? YES STORE QUOTIENT STORE REMAINDER = DIVIDEND NOW STOP STOP . MOV MOV BX. 0000H MOV AX. increment the Store the Store the Stop the . [1202] ADD AX. 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. 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.PROGRAM (right hand side of your observation note) ADDITION ADDRESS OPCODE LABEL MNEMONICS MOV CX.CX MOV [1204].BX JNC L1 INC CX L1 : MOV [1206]. SUB JNC INC L1 : MOV MOV [1204].[1200] MOV BX. increment the CX Store the carry Store the sum Stop the program SUBTRACTION ADDRESS OPCODE LABEL MNEMONICS MOV CX. 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.AX MOV [1208].[1200] MOV BX.MULTIPLICATION(right hand side of your observation note) ADDRESS OPCODE LABEL MNEMONICS MOV AX.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. . [1202] MUL BX MOV [1206]. MOV BX. MANUAL CALCULATIONS: (left hand side of your observation note) . OUTPUT ADDITION (right hand side of your observation note) MEMORY DATA SUBTRACTION MEMORY DATA MULTIPLICATION MEMORY DATA DIVISON MEMORY DATA RESULT: .