Some computers have a swap instruction. Modify the subroutines shown in Program 5.14, written in 9S12 assembly language, to implement a binary spin-lock semaphore using this fictional instruction. The system must provide for mutual exclusion. You may not disable interrupts. Do not use the minm instruction. The syntax of this fictional atomic operation is
Where Operand is any standard 9S12 addressing mode and r is any of the 9S12 registers. This instruction exchanges the 8- or 16-bit contents of the Operand and data register. It does not set any condition code bits.
Program 5.14