0% found this document useful (0 votes)
13 views65 pages

Microprocessor File

The document describes a program that stores an 8-bit value (48 decimal) in the A register and then copies that value to all other registers (B, C, D, E, H, L). The program is executed on an 8085 microprocessor kit and simulator. After execution, all registers contain the value 48 decimal as expected.

Uploaded by

bybirthpro
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
0% found this document useful (0 votes)
13 views65 pages

Microprocessor File

The document describes a program that stores an 8-bit value (48 decimal) in the A register and then copies that value to all other registers (B, C, D, E, H, L). The program is executed on an 8085 microprocessor kit and simulator. After execution, all registers contain the value 48 decimal as expected.

Uploaded by

bybirthpro
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 65

Microprocessor Based Systems Design (UCS617)

Lab Assignment-1 (8085)

Submitted to:

Dr. Manju Khurana

Submitted by:
Nishchey khajuria 102283032
Yuvraj Bhalla 102153015
Divyajot Kaur Sodhi 102103293
Yashika 102283033
Komal 102283043

BE Third Year, COE Group No: 3COE10

Computer Science and Engineering Department

TIET, Patiala
INDEX
Sr. Experiment Name Page
No. No.

1. Introduction of 8085-microprocessor kit and steps for execution on the kit. 4

2.1 Write a program to store 8-bit data into one register and then copy that to all 8
registers.

11
2.2 Write a program for addition of 2 bit numbers.

Write a program to add two 8-bit numbers using direct and indirect 13
2.3
addressing.

Write a program to add 16-bit number using direct and indirect addressing 17
2.4
mode.

2.5 24
Write a program to add 8-bit numbers using carry(using JNC instruction).

Write a program to find 1’s complement and 2’s complement of a 8-bit 27


2.6
number.

3 30
Write a program for the sum of series of numbers.

4 Write a program for data transfer from memory block B1 to memory block B2 34

5 Write a program to multiply two 8-bit numbers. 39

6 Write a program to add ten 8-bit numbers. Assume the numbers are stored in 41
8500-8509. Store the result in 850A and 850B memory address

7 Write a program to find the negative numbers in a block of data 45

8 Write a program to count the number of one's in a number. 48

2
9 Write a program to arrange numbers in ascending order. 51

10 Write a program to calculate the sum of a series of even 54


numbers.
11 Write an assembly language program to verify how many 57
bytes are present in a given set, which resembles 10101101 in
8085
12 Write an assembly language program to find the numbers of 61
even parity in ten consecutive memory locations in 8085
13 Write an assembly language program to convert a BCD 63
number into its equivalent binary in 8085.
14 Write an ALP for exchange the contents of memory location. 65

15 Write a program to find the largest number in an array of 10 67


elements.

3
Experiment No.1
Aim: Introduction of 8085-microprocessor kit and steps for execution on the kit.

Fig. 1.1: Intel 8085 Microprocessor

Microprocessor
Microprocessor is a hardware component of a computer , and it works as the
brain of the computer system.It is a small chip that is made of silicon and performs
all functions of the central processing unit.

Features of Microprocessor- 8085


● 8085 is developed by INTEL.
● 8 bit microprocessor: can accept 8 bit data simultaneously.
● Operates on single +5V D.C. supply.
● Designed using NMOS technology.
● 6200 transistor on a single chip.
● It provides an on-chip clock generator, hence it does not require an external clock
generator.
● Operates on 3MHz clock frequency.
● 8 bit multiplexed address/data bus, which reduces the number of pins.
● 16 address lines, hence it can address 2^16 = 64 K bytes of memory
● It generates 8 bit I/O addresses, hence it can access 2^8 = 256 I/O ports. ● 5 hardware
interrupts i.e. TRAP/RST4.5, RST 7.5, RST 6.5, RST 5.5, and INTR ● It provides DMA
(Direct memory access).

4
● 40-pin I.C. package fabricated on a single LSI chip.
● Clock cycle is 320ns.
● 80 basic instructions and 246 opcodes.

