Skip to content
Related Articles

Related Articles

8086 program to convert 8 bit ASCII to BCD number
  • Last Updated : 10 Sep, 2018

Problem – Write a program to convert ASCII to BCD 8-bit number where starting address is 2000 and the number is stored at 2050 memory address and store result into 3050 memory address.

Example-
Input  : location: 2050
         Data   : 37
Output : location: 3050    
         Data   : 07        

Algorithm –

  1. Move value at [2050] into AL
  2. Perform AND operation on AL with 0F
  3. Move content of accumulator AL into 3050
  4. Stop

Program –

MemoryMnemonicsOperandsComment
2000MOVAL, [2050][AL] <- [2050]
2004ANDAL, 0F[AL] <- ([ AL] AND 0F )
2006MOV[3050], AL[3050] <- [AL]
200AHLTStop

Explanation – Registers AL is used for general purpose

  1. MOV is used to transfer the data
  2. AND is used for multiplication (logically)
  3. HLT is used to halt the program
My Personal Notes arrow_drop_up
Recommended Articles
Page :