Actually, there isn't much to this instruction. A typical piece of spin lock code in 68k assembly could look like that:
lea.l spinLock(pc),a0
getLock:
tas (a0)
bne.s getLock
bra haveLock
spinLock
dc.b 0
The code sets the MSB of the byte at spinLock
, and loops around until the zero flag is set (telling you the bit was not set before, i.e. no other piece of code has already acqiured the lock). The important thing is the TAS instruction is atomic, that is, it cannot be interrupted by other code (like an ISR, for example) between the bit test and the set.