Publish your: Interview/placement Paper or an Ebook you have



2-Digit BCD to binary conversion

Problem Statement:  

Convert a 2-digit BCD number stored at memory address 2200H into its binary equivalent number and store the result in a memory location 2300H.

Sample problem 1:

(2200H) = 67H

(2300H) = 6 x OAH + 7 = 3CH + 7 = 43H

Source program :

    * LDA 2200H : Get the BCD number
    * MOV B, A : Save it
    * ANI OFH : Mask most significant four bits
    * MOV C, A : Save unpacked BCDI in C register
    * MOV A, B : Get BCD again
    * ANI FOH : Mask least significant four bits
    * RRC : Convert most significant four bits into unpacked BCD2
    * RRC
    * RRC
    * RRC
    * MOV B, A : Save unpacked BCD2 in B register
    * XRA A : Clear accumulator (sum = 0)
    * MVI D, 0AH : Set D as a multiplier of 10
    * Sum:   ADD D : Add 10 until (B) = 0
    * DCR B : Decrement BCD2 by one
    * JNZ SUM : Is multiplication complete? i if not, go back and add again
    * ADD C : Add BCD1
    * STA 2300H : Store the result
    * HLT : Terminate program execution

Spread The Love, Share Our Article

Related Posts

Be the first to comment on "2-Digit BCD to binary conversion"

Most Popular posts

Trending posts

About Us

Free engineering materials and courseware for all is our motto . Besides we provide free Placement Orientation and Training.
Move ahead >>>>>
Email :

Publish your

Keep Yourself Updated

Get the latest posts delivered on your mail box for free. Enter your email address below and press submit

You can also keep in touch via

Subscribe via RSS Feed Subscribe via Google SMS Channel

Recent Posts


Our Partners : link directoryWeb Directory Visit to discover Indian blogsAcademicsTop Blogs