You are on page 1of 20

GOVERNMENT ENGINEERING COLLEGE, BILASPUR

SESSION 2018-19

MICROPROCESSOR

SUBMITTED TO: SUBMITTED BY:


NISHANT YADAV SIR
ROLL NO
BRANCH- C.S.E
SEMESTER- 5TH
Name: - Class: - BE (CSE)
Subject: - MICROPROCESSOR LAB FILE Year: - 3rd
Roll No.: - Semester: - V

INDEX

Sr. No. Experiment Description Date of Submission Remarks /


Experiment Signature
01 a) Write a Program to Add two 8-bit
numbers.

b) Write a Program to Subtract two 8-


bit numbers.
02 a) Write a programtoAdd two 16-bit
numbers.

b) Write a Program to Subtract two


16-bit numbers.
03 To perform addition & subtraction 32
– bit hexadecimal numbers

04 a) Write a Program to perform


addition of 2 decimal digits 9 and 7
using ASCII codes and store the result
in A SCII format.

b) Write a Program to perform


subtraction of 2 decimal digits 9 and 7
using ASCII codes and store the result
in ASCII format.
05 Write a Program to Multiply 4 into 5.

06 Write a Program to Divide 16-bit


signed number by an 8-bit signed
number.
07 Write an assembly language program
to solve following arithmetic equation:
3AX+5DX+BP.
08 Write a Program to Add series of 20
byte.

09 Write a program to solve arithmetic


equation (P*Q)+(R*S).
10 Write an assembly program to check
whether the string is palindrome or
not
PROGRAM 1(a)
AIM : Write a Program to Add two 8-bit numbers.
REQUIREMENT: EMU 8086 SOFTWARE, PC.

Program:

Instructions Comments

ORG 100h

MOV AL, 05 H Move 1st 8-bit number to AL

MOV BL, 03H Move 2nd 8-bit number to BL

Add BL with AL.


ADD AL, BL

END
End of program

Explanation:
● This program add two 8-bit numbers.
● ORG 100h is a compiler directive. It tells compiler how to handle the source code.
● It tells compiler that the executable file will be loaded at the offset of 100h (256 bytes).
● The 1st 8-bit number 05H is moved to accumulator AL.
● The 2nd 8-bit number 03H is moved to register BL.
● Then, both the numbers are added and the result is stored in AL.
Output:
Before Execution: After Execution:
AX = 05H AX = 08H
BX = 03H
PROGRAM- 1(b)

AIM: Write a Program to Subtract two 8-bit numbers.


REQUIREMENT: EMU 8086 SOFTWARE, PC.

Program:

INSTRUCTION COMMENTS

ORG100h

MOV AL, 05 H Move 1st 8-bit number to AL

MOV BL, 03H Move 2nd 8-bit number to BL

Subtract BL with AL.


SUB AL, BL

END
End of program

Explanation:
● This program subtract two 8-bit numbers.
● ORG 100h is a compiler directive. It tells compiler how to handle the source code.
● It tells compiler that the executable file will be loaded at the offset of 100h (256 bytes).
● The 1st 8-bit number 05H is moved to accumulator AL.
● The 2nd 8-bit number 03H is moved to register BL.
● Then, both the numbers are subtracted and the result is stored in AL.

Output:
Before Execution: After Execution:
AX = 05H AX = 02H
BX = 03H
PROGRAM 2(a)
Aim: Write a program to Add two 16-bit numbers.
REQUIREMENT:EMU 8086 SOFTWARE, PC.

Program:

Instructions Comments
ORG100h

MOVAX,0005H Move1st16-bitnumbertoAX

MOVBX,0003H Move2nd16-bitnumbertoBX

ADDAX,BX Add BX with AX.

END End of program

Explanation:
This program adds two16-bit numbers.
ORG100h is a compiler directive. It tells compiler how to handle the source code.
It tells compiler that the executable file will be loaded at the offset of 100h (256bytes).
The 1st 16-bit number 0005H is moved to accumulator AX.
The 2nd 16-bit number 0003H is moved to register BX.
Then, both the numbers are added and the result is stored in AX.

Output:
Before Execution: After Execution:
AX=0005HAX=0008H
BX=0003H
PROGRAM 2(b)
AIM: Write a Program to Subtract two 16-bit numbers.
REQUIREMENT: EMU 8086 SOFTWARE, PC.

Program:

Instructions Comments

ORG100h

MOVAX,0005H Move 1st16-bitnumber to AX

MOVBX,0003H Move 2nd16-bitnumber to BX

SUBAX,BX Subtract BX from AX.

END End of program

Explanation:
This program subtract two16-bit numbers.
ORG100h is a compiler directive. It tells compiler how to handle the source code.
It tells compiler that the executable file will be loaded at the offset of 100h (256bytes).
The 1st 16-bit number 0005H is moved to accumulator AX.
The 2nd 16-bit number 0003H is moved to register BX.
Then, both the numbers are subtracted and the result is stored in AX.

Output:
Before Execution: After Execution:
AX=0005H,BX=0003HAX=0002H
PROGRAM - 3
PROGRAM-04(a)
AIM: Write a Program to perform addition of 2 decimal digits 9 and 7 using ASCII
codes and store the result in A SCII format.

