From Learn @ Cemetech
Revision as of 18:37, 5 February 2016 by Maintenance script (talk | contribs) (Initial automated import)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Tests if the specified bit is set.


   bit n,op8

Allowed Instructions

n can be any integer from [0,7]. It must be defined on compile time.

   bit n,a
   bit n,b
   bit n,c
   bit n,d
   bit n,e
   bit n,h
   bit n,l
   bit n,(hl)
   bit n,(ix+n)
   bit n,(iy+n)


Opposite of the n^^th^^ bit is written into the Z flag. C is preserved, N is reset, H is set, and S and P/V are undefined.

   ld a,%00000001
   bit 0,a		;would reset Z
   bit 1,a		;would set Z



r denotes 8-bit register.

r 8
(hl) 12
(ix+X) 20
(iy+X) 20

See Also