Intel 8085
1. Registers Array :
(a) General purpose register (8 bit) :
● can be used singly or in pairs (16b-bit): {B,C,D,E,H,L} , {BC,DE,HL}
● Used to store the intermediate data and result
● H & L: used as a data pointer (holds memory address)
(b) Special Purpose Register Accumulator (A) (8 bit):
● All the ALU operations are performed with reference to the contents of
Accumulator.
● Result of an operation is stored in A.
Instruction Register:
● When an instruction is fetched from memory, it is loaded in IR. Then
transferred to the decoder for decoding.
(c) Flag Register (F) (8 bit) :
● Indicates the status of the ALU operation.
● ALU includes 5 flip flops, which are set or reset after an operation
according to data conditions of the result in the accumulator.
(d) Temporary Register [ W, Z, Temporary data register] : Internally used by the
MP
W and Z register (8 bit): Used to hold temporary addresses during the
execution of some instructions

Temporary data register (8 bit) : Used to hold temporary data during ALU
operations.

(e) Pointer Register or special purpose [SP, PC]


Stack Pointer (SP) (16 bit) : holds the address of the data present at the top
of the stack memory

Program Counter (PC) (16 bit) ●


used for the execution of program
● Contain the address of the next instruction to be executed after fetching the
instruction and is automatically incremented by 1.

5
(2) ALU & Logical Group: it consists of ALU, Accumulator, Temporary register and
Flag Register
ALU
● Performs arithmetic and logical operations
● Stores result of arithmetic and logical operations in accumulator
Accumulator ( 8 bit data)
● General purpose register
● Stores one of the operand before any arithmetic and logical operations and
result of operation is again stored back in Accumulator
Temporary Register (8 bit)
● During the arithmetic and logical operations one operand is available in A
and other operand is always transferred to temporary register
Flag Register
● Five flags are connected to ALU
● After the ALU operation is performed the status of result will be stored in
five flags.
(3) Interrupt Control group
Interrupt:- Occurrence of an external disturbance
● After servicing the interrupt, 8085 resumes its normal working sequence
● Transfer the control to special routines

(4) Serial I/O control Group


● Data transfer D 0 - D 7 lines is parallel data
● But under some conditions it is used serial data transfer
● Serial data is entered through SID (serial input data) input (received)
● Serial data is outputted on SOD (serial output data) input (send)

6
Fig. 1.2 Vikas Simulator
Functional Keys in Vikas 8085 simulator

● Reset: Used to reset the value of register


● Go : gives starting address of program
● Execute : tells till where to execute the program
● Exam Mem : examine contents of memory
● Exam Reg : examine contents of register

Steps to perform on the Intel kit as well as on Simulator

● Press Reset
● Press Examine Memory
● Enter starting address
● Press Next
● Enter opcodes by subsequently pressing Next
● Press Reset
● Press Go
● Enter starting address of the program to compile
● Press EXEC/FILL
● Press Reset
● Press Examine Memory
● Enter Output Address
● Press Next

7
Program No: 2.1
Aim: Write a program to store 8-bit data into one register and then copy that to all registers .

CODE MEMORY OPCODE


LOCATION

MVI A,48 8000,8001 3E,48

MOV B,A 8002 47

MOV C,A 8003 4F

MOV D,A 8004 57

MOV E,A 8005 5F

MOV H,A 8006 67

MOV L,A 8007 6F

RST 5 8008 EF
Table 2.1 Program to store 8-bit data into one register and then copy that to all registers

Output: A – 48, B – 48, C – 48, D – 48, E – 48, H – 48, L – 48

8
Fig 2.1.2 A-48 Fig 2.1.3 B-48

Fig 2.1.4 C-48 Fig 2.1.5 D-48

Fig 2.1.6 H-48 Fig 2.1.7 L-48

9
Fig 2.1.8 E-48

Flag Register:

Fig. 2.1.9 Flag Register

10
Program no: 2.2
Aim: Write a program for addition of two 8 bit numbers.

CODE MEMORY LOCATION OPCODE

MVI A,48 8000,8001 3E,48

MVI B,48 8002,8003 06,48

ADD B 8004 80

STA 8500 8005,8006,8007 32,00,85

RST 5 8008 EF
Table 2.2 Program for addition of two 8 bit numbers.

11
Output: [8500 ] – 90

Fig. 2.2.2 [A-90]

