Chapter 16
Appendix
Extension Instruction Specification XVI - 67
BSCH (bit search instruction)
[Instruction format (macro name)]
BSCH Dm, Dn
[Assembler mnemonic]
udf07 Dm, Dn
[Operation]
This instruction searches 32-bit string stored in Dm starting with the bit number specified by the content of Dn - 1
in order from larger to smaller bit numbers and stores the bit number, at which the first “1” is found, in Dn.
The instruction makes a search starting with bit 31 in order from larger to smaller bit numbers if the contents of
low-order 5 bits of Dn are 0s.
If no “1” is found after search to bit 0, the instruction sets the C flag and sets Dn to “0x00000000” to terminate its
execution.
Note that high-order 27 bits of Dn are ignored when the instruction execution is initiated.
[Flag changes]
When search is successful (“1” is found)
When search is not successful (“1” is not found)
[Note for programming]
Updating of the PSW as a result of flag changes is delayed by 1 instruction.
Note, however, that flags can be evaluated for the Bcc and Lcc instructions before flag changes are reflected in the
PSW.
Flag Change Condition
V * Undefined
C 0 Indicates that search is successful.
N * Undefined
Z * Undefined
Flag Change Condition
V * Undefined
C 1 Indicates that search is not successful.
N * Undefined
Z * Undefined
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
Dn before execution
of the instruction
Bit 31
Search direction
Dn after execution
of the instruction
Bit 0
LSBMSB
Search range