Write an 8085 program to add two 8-bit decimal numbers using immediate addressing mode
Up until now, we have seen programs which included 8-bit hexadecimal numbers, but for this 8085 program, we are going to use two 8-bit decimal numbers.
Now, if you are not familiar with the number system then I’m gonna urge you go through the basics of the number system including conversions.
Nonetheless, if you are familiar with number system then you don’t need to worry.
Anyways, let us now talk about this 8085 program. The first thing which we are going to do is store two 8-bit data in two successive memory location, then using HL register we are going to point the memory location.
After pointing the HL register pair, we are going to perform the add operation by using ADD instruction. And then finally we are going to adjust the result by using DAA instruction. Now unlike the previous programs in which we store the result in a register, this time we are going to store the result in a memory location.
Hence, we will need to three memory location. For this program, we are going to use 2000H, 2001H and 2002H memory location.
Let 2000H memory address hold 24D, 2001H hold 65D, after adding them we get the result 89D, which we will store in a 2002H memory location.
|Memory Location||OPCODE||Operand||Label||Hex Code|