In this blog post, we will explore an 8086 assembly language program designed to convert a binary number into its Binary-Coded Decimal (BCD) format. This conversion is essential in applications where binary numbers need to be represented in a decimal-like format, such as digital displays or interfaces that require human-readable numbers.
The following assembly program performs the conversion:
DATA SEGMENT NO1 DB "1001000000110110" D1 DW 4 DUP (?) DATA ENDS CODE SEGMENT ASSUME CS:CODE, DS:DATA START: MOV AX, DATA MOV DS, AX LEA SI, NO1 LEA DI, D1 MOV CX, 04H TOP: MOV BX, 00H MOV AX, [SI] ROR AX, 1 JNC P2 ADD BX, 08H P2: INC SI MOV AX, [SI] ROR AX, 1 JNC P3 ADD BX, 04H P3: INC SI MOV AX, [SI] ROR AX, 1 JNC P4 ADD BX, 02H P4: INC SI MOV AX, [SI] ROR AX, 1 JNC P5 ADD BX, 01H P5: MOV [DI], BX INC DI INC SI DEC CX JNZ TOP INT 3 CODE ENDS END STARTContinue reading 8086 Assembly Program to Convert Binary Number into BCD Format