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

8-bit cmos
Hide thumbs Also See for S3F84B8:
Table of Contents

Advertisement

S3F84B8_UM_REV 1.00
6.3.19 CPIJNE — COMPARE, INCREMENT, AND JUMP ON NON-EQUAL
dst,src,RA
CPIJNE
If dst – src
Operation:
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 is passed 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.
No flags are affected.
Flags:
Format:
opc
Execution time is 18 cycles if the jump is taken or 16 cycles if it is not taken.
NOTE:
Given R1 = 02H, R2 = 03H, and register 03H = 04H:
Example:
CPIJNE R1,@R2,SKIP 
The working register R1 contains the value 02H, working register R2 (source pointer) contains the
value 03H, and general register 03 contains the value 04H. The statement "CPIJNE
R1,@R2,SKIP" subtracts 04H (00000100B) from 02H (00000010B). Since the result of
comparison is non-equal, the relative address is added to the PC. The PC then jumps to the
memory location pointed to by SKIP. The source pointer register (R2) is also incremented by one,
leaving value of 04H. (Note that the memory location must be within the allowed range of + 127 to
– 128.)
"0", PC  PC + RA
src
dst
RA
R2 = 04H, PC jumps to SKIP location
Bytes
Cycles
3
6-31
6 INSTRUCTION SET
Opcode
Addr Mode
(Hex)
dst
12
D2
src
r
Ir

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents