0% found this document useful (0 votes)
41 views5 pages

Mi RK 2

The document outlines a laboratory exercise focused on programming using arithmetic and logical operations with the 8085 microprocessor. It includes objectives, an overview of relevant instructions, and several assembly language programs (ALPs) for performing operations such as addition, subtraction, and complementing data. Each program is accompanied by its corresponding assembly code for implementation.

Uploaded by

salachapri403
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)
41 views5 pages

Mi RK 2

The document outlines a laboratory exercise focused on programming using arithmetic and logical operations with the 8085 microprocessor. It includes objectives, an overview of relevant instructions, and several assembly language programs (ALPs) for performing operations such as addition, subtraction, and complementing data. Each program is accompanied by its corresponding assembly code for implementation.

Uploaded by

salachapri403
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/ 5

RUSHI KAKADIYA CE-B IU2241050224

LABORATORY-2

PROGRAMMING BASED ON ARITHMETIC AND LOGICAL OPERATIONS

OBJECTIVE
To familiar with the use of arithmetic and logical instruction sets of 8085

PRELAB
Read the instructions related to arithmetic and logical operations in detail.

OVERVIEW OF ARITHMETIC & LOGICAL INSTRUCTIONS

Opcode Operand Description

ADD R Adds the content of register R to the content of the accumulator

ADI 8-bit Adds the 8-bit Data to the content of the accumulator
Subtracts content of register R from the content of the
SUB R
accumulator
SUI 8-bit Subtracts 8-bit Data from the content of the accumulator

INR R Increases the content of register R by 1

DCR R Decreases the content of register R by 1


Adds the content of memory location specified by register pair HL
ADD M
to the content of the accumulator
Subtracts the content of memory location specified by register
SUB M
pair HL from the content of the accumulator
Increment the content of the memory location specified by
INR M
register pair HL by 1.
Decrement the content of the memory location specified by
DCR M
register pair HL by 1.
Logically ANDs the content of register R with the content of
ANA R
accumulator
ANI 8-bit Logically ANDs the 8-bit data with the content of the accumulator

1
RUSHI KAKADIYA CE-B IU2241050224

ORA R Logically ORs the content of register R with content of the


accumulator
ORI 8-bit Logically ORs the 8-bit data with the content of the accumulator
Exclusive-ORs the contents of register R with the content of
XRA R
accumulator
XRI 8-bit Exclusive-ORs the 8-bit data with the content of the accumulator

CMA Complements the content of the accumulator

RLC Rotate accumulator left

RAL Rotate accumulator left through carry

RRC Rotate accumulator right

RAR Rotate accumulator right through carry

CMP R/M Compare register or memory with accumulator

CPI 8-bit Compare 8-bit data with accumulator

2
RUSHI KAKADIYA CE-B IU2241050224

Programs

1. Write an assembly language program for the adding of two 8-bits numbers stored
at memory location 2100H and 2101H respectively. Store the result at memory
location 2102H.

CODE:
LXI H, 2100H
MVI M, 22H
MOV A, M
LXI H, 2101H
MVI M, 24H
ADD M
LXI H, 2102H
MOV M, A
HLT

2. Write an ALP to add two sixteen bit numbers and store 16-bit result.

CODE:
LXI H, 1020H
LXI B, 1516H
DAD B
HLT

3. Subtract two 8-bit numbers at 2100H and 2101H. Save the result at location
2102H.

CODE:
LXI H, 2100H
MVI M, 30H
MOV A, M
LXI H, 2101H
MVI M, 24H
SUM M
LXI H, 2102H
MOV M, A
HLT

4. Write a program to subtract two 16-bit numbers and store the result.

3
RUSHI KAKADIYA CE-B IU2241050224

CODE:
MVI C, 30H
MOV A, C
MVI E, 20H
SUB E
MOV L, A
MVI B, 15H
MOV A, B
MVI D, 10H
SBB D
MOV H, A
HLT

5. Write ALP to find one’s complement of data 0x55 stored at memory location
2100H.

CODE:
LXI H, 2100H
MVI M, 55H
MOV A, M
CMA
LXI H, 2101H
MOV M, A
HLT

6. Write an ALP to find two’s complement of data 0x45 stored at memory


location 2100H.

CODE:
LXI H, 2100H
MVI M, 45H
MOV A, M
CMA
INR A
LXI H, 2101H
MOV M, A
HLT

7. Write an ALP to unpacked data stored at location 2100H. Save result at memory
locations 2101H and 2102H.

4
RUSHI KAKADIYA CE-B IU2241050224

CODE:
LXI H, 2100H
MVI M, 22H
LXI H, 2100H
MOV A, M
ANI 0FH
MOV E, A
MOV A, M
ANI F0H
RRC
RRC
RRC
RRC
MOV D, A
LXI H, 2101H
MOV M, E
INX H
MOV M, D
HLT

8. Write a program that takes two nibbles from 2100H, 2101H and combines to form
byte. The nibbles from 2100 are to be taken as most significant nibble.

CODE:
LXI H, 2100H
MVI M, 22H
LXI H, 2100H
MOV A, M
ANI 0F0H
MOV B, A
INX H
MOV A, M
ANI 0FH
ORA B
STA 2102H
HLT

You might also like