0% found this document useful (0 votes)
11 views14 pages

Mmit

Microcontroller 8086 programs

Uploaded by

ak5598
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views14 pages

Mmit

Microcontroller 8086 programs

Uploaded by

ak5598
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 14

EX NO: 1 DESIGN ASSEMBLY LANGUAGE PROGRAM FOR ARITHMETIC OPERATION IN

DATE: 8086

AIM:

To develop assembly language program for Arithme c opera on in 8086

so ware required:

EMU8086

Program:

Addi on of two 16-bit numbers:

MOV CL,00h

MOV AX,[2000h]

MOV BX,[2002h]

ADD AX,BX

MOV [2004h],AX

JNC L1

INC CL

L1:MOV [2006h],CL

HLT

subtrac on of two 16-bit numbers:

ORG 1000h

MOV CL,00h

MOV AX,[2000h]

MOV BX,[2002h]

SUB AX,BX

MOV [2004h],AX

JNC L1

INC CL

L1:MOV [2006h],CL

HLT
Mul plica on o/p:

Division o/p:
Mul plica on of two 16-bits numbers:

ORG 1000h
MOV AX, [2000h] ; Load the value at memory address 2000h into AX
MOV BX, [2002h] ; Load the value at memory address 2002h into BX
MUL BX ; Mul ply AX by BX (result is stored in DX:AX)
MOV [2004h], AX ; Store the lower 16 bits of the result in memory loca on 3000h
MOV [2006h], DX ; Store the higher 16 bits of the result in memory loca on 3002h
HLT ; Halt the processor

Division of two 16-bits numbers:

ORG 1000h
MOV AX, [2000h]
MOV BX, [2002h]
DIV BX
MOV [2004h], AX
MOV [2006h], DX
HLT

Result:
Hence the ALP for Arithme c opera on for 8086 successfully developed.
Smallest value o/p:

Largest value o/p:


Largest value:

MOV SI, 1100h

MOV DI, 1110h

MOV CL, [SI]

INC SI

MOV AL, [SI]

DEC CL

AGAIN:

INC SI

MOV BL, [SI]

CMP AL, BL

JNC AHEAD

MOV AL, BL

AHEAD:

DEC CL

JNZ AGAIN

MOV [DI], AL

HLT

Result:
Hence the ALP for finding smallest/largest data in an array in 8086 was successfully developed.
Factorial o/p:
EX NO: 3 DESIGN ASSEMBLY LANGUAGE PROGRAM FOR FINDING FACTORIAL OF A
DATE: NUMBER IN 8086

AIM:

To develop assembly language program for finding factorial of a number in 8086

so ware required:

EMU8086

Program:

Factorial:

MOV CX, [5000h] ; Load the number from memory (e.g., 5) into CX register

MOV AX, 0001h ; Ini alize AX to 1 (factorial starts at 1)

L1: MUL CX ; Mul ply AX by CX (AX = AX * CX)

DEC CX ; Decrease CX by 1

CMP CX, 0001h ; Check if CX has reached 1

JNZ L1 ; If CX is not 1, loop back and con nue

MOV [6000h], AX ; Store the result (factorial) at memory address 6000h

HLT ; Stop the program

Result:
Hence the ALP for finding factorial of a number in 8086 was successfully developed.
BCD to HEXA conversion o/p:
EX NO: 4 DESIGN ASSEMBLY LANGUAGE PROGRAM FOR CONVERTING BCD TO
DATE: HEXADECIMAL VALUE IN 8086

AIM:

To develop assembly language program for conver ng BCD to HEXA decimal value in 8086

so ware required:

EMU8086

Program:

BCD – HEXA:

org 100h

MOV SI,1000H

MOV DI,1010H

MOV BL,[SI]

AND BL,0FH

MOV AL,[SI]

AND AL,0F0H

MOV CL,04H

ROR AL,CL

MOV DL,0AH

MUL DL

ADD AL,BL

MOV [DI],AL

HLT

Result:
Hence the ALP for conver ng BCD to HEXA decimal value in 8086 was successfully developed.
Ascending order o/p:

Descending order o/p:


EX NO: 5 DESIGN ASSEMBLY LANGUAGE PROGRAM FOR SORTING AN ARRAY IN
DATE: ASCENDING/DESCENDING ORDER IN 8086

AIM:

To develop assembly language program for Sor ng an Array in Ascending/ Descending Order in 8086

so ware required:

EMU8086

Program:

Ascending order:

MOV SI, 1100h

MOV CL, [SI]

DEC CL

REPEAT:

MOV SI, 1100h

MOV CH, [SI]]

DEC CH

INC SI

REPCOM:

MOV AL, [SI]

INC SI

CMP AL, [SI]

JC AHEAD

XCHG AL, [SI]

XCHG AL, [SI-1]

AHEAD:

DEC CH

JNZ REPCOM

DEC CL

JNZ REPEAT

HLT
Addi on o/p:

Subtrac on o/p:
Descending order:

MOV SI, 1100h


MOV CL, [SI]
DEC CL
REPEAT:
MOV SI, 1100h
MOV CH, [SI]]
DEC CH
INC SI
REPCOM:
MOV AL, [SI]
INC SI
CMP AL, [SI]
JNC AHEAD
XCHG AL, [SI]
XCHG AL, [SI-1]
AHEAD:
DEC CH
JNZ REPCOM
DEC CL
JNZ REPEAT
HLT

Result:
Hence the ALP for Sor ng an Array in Ascending/ Descending Order in 8086 was successfully
developed.
EX NO: 2 DESIGN ASSEMBLY LANGUAGE PROGRAM FOR FINDING
DATE: SMALLEST/LARGEST DATA IN AN ARRAY IN 8086

AIM:

To develop assembly language program for finding smallest/largest data in an array in 8086

so ware required:

EMU8086

Program:

Smallest value:

MOV SI, 1100h

MOV DI,1200h

MOV CL,[SI]

INC SI

MOV AL,[SI]

DEC CL

AGAIN:

INC SI

MOV BL,[SI]

CMP AL,BL

JC AHEAD

MOV AL,BL

AHEAD:

DEC CL

JNZ AGAIN

MOV [DI],AL

HLT

You might also like