8085 program to convert 8 bit BCD number into ASCII Code

Problem â€“ Write an assembly-level language program to convert 8-bit BCD number to its respective ASCII Code.Â

Assumptions –Â
Input memory location: 2050Â
Output memory location: 3050 and 3051Â

ASCII Code for Digits 0 â€“ 9Â

Example –Â

Algorithm –Â Â

1. Input the content of 2050 in accumulatorÂ
Â
2. Move content of Accumulator to register BÂ
Â
3. Separate the least significant digit using AND with 0F and ADD 30 to accumulatorÂ
Â
4. Store content of accumulator to memory location 3050Â
Â
5. Move content of register B to AccumulatorÂ
Â
6. Separate the most significant digit using AND with F0Â
Â
7. Rotate Content of Accumulator 4 timesÂ
Â
Â
9. Store content of accumulator to memory location 3051Â
Â

Program –Â

2000LDA 2050A <- [2050]
2003MOV B, AB <- A
2004ANI 0FA <- A & 0F
2006ADI 30A <- A + 30
2008STA 3050[3050]<-A
200BMOV A, BA <- B
200CANI F0A <- A & F0
200ERLCRotate A left
200FRLCRotate A left
2010RLCRotate A left
2011RLCRotate A left
2012ADI 30A <- A + 30
2014STA 3051[3051]<-A
2017HLTStop Execution

Explanation –Â

1. LDA 2050 load the content of memory location 2050 to accumulatorÂ
Â
2. MOV B, A copy the content of accumulator to register BÂ
Â
3. ANI 0F AND the content of accumulator with immediate data 0FÂ
Â
Â
5. STA 3050 store the content of accumulator to memory location 3050Â
Â
6. MOV A, B copy the content of register B to accumulatorÂ
Â
7. ANI F0 AND the content of accumulator with immediate data F0Â
Â
8. RLC rotate the content of accumulator left without carryÂ
Â
9. RLC rotate the content of accumulator left without carryÂ
Â
10. RLC rotate the content of accumulator left without carryÂ
Â
11. RLC rotate the content of accumulator left without carryÂ
Â
Â
13. STA 3051 store the content of accumulator to memory location 3051Â
Â
14. HLT stops the execution of programÂ Â

Simple: The program is relatively short and easy to understand. It doesn’t require any complex operations or calculations, making it easy to implement.

Efficient: The program uses only a few instructions, so it executes quickly and doesn’t require much memory.

Useful: The program can be used in a variety of applications where BCD to ASCII conversion is required, such as in digital displays or in communication with other devices.