12
Program no: 2.3
Aim: Write a program to add two 8-bit numbers using direct and indirect addressing mode.

a) Direct Addressing mode:

CODE MEMORY LOCATION OPCODE

LDA 8500 8000,8001,8002 3A,00,85

MOV B,A 8003 47

LDA 8501 8004,8005,8006 3A,01,85

ADD B 8007 80

STA 8502 8008,8009,8010 32,02,85

RST 5 8011 EF

Table 2.3 Program to add 8-bit numbers using direct addressing mode

Code:

Fig. 2.3.1 Code to add 8-bit numbers using direct addressing mode

13
Input : [ 8500 ] – 88, [ 8501 ] – 88

Fig 2.3.2 [8500]-88 Fig 2.3.3 [8501]-88

Output: [ 8502 ] – 10

Fig. 2.3.4 [ 8502 ] – 10

b) Indirect Addressing mode:

14
Instruction Location
Opcode

LXI H, 8500 8000, 8001, 8002 21,00,85

MOV A, M 8003 7E

INX H 8004 23

ADD M 8005 86

INX H 8006 23

MOV M, A 8007 77

RST 5 8008 EF
Table 2.3.5 Program to add 8-bit numbers using indirect addressing mode

Code :

Fig. 2.3.6 Code to add 8-bit numbers using indirect addressing mode
Input : [ 8500 ] – 88, [ 8501 ] – 88

15
Fig 2.3.7 [8500]-88 Fig 2.3.8 [8501]-88

Output: A – 10

Fig 2.3.9 A-10

16
Program no: 2.4
Aim: Write a program to add 16-bit numbers using direct and indirect addressing.

a) Direct Addressing:

Instruction Memory Location Opcode

LHLD 8500 8000,8001,8002 2A,00,85

XCHG 8003 EB

LHLD 8502 8004,8005,8006 2A,02,85

DAD D 8007 19

SHLD 8504 8008,8009,800A 2A,04,85

RST 5 800B EF
Table 2.4 Program to add 16-bit numbers using direct addressing mode

Code:

Fig. 2.4.1 Code to add 16-bit numbers using direct addressing mode

17
Input: [8500]- 48, [8501]- 48, [8502]- 48, [8503]-48

Fig 2.4.2 [8500]-48 Fig 2.4.3 [8501]-48

Fig 2.4.2 [8502]-48 Fig 2.4.3 [8503]-48

Output: [8504]- 90, [8506]- 90

Fig. 2.4.6 [ 8504 ] – 90 Fig. 2.4.7 [ 8505 ] – 90

18
b) Indirect Addressing:

Instruction Memory Location Opcode

LXI B, 8500 8000,8001,8002 01,00,85

LDAX B 8003 0A

MOV D, A 8004 57

INX B 8005 03

LDAX B 8006 0A

ADD D 8007 82

STA 8504 8008,8009,800A 32,04,85

INX B 800B 03

LDAX B 800C 0A

MOV D,A 800D 57

INX B 800E 03

LDAX B 800F 0A

ADC D 8010 8A

STA 8505 8011,8012,8013 32,05,85

RST 5 8014 EF
Table 2.4.8 Program to add 16-bit numbers using indirect addressing mode

19
Input: [8500]- 34, [8501]- 48, [8502]- 54, [8503]- 78

Fig 2.4.10 [8500]-34 Fig 2.4.11 [8501]-48

Fig 2.4.12 [8502]-54 Fig 2.4.13 [8503]-78


Output: [8504]- 7C, [8505]- CC

Fig. 2.4.14 [ 8504 ] – 7C Fig. 2.4.15 [ 8505 ] – CC

20
Program no: 2.5
Title: Write a program to add 8-bit numbers using carry.(using JNC function)

Instruction Memory Location Opcode

MVI C,00 8000,8001 0E,00

LXI H,8500 8002,8003,8004 21,00,85

MOV A,M 8005 7E

INX H 8006 23

ADD M 8007 86

JNC Next 8008,8009,800A D2,0C,80

INR C 800B 0C

Next: INX H 800C 23

MOV M,A 800D 77

INX H 800E 23

MOV M,C 800F 71

RST 5 8010 EF
Table 2.5 Program to add 8-bit numbers using carry(JNC function)

