Write an 8085 program to evaluate  an expression y=a+b+c, where a, b  and c are 8-bit decimal numbers - ChromeTechny
Home » Write an 8085 program to evaluate  an expression y=a+b+c, where a, b  and c are 8-bit decimal numbers
8085 Programming

Write an 8085 program to evaluate  an expression y=a+b+c, where a, b  and c are 8-bit decimal numbers

In the last program, we did an evaluation of an expression consisting of three 8-bit hexadecimal numbers.

However, for this program, we are going to evaluate another expression but for this particular expression, we are going to add three 8-bit decimal numbers.

And quite similar to the earlier program, in this program also we are going to use immediate addressing mode. The only difference would be that in this program we are going to adjust the decimal number using DAA instruction.

Input:

Let a = 41D, which we will be storing at the 2000H memory location, b = 24D stored at 2001H memory location, c = 12D stored at 2002H memory location.

And, we will use 2003H to store the final result.

Program:

LXI H, 2000H

MOV A, M

INX H

ADD M

INX H

ADD M

DAA

STA 2003

HLT

Programming Details
Memory Location OPCODE Operand Label Hex Code
2004 LXI H, 2000H 21H
2005 00H
2006 20H
2007 MOV A,M 7EH
2008 INX H 23H
2009 ADD M 86H
200A INX H 23H
200B ADD M 86
200C DAA 27
200D STA 2003 32H
200E 03H
200F 20H
2010 HLT 76H

About the author

Ayan