Sunday, 28 April 2013

8085 program to convert 8-bit binary to BCD

LXI H, 8D02
MOV A, M
MVI C, D
MVI B, 0

HUN:
SUI 64H
JC TENS
INRC
JMP HUN

TENS:
ADI 64H

LOOP:
SUI 0AH
JC UNITS
INR B
JMP LOOP

UNITS:
ADI 0AH

INX H
MOV M,C
INX H
MOV M,B
INX H
MOV M,A
HLT

Observation:

Memory
Content
Input
8D02H
8D
Output
8D21H
01
8D22H
04
8D23H
01

©Dixit Bhatta 2013

7 comments:

  1. MVI C, D
    MVI B, 0

    wrong code solve it first

    ReplyDelete
    Replies
    1. Hi Adhir,
      Can you explain a bit more? This runs perfectly in my 8085 simulator.

      Delete
  2. MVI C D
    MVI B 0
    i dont think they are correct !!!

    ReplyDelete

Was this post helpful? Ask any questions you have, I will try to answer them for you.

Follow by Email