21
Input: [8500]- 88, [8501]- 88

Fig 2.5.2 [8500]-88 Fig 2.5.3 [8501]-88

Output: [8502]- 10, [8503]- 01

Fig. 2.5.4 [ 8502 ] – 01

22
Fig. 2.5.5 [ 8503 ] – 01

23
Program no: 2.6
Aim: Write a program to find the 1’s complement and 2’s complement of a 8-bit number.

a) 1’s complement

Instruction Memory Location Opcode

LDA 8500H 8000,8001,8002 3A,00,85

CMA 8003 2F

STA 8501H 8004,8005,8006 32,01,85

RST 5 8007 EF

Table 2.6.1 Program to calculate the 1’s complement of an 8-bit number

Input: [8500]- 48

Fig. 2.6.4 [ 8500 ] – 48

24
Output: [8501]- B7

Fig. 2.6.4 [ 8501 ] – B7

b) 2’s complement:

Instruction Memory Location Opcode

LDA 8500H 8000,8001,8002 3A,00,85

CMA 8003 2F

INR A 8004 3C

STA 8501H 8005,8006,8007 32,01,85

RST 5 8008 EF

Table 2.6.5 Program to calculate the 2’s complement of an 8-bit number

25
Input: [8500]- 48

Fig. 2.6.7 [ 8500 ] – 48


Output: [8501]- B8

Fig. 2.6.8 [ 8501 ] – B8

26
Program No.: 3
Aim : Write a program for the sum of series of numbers.
a) 1’s Complement

Code Memory Location Opcode

LDA 8500H
8000, 8001, 8002 3A, 00, 85

MOV C, A
8003 4F

SUB A
8004 97

LXI H, 8501H
8005, 8006, 8007 21, 01, 85

Back: ADD M
8008 86

INX H
8009 23

DCR C
800A 0D

JNZ Back
800B, 800C, 800D C2, 08, 80

STA 8600H
800E 32, 00, 86

RST 5
800F EF
Table 3.1 Program to find the negative numbers in a block of data

27
Input - [8500] – 04, [8501] – 9A, [8502] – 52, [8503] – 89, [8504] – 3E

Fig 3.3 [8500]-04 Fig 3.4 [8501]-9A

Fig 3.5 [8502]-52 Fig 3.6 [8503]-89

Fig 3.7 [8504]-3E

28
Output - [8600] – B3

Fig.3.8 [8600]-B3

29
Program No. 4:
Aim : Write a program for data transfer from memory block B1 to memory block B2.

Code Memory Location Opcode

MVI C, 0AH 8000,8001 0E,0A

LXI H, 8500H 8002,8003,8004 21,00,85

LXI D, 8600H 8005,8006,8007 11,00,86

Back: MOV A, M 8008 7E

STAX D 8009 12

INX H 800A 23

INX D 800B 13

DCR C 800C 0D

JNZ Back 800D,800E,800F C2,08,80

RST 5 8010 EF
Fig-4.1: Program for data transfer from memory block B1 to memory block B2

30
Input - [8500] – 01, [8501] – 02, [8502] – 03,……… [8509] – 0A

Fig 4.3 [8500]-01 Fig 4.4 [8501]-02

Fig 4.5 [8502]-03 Fig 4.6 [8503]-04

Fig 4.7 [8504]-05 Fig 4.8 [8505]-06

31
Fig 4.9 [8506]-07 Fig 4.10 [8507]-08

Fig 4.11 [8508]-09 Fig 4.12 [8509]-0A

32
Output - [8600] – 01, [8601] – 02, [8602] – 03,……… [8609] – 0A

Fig 4.13 [8600]-01 Fig 4.14 [8601]-02

Fig 4.15 [8602]-03 Fig 4.16 [8603]-04

Fig 4.17 [8604]-05 Fig 4.18 [8605]-06

33
Fig 4.19 [8606]-07 Fig 4.20 [8607]-08

Fig 4.21 [8608]-09 Fig 4.22 [8609]-0A

34
Program No. 5:
Aim : Write a program to multiply two 8-bit numbers.

Code Memory Location Opcode

LDA 8500H 8000,8001,8002 3A,00,85

