8085 program to convert a hexadecimal number into ASCII code Last Updated : 08 Feb, 2024 Summarize Comments Improve Suggest changes Share Like Article Like Report Problem: Write an assembly-level language program to convert the HEX code to its respective ASCII code. Assume that the starting address of the program and input memory location are 2000 and 2050 respectively. Example: Input: 2050 E4 (Hex data)Output:2051 34 (ASCII code for 4)2052 45 (ASCII code for E) Algorithm: Load the given data in accumulator and move to B register Mask the most significant 4 bits(upper nibble) of the Hexa decimal number in accumulator. Call subroutine to get ASCII of least significant 4 bits. Store it in memory Move B register to accumulator and mask the least significant 4 bits(lower nibble). Rotate the upper and lower nibble position. Call subroutine to get ASCII of upper nibble Store it in memory Terminate the program. Code: MEMORY ADDRESSMNEMONICSCOMMENTS2000LDA 2050HLoad the hex data2003MOV B, Amove content of accumulator to B2004ANI OFHmask upper nibble2006CALL SUB1get ascii code for upper nibble2009STA 2051H2012MOV A, Bmove content of B to accumulator2013ANI F0Hmask lower nibble2015RLC2016RLC2017RLC2018RLC2019CALL SUB1get ascii code for lower nibble2022STA 2052H2025HLTSUB1CPI 0AHJC SKIPADI 07HSKIPADI 30HRETExplanation: LDA 2050H: load the content of memory location 2050H in accumulator. MOV B, A: copies the content of accumulator to register B. ANI OFH: AND operation is performed between accumulator and 0FH value. CALL SUB1: the subroutine at memory location SUB1 is called. STA 2051H: store the content of accumulator in the memory location 2051H. MOV A, B: copies the content of register B to accumulator. ANI F0H: AND operation is performed between accumulator and F0H value. RLC: rotate accumulator left. HLT: stops executing the program and halts any further execution. CPI 0AH: compare accumulator content with 0AH value. JC SKIP: jump to memory location SKIP if the carry bit is set. ADI 07H: add 07H value to the content of accumulator. RET: Return from the subroutine unconditionally. Comment More infoAdvertise with us Next Article 8085 program to convert 8 bit BCD number into ASCII Code D Debomit Dey Follow Improve Article Tags : Computer Organization & Architecture system-programming ASCII microprocessor Similar Reads 8085 program to convert an 8 bit BCD number into hexadecimal number Problem - Write an assembly language program in 8085 microprocessor to convert an 8 bit BCD number into hexadecimal number. Assumptions - Assume that starting address of the program is 2000, input memory locations, 2050, 2051, and output memory location is 2052. Example - INPUT: 2050:02H 2051: 09H O 2 min read 8085 program to convert ASCII code into HEX code Problem - Write an assembly level language program to convert ASCII code to its respective HEX Code. Examples: Input: DATA: 31H in memory location 2050Output:DATA: 0BH in memory location 3050 Assume that starting address of program, input memory location, and output memory locations are 2000, 2050, 1 min read 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 - Starting address of program: 2000 Input memory location: 2050 Output memory location: 3050 and 3051 ASCII Code for Digits 0 â 9 Example - Algorithm -  Input the content of 20 3 min read 8086 program to convert 8 bit BCD number into ASCII Code Problem â Write an assembly language program in 8086 microprocessor to convert 8-bit BCD number to its respective ASCII Code. Assumption â Starting address of the program: 400 Input memory location: 2000 Output memory location: 3000 Example : Input: DATA: 98H in memory location 2000Output:DATA: 38H 2 min read 8086 program to convert a 16 bit decimal number to Hexadecimal Problem: We are given a 16 bit decimal number we have to print the number in Hexadecimal format. Examples: Input: d1 = 999 Output: 3E7 Input: d1 = 123 Output: 7B Explanation: Load the value stored into register Divide the value by 16 to convert it to Hexadecimal Push the remainder into the stack Inc 2 min read 8086 program to convert a 16 bit decimal number to binary Problem: We are given a 16 bit decimal number we have to print the number in binary format Examples: Input: d1 = 16 Output: 10000 Input: d1 = 7 Output: 111 Explanation: Load the value stored into registerDivide the value by 2 to convert it to binaryPush the remainder into the stackIncrease the count 2 min read Like