448
CHAPTER 7 DESCRIPTION OF INSTRUCTIONS
Compare Multiple Equal Byte
Block Comparison with Fixed Byte Data (Match Detection)
[Instruction format]
CMPME [TDE + ], A
CMPME [TDE – ], A
[Operation]
(TDE) – A, TDE
←
TDE + 1, C
←
C – 1 End if C = 0 or Z = 0
(TDE) – A, TDE
←
TDE – 1, C
←
C – 1 End if C = 0 or Z = 0
[Operands]
Mnemonic
Operands
CMPME
[TDE + ], A
[TDE – ], A
[Flags]
S
Z
AC
P/V
CY
×
×
×
V
×
[Description]
The contents of the A register are compared with the contents of the memory addressed by the TDE register,
the contents of the TDE register 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 mismatch, or the contents
of the C register are 0.
Execution of this instruction does not change the contents of the A register or of the memory addressed by the
TDE register.
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 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.
CMPME