8085 code to convert binary number to ASCII code Last Updated : 11 Jul, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report Problem - Assembly level program in 8085 which converts a binary number into ASCII number. Example - Assumptions - Binary number which have to convert in ASCII value is stored at memory location 2050 and output will be displayed at memory location 3050 and 3051. Algorithm - Load the content of 2050.Then separate the LSB of the no. using ANI 0F instruction and MSB of the number by again loading the content of 2050 and rotate it by one bit 4 times to get reverse of the number and then again use ANI 0F to separate the digit.If the digit is more than or equal to 0A (in hexadecimal) then add 37 otherwise add 30 to convert into ASCII value (For checking the number is greater than or equal to A then use instruction: CPI 0A and then check the carry flag, if it is 0 then it means digit is greater than or equal to A and if 1 digit is less than A).Now Store the ASCII values of both the digits in 3050 and 3051 respectively.Program - Main routine: ADDRESSMNEMONICSCOMMENTS2000LDA 2050A<-[2050]2003CALL 2500go to address 25002006STA 3050A->[3050]2009LDA 2050A<-[2050]200CRLCRotate the number by one bit to left without carry200DRLCRotate the number by one bit to left without carry200ERLCRotate the number by one bit to left without carry200FRLCRotate the number by one bit to left without carry2010CALL 2500go to address 25002013STA 3051A->[3051]2016HLTTerminates the programSub routine: ADDRESSMNEMONICSCOMMENTS2500ANI 0FA<-[A] AND 0F2502CPI 0A[A]-0A2504JNC 250AJump to [250A] if carryflag is 02507ADI 30A<-[A]+302509RETReturn to the next instruction from where subroutine address was called in main routine250AADI 37A<-[A]+37250CRETReturn to the next instruction from where subroutine address was called in main routineExplanation - Main routine: LDA 2050: This instruction will load the number from address 2050 to the accumulator.CALL 2500: This instruction will stop executing the main routine instructions after it and will move to the subroutine address 2500 for performing the subtask and after performing subroutine instructions it will come back to mainroutine and execute the instructions after CALL 2500.STA 3050: This instruction will store the result (performed in subroutine) of Accumulator to address 3050.LDA 2050: This instruction will again load the number from address 2050 to the accumulator as the earlier loaded number is changed in accumulator.RLC: Rotate the contents of Accumulator by one bit left side without carry.RLC: Rotate the contents of Accumulator by one bit left side without carry.RLC: Rotate the contents of Accumulator by one bit left side without carry.RLC: Rotate the contents of Accumulator by one bit left side without carry. (Applying RLC 4 times it will reverse the contents of the Accumulator) 9. CALL 2500: This instruction will stop executing the main routine instructions after it and will move to the subroutine address 2500 for performing the subtask and after performing subroutine instructions it will come back to mainroutine and execute the instructions after CALL 2500.10. STA 3051: This instruction will store the result (performed in subroutine) of Accumulator to address 3051.11. HLT: This instruction will terminate the program.Sub routine: ANI 0F: This instruction will separate the LSB of the number present in Accumulator and stores the result back in Accumulator.CPI 0A: This instruction will compare the content of Accumulator with 0A i.e. [A]-0A.JNC 205A: If the carryflag becomes 0 then it will jump to 205A otherwise move to the next instruction.ADI 30: It will add 30 to the content of Accumulator and again store the result back in Accumulator.RET: Now it will move back to the main routine after the next instruction of CALL and start executing instructions of main routine.It will add 37 to the content of Accumulator and again store the result back in Accumulator.RET: Now it will move back to the main routine after the next instruction of CALL and start executing instructions of main routine.Advantages of converting binary number to ASCII code:Converting a binary number to ASCII code is a common operation used in many applications, such as displaying binary data on a computer screen or printing binary data to a printer. It is a simple and straightforward task that can be easily implemented in any programming language. It is a fast operation that can be completed in O(n) time complexity, where n is the number of bits in the binary number. Disadvantages of converting binary number to ASCII code:If the binary number is very large, storing the entire number in memory may not be feasible, which could require a more complex solution such as processing the binary number in smaller parts. If the binary number is negative, additional logic is required to handle the sign bit and convert it to a negative ASCII code. If the ASCII code is being displayed on a computer screen or printed to a printer, the font used to display the characters may not be able to display all ASCII codes correctly, which could result in distorted or unreadable characters.Next article: 8085 program to convert 8 bit BCD number into ASCII Code Comment More infoAdvertise with us Next Article Introduction of Microprocessor A AashutoshChauhan Follow Improve Article Tags : Computer Organization & Architecture system-programming ASCII microprocessor Similar Reads Microprocessor Tutorials A microprocessor is fabricated on a single integrated circuit (IC) or chip that is used as a central processing unit (CPU). It is used as an electronic device, giving output instructions and executing data. In the microprocessor tutorial page, We will cover some basic topics like the introduction to 9 min read IntroductionIntroduction of Microprocessor In this article we will go through the Microprocessor, we will first define what is a Microprocessor, then we will go through its different types with its block diagram and we will see different types of processors, At last, we will conclude our article with some applications and FAQs.What is Microp 6 min read Types of Microprocessors This article provides an overview of the microprocessor, one of the most important components of a modern computing device. It describes how they function like the "brain" of the computer and enumerates the different types of Microprocessors. This also includes the vector processors, array processor 6 min read Microprocessor | Intel x86 evolution and main features Intel x86 architecture has evolved over the years. From a 29, 000 transistors microprocessor 8086 that was the first introduced to a quad-core Intel core 2 which contains 820 million transistors, the organization and technology have changed dramatically. Some of the highlights of the evolution of x8 5 min read Evolution of Microprocessors Transistor was invented in 1948 (23 December 1947 in Bell lab). IC was invented in 1958 (Fair Child Semiconductors) By Texas Instruments J Kilby. The first microprocessor was invented by INTEL(INTegrated ELectronics). Size of the microprocessor - 4 bit NameYear of InventionClock speedNumber of trans 5 min read 8085 MicroprocessorArchitecture of 8085 microprocessor A microprocessor is fabricated on a single integrated circuit (IC) or chip that is used as a central processing unit (CPU).The 8085 microprocessor is an 8-bit microprocessor that was developed by Intel in the mid-1970s. It was widely used in the early days of personal computing and was a popular cho 11 min read Pin diagram of 8085 microprocessor The 8085 microprocessor is a popular 8-bit microprocessor developed by Intel. It has 40 pins, each with a specific function for interfacing with memory, input/output devices, and other components.Pin diagram of 8085 microprocessor is shown below: Key Pin Descriptions1. Address Bus and Data BusAddres 5 min read Registers of 8085 microprocessor Introduction : A microprocessor is a multipurpose, programmable, clock-driven, register-based electronic device that reads binary instructions from a storage device called memory, accepts binary data as input and processes data according to those instructions and provide results as output. A 8085 mi 8 min read Like