AH500 Programming Manual 
6-252 
API 
Instruction code  Operand  Function 
1109    MBS  P 
S, D, n 
Shifting the matrix bits 
Device
X  Y  M  S  T  C  HC  D  L  SM  SR  E  PR  K  16#
“$”  DF 
16-bit instruction (7 steps) 
Symbol: 
 
S
: 
Matrix source  Word 
D
: 
Operation result  Word 
n
: 
Length of the array  Word 
Explanation: 
1.  The values of the n rows of bits in S are shifted to the right or to the left. When SM616 is OFF, 
the values of the bits are shifted to the left. When SM616 is ON, the values of the bits are 
shifted to the right. The vacancy resulting from the shift is filled by the state of the borrow flag 
SM615, the value of the bit shifted last is transmitted to the carry flag SM614, and the 
operation result is stored in D.   
2.  The operand n should be within the range between 1 and 256. 
3.  Generally, the pulse instruction MBSP is used. 
Example 1: 
When X0.0 is ON, SM616 is OFF. The values of the bits are shifted to the left. Suppose SM615 is 
OFF. After the values of the bits in the 16-bit registers D0~D2 are shifted to the left, the operation 
result is stored in the 16-bit registers D20~D22, and SM614 is ON.