English
Language : 

PM0044 Datasheet, PDF (147/162 Pages) STMicroelectronics – STM8 CPU programming manual
PM0044
STM8 instruction set
SRA
Shift Right Arithmetic
SRA
Syntax
SRA dst
e.g. SRA (X)
Operation
Description
The destination is either a memory byte or a register. It performs an signed
division by 2: The sign bit 7 is not modified.This instruction is compact, and
does not affect any register when used with RAM variables.
Instruction overview
mnem
SRA
SRA
N⇒
Z⇒
C⇒
Affected condition flags
dst
V
I1
H
I0
N
Z
C
Reg
Mem
-
-
-
-
N
Z
bit0
-
-
-
-
N
Z
bit0
R7
Set if bit 7 of the result is set (negative value), cleared otherwise.
R7.R6.R5.R4.R3.R2.R1.R0
Set if the result is zero (0x00), cleared otherwise.
b0
Set if, before the shift, the LSB of register or memory was set, cleared
otherwise.
b7
b7
b0
C
Detailed description
dst
A
shortmem
longmem
(X)
(shortoff,X)
(longoff,X)
(Y)
(shortoff,Y)
(longoff,Y)
(shortoff,SP)
[shortptr.w]
[longptr.w]
([shortptr.w],X)
([longptr.w],X)
([shortptr.w],Y)
Asm
SRA A
SRA $15
SRA $1505
SRA (X)
SRA ($15,X)
SRA ($1505,X)
SRA (Y)
SRA ($15,Y)
SRA ($1505,Y)
SRA ($15,SP)
SRA [$15]
SRA [$1505].w
SRA ([$15],X)
SRA ([$1505.w],X)
SRA ([$15],Y)
cy lgth
1
1
1
2
1
4
1
1
1
2
1
4
1
2
1
3
1
4
1
2
4
3
4
4
4
3
4
4
4
3
See also: SRAW, SRL, SLL, RRC, RLC, SWAP
Op-code(s)
47
37 XX
72 57 MS LS
77
67 XX
72 47 MS LS
90 77
90 67 XX
90 47 MS LS
07 XX
92 37 XX
72 37 MS LS
92 67 XX
72 67 MS LS
91 67 XX
Doc ID 13590 Rev 3
ST7
✗
✗
✗
✗
✗
✗
✗
✗
✗
✗
147/162