REQUIREMENT: EMU 8086 SOFTWARE, PC.

Instructions Comments
ORG100h

MOVAH,00H Move 00 to AH (clearAH)

MOVAL,‘9’ Move 1stdecimal number to AL

ADDAL,’7’ ADD 2ndnumber and result will be in AL

AAA ASCII adjustment after addition.

ADDAX,3030h

MOVCX,AX Move result into CX.

HLT Halt of program after execution

Explanation:
 This program ASCII addition.
 ORG100h is a compiler directive. It tells compiler how to handle the source code.
 It tells compiler that the executable file will be loaded at the offset of 100h (256bytes).
 The 1st decimal number 9 is moved to accumulator AL.
 The 2nd decimal number 9 is added and result will store in AL.
 After addition AAA is performed and result will moved in CX.
Output: CX=0106.
PROGRAM-04(b)

AIM:-Write a Program to perform subtraction of 2 decimal digits 9 and 7 using ASCII


codes and store the result in ASCII format.

REQUIREMENT: EMU 8086 SOFTWARE, PC.

Instructions Comments
ORG100h

MOVAH,00H Move 00 to AH (clearAH)

MOVAL,‘9’ Move 1st decimal number to AL

SUBAL,’7’ Subtract 2nd number and result will be in AL

AAS ASCII adjustment after subtraction.

ADDAL,30H

MOVCH,AL Move result into CH.

HLT Halt of the program after execution.

Explanation:
 This program ASCII addition.
 ORG100h is a compiler directive. It tells compiler how to handle the source code.
 It tells compiler that the executable file will be loaded at the offset of 100h (256bytes).
 The 1st decimal number 9 is moved to accumulator AL.
 The 2nd decimal number 9 is added and result will store in AL.
 After addition AAA is performed and result will moved in CX.
Output: CH=02.
PROGRAM - 5
AIM: Write a Program to Multiply 4 into 5.
REQUIREMENT: EMU 8086 SOFTWARE, PC.

Program:

Instructions Comments
ORG 100h

MOV AL, 0005 H Move 1st 8-bit number to AL

MOV BL, 0003H Move 2nd 8-bit number to BL

MUL BL Multiply BL with AL and result will be in AL.

END End of program

Explanation:
● This program multiply two 8-bit numbers.
● ORG 100h is a compiler directive. It tells compiler how to handle the source code.
● It tells compiler that the executable file will be loaded at the offset of 100h (256 bytes).
● The 1st 8-bit number 05H is moved to accumulator AL.
● The 2nd 8-bit number 04H is moved to register BL.
● Then, both the numbers are multiplied and the result is stored in AL.
Output:
Before Execution: After Execution:
AX = 05H AX = 14H
BX = 04H
PROGRAM-6

AIM: Write a Program to Divide 16-bit signed number by an 8-bit signed


number.
REQUIREMENT: EMU 8086 SOFTWARE, PC.

Program:

Instructions Comments
ORG100h

MOVAX,0008H Move1st16 bit number to AX.

MOVBL,FEH Move2nd 8-bit number to BL

IDIVBL Divide AX with BL and the Result will be in


AX.

END End of program

Explanation:
 This program multiplies two 8-bit numbers.
 ORG100h is a compiler directive. It tells compiler how to handle the source code.
 It tells compiler that the executable file will be loaded at the offset of 100h (256bytes).
 The 1st 16- bit number 0008H, i.e. dividend, is moved to accumulator AX.
 The2nd8-bitnumberFEH(-2indecimal),i.e.divisor,ismovedtoregisterBL.
 Then, both the numbers are divided.
 The result of division is stored in AX. AL contains the quotient and AH contains the
 remainder.
Output:
Before Execution: After Execution:
AX=0008HAL=FCH(-4indecimal)(Quotient)
BL=FEH(-2indecimal)AH=00H(Remainder)
PROGRAM -7
AIM: Write an assembly language program to solve following arithmetic equation:
3AX+5DX+BP.

REQUIREMENT: EMU 8086 SOFTWARE, PC.

PROGRAM:

org 100h

MOV BX,AX

SAL AX,1

ADD BX,AX

ADD BX,DX

ADD CL,02

SAL DX,CL

ADD BX,DX

SAL BP,1

ADD BX,BP

MOV CX,BX

HLT
PROGRAM - 8

AIM- Write a Program to Add series of 20 byte.

REQUIREMENT: EMU 8086 software, PC.

OUTPUT: 1+2+3+4+5………=210.
PROGRAM - 9

AIM: Write a program to solve aarithmetic equation (P*Q)+(R*S).


PROGRAM-10
AIM:- Write an assembly program to check whether the string is
palindrome or not .
MOV AX,2000H

MOV DS,AX

MOV SI,0500H

MOV DI,0604H

MOV AX,0000H

MOV CL,05H

L1: MOV AL,[SI]

CMP AL,[DI]

JNZ L2

INC SI

DEC DI

DEC CL

JNZ L1

MOV DX,01H

JMP L3

L2: MOV DX,00H

L3: HLT

OUTPUT: DX=01

You might also like