0% found this document useful (0 votes)
59 views

COA Lab 2

The document contains programs written for the 8085 and 8086 microprocessors. For the 8085, programs are provided to add, subtract, and perform other operations on 8-bit numbers using accumulators and memory pointers. For the 8086, programs are given to add, subtract, increment, decrement and swap values. Sample solutions are provided for each program assignment in assembly language along with comments.

Uploaded by

Y neeraja
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views

COA Lab 2

The document contains programs written for the 8085 and 8086 microprocessors. For the 8085, programs are provided to add, subtract, and perform other operations on 8-bit numbers using accumulators and memory pointers. For the 8086, programs are given to add, subtract, increment, decrement and swap values. Sample solutions are provided for each program assignment in assembly language along with comments.

Uploaded by

Y neeraja
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

MICROPROCESSOR PROGRAMS

8085
1) Write a Program along with flowchart for addition of two 8bit numbers using
Accumulator

Constrains: - S=0, Cy=0 store the result in 1000h memory location

S=0 Cy=1 store the result in 2000h memory location

S=1, Cy=0 store the result in 3000h memory location

S=1 Cy=1 store the result in 4000h memory location

2) Write a program along with flowchart for addition of two 8 bit numbers using memory
pointers

3) Write a program along with flowchart for subtractions of two 8 bit numbers using
memory pointers

4) Write a program to perform 1's complement of a number using Accumulator

5) Write a program to perform 2's complement of a number using memory pointers

6) Write a program to perform swapping operation by using Accumulator

7) Write a Program along with flowchart for swapping of two 8 bit numbers by using
memory pointers

8) Write a program to perform 16 bit addition by using without using DAD instructions

8086

1) Write a program for addition of two numbers

2) Write a program for subtraction of two numbers

3) Write a program to increment an instruction


4) Write a program to decrement an instruction

5) Write a program to swap two 8 bit numbers

2
8085

1-Solution

LDA 0100H

MOV B,A

LDA 0101H

ADD B

JP P1

JM P2

P1:

JC C1

STA 1000H

HLT

C1:

STA 2000H

HLT

P2:

JC C2

3
STA 3000H

HLT

C2:

STA 4000H

HLT

#ORG 0100H

#DB 09H

#ORG 0101H

#DB 0BH

2-Solution

LXI 2000

MOV A,M

INX H

ADD M

#ORG 2000

#DB 04,0F

4
3-Solution

LXI 2000

MOV A,M

INX H

SUB M

#ORG 2000

#DB 04,0F

4-Solution

LAD 1000

CMA

#ORG 1000

#DB FF

5-Solution

LXI H,2000

MOV A,M

CMA

5
INR A

STA 2001

HLT

# ORG 2000H

# DB 01H

6-Solution

LDA 2000

MOV B,A

LDA 2001

MOV C,A

MOV A,B

MOV B,C

STA 2002

HLT

# ORG 2000H

# DB 02H,08H

6
7-Solution

LXI H,2000

MOV A,M

LXI H,2001

MOV B,M

MOV C,A

MOV A,B

MOV B,C

STA 2002

HLT

# ORG 2000H

# DB 02H,08H

8-Solution

LHLD 2000H

XCHG

LHLD 2001H

MOV A,E

7
ADD L

MOV L,A

MOV A,D

ADD H

MOV H,A

HLT

# ORG 2000H

# DB 13,14,10,12

8086

1-Solution

ORG 100h

.MODEL SMALL

.CODE

MOV AL, 10H

MOV BH, 75H

ADD AL, BH

MOV CX, 0F21Ah

8
ADD [0154H], CX

MOV AH, 9FH

ADD AH,BH

RET

2-Solution

ORG 100h

MOV AX, 2506

MOV BX, 1647

SUB AX, BX

SUB [SI], AX

RET

3-Solution

ORG 100h

.MODEL SMALL

.CODE

MOV AL, 7DH

9
INC AL

RET

4-Solution

ORG 100h

.MODEL SMALL

.CODE

MOV AX, 25

DEC

RET

5-Solution

.MODEL SMALL

.STACK 100H

.DATA

NUM1 DB 05H

NUM2 DB 02H

.CODE

10
MOV AX , @DATA

MOV DS , AX

MOV BL , NUM1

MOV CL , NUM2

MOV NUM2 , BL

MOV NUM1 , CL

MOV AH , 4CH

INT 21H

END

11

You might also like