Hitachi SH7750 Programming Manual page 254

High-performance risc engine superh (sh) 32-bit risc mcu/mpu series
Hide thumbs Also See for SH7750:
Table of Contents

Advertisement

10.22
DT
Decrement and Test
Format
DT Rn
Description
This instruction decrements the contents of general register Rn by 1 and compares the result with
zero. If the result is zero, the T bit is set to 1. If the result is nonzero, the T bit is cleared to 0.
Operation
DT(long n)/* DT Rn */
{
R[n]--;
if (R[n]==0) T=1;
else T=0;
PC+=2;
}
Example
MOV
#4,R5
LOOP:
ADD
R0,R1
DT
R5
BF
LOOP
Rev. 2.0, 03/99, page 240 of 396
Decrement and Test
Summary of Operation
Rn – 1 → Rn;
if Rn = 0, 1 → T
if Rn ≠ 0, 0 → T
;Set loop count
;
;Decrement R5 value and check for 0.
;If T = 0, branch to LOOP (in this example, 4 loops are executed).
Arithmetic Instruction
Instruction Code
0100nnnn00010000 1
Execution
States
T Bit
Test
result

Advertisement

Table of Contents
loading

Table of Contents