Download 78K0R Microcontrollers User`s Manual for Instructions

Transcript
78K0R Microcontrollers
CHAPTER 6 EXPLANATION OF INSTRUCTIONS
Shift Arithmetic Right Word
SARW
Arithmetic Shift to the Right
[Instruction format]
SARW dst, cnt
[Operation]
(CY ← dst0, dstm-1 ← dstm, dst15 ← dst15) × cnt
[Operand]
Mnemonic
SARW
Operand (dst, cnt)
AX, cnt
[Flag]
Z
AC
CY
×
[Description]
• The destination operand (dst) specified by the first operand is shifted to the right the number of times specified by cnt.
• The same value is retained in the MSB (bit 15), and the value shifted last from bit 0 is entered to CY.
• cnt can be specified as any value from 1 to 15.
15
0
CY
[Description example]
SAR AX, 4; When the AX register’s value is A28CH, AX = FA28H and CY = 1.
AX = 1010_0010_1000_1100B CY = 0
AX = 1101_0001_0100_0110B CY = 0 1 time
AX = 1110_1000_1010_0011B CY = 0 2 times
AX = 1111_0100_0101_0001B CY = 1 3 times
AX = 1111_1010_0010_1000B CY = 1 4 times
R01US0029EJ0600 Rev.6.00
Jan 31, 2011
133