You are on page 1of 6

8085 MICROPROCESSOR PROGRAMMING

Rev. 1.0

This work is licensed under the Creative Commons Attribution-NonCommercial-Share Alike 2.5 India
License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/2.5/in/deed.en or
send a letter to Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.

Page #1

8085 MICROPROCESSOR PROGRAMMING

Rev. 1.0

Hexadecimal to bcd code conversion


AIM
To write an assembly language program to convert the given
hexadecimal number in to BCD number

ASSEMBLY LANGUAGE PROGRAM


C100
C101
C102
C103
C104
C105
C106
C107

LXI H C200

C108
C109
C10A
C10B
C10C
C10D
C10E
C10F
C110
C111
C112
C113
C114
C115
C116
C117
C118
C119
C11A
C11B
C11C
C11D
C11E
C11F
C120

MOV A C
ANI F0

MOV A M
MOV C A
ANI 0F
MOV E A

RRC
RRC
RRC
RRC
MOV D A
JZ C11C
MVI A 00
ADI 16
DAA
DCR D
JNZ C115
ADD E
DAA
INX H
MOV M A
HLT

21
00
C2
7E
4F
E6
0F
5F

;
;
;
;
;
;
;
;

79
E6
F0
0F
0F
0F
0F
57
CA
1C
C1
3E
00
C6
16
27
15
C2
15
C1
83
27
23
77
76

;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;
;

Initialize the HL register pair


Move the memory content to accumulator
Move the accumulator content to C register
And the data byte OFH with the accumulator
content
Move the accumulator content in to E
register
Move the C register content to accumulator
And the data byte FOH with the accumulator
content
Rotate accumulator right through carry
Rotate accumulator right through carry
Rotate accumulator right through carry
Rotate accumulator right through carry
Move the accumulator content to D register
Jump if zero to C11CH
Move immediately 00H to accumulator
Add immediate data 16H to the accumulator
Decimal adjust accumulator
Decrement D register content
Jump if no zero to C115H
Add the E register content with accumulator
Decimal adjust accumulator
Increment the HL register pair
Move the accumulator content in to memory
Halt the execution

Page #2

8085 MICROPROCESSOR PROGRAMMING

Rev. 1.0

EXECUTION - 1
C200 1B ; Hexadecimal number(Input data)
C201 27 ; BCD number(Output data)

PROGRAM TRACE

FLAG WORD

Page #3

8085 MICROPROCESSOR PROGRAMMING

Rev. 1.0

EXECUTION - 2
C200 41 ; Hexadecimal number(Input data)
C201 65 ; BCD number(Output data)

PROGRAM TRACE

FLAG WORD

Page #4

8085 MICROPROCESSOR PROGRAMMING

Rev. 1.0

EXECUTION - 3
C200 A6 ; Hexadecimal number(Input data)
C201 66 ; BCD number(Output data)

PROGRAM TRACE

FLAG WORD

REFERENCE
1. Ramesh S.Gaonkar, Microprocessor Architecture, Programming,
and Applications, Fourth Edition, Penram International
Publishing (India), 2000.
2. S.Subathra,
Microprocessor
Adhiparashakthi Engineering
2001

Laboratory,
Record
College, Melmaruvathur,

work,
March

3. S.Subathra, Programming in 8085 Microprocessor and its


applications An Innovative Analysis, Technical Report,

Page #5

8085 MICROPROCESSOR PROGRAMMING

Adhiparashakthi
2003

Engineering

Rev. 1.0

College,

Melmaruvathur,

March

4. Micro-85 EB, User Manual, Version 3.0, CAT #M85 EB-002, VI


Microsystems Pvt. Ltd., Chennai.
5. icro85 simulation software, Infotech Solutions, Calcutta.

Page #6

You might also like