[CCR] ← tested([operand]); [destination(7)] ← 1
TAS <ea>
Size
byte
Test and set the byte operand addressed by the effective address field. The N- and Z-bits of the CCR are updated accordingly. The high-order bit of the operand (i.e., bit 7) is set. This operation is indivisible and uses a read-modify-write cycle. Its principal application is in multiprocessor systems.
The TAS
instruction permits one processor in a multiprocessor system to test a resource (e.g., shared memory) and claim the resource if it is free. The most-significant bit of the byte at the effective address is used as a semaphore to indicate whether the shared resource is free. The TAS
instruction reads the semaphore bit to find the state of the resource, and then sets the semaphore to claim the resource (if it was free). Because the operation is indivisible, no other processor can access the memory between the testing of the bit and its subsequent setting.
X | N | Z | V | C |
---|---|---|---|---|
- | * | * | 0 | 0 |
Dn | An | (An) | (An)+ | ‑(An) | (d,An) | (d,An,Xi) | ABS.W | ABS.L | (d,PC) | (d,PC,Xn) | imm |
---|---|---|---|---|---|---|---|---|---|---|---|
✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
From MOTOROLA M68000 FAMILY Programmer's reference manual. Copyright 1992 by Motorola Inc./NXP. Adapted with permission.