Renesas R8C/Tiny Series Software Manual page 84

16-bit single-chip microcomputer
Hide thumbs Also See for R8C/Tiny Series:
Table of Contents

Advertisement

Chapter 3
Functions
DIV
[ Syntax ]
DIV.size
src
[ Operation ]
If the size specifier (.size) is (.B)
R0L (quotient), R0H (remainder)
If the size specifier (.size) is (.W)
R0 (quotient), R2 (remainder)
[ Function ]
• This instruction divides R2R0 (R0)
mainder in R2 (R0H)
registers that are operated on when you selected (.B) for the size specifier (.size).
src
• If
is an A0 or A1 when the size specifier (.size) you selected is (.B), operation is performed on the
8 low-order bits of A0 or A1.
• If you specify (.B) for the size specifier (.size), the O flag is set when the operation resulted in the
quotient exceeding 8 bits or the divisor is 0. At this time, R0L and R0H are indeterminate.
• If you specify (.W) for the size specifier (.size), the O flag is set when the operation resulted in the
quotient exceeding 16 bits or the divisor is 0. At this time, R0 and R2 are indeterminate.
[ Selectable src ]
R0L/R0
R0H/R1
A0/A0
A1/A1
dsp:8[A0]
dsp:8[A1]
dsp:16[A0] dsp:16[A1]
dsp:20[A0] dsp:20[A1]
R2R0
R3R1
[ Flag Change ]
Flag
U
I
O
Change
Conditions
O :
The flag is set when the operation resulted in the quotient exceeding 16 bits (.W) or 8 bits (.B) or
the divisor is 0; otherwise cleared.
[ Description Example ]
DIV.B
A0
DIV.B
#4
DIV.W
R0
[ Related Instructions ]
B , W
R2R0
*1
by signed
*1
. The remainder has the same sign as the dividend. Shown in ( )
src
R1L/R2
R1H/R3
[A0]
[A1]
dsp:8[SB]
dsp:8[FB]
dsp:16[SB]
abs16
abs20
#IMM
A1A0
B
S
Z
D
C
DIVU,DIVX,MUL,MULU
Signed divide
DIVide
[ Instruction Code/Number of Cycles ]
R0
src
src
src
and stores the quotient in R0 (R0L)
;A0's 8 low-order bits is the divisor.
67
3.2 Functions
DIV
Page=170
*1
and the re-
*1
are the

Advertisement

Table of Contents
loading

Table of Contents