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.
Starting address of program: 400
Input memory location: 2000
Output memory location: 3000
DATA: 98H in memory location 2000
DATA: 38H in memory location 3000 and
39H in memory location 3001
- Load contents of memory location 2000 in register AL
- Copy contents of register AL in register AH
- Perform AND operation on register AL with 0F
- Assign 04 to CL Register
- Shift the contents of AH by executing SHR instruction using CL
- Perform OR operation on register AX with 3030
- Store the content of AX in memory location 3000
||MOV AL, 
||MOV AH, AL
||AND AL, 0F
||AL <- (AL AND 0F)
||MOV CL, 04
||CL <- 04
||SHR AH, CL
||Shift AH content Right by 4 bits(value of CL)
||OR AX, 3030
||AX <- (AX OR 3030)
||MOV , AX
- MOV AL, : loads contents of memory location 2000 in AL
- MOV AH, AL: copy contents of AL in AH
- AND AL, 0F: do AND operation on AL with 0F
- MOV CL, 04 assign 04 to CL register
- SHR AH, CL: shift the content of AH register right by 4 bits i.e. value of CL register
- OR AX, 3030: do OR operation on AX with 3030
- MOV , AX: stores the content of AX register pair in 3000 memory address
- HLT: stops executing the program
- It can be implemented in low-level programming languages such as assembly language, providing a high level of control over the hardware and the ability to optimize the code for specific applications.
- It can be used in embedded systems and other applications where hardware resources are limited, as the 8086 microprocessor is a simple and low-cost device.
- It can perform BCD-to-ASCII conversions on other types of data, such as arrays or memory locations, providing a versatile tool for manipulating data.
- It can be a complex and error-prone process, requiring a sequence of instructions to be executed in a specific order and careful handling of register values.
- It may not be as fast or efficient as dedicated BCD-to-ASCII conversion hardware or software libraries on more advanced microprocessors.
- It may require specialized knowledge and programming skills to implement and optimize, as the sequence of instructions can be complex and the conversion table may need to be customized for specific applications.
Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, GeeksforGeeks Courses
are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out - check it out now!