EasyManua.ls Logo

Samsung S3F84B8 - CPIJE - Compare, Increment, and Jump on Equal

Samsung S3F84B8
322 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
S3F84B8_UM_REV 1.00 6 INSTRUCTION SET
6-30
6.3.18 CPIJE — COMPARE, INCREMENT, AND JUMP ON EQUAL
CPIJE dst,src,RA
Operation: If dst – src = “0”, PC PC + RA
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 is passed 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.
Flags: No flags are affected.
Format:
Bytes Cycles Opcode
(Hex)
Addr Mode
dst src
opc src dst RA 3 12 C2 r Ir
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 = 02H:
CPIJE R1,@R2,SKIP R2 = 04H, PC jumps to SKIP location
In this example, working register R1 contains the value 02H, working register R2 contains the
value 03H, and working register 03 contains the value 02H. The statement “CPIJE
R1,@R2,SKIP” compares the @R2 value 02H (00000010B) to 02H (00000010B). Since the result
of comparison is equal, the relative address is added to the PC. The PC then jumps to the
memory location pointed to by SKIP. The source register (R2) is incremented by one, leaving
value of 04H. (Note that the memory location must be within the allowed range of + 127 to – 128.)

Table of Contents

Other manuals for Samsung S3F84B8

Related product manuals