From Learn @ Cemetech
Jump to: navigation, search

The sum of the two operands plus the carry flag (0 or 1) is calculated, and the result is written back into the first operand.


   adc a,op8		;8 bit
   adc hl,op16		;16 bit

Allowed instructions

   adc a,a
   adc a,b
   adc a,c
   adc a,d
   adc a,e
   adc a,h
   adc a,l
   adc a,ixh
   adc a,ixl
   adc a,iyh
   adc a,iyl
   adc a,(hl)
   adc a,(ix+n)
   adc a,(iy+n)
   adc a,n		;(8-bit number)
   adc hl,bc
   adc hl,de
   adc hl,hl
   adc hl,sp


The N flag is reset, P/V is interpreted as overflow. The rest of the flags is modified by definition. In the case of 16-bit addition the H flag is undefined.


Multiple precision adding


r denotes 8-bit register. rr represents a two byte register pair: BC, DE, HL, SP

a, r 4
a, X 7
a, (hl) 7
a, (ix+X) 19
a, (iy+X) 19
hl, rr 15

See also