BSER
BSER, BSERP
BSER instruction searches the value 1 in the source and saves the lowest bit to D and the highest bit to D+1.
| |
S | Source |
D | Destination |
Instruction | Device address | No. of Steps | Flag | |||||||||||||||
M | X | Y | K | L | F | T | C | S | Z | D | @D | Int. |
| Error | Zero | Carry | ||
BSER BSERP | S | o | o | o | o | o | o | o | o | - | o | o | o | o | 3 | o | - | - |
D | o | - | o | o | o | - | o | o | - | o | o | o | - |
When enabled, the BSER instruction searches the value 1 and saves the position number of the lowest bit to the D and the highest bit to the D+1.
D : The lowest bit position(4) is stored in D.
D+1 : The highest bit position(15) is stored in D+1.
If there is no value 1 in the source, D and D+1 will have 0 value.
If There is only 1 bit which has value 1, D and D+1 will have the same value.
Example)
If M01 is ON, the BSER instruction searches value 1 in the source (H1D1C). The lowest bit position 3 is stored in D100 and the highest bit position 13 is stored in D101.