Download as pdf or txt
Download as pdf or txt
You are on page 1of 21

8086 Experiments

1. Write an assembly language program to find the largest of three numbers stored in the
memory location 2050H, 2051H, AND 2052H, assuming that all three numbers are
unequal.
ORG 100H
MOV CL, 03H
MOV BX, 2050H
MOV AL, 00H
J: CMP AL, [BX]
JNC SKIP
MOV AL, [BX]
SKIP: INC BX
LOOP J
HLT
2. Write an assembly language program to find the largest of the given list of n data bytes
stored in the memory starting from memory location 2071H. Count of data bytes in the
list (i.e. n) is stored at memory location 2070H.
ORG 100H
MOV CL, [2070H]
MOV BX, 2071H
MOV AL, 00H
J: CMP AL, [BX]
JNC SKIP
MOV AL, [BX]
SKIP: INC BX
LOOP J
HLT
3. Write an assembly language program to find the smallest of the given list of n data
bytes stored in the memory starting from memory location 2071H. Count of data bytes
in the list (i.e. n) is stored at memory location 2070H.
ORG 100H
MOV CL, [2070H]
MOV BX, 2071H
MOV AL, [BX]
INC BX
DEC CL
J: CMP AL, [BX]
JC SKIP
MOV AL, [BX]
SKIP: INC BX
LOOP J
HLT
4. Write an 8085 assembly language program to find the largest and smallest numbers out of 10
assigned 8-bit integers stored at 3000H onwards. Store the result at 3050H and3051H.
ORG 100H
MOV CL, 05H
MOV BX, 3000h
MOV AL, [BX]
MOV AH, [AL]
INC BX
DEC CL
J: CMP AL, [BX]
JNC SKIP
MOV AL, [BX]
SKIP: CMP AH, [BX]
JC SKIP
MOV AH, [BX]
SKIP1: INC BX
LOOP J
MOV [3050H], AL
MOV [3051H], AH
HLT
5. Write an assembly language program to add the given list of n data bytes stored in the
memory starting from memory location 3000H. Store the 8-bit sum in the memory
location 3050H. Where n may be any number but for this case choose n=10.
ORG 100H
MOV BX, 3000H
MOV AL, 00H
MOV CL, 0AH
J: ADD AL, [BX]
INC BX
LOOP J
MOV [3050H], AL
HLT
6. Write an assembly language program to add the given list of n data bytes stored in the
memory starting from memory location 3050H. Store the 16-bit sum in the
memory location 3070H (lower byte) and 3071H (higher byte). Where n may be any number
but for this case choose n=25.
ORG 100H
MOV CL, 0AH
MOV BX, 3050h
MOV AX, 0000H
J: ADD AX, [BX]
INC BX
LOOP J
HLT
7. Write an assembly language program to add the set of data bytes stored in the memory
starting form 2050H. The end of data string is indicated by 00H. Result may be larger than FFH.
Display the sum at port 1 and port 2.
ORG 100H
MOV BX, 2050H
MOV AX, 0000H
MOV CL, 00H
J: CMP CL, [BX]
JZ SKIP1
ADD AL, [BX]
JNC SKIP
INC AH
SKIP: INC BX
JMP J
SKOP1: HLT
8. Write an assembly language program to find the sum of positive numbers only and ignore
negative numbers from the list of numbers. The length of the list is in memory location 2050H
and the series itself begins from memory location 2051H. Store the 8-bitsum at the memory
location 3070H.
ORG 100H
MOV BX, 2051H
MOV AL, 00H
MOV CL, [2050H]
J: ROL [BX], 1
JC SKIP
ROR [BX], 1
ADD AL, [BX]
SKIP: INC BX
LOOP J
MOV [3070H], AL
HLT
9. Write an assembly language program to copy a block of data bytes from one memory
location starting from 2051H to another section of memory starting from 3051H. Number of
bytes to be copied is given at memory location 2050H.

