Kaiyi — 6.12.2 Explanation of Shift Instructions

AH500 Programming Manual b0 b15 Borrow flag Example 2: When X0.0 is ON, SM616 is ON. The values of the bits are shifted to the right. Suppose SM615 is ON. After the values of the bits in the 16-bit registers D0~D2 are rotated to the right, the operation result is stored in the 16-bit registers D20~D22, and SM614 is OFF. b0 b15 Carry flag Additional remark: 1. If S + n -1 or D + n -1 exceeds the device range, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#2003. 2. If n is less than 1, or if n is larger than 256, the instruction is not executed, SM0 is ON, and the error code in SR0 is 16#200B. 3. The flags: SM614:

It is the carry flag for the matrix rotation/shift/output. SM615: It is the borrow flag for the matrix shift/output. SM616: It is the direction flag for the matrix rotation/shift.

6-239 D0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 rry flag D1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 D2 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 After the shift Borrow b15 b0 D20 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 rry flag D21 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 D22 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 D0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 rrow flag D1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 D2 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 After the shift Carry fl b15 b0 D20 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 rrow flag D21 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 D22 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1