sbf


Subtracts on condition flag.

[Syntax]

-

sbf imm4, reg1, reg2, reg3

-

sbfcnd reg1, reg2, reg3

 

The following can be specified for imm4:

-

Absolute expression having a value up to 4 bits (0xD cannot be specified)

[Function]

-

Syntax "sbf imm4, reg1, reg2, reg3"

It compares the current flag condition with the flag condition indicated by the value of the lower 4 bits of the absolute expression (see "Table 5.29 sbfcnd Instruction List") specified by the first operand.

If the values match, subtracts the word data of the register specified by the second operand from the word data of the register specified by the third operand. And 1 is subtracted from the subtraction result and that result is stored in the register specified by the fourth operand.

If the values not match, subtracts the word data of the register specified by the second operand from the word data of the register specified by the third operand. And that result is stored in the register specified by the fourth operand.

-

Syntax "sbfcnd reg1, reg2, reg3"

It compares the current flag condition with the flag condition indicated by the string in the "cnd" part.

If the values match, subtracts the word data of the register specified by the first operand from the word data of the register specified by the second operand. And 1 is subtracted from the subtraction result and that result is stored in the register specified by the third operand.

If the values not match, subtracts the word data of the register specified by the first operand from the word data of the register specified by the second operand. And that result is stored in the register specified by the third operand.

[Description]

-

For the sbf instruction, the assembler generates one sbf machine instruction.

-

For the adcond instruction, the assembler generates the corresponding sbf instruction (see "Table 5.29 sbfcnd Instruction List") and converts it to syntax "sbf imm4, reg1, reg2, reg3".

Table 5.29

sbfcnd Instruction List

Instruction

Flag Condition

Meaning of Flag Condition

Instruction Conversion

sbfgt

( (S xor OV) or Z) = 0

Greater than (signed)

sbf 0xF
sbfge

(S xor OV) = 0

Greater than or equal (signed)

sbf 0xE
sbflt

(S xor OV) = 1

Less than (signed)

sbf 0x6
sbfle

( (S xor OV) or Z) = 1

Less than or equal (signed)

sbf 0x7
sbfh

(CY or Z) = 0

Higher (Greater than)

sbf 0xB
sbfnl

CY = 0

Not lower (Greater than or equal)

sbf 0x9
sbfl

CY = 1

Lower (Less than)

sbf 0x1
sbfnh

(CY or Z) = 1

Not higher (Less than or equal)

sbf 0x3
sbfe

Z = 1

Equal

sbf 0x2
sbfne

Z = 0

Not equal

sbf 0xA
sbfv

OV = 1

Overflow

sbf 0x0
sbfnv

OV = 0

No overflow

sbf 0x8
sbfn

S = 1

Negative

sbf 0x4
sbfp

S = 0

Positive

sbf 0xC
sbfc

CY = 1

Carry

sbf 0x1
sbfnc

CY = 0

No carry

sbf 0x9
sbfz

Z = 1

Zero

sbf 0x2
sbfnz

Z = 0

Not zero

sbf 0xA
sbft

always 1

Always 1

sbf 0x5

[Flag]

CY

1 if a borrow occurs from MSB (Most Significant Bit), 0 if not

OV

1 if overflow occurred, 0 if not

S

1 if the result is negative, 0 if not

Z

1 if the result is 0, 0 if not

SAT

---

[Caution]

-

If an absolute expression having a value exceeding 4 bits is specified as imm4 of the sbf instruction, the following message is output, and assembly continues using the lower 4 bits of the specified value.

W0550011 : illegal operand (range error in immediate).

 

-

If 0xD is specified as imm4 of the sbf instruction, the following message is output, and assembly is stopped.

E0550261 : illegal condition code.