Packed BCD Addition

The following addition function assumes that both BCD numbers are stored with their least significant digits at the lowest address, and both numbers must have the same length.

;Input:  HL = base address of addend, DE = base address of adder, B = length of numbers
;Output: Addend replaced by addend plus adder
 
        ld      A, B
        or      A
        ret     z	;test whether length = 0
Loop:   ld      A, (DE)	;get byte of adder
        adc     A, (HL)	;add it to addend, care for carry
        daa		;convert to BCD-decimal
        ld      (HL), A	;save number back in addend
        inc     HL	;next number
        inc     DE
        djnz    Loop   	;continue until all bytes summed
        ret

Source: Icarus Productions' Z80 FAQ