Cpijne Compare, Increment, And Jump On Non-Equal - Samsung S3C8275X User Manual

8-bit cmos microcontrollers
Table of Contents

Advertisement

INSTRUCTION SET
CPIJNE
— Compare, Increment, and Jump on Non-Equal
CPIJNE
dst,src,RA
Operation:
If dst – src
Ir ← Ir + 1
The source operand is compared to (subtracted from) the destination operand. If the result is not
"0", the relative address is added to the program counter and control passes to the statement
whose address is now in the program counter; otherwise the instruction following the CPIJNE
instruction is executed. In either case the source pointer is incremented by one before the next
instruction.
Flags:
No flags are affected.
Format:
opc
NOTE: Execution time is 18 cycles if the jump is taken or 16 cycles if it is not taken.
Example:
Given: R1 = 02H, R2 = 03H, and register 03H = 04H:
CPIJNE R1,@R2,SKIP →
Working register R1 contains the value 02H, working register R2 (the source pointer) the value
03H, and general register 03 the value 04H. The statement "CPIJNE R1,@R2,SKIP" subtracts
04H (00000100B) from 02H (00000010B). Because the result of the comparison is non-equal, the
relative address is added to the PC and the PC then jumps to the memory location pointed to by
SKIP. The source pointer register (R2) is also incremented by one, leaving a value of 04H.
(Remember that the memory location must be within the allowed range of + 127 to – 128.)
6-32
"0", PC ← PC + RA
src
dst
RA
R2 = 04H, PC jumps to SKIP location
S3C8275X/F8275X/C8278X/F8278X/C8274X/F8274X
Bytes
Cycles
Opcode
3
12
Addr Mode
(Hex)
dst
src
D2
r
Ir

Advertisement

Table of Contents
loading

This manual is also suitable for:

F8275xF8274xC8278xC8274xF8278x

Table of Contents