Cpije Compare, Increment, And Jump On Equal - Samsung S3C80M4/F80M4 User Manual

8-bit cmos microcontrollers
Table of Contents

Advertisement

S3C80M4/F80M4
CPIJE
— Compare, Increment, and Jump on Equal
CPIJE
dst,src,RA
If dst – src = "0", PC ← PC + RA
Operation:
Ir ← Ir + 1
The source operand is compared to (subtracted from) the destination operand. If the result is "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 immediately following the
CPIJE instruction is executed. In either case, the source pointer is incremented by one before the
next instruction is executed.
No flags are affected.
Flags:
Format:
opc
NOTE: Execution time is 18 cycles if the jump is taken or 16 cycles if it is not taken.
Given: R1 = 02H, R2 = 03H, and register 03H = 02H:
Example:
CPIJE R1,@R2,SKIP →
In this example, working register R1 contains the value 02H, working register R2 the value 03H,
and register 03 contains 02H. The statement "CPIJE R1,@R2,SKIP" compares the @R2 value
02H (00000010B) to 02H (00000010B). Because the result of the comparison is equal, the
relative address is added to the PC and the PC then jumps to the memory location pointed to by
SKIP. The source register (R2) is incremented by one, leaving a value of 04H. (Remember that
the memory location must be within the allowed range of + 127 to – 128.)
src
dst
RA
R2 = 04H, PC jumps to SKIP location
Bytes
Cycles
Opcode
(Hex)
3
12
INSTRUCTION SET
Addr Mode
dst
src
C2
r
Ir
6-31

Advertisement

Table of Contents
loading

Table of Contents