CAS Destination -- Compare Operand -->; cc;
if Z, Update Operand -->; Destination
else Destination -->; Compare Operand
CAS Dc, Du, <ea>
Attributes: Size = (Byte, Word, Long)
Description: CAS compares the effective address operand to
the compare operand (Dc). If the operands are equal, the
instruction writes the update operand (Du) to the effective
address operand; otherwise, the instruction writes the
effective address operand to the compare operand (Dc).
The instruction accesses memory using locked or read-
modify-write transfer sequences. This provides a means
of synchronizing several processors.
X Not affected.
N Set if the result is negative. Cleared otherwise.
Z Set if the result is zero. Cleared otherwise.
V Set if an overflow is generated. Cleared otherwise.
C Set if a borrow is generated. Cleared otherwise.
Size field -- Specifies the size of the operation.
01 -- Byte operation.
10 -- Word operation.
11 -- Long operation.
Effective Address field -- Specifies the location of the memory
operand. Only memory alterable addressing modes are
allowed as shown:
Du field -- Specifies the data register that contains the update
value to be written to the memory operand location if
the comparison is successful.
Dc field -- Specifies the data register that contains the value
to be compared to the memory operand.
The CAS and CAS2 instructions can be used to perform secure
update operations on system control data structures in
a multiprocessing environment.
In the MC68040 if the operands are not equal, the destination
operand is written back to memory to complete the locked