![](http://datasheet.mmic.net.cn/380000/-PD784928Y_datasheet_16744934/-PD784928Y_463.png)
463
CHAPTER 7 DESCRIPTION OF INSTRUCTIONS
Compare Block Not Equal Byte
Block Comparison with Byte Data (Mismatch Detection)
[Instruction format]
CMPBKNE [TDE + ], [WHL + ]
CMPBKNE [TDE – ], [WHL – ]
[Operation]
(TDE) – (WHL), TDE
←
TDE + 1, WHL
←
WHL + 1, C
←
C – 1
End if C = 0 or Z = 1
(TDE) – (WHL), TDE
←
TDE – 1, WHL
←
WHL – 1, C
←
C – 1
End if C = 0 or Z = 1
[Operands]
Mnemonic
Operands
CMPBKNE
[TDE + ], [WHL + ]
[TDE – ], [WHL – ]
[Flags]
S
Z
AC
P/V
CY
×
×
×
V
×
[Description]
The contents of the memory addressed by the WHL register are compared with the contents of the memory
addressed by the TDE register, the contents of the TDE and WHL registers are incremented/decremented, and
the contents of the C register are decremented. The above operations are repeated until the result of the
comparison is a match, or the contents of the C register are 0.
Execution of this instruction does not change the contents of the memory addressed by the TDE and WHL
registers.
If an acknowledgeable interrupt or macro service request is generated during execution of this instruction,
execution of this instruction is interrupted and the interrupt or macro service request is acknowledged. When
an interrupt is acknowledged, if the return address and the contents of the TDE, WHL, and C registers used
by this instruction which have been saved to the stack or to RP2 and R7 are not changed, execution of the
interrupted instruction is resumed upon returning from the interrupt. When a macro service request is
acknowledged, execution of this instruction is resumed after completion of the macro service.
The S, Z, AC, P/V, and CY flags are changed in accordance with the last compare operation (subtraction)
executed by this instruction.
The S flag is set (1) if bit 7 is set (1) as a result of the subtraction, and cleared (0) otherwise.
The Z flag is set (1) if the result of the subtraction is 0, and z flag is cleared (0) otherwise.
The AC flag is set (1) if a borrow is generated out of bit 4 into bit 3 as a result of the subtraction, and cleared
(0) otherwise.
The P/V flag is set (1) if a borrow is generated in bit 6 and a borrow is not generated in bit 7 as a result of the
subtraction (when underflow is generated by a two’s complement type operation), or if a borrow is not generated
in bit 6 and a borrow is generated in bit 7 (when overflow is generated by a two’s complement type operation),
and is cleared (0) otherwise.
The CY flag is set (1) if a borrow is generated in bit 7 as a result of the subtraction, and cleared (0) otherwise.
CMPBKNE