8085 Program to convert decimal to binary

8085 is a Microprocessor which was developed by Intel in 1970s. All the instructions in this microprocessor are encoded in a single byte. Some of the instructions are followed by one or two bytes of data, which can be a memory address, an immediate operand or a port number.

In this post, we will write a program in 8085 to convert decimal to binary number.

Algorithm

Start
Read the 8-bit number
Get upper 4-bits and store it as D
Get lower 4-bits and store it as C
D <- D x 10
A <- D + C
Store A
Stop

Flow Chart

Program

      LDA 2100H
      MOV B, A
      ANI 0FH
      MOV C, A
      MOV A, B
      ANI F0H
      JZ SKIP
      RRC
      RRC
      RRC
      RRC
      MOV D, A
      XRA A
      MVI E, 0AH
SUM:  ADD D
      DCR E
      JNZ SUM
SKIP: ADD C
      STA 2101H
      RST-5

Example

2100H: 72
2101H: 48  ->  output

Let us know in the comments if you are having any questions regarding this microprocessor program.

And if you found this post helpful, then please help us by sharing this post with your friends. Thank You

Default image
Jazib
Android Developer | Competitive Programmer

Leave a Reply