SX Users Manual Rev. 3.1
118
© 2000 Scenix Semiconductor, Inc. All rights reserved.
www.scenix.com
Chapter 3 Instruction Set
3.6.48 SB fr.bit
Test Bit in fr and Skip if Set
Operation:
Test a specified bit in fr; if 1, skip next instruction
Bits affected:
none
Opcode:
0111 bbbf ffff
Description:
This instruction tests a bit in the specified file register. The file register address (00h
through 1Fh) and the bit number (0 through 7) are the instruction operands. If the
bit is 1, the next instruction in the program is skipped. Otherwise, program execu-
tion proceeds normally with the next instruction.
Cycles:
1 if tested condition is false, 2 if tested condition is true
Example:
sb
$1F.7
;test bit 7 of file register
inc
$1F
;increment if bit=0
mov
W,$1F
;move file register to W
This example tests the most significant bit of file register 1Fh. If that bit is 1, the
inc instruction is skipped. Otherwise, program execution proceeds normally with
the inc instruction.