0% found this document useful (0 votes)
332 views8 pages

Log Book

The document contains a lab log book for a microprocessor course. It details 10 exercises completed by the student, including writing assembly language programs to transfer data between memory locations, perform arithmetic operations, and compare values. The programs demonstrate skills with instructions like LDA, STA, ADD, SUB, CMP, and conditional jumps. Memory locations and registers are used to store input data and output results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
332 views8 pages

Log Book

The document contains a lab log book for a microprocessor course. It details 10 exercises completed by the student, including writing assembly language programs to transfer data between memory locations, perform arithmetic operations, and compare values. The programs demonstrate skills with instructions like LDA, STA, ADD, SUB, CMP, and conditional jumps. Memory locations and registers are used to store input data and output results.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

NMK20103

MICROPROCESSOR

LAB LOG BOOK

Name Akmal Hafiz Bin Khairun


Matric Number 211393327
Programme UR6523008 – Electronic
Telecommunication Design

Faculty of Electronic Engineering & Technology


University Malaysia Perlis
Lab 2
Exercise:

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.
8. Write an 8085 assembly language program using minimum number of instructions to
add 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

SMALLEST2801: STA 3000H


HLT

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 SP, 3FF0H
MVI A, 55H
STA 2804H
STA 2807H
STA 280CH
STA 280FH

MVI E, 10H
MVI B, 00H
LXI H, 2800H
LOOP: MOV A, M
CPI 55H
JZ COUNT
INX H
DCR E
JNZ LOOP
HLT

COUNT: INR B
INX H
DCR E
JNZ LOOP
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).

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.
Store the largest value in memory locations 2500H. Assume that the numbers in the
block are all 8-bit unsigned binary numbers.
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.
8. Write a program to multiply two 8-bit unsigned numbers. Store the result in memory
locations 2A00H and 2A01H (MSB byte in 2A01H).
9. Write an 8085 assembly language program, which checks the number in memory
location 2800H based on the following algorithm.

If the number is less than 80H


Store 00H in memory location 2810H
Else if the number is equal to 80H
Store 7FH in memory location 2810H
Else if the number is more than 80H
Store FFH in memory location 2810H

You might also like