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

8085 Assembly Language Programs from Lab Manual

Write an assembly language program to copy data from memory location 2050h to 3050h.
LDA 2050H
STA 3050H
HLT
Write an assembly language program to swap data on memory location 2050h & 3050h.
LDA 2050H
MOV B, A
LDA 3050H
STA 2050H
MOV A, B
STA 3050H
HLT
Write an assembly language program to move immediate data 96h into Register B and then
move Immediate data 43h to register C. Finally load the HL pair with the 16-bit data stored at
memory location 9643h
MVI B, 96H
MVI C, 43H
LHLD 9643H
HLT
Write an assembly language program to load data into accumulator which is pointed by
memory location 1000h, also store that data into 2000h memory location
LXI H, 1000H
MOV A, M
LXI H, 2000H
MOV M, A
HLT
Write an assembly language program to add two numbers stored at memory locations 2000h
and 2001h and also store the result back into memory location 2002h.
LXI H, 2000H
MOV A, M
INX H
ADD M
INX H
MOV M, A
HLT
Write an assembly language program to increment a number stored in memory location
8000h and store the result back into the same memory location using indirect addressing
mode.
LXI H, 8000H
INR M
HLT
Write an assembly language program to decrement a 16-bit number stored in memory
location 3000h and store the result back into the same memory location.
LHLD 3000H
INX H
SHLD 3000H
HLT
Write an assembly language program to add 2 16-bit numbers stored in memory locations
2050h and 2052h and store the answer at memory location 2054h.
LHLD 2052H
XCHG
LHLD 2050H
DAD D
SHLD 2054H
HLT
Write an assembly language program to add 2 16-bit numbers stored in memory locations
2050h and 2052h without using DAD instruction and store the answer at memory location
2054h.
LHLD 2052H
XCHG
LHLD 2050H
MOV A, L
ADD E
MOV L, A
MOV A, H
ADC D
MOV H, A
SHLD 2054H
HLT
Write an assembly language program to mask the lower nibble (4 bits) of the data stored at
memory location 2050h. Also store the result on 2051h.
LDA 2050H
ADI 0F0H
STA 2051H
HLT
Write an assembly language program to set odd bits of the data stored at 1000h and store the
answer back on 1001h.
LDA 1000H
ORA 0AAH ; Bit Pattern: (1010 1010)
STA 1001H
HLT
Write an assembly language program to multiply the number stored in the location pointed
by HL register pair by 4. Store the answer in 1000h.
LXI H, 1234H
MOV A, M
RLC
RLC
STA 1000H
HLT
Write an assembly language program to clear the contents of an accumulator and set it to 00h
without using any data transfer instruction.
XRA A
HLT
Write an assembly language program to check the bit – 3 (4th bit) of the number stored in
memory location 1000h. The answer can be observed in Zero Flag (Z).
LDA 1000H
ANI 08H
HLT
Write an assembly language program to generate 2’s Complement of the number stored in
Register B and store the answer back in Register C.
MOV A, B
CMA
INR A
MOV C, A
HLT
Write an assembly language program to read data from one input port (e.g., Port 06h),
perform some operations, and then write the result to an output port (e.g., Port 07h).
IN 06H
OUT 07H
HLT
Write an assembly language program Enable Interrupts and Clear all pending requests of RST
7.5 as well as Mask RST 7.5 and RST 5.5.
MVI A, 1DH ; Bit Pattern: (0001 1101)
SIM
HLT
Write an assembly language program that takes an integer 'N' as input from memory location
2050h and then reads 'N' numbers from memory locations 2051h to (2050+N)h. The program
should copy these 'N' numbers starting from memory location 2060h.
LXI H, 2060H
XCHG
LXI H, 2050H
MOV C, M
INX H
LOOP: MOV A, M
XCHG
MOV M, A
XCHG
INX H
INX D
DCR C
JNZ LOOP
HLT
Write an assembly language program that takes an integer 'N' as input from memory location
2050h and then reads 'N' numbers from memory locations 2051h to (2050+N)h. The program
should compute the sum of these 'N' numbers and store the result in memory location 2060h.
LXI H, 2050H
MOV C, M
INX H
XRA A
MOV B, A
LOOP: ADD M
INX H
JNC SKIP
INR B
SKIP: DCR C
JNZ LOOP
STA 2060H
MOV A, B
STA 2061H
HLT
Develop an assembly language program that takes an integer 'N' as input from memory
location 2050h and calculates its factorial. The result should be stored in memory location
2060h.
LDA 2050H
MOV B, A
MOV D, A
DCR B
MOV C, B
LOOP1: XRA A
LOOP2: ADD D
DCR C
JNZ LOOP2
MOV D, A
DCR B
MOV C, B
JNZ LOOP1
STA 2051H
HLT
Write an assembly language program that takes an 8-bit binary number as input from memory
location 2050h and converts it into its decimal equivalent. The decimal value should be stored
in memory location 2060h.
LDA 2050H
MOV C, A
XRA A
CONV: INR A
DAA
DCR C
JNZ CONV
STA 2051h
HLT
Write an assembly language program that reads an array of 'N' numbers from memory
locations 2050h to (2050+N-1)h. The program should classify even numbers and store the
count of even numbers in memory location 2060h.
LXI H, 2050H
MVI C, 06H
MVI B, 00H
LOOP: MOV A, M
RRC
JNC SKIP
INR B
SKIP: DCR C
JNZ LOOP
MOV A, B
STA 2060H
HLT
Write an assembly language program that takes an array of 'N' numbers as input from memory
locations 2050h to (2050+N-1)h. The program should find the largest number in the array and
store it in memory location 2060h.
LXI H, 2050H
MVI C, 06H
MVI B, 00H
LOOP: MOV A, M
CMP B
JC SKIP
MOV B, A
SKIP: INX H
DCR C
JNZ LOOP
MOV A, B
STA 2060H
HLT
Write an assembly language program to multiply numbers stored in memory location 2050h
and 2051h. Also take care of the overflow if there’s any while multiplication..
LXI H, 2050H
MOV B, M
INX H
MOV C, M
XRA A
MOV D, A
LOOP: ADD B
JNC SKIP
INR D
SKIP: DCR C
JNZ LOOP
MOV E, A
Observe the answer in DE register pair for this program.

• Some of the above programs can be performed in more than 1 way, one
can develop the program in any of the way possible, as long as the
required criteria is satisfied.

You might also like