Section 07 Part 02 – The SVC, SVS, ST & SF Instructions “One must learn to be a sponge if one wants to be loved by hearts that overflow." ~Friedrich Nietzsche

The SVC Instruction

SVC – Set on oVerflow Clear

If the V flag of the CCR is clear, the destination operand is set (%11111111).  Otherwise, the destination operand is cleared (%00000000).

Examples

This is based on whether or not overflow occurred:

 cmpi.w    #\$0020,d0           svc.b     d1

We’ll pretend d0 contains 2400801E, the CMP is word, so only the 801E is taken into account.  801E - 0020 = 7FFE.  Since we’re subtracting from a negative value, the result is suppose to be negative.  But, since the result has turned positive, we have an impossible result (i.e. overflow).  The V flag has been set.

• If the V flag is set, the SVC instruction will set d1 as 00000000.
• If the V flag is cleared, the SVC instruction will set d1 as 000000FF.

The SVS Instruction

SVS – Set on oVerflow Set

If the V flag of the CCR is set, the destination operand is set (%11111111).  Otherwise, the destination operand is cleared (%00000000).

Examples

This is the opposite of SVC:

 cmpi.w    #\$0020,d0           svs.b     d1

Again, using the same example, with d0 containing 2400801E.  801E - 0020 = 7FFE, the result is impossible, overflow has occurred.  The V flag is set.

• If the V flag is set, the SVS instruction will set d1 as 000000FF.
• If the V flag is cleared, the SVS instruction will set d1 as 00000000.

The ST & SF Instructions

These two will automatically set (%11111111) and clear (%00000000) the destination operand regardless of the CCR conditions.  These two are not conditional based instructions, but they still belong to the S## area of functionality.

The ST Instruction

ST – Set on True

The destination operand is set as true (%11111111).  No CCR flags are changed by this instruction.

Example

 st.b d1

If d1 contained 01234567, then after this instruction, d1 will contain 012345FF.

The SF Instruction

SF – Set on False

The destination operand is cleared as false (%00000000).  No CCR flags are changed by this instruction.

Example

 sf.b d1

If d1 contained 01234567, then after this instruction, d1 will contain 01234500.