![](http://datasheet.mmic.net.cn/370000/P9S12XEP100J1VVLR_datasheet_16728329/P9S12XEP100J1VVLR_407.png)
Chapter 10 XGATE (S12XGATEV3)
BFFO
MC9S12XE-Family Reference Manual Rev. 1.07
Freescale Semiconductor
407
Operation
FirstOne(RS)
RD;
Searches the first “1” in register RS (from MSB to LSB) and writes the bit position into the destination
register RD. The upper bits of RD are cleared. In case the content of RS is equal to $0000, RD will be
cleared and the carry flag will be set. This is used to distinguish a “1” in position 0 versus no “1” in the
whole RS register at all.
CCR Effects
Code and CPU Cycles
BFFO
Bit Field Find First One
N
Z
V
C
0
0
N:
Z:
V:
C:
0; cleared.
Set if the result is $0000; cleared otherwise.
0; cleared.
Set if RS = $0000
1
; cleared otherwise.
1
Before executing the instruction
Source Form
Address
Mode
Machine Code
Cycles
BFFO RD, RS
DYA
0
0
0
0
1
RD
RS
1
0
0
0
0
P