Log Book Finished
Log Book Finished
MICROPROCESSOR
1. Using LDA and STA instructions, write a program that will transfer five byte of
memory from location 3000H through 3004H to location 3200H through 3204H.
ORG 2000H
LDA 3000H
STA 3200H
LDA 3001H
STA 3201H
LDA 3002H
STA 3202H
LDA 3003H
STA 3203H
LDA 3004H
STA 3204H
HLT
2. Write a program to exchange the contents of HL register pair with DE register pair
using MOV instruction.
ORG 2000H
MOV B, H
MOV H, D
MOV C, L
MOV L, E
MOV D, B
MOV E, C
HLT
3. Write a program to swap lower 4 bit nibble with upper 4 bit nibble of 8 bit data at
memory location 2100H and place a result to location 2101H.
ORG 2000H
LDA 2100H
RRC
RRC
RRC
RRC
STA 2101H
HLT
4. Write a program using the ADD instruction to add the two hexadecimal numbers 3AH
and 48H and store the result in memory location 2100H.
ORG 2000H
MVI A, 3AH
MVI B, 48H
ADD B
STA 2100H
HLT
5. Write a program to subtract the number in the D register from the number in the E
register. Store the result in register C.
ORG 2000H
MOV A, E
SUB D
MOV C, A
HLT
6. Write an assembly language program that AND, OR and XOR together the contents
of register B, C and E and place the result into memory location 3000H, 3001H and
3002H.
ORG 2000H
MOV A, B
ANA C
ANA E
STA 3000H
MOV A, B
ORA C
ORA E
STA 3001H
MOV A, B
XRA C
XRA E
STA 3002H
HLT
7. Write an assembly language program to add two 3-digit BCD numbers at memory
location 3000H (MSB) to 3002H (LSB) and 3003H (MSB) to 3005H (LSB) and store
the result at memory location 3006H to 3008H.
ORG 2000H
LDA 3000H
MOV B, A
LDA 3001H
MOV C, A
LDA 3002H
MOV D, A
LDA 3003H
ADD B
MOV E, A
LDA 3004H
ADD C
MOV H, A
LDA 3005H
ADD D
MOV L, A
STA 3006H
STA 3007H
STA 3008H
HLT
8. Write an 8085-assembly language program using minimum number of instructions
toadd the 16-bit number in BC, DE & HL. Store the 16-bit result in DE.
ORG 2000H
DAD B
DAD D
MOV D, H
MOV E, L
HLT
9. Develop a program in assembly that subtracts the number in the DE register pair from
the number in the HL register. Place the result in BC register.
ORG 2000H
MOV A, H
SUB D
MOV B, A
MOV A, L
SUB E
MOV C, A
HLT
10. Write an 8085 assembly language program to find the smallest value between two
number in memory location 2800H and 2801. Store the value in memory location
3000H.
ORG 2000H
LDA 2800H
MOV B, A
LDA 2801H
CMP B
JC SMALLEST2801
JMP SMALLEST2800
SMALLEST2800: MOV A, B
STA 3000H
HLT
Lab 3
Task:
1. Write an 8085 assembly language program, which adds two three-byte numbers. The
first number is stored in memory locations 3800H, 3801H & 3802H and the second
number is stored in memory location 3803H, 3804H & 3805H. Store the answer in
memory locations 3810H upwards.
ORG 2000H
LXI SP, 3FF0H
LDA 3800H
MOV B, A
LDA 3803H
ADD B
STA 3810H
LDA 3801H
MOV B, A
LDA 3804H
ADD B
STA 3811H
LDA 3802H
MOV B, A
LDA 3805H
ADD B
STA 3812H
HLT
2. Write a program that store 00H into memory location 2500H through 2510H.
ORG 2000H
LXI SP, 3FF0H
MVI B, 10
LXI H, 2500H
LOOP: MVI M, 00H
INX H
DCR B
JNZ LOOP
3. Write a program to count the data byte in memory that equal to 55H starting at
memory location 2800H through 280FH. Place the count value in B register.
ORG 2000H
LXI H,2800H
MVI C,10H
MVI B,00H
MVI A,55H
LOC2:CMP
JNZ LOC1
INR B
LOC1:INX H
DCR C
JNZ LOC2
HLT
4. Sixteen bytes of data are stored in memory locations at 3150H to 315FH. Write a
program to transfer the entire block of data to new memory locations starting at
3250H.
ORG 2000H
LXI SP, 3FF0H
LHLD 3150H
SHLD 3250H
LHLD 3152H
SHLD 3252H
LHLD 3154H
SHLD 3254H
LHLD 3156H
SHLD 3256H
LHLD 3158H
SHLD 3258H
LHLD 315AH
SHLD 325AH
LHLD 315CH
SHLD 325CH
LHLD 315EH
SHLD 325EH
HLT
5. Write a program to calculate the sum of a series of numbers. The length of the block
is in memory location 2102H and the series itself begins in memory location 2103H.
Store the sum in memory locations 2100H and 2101H (MSB byte in 2101H).
ORG 2000H
LDA 2102H
MOV C,A
LXI H,2103H
SUB A
MOV B,A
BACK:ADD M
JNC SKIP
INR B
SKIP:INX H
DCR C
JNZ BACK
STA 2100H
MOV A,B
STA 2101H
HLT
6. Write a program to find the largest element in a block of data. The length of series is
in memory location 2501H and the block itself begins in memory location 2502H.
ORG 2000H
LDA 2501H
MOV C, A
LDA 2502H
MOV B, A
LXI H, 2503H
MOV A, M
CMP B
JC NEXT
MOV B, A
INX H
DCR C
JNZ COMPARE
MOV 2500H, B
HLT
7. Read one byte data from memory location 2200H. Determine the number of bit 1’s in
the data and store the result at memory location 2201H.
ORG 2000H
LDA 2200H
MOV B, A
MVI C, 00H
RRC
JC INCREMENT
JMP NEXT_BIT
INR C
DCR B
MOV A, B
HLT
8. Write a program to multiply two 8-bit unsigned numbers. Store the result in memory
locations 2A00H and 2A01H (MSB byte in 2A01H).
ORG 2000H
LDA 2A02H
MOV B, A
LDA 2A03H
MVI C, 00H
MVI D, 00H
ADD D
JNC NEXT
INR C
DCR B
JNZ MULTIPLY
MOV A, D
STA 2A00H
MOV A, C
STA 2A01H
HLT