© 2000 Scenix Semiconductor, Inc. All rights reserved.
125
SX Users Manual Rev. 3.1
www.scenix.com
Chapter 3 Instruction Set
3.6.54 TEST fr
Test fr for Zero
Operation:
fr = fr
Bits affected:
Z
Opcode:
0010 001f ffff
Description:
This instruction moves the contents of the specified file register into the same reg-
ister. There is no net effect except to set or clear the Z bit. If the register contains
00h, the bit is set. Otherwise, the bit is cleared. If the TEST operation is performed
on the RTCC register, the RTCC prescaler will be initialized to 0. If the prescaler is
about to expire causing the RTCC to increment and the TEST instruction is execut-
ed, the RTCC will not increment.
Cycles:
1
Example:
test
$1B
;test file register 1Bh
sb
STATUS.2
;test Z bit and skip if set
inc
$1B
;increment file reg 1Bh if nonzero
mov
W,$1B
;move file reg 1Bh to W
This example tests the contents of file register 1Bh. The test instruction sets or
clears the Z bit based on the contents of the file register. The sb instruction tests
the Z bit. The inc instruction is executed if the file register contains zero or is
skipped if the file register contains a nonzero value.