Branch on Bit Set (BBSi)

Function
The ith bit value in zero page memory location ZZ is tested. If it is set, a branch is taken; if it is clear, the instruction immediately following the three-byte BBSi instruction is executed. If the branch is taken, a one-byte signed displacement, fetched from the third byte of the instruction, is added to the program counter. Once the branch address has been calculated, the result is loaded into the program counter, transferring control to that location. The allowable range of the displacement is -128 to +127 from the instruction immediately following the branch.
Addressing Modes & Opcodes
Addressing Mode Syntax Opcode # of bytes # of cycles
Zero Page, Relative BBS0 ZZ, hhll 8F ZZ rr 3 6
Zero Page, Relative BBS1 ZZ, hhll 9F ZZ rr 3 6
Zero Page, Relative BBS2 ZZ, hhll AF ZZ rr 3 6
Zero Page, Relative BBS3 ZZ, hhll BF ZZ rr 3 6
Zero Page, Relative BBS4 ZZ, hhll CF ZZ rr 3 6
Zero Page, Relative BBS5 ZZ, hhll DF ZZ rr 3 6
Zero Page, Relative BBS6 ZZ, hhll EF ZZ rr 3 6
Zero Page, Relative BBS7 ZZ, hhll FF ZZ rr 3 6
Flags Affected
N V T B D I Z C
- - 0 - - - - -