Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
548 views

Program To Convert Binary To BCD

This program converts an 8-bit binary number to binary coded decimal (BCD). It initializes a memory pointer, clears registers for the most and least significant bytes, loads the binary data, counts ones using a loop to adjust for BCD, stores the result in memory, and terminates the program.

Uploaded by

prashantvlsi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
548 views

Program To Convert Binary To BCD

This program converts an 8-bit binary number to binary coded decimal (BCD). It initializes a memory pointer, clears registers for the most and least significant bytes, loads the binary data, counts ones using a loop to adjust for BCD, stores the result in memory, and terminates the program.

Uploaded by

prashantvlsi
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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

You might also like