Section 07 Part 01 – The SEQ, SNE, SPL & SMI Instructions “Self-esteem is the greatest sickness known to man or woman because it's conditional." ~Albert Ellis

Introduction

The S## instructions coming up are pretty much the same as conditional branches, they perform an action based on the same sort of conditions.  The difference however, is that instead of branching, these instructions set or clear bits on the destination operand.

The SEQ Instruction

SEQ – Set on EQual

The Z (Zero) flag is tested, if true, the destination operand is set (%11111111), if false, the destination operand is cleared (%00000000).

Example

This is rather simple:

 tst.l     d0           seq.b     d1

The TST instruction will check d0 for zero, it's a long-word check.

• If d0 was 00000000, the Z flag would be set.  The SEQ instruction will set d1 as 000000FF.
• If d0 was NOT 00000000, the Z flag would be clear.  The SEQ instruction will set d1 as 00000000.

It couldn't be simpler.

The SNE Instruction

SNE – Set on Not Equal

The Z (Zero) flag is tested, if true, the destination operand is cleared (%00000000), if false, the destination operand is set (%11111111).

Example

 tst.l     d0           sne.b     d1

The TST instruction will check d0 for zero, it's a long-word check.

• If d0 was 00000000, the Z flag would be set.  The SNE instruction will set d1 as 00000000.
• If d0 was NOT 00000000, the Z flag would be clear.  The SNE instruction will set d1 as 000000FF.

It is pretty much the opposite of SEQ.

The SPL Instruction

SPL – Set on PLus

The N (Negative) flag is tested, if true, the destination operand is cleared (%00000000), if false, the destination operand is set (%11111111).

Example

 tst.b     d0           spl.b     d1

The TST instruction will check d0 for positive/negative, it's a byte check.

• If d0 was between 00 and 7F (Positive), the N flag would be clear.  The SPL instruction will set d1 as 000000FF.

·         If d0 was between 80 and FF (Negative), the N flag would be set.  The SPL instruction will set d1 as 00000000.

The SMI Instruction

SMI – Set on MInus

The N (Negative) flag is tested, if true, the destination operand is set (%11111111), if false, the destination operand is cleared (%00000000).

Example

 tst.b     d0           smi.b     d1

The TST instruction will check d0 for positive/negative, it's a byte check.

• If d0 was between 00 and 7F (Positive), the N flag would be clear.  The SMI instruction will set d1 as 00000000.
• If d0 was between 80 and FF (Negative), the N flag would be set.  The SMI instruction will set d1 as 000000FF.

It is the opposite of SPL.