In this program we will see how to add two 8-bit BCD numbers.
Write 8085 Assembly language program to add two 8-bit BCD number stored in memory location 8000H – 8001H.
This task is too simple. Here we are taking the numbers from memory and after adding we need to put DAA instruction to adjust the accumulator content to decimal form. The DAA will check the AC and CY flags to adjust a number to its decimal form.
|F000||21, 00, 80||LXI H,8000H||Point to first operand|
|F003||7E||MOV A, M||Load A with first operand|
|F004||23||INX H||Point to next operand|
|F005||86||ADD M||Add Acc and memory element|
|F007||21, 50, 80||LXI H,8050H||Locate destination address|
|F00A||77||MOV M, A||Store the result into memory|
|F00B||D2, 12, F0||JNC DONE||If CY = 0, jump to Done|
|F00E||3E, 01||MVI A, 01H||Load 01H into Acc|
|F010||23||INX H||Point to next location|
|F011||77||MOV M,A||Store the carry|
|F012||76||DONE||HLT||Terminate the program|