You are on page 1of 19

Program No.

2
Alm: write a
program to perform addition of two 8 bit numbers.

Program:

LXI H,CO050
MOV A,M
INXH
ADD M
STA CO52
HLT

=66HH
I/EXAMPLE-> CO50 55H, CO51

I/ OUTPUT -> CO52 =BBH


Program No.3

Aim:
Write a program to perform subtraction of twe 8 hit numhers.
Programn:

LXI H, CO50
MOV A, M
INX H
SUB M
INX H
MOV M, A

HLT

=11
/ EXAMPLE-> CO50 55, CO51
I/ OUTPUT -> CO52 =
44
Program No.4
Aim: Write a
program to perform multiplication of two 8 bit numbers.

Program:

MVI A ,05
MVI B, 02

DCR B
JZ 800A
ADD A

DCR B

JNZ 8008

HLT

/OUTPUT

A=05, B=02

RESULT =
0A H
Program No.5
Aim : write a
program to
perform division of two 8 bit numbers.

Program:

MVI A, 05
MVI B,02
MOV C,A
MOV D,B
MVI E,00o
SUB B
INR E
JNZ 8008
DCR E
ADD D
HLT

//OUTPUT
A=05, B=02, E=0
RESULT
A=01 H, E=02H
Program No.6
Aim: Write a
program to find sum of ten bytes of data sting.
Program:

LDACOUNTER
MOV B. A

LXID,2601
LOOP: LXI H,SIZE
MOV C.M
LXI H.SUM

ORA A

BACK: LDAX D
ADC M
DAA
MOV M,AA
INX D
INX H
DCR C
JNZ BACK
DCR B
JNZ LOOP
HLT
I/ OUTPUT

I0024568945

I/+0054863564
Il +0032718907

0112151416
Program No.7
Aim: Write a
program to find 1's
complement of given number.
Program:

LDA COS50
CMA
STA CO51
HLT

II EXAMPLE-> COS0-96

Answer-> CO51=69
Program No.8
Aim: Write a
program to find 2's
Complement of given number.
Program:

LDA CO50
CMA
INR A
STA CO51
HLT

I/ EXAMPLE-> CO50=96

// OUTPUT-> CO51=6A
Program No.9
Aim: Write a
program to find
largest/ smallest no. in a given series.
To find
Largest No.
LXI H,2500 H

MOV C,MM
INX H
MOV A,M
DCRC
LOOP INX H
CMP M
JNC AHEAD
MOV A,M
AHEAD DCR C
JNZ LOOP

STA 2450 H
HLT

WEXAMPLE

2500 -03

2501-98

2502-75

2503-99

/OUTPUT

2450-99
10 1ind Smallest No.:

LXI H, 2500 H
MOV C, M
MVI A, FF

LOOP INX H

CMP M

JC AHEAD

MOV A,M

DCR C
AHEAD

JNZ LOOP

STA 2450 H

HLT

/EXAMPLE

2500 -03

2501-98

2502-75
2503-99

HANSWER

2450-7
Program No. 10
Am: Write a
program to find the ascending/ descending order. in a given series.

Program
To find Ascending order:

LDA 4500

MOV B,A

DCR B

LOOP3 LXI H, 4500

MOV C,M

DCR C

INX H

LOOP2 MOV A,M


INX H

CMP M

JC

MOV D,M

MOV M,A

DCX H

MOV M,D

NX H

LOOPI DCR C

JNZ Loopl
DCR B
JNZLoop 2
HLT

Input
Input
Address Value
4500
4501 04
4502 AB
4503 BC
4504 01
OA

Output Address &


Value:
Output Value
Address
4500
4501 04
01
4502
4503 OA
4504 AB
BC
To find
Descending Order:

LDA 4500

MOV B.A

DCR B

LOOP3 LXI H, 4500

MOV C,M

DCR C

INX H

LOOP2 MOV A,M

INX H

CMP M

ICE, Loop 1

MOV D,M

MOV M,A

DCX H

MOV M,D

INX H

LOOPI DCR C

JNZ Loop 2

DCR B

JNZ Loop3
HLT
Input:

Input Value
Address
4500 04
4501 AB
4502 BC
4503 01
4504 OA

Value:
Output Address &

Value
Output
Address
4500 04
4501 BC
4502 AB
4503 OA
4504 01
Program No. 11

Aim: Write a program to generate the Fibonacci series.

Program:

MVI C.09 / Counter

LXI H.Co50 // Memory Pointer

X MOV A,M

INX H

MOV B,M

INX H

ADD B

DAA

MOV M,A

DCX H

DCR C

JNZ X

HLT

/To run the Program simply load at memory location CO50=01,CO51=01


Program No. 12

source to
in order from
r i t e a program to transfer block of N-bytes reverse

destination
MVIC, 05 H

LXI H, 3000H

LXI D, 3504H

MOV A,M

STAXD

INXH

DCX D

DCR C

JNZ 2008 H

HLT

/Output:
After Execution:
Before Execution:

3500H: 02H
3000H: 05H

3501H: 03H
3001H: 02H

3002H: 04H 3502H: 04H

3003H: 03H 3503H: 02H

3004H: 02H 3504H: 05H


Program No. 13
etc )
NOR, XOR
operation ( AND, OR, NOT,
a program to perform logical
Alm
on a
:8 Write
bit number.

a)ORoperation:

MVIA, 24H
ORI 10 H

HLT

b)AND operation:
MVI A, 24 H

ANI 10 H

HLT

c)XORoperation:
MVIA, 24 H

XRI 10 H

HLT

/OUTPUT

OR operation = 34 H

AND operation = 00H

XOR operation = 34 H
Program No. 14

AIM: To prepare an assembly language progranm for 8085 to count the number of zerOS,
even and odd numbers in an array

Program:
MVI C.00
MVI D,00
MVI E.O0
LXI H,4200
MOV B,M
INXH
LXI H,4200
MOV B,M
LABEL4:INX H
MOV A,M
CPI 00
JNZ LABELI
INR C
JNZ LABEL2
LABEL1:RRC
JNZ LABEL3
INR D
JMP LABEL2
LABEL3:INR E
LABEL2:DCR B
JNZ LABEL4
INX H
MOV A,C
MOV M,A
INX H
MOV A,DD
MOV M,A
INX H
MOV A,E
MOV M,A
HLT
SAMPLE OUTPUT
Tdhüen.aiaa Saiosat

ADDRESS DATA
4200 09
INPUT/OUTPUT|
nput
4201
00 Input
4202 06 Input
4203 02
** ******** Input
4204
************************ ****************** Input
4205 0A Input
***************** *
* *** ****
************

4206 OD *** *********"


Input
4207
-
00 Lnput
4208 OF nput

4209 10 Input
420A 02 Output
04 Output
420B dasiidaiidaidi

420C 03 Output
Program No. 15
Aim: Write a
program to find square fronm
LOOP-UP Table.
LDA COs0
ADI 60
MOV L,A
MVI H,CO
MOV A,M
STA CO51
HLT

I First create
the look up
table->C060=00,C061=01 ,, C069-81

/ EXAMPLE-> CO50=09

/Output-> C051=81

You might also like