0 Members and 1 Guest are viewing this topic.
;Input: A=byteToCheck;Destroys B.CheckOneBitUnset: cpl ld b,8 rlca jr c,$+6 djnz $-3 scf ret ;returns with a carry if no bits are set and %11111110 ret ;zero if only one bit is unset, nonzero if others are set. No carry regardless.
;Outputs Z if 0-1 bits of A are resetld b,ainc aor binc a
This method tests for zero or one reset bits (you'd have to check the $FF case manually)Code: [Select];Outputs Z if 0-1 bits of A are resetld b,ainc aor binc a
;Input: a = byte to check;Flags: z = Exactly 1 reset bit cpl ld b,a dec a xor b add a,1 rra xor b
;Outputs Z if exactly 1 bit of A is reset ld b,a inc a jr z,special or bspecial: inc a