Program to convert an 8-bit binary to
BCD
Program
Address HEX Codes Labels Mnemonics Comments
F000 21, 00, 80 LXI H,8000H Initialize memory pointer
F003 16, 00 MVI D,00H Clear D- reg for Most significant Byte
F005 AF XRA A Clear Accumulator
F006 4E MOV C, M Get HEX data
F007 C6, 01 LOOP ADI 01H Count the number one by one
F009 27 DAA Adjust for BCD count
F00A D2, 0E, F0 JNC SKIP Jump to SKIP
F00D 14 INR D Increase D
F00E 0D SKIP DCR C Decrease C register
F00F C2, 07, F0 JNZ LOOP Jump to LOOP
F012 6F MOV L, A Load the Least Significant Byte
F013 62 MOV H, D Load the Most Significant Byte
F014 22, 50, 80 SHLD 8050H Store the BCD
Address HEX Codes Labels Mnemonics Comments
F017 76 HLT Terminate the program