MOV E, A 8003 5F

MVI D, 00 8004,8005 16,00

LDA 8501H 8006,8007,8008 3A,01,85

MOV C, A 8009 4F

LXI H, 0000H 800A,800B,800C 21,00,00

Back: DAD D 800D 19

DCR C 800E 0D

JNZ Back 800F,8010,8011 C2,0D,80

SHLD 8600H 8012,8013,8014 22,00,80

RST 5 8015 EF

Fig-5.1:program for multiply two 8-bit numbers.

35
Input - [8500] – B2, [8501] – 03

Fig 5.3 [8500]-B2 Fig 5.4 [8501]-03

Result – B2 + B2 + B2 = 0216 H

Output - [8600] – 16, [8601] – 02

Fig 5.5 [8600]-16 Fig 5.6 [8601]-02

Result – B2 + B2 + B2 = 0216 H

36
Program No. 6:
Aim : Write a program to add ten 8-bit numbers. Assume the numbers are stored in 8500-8509.
Store the result in 850A and 850B memory address.

Code Memory Location Opcode

MVI C, 00 8000,8001 0E,00

MVI B, 09 8002,8003 06,09

LXI H, 8500H 8004,8005,8006 21,00,85

MOV A, M 8007 7C

Back: INX H 8008 23

ADD M 8009 86

JNC Next 800A,800B,800C D2,0E,80

INR C 800D 0C

Next: DCR B 800E 05

JNZ Back 800F,8010,8011 C2,08,80

INX H 8012 23

MOV M, A 8013 77

INX H 8014 23

MOV M, C 8015 71

RST 5 8016 EF

Fig-6.1: Program to add ten 8-bit numbers. .


Input - [8500] – FF, [8501] – 01, [8502] – 01, [8503] – 01, [8504] – 01, [8505] – 01, [8506] –
01, [8507] – 01, [8508] – 01, [8509] – 01

37
Fig 6.3 [8500]-16 Fig 6.4 [8501]-02

Fig 6.5 [8502]-01 Fig 6.6 [8503]-01

Fig 6.3 [8504]-01 Fig 6.4 [8505]-01

38
Fig 6.5 [8506]-01 Fig 6.6 [8507]-01

Fig 6.7 [8508]-01 Fig 6.8 [8509]-01

Output - [850A] – 08, [850B] – 01

Fig 6.9 [850A]-08 Fig 6.4 [850B]-01

39
Program No. 7:
Aim : Write a program to find the negative numbers in a block of data.

Code Memory Location Opcode

LDA 8500H 8000,8001,8002 3A,00,85

MOV C, A 8003 4F

MVI B, 00 8004,8005 06,00

LXI H, 8501H 8006,8007,8008 21,01,85

Back: MOV A, M 8009 7E

ANI 80H 800A,800B E6,80

JZ Skip 800C,800D,800E CA,10,80

INR B 800F 04

Skip: INX H 8010 23

DCR C 8011 0D

JNZ Back 8012,8013,8014 C2,09,80

MOV A, B 8015 78

STA 8600H 8016,8017,8018 32,00,86

RST 5 8019 EF

Fig-7.1: Program to find the negative numbers in a block of data .

40
Input - [8500] – 04, [8501] – 56, [8502] – A9, [8503] – 73, [8504] – 82

Fig 7.3 [8500]-04 Fig 7.4 [8501]-56

Fig 7.5 [8502]-A9 Fig 7.6 [8503]73

Fig 7.7 [8504]-82

41
Output - [8600] – 02

Fig 7.88 [8600]-02

42
Program No. 8
Aim : Write a program to count the number of one's in a number.

Code Memory Location Opcode


LDA 8500H 8000,8001,8002 3A,00,85

MVI B,08 8003,8004 06,08

MVI D,00 8005,8006 16,00

Loop1: RLC 8007 07

JNC Loop2 8008,8009,800A D2,0C,80

INR D 800B 14

Loop2: DCR B 800C 05

JNZ Loop1 800D,800E,800F C2,07,80

MOV A,D 8010 7A

STA 8600H 8011,8012,8013 32,00,86

RST 5 8014 EF
Fig.8.1: Program to count the number of one's in a number.
Input: [8500] – 25

