program to find sum of series of 8 bit numbers 8085 code example
Example: 8085 code to find sum of series
where series starts from 3001 memory address
and count of series is at 3000 memory address
where starting address of the given program is 2000
store result into 4000 memory address.
Memory Mnemonics+Operands Comment
2000 MVI B, 00 [B] <- 00
2002 LXI H, [3000] [H-L] <- [3000]
2005 MOV C, M [C] <- [M]
2006 DCR C [C] <- [C] – 1
2007 INX H [H-L] <- [H-L] + 1
2008 MOV A, M [A] <- [M]
2009 INX H [H-L] <- [H-L] + 1
200A ADD M [A] <- [A] + [M]
200B JNC 200F jump if no carry
200E INR B [B] <- [B] + 1
200F DCR C [C] <- [C] – 1
2010 JNZ 2009 jump if not zero
2013 STA [4000] result
2016 MOV A, B [A] <- [B]
2017 STA [4001] carry
201A HLT Stop