ORG 100H
MOV CL, [2050H]
MOV SI, 2051H
MOV DI, 3051H
REB MOUSB
HLT
10. Write an assembly language program to exchange a block of data bytes stored in the
memory starting from 2051H with a block of data bytes stored at another section
of memory starting from 3051H. Number of bytes to be exchanged is given at
memory location 2050H.
ORG 100H
MOV CL, [2050H]
MOV SI, 2051H
MOV DI, 3051H
J: MOV AL, [SI]
MOV BL, [DI]
MOV [SI], BL
MOV [DI], AL
INC SI
INC DI
LOOP J
HLT
11. A set of 8 data bytes is stored in the memory locations starting at 2050H. Write an assembly
language program to check each data byte for bit D7 and D0. If D7 or D0 is 1,
reject the data byte; otherwise, store the data bytes at memory locations starting
from2060H.
ORG 100H
MOV SI, 2050H
MOV DI, 2060H
MOV CL, 08H
J: LODSB
ROL AL, 1
JC SKIP
ROR AL, 2
JC SKIP
ROL AL, 1
STOSB
SKIP: LOOP J
HLT
12. Write an assembly language program for shifting of block of data from
memory locations 3000H – 3009H to new memory locations 3050H – 3059H in reverse order.
i.e. data from 3000H will be moved to 3059H and so on.
ORG 100H
MOV SI, 3000H
MOV DI, 3059H
MOV CL, OAH
J: LODSB
MOV [DI], AL
DEC DI
LOOP J
HLT
13. Write an 8085 assembly program to check if the Input string of characters (in ASCII codes)
stored at location 2050H to 205FH is equal to a string stored at location 2100H to210FH (in
ASCII codes). If two strings are same, display 1 at Port 1, otherwise 0.
ORG 100H
MOV SI, 2050H
MOV DI, 2100H
MOV CL, 10H
MOV DL, 00H
REPZ CMPSB
JNZ SKIP
MOV DL, 01H
SKIP: HLT
14. Write an assembly language program to search a data byte in stored at
memory location 3000H in the list of 100 data bytes stored in the memory starting from
location3001H. If the data byte is found, display 01H and if not found display 00H, on the
output port 82H.
ORG 100H
MOV DI, 3001H
MOV AL, [3000H]
MOV CL, OAH
MOV DL, 00
REPNE SCASB
JNZ SKIP
MOV DL, 01
SKIP: HLT
15. Write an assembly language program to scan a data byte in the memory block of 128bytes
starting from 2501H. Assume that the data byte to be scanned is stored at 2500H.Store the
number that how many times the given data byte is found in the memory block, at memory
location 4000H and also display the data byte and the number at output port00H and 01H
respectively.
ORG 100H
MOV DI, 2501H
MOV AL, [2500H]
MOV CL, OAH
MOV DL, 00
J: REPNE SCASB
JZ K
JMP SKIP
K: INC DL
JMP J
SKIP: HLT
16. Write a program to multiply two 8-bit numbers. Multiplicand is extended to 16-bitand
stored in the two consecutive memory locations 2050H and 2051H. The multiplier is stored at
2052H. Store the 16-bit product at two consecutive memory locations 2053Hand 2054H.
ORG 100H
MOV SI, 2050H
MOV DI, 2054H
MOV BL, [2052H]
LODSW
MUL BX
STOSW
HLT
17. Write an assembly language program to divide a 16-bit dividend, stored in memory
locations 2051H & 2052H, by an 8-bit divisor, stored in memory location 2053H. After division
the quotient must be stored in memory location 2054H and remainder in memory location
2055H.
ORG 100H
MOV BL, [2053]
MOV SI, 2051
MOV DI, 2054
LODSW
DIV DL
STOSW
HLT
18. Write an assembly language program to perform addition of two Hexadecimal
Numbers as given below:9A5B8938H & 8BC34AD1H
ORG 100H
MOV AX, 8938H
MOV BX, 9A5BH
MOV CX, 4AD1H
MOV DX, 8BC3H
ADD AX, CX
ADC BX, DX
HLT
19. Write an assembly language program to sort the list of bytes, in ascending
order, stored in the memory starting from 2061H. The count of the bytes in the list is stored at
memory location 2060H.
ORG 100H
MOV CL, [2060H]
DEC CL
I: MOV DL, CL
MOV SI, 2061H
J: MOV AL, [SI]
INC SI
CMP AL, [SI]
JC K
XCHG AL, [SI]
MOV [SI-1], AL
K: DEC DL
JNZ J
DEC CL
JNZ I
HLT
20. Write an assembly language program to convert 8-packed BCD number into its
equivalent 8-bit binary number.
ORG 100H
MOV AL, [2050H]
MOV BL, AL
MOV AL, OFH
MOV CL, AL
MOV AL, BL
AND AL, 240
JZ K
ROR AL, 4
MOV DL, AL
MOV AL, 00H
MOV DH 0AH
L: ADD AL, DL
DEC DH
JNZ L
K: ADD AL, CL
MOV [2051H], AL
HLT
21. Write an assembly language program to convert 8-bit Binary number to its equivalent
packed BCD number.
ORG 100H
MOV SI, 3000H
MOV AL, [SI]
MOV BL, 00H
MOV CL, BL
J: SUB AL, 64H
JC K
INC CL
JMP J
K: ADD AL, 64H
M: SUB AL, 0AH
JC L
INC BL
JMP M
L: ADD AL, 0AH
INC SI
MOV [SI], CL
INC SI
MOV [SI], BL
INC SI
MOV [SI], AL
HLT

You might also like