43
Fig 8.3 [8500]-25
Output - [8600] – 03

Fig 8.4 [8600]-03

44
Program No. 9
Aim: Write a program to arrange numbers in ascending order.
CODE MEMORY LOCATION OPCODE
LXI H, 8500H 8000,8001,8002 21,00,85
MOV C, M 8003 4E
DCR C 8004 0D
Repeat: MOV D, C 8005 51
LXI H, 8501H 8006,8007,8008 21,01,85
Loop: MOV A, M 8009 7E
INX H 800A 23
CMP M 800B BE
JC Skip 800C,800D,800E DA,14,80
MOV B, M 800F 46
MOV M , A 8010 77
DCX H 8011 2B
MOV M, B 8012 70
INX H 8013 23
Skip: DCR D 8014 15
JNZ Loop 8015,8016,8017 C2,09,80
DCR C 8018 0D
JNZ Repeat 8019,801A,801B C2,05,80
RST5 801C EF
Fig.9.1: Program to arrange numbers in ascending order.

45
Input: [8500] – 05, [8501] – 05, [8502] – 04, [8503] – 03, [8504] – 02, [8505] – 01

Fig 9.1 [8500]-05


Output: [8501] – 01, [8502] – 02, [8503] – 03, [8504] – 04, [8505] – 05

Fig 9.2 [8501]-01 Fig 9.3 [8502]-02

Fig 9.4 [8503]-03 Fig 9.5 [8504]-04

46
Fig 9.6 [8505]-05

47
Program No. 10
Aim: Write a program to calculate the sum of a series of even numbers.

Code Memory Location Opcode

LDA 8500H 8000,8001,8002 3A,00,85

MOV C, A 8003 4F

MVI B, 00 8004,8005 06,00

LXI H, 8501H 8006,8007,8008 21,01,85

Back: MOV A, M 8009 7E

ANI 01 800A,800B E6,01

JNZ Skip 800C,800D,800E C2,12,80

MOV A, B 800F 78

ADD M 8010 86

MOV B, A 8011 47

Skip: INX H 8012 23

DCR C 8013 0D

JNZ Back 8014,8015,8016 C2,09,80

STA 8600H 8017,8018,8019 32,00,86

RST 5 801A EF
Fig.10.1: Program to calculate the sum of a series of even numbers.

48
Input: [ 8500] – 04, [8501] – 20, [8502] – 15 , [8503] – 13, [8504] – 22

Fig 10.1 [8500]-04 Fig 10.2 [8501]-20

Fig 10.3 [8502]-15 Fig 10.4 [8503]-13

Fig 10.5 [8504]-22

49
Output : [8600] – 42

` Fig 10.6 [8600]-42

50
Program no. 11
Aim : Write an assembly language program to verify how many bytes are present in a given
set, which resembles 10101101 in 8085

Code Memory Location Opcode


MVI B ,0A 8000,8001 06,0A
MVI D, AD 8002,8003 16,AD
MVI C,00 8004,8005 OE,00
LXI H 8500H 8006,8007,8008 21,00,85
Back: MOV A,M 8009 7E
CMP D 800A BA
JNZ Next 800B,800C,800D C2,0F,80
INRC 800E 0C
Next:INX H 800F 23
DCR B 8010 05
JNZ Back 8011,8012,8013 C2,09,80
MOV A,C 8014 79
STA 8600H 8015,8016,8017 32,00,86
RST 5 8018 EF
Fig.11.1: Program to write an assembly language program to verify how many bytes are
present in a given set, which resembles 10101101 in 8085

51
Input - [8500] – AD, [8501] – 01, [8502] – 01, [8503] – 01, [8504] – 01, [8505] – 01,
[8506]–01, [8507] – 01, [8508] – 01, [8509] – 01

Fig 11.1 [8500]-AD Fig 11.2 [8501]-01

Fig 11.3 [8502]-01 Fig 11.4 [8503]-01

Fig 11.5 [8504]-01 Fig 11.6 [8505]-01

52
Fig 11.7 [8506]-01 Fig 11.8 [8507]-01

Fig 11.8 [8508]-01 Fig 11.9 [8509]-01


Output - [8600] – 01

Fig 11.10 [8600]-01

53
Program no. 12
Aim: Write an assembly language program to find the numbers of even parity in ten
consecutive memory locations in 8085

Code Memory Location Opcode


MVI B,0A 8000,8001 06,0A
MVI C,00 8002,8003 0E,00
LXI H 8500H 8004,8005,8006 21,00,85
Back;MOVA,M 8007 7E
ANI FF 8008,8009 E6 ,FF
JPO Next 800A,800B,800C E2,0E,80
INR C 800D 0C
Next: INX H 800E 23
DCR B 800F 05
JNZ Back 8010,8011,8012 C2,07,80
MOV A,C 8013 79
STA 8600H 8014,8015,8016 32,00,86
RST 5 8017 EF
Fig.12.1: Assembly language program to find the numbers of even parity in ten consecutive
memory locations in 8085

54
Input - [8500] – 01, [8501] – 03, [8502] – 01, [8503] – 03, [8504] – 01, [8505] – 03, [8506]

01,[8507] – 03, [8508] – 01, [8509] – 03

55
56
Output - [8600] – 05

57
Program No. 13
Aim :
Write an assembly language program to convert a BCD number into its equivalent binary in
8085.

Code Memory Location Opcode

LDA 8500H 8000,8001,8002 3A,00,85

MOV B, A 8003 47

ANI 0F 8004,8005 E6.0F

MOV C, A 8006 4F

MOV A, B 8007 78

ANI F0 8008 E6,F0

RRC 8009 0F

RRC 800A 0F

RRC 800B 0F

RRC 800C 0F

MOV B, A 800D 47

XRA A 800E AF

MVI D, 0A 800F,8010 16,0A

Sum: ADD D 8011 82

DCR B 8012 05

JNZ Sum 8013,8014,8015 C2,12,80

ADD C 8016 81

STA 8600H 8017,8018 32,00,86

RST 5 8019 EF
Table 13.1 Program for addition of two 8 bit numbers

Input - [8500] – 67

58
Fig. 13.3 [ 8500 ] – 67

Output - [8600] – 43

Fig. 13.4 [ 8600 ] – 43

59
Program No. 14
Write an ALP for exchange the contents of memory location.

Code Memory Location Opcode


LDA 8500H 8000,8001,8002 3A,00,85

MOV B, A 8003 47

LDA 8600H 8004,8005,8006 3A,00,86

STA 8500H 8007,8008,8009 32,00,85

MOV A, B 800A 78

STA 8600H 800B,800C,800D 32,00,86

RST 5 800D EF
Table 14.1 ALP program for exchange the contents of memory location

Input : [8500] – 48, [8600] – 88

Fig. 14.2 [ 8500 ] – 48 Fig. 14.3[ 8600 ] – 88

60
Output: [8500] – 88, [8600] – 48

Fig. 14.4 [ 8500 ] – 88 Fig. 14.5[ 8600 ] – 48

61
Program No. 15
Write a program to find the largest number in an array of 10 elements.

Code Memory Location Opcode


MVI B, 09 8000,8001 06,09

LXI H, 8500H 8002,8003,8004 21,00,85

MOV A, M 8005 7E

INX H 8006 23

Back: CMP M 8007 BE

JNC Next 8008,8009,800A D2,0C,80

MOV A, M 800B 7E

Next: INX H 800C 23

DCR B 800D 05

JNZ Back 800E,800F,8010 C2,07,80

STA 850AH 8011,8012,8013 32,0A,85

RST 5 8014 EF
Fig.15.1 Program to find the largest number in an array of 10 elements.

62
Input - [8500] – 01, [8501] – 02, [8502] – 03, [8503] – 04, [8504] – 05,[8505] – 06, [8506]

07,[8507] – 08, [8508] – 09 ,[8509] – 0A

Fig. 15.1 [ 8500 ] – 01 Fig. 15.2[ 8501 ] – 02

Fig. 15.3 [ 8502 ] – 03 Fig. 15.2[ 8503 ] – 04

63
64
Fig. 15.7 [ 8508 ] – 09 Fig. 15.2[ 8509 ] – 0A

Output - [850A] – 0A

Fig 15.3 [850A]-0A

65

You might also like