setf


Sets flag condition.

[Syntax]

-

setf imm4, reg

-

setfcnd reg

 

The following can be specified for imm4:

-

Absolute expression having a value up to 4 bits

[Function]

-

Syntax "setf imm4, reg"

Compares the status of the flag specified by the value of the lower 4 bits of the absolute expression specified by the first operand with the current flag condition. If they are found to match, 1 is stored in the register specified by the second operand; otherwise, 0 is stored in the register specified by the second operand.

-

Syntax "setfcnd reg"

Compares the status of the flag indicated by string cnd with the current flag condition. If they are found to match, 1 is stored in the register specified by the second operand; otherwise, 0 is stored in the register specified by the second operand.

[Description]

-

If the instruction is executed in syntax"setf imm4, reg",the assembler generates one satf machine instruction.

-

If the instruction is executed in syntax "setfcnd reg", the assembler generates the corresponding setf instruction (see "Table 5.31 setfcnd Instruction List") and expands it to syntax "setf imm4, reg".

Table 5.31

setfcnd Instruction List

Instruction

Flag Condition

Meaning of Flag Condition

Instruction Conversion

setfgt

( (S xor OV) or Z) = 0

Greater than (signed)

setf 0xF
setfge

(S xor OV) = 0

Greater than or equal (signed)

setf 0xE
setflt

(S xor OV) = 1

Less than (signed)

setf 0x6
setfle

( (S xor OV) or Z) = 1

Less than or equal (signed)

setf 0x7
setfh

(CY or Z) = 0

Higher (Greater than)

setf 0xB
setfnl

CY = 0

Not lower (Greater than or equal)

setf 0x9
setfl

CY = 1

Lower (Less than)

setf 0x1
setfnh

(CY or Z) = 1

Not higher (Less than or equal)

setf 0x3
setfe

Z = 1

Equal

setf 0x2
setfne

Z = 0

Not equal

setf 0xA
setfv

OV = 1

Overflow

setf 0x0
setfnv

OV = 0

No overflow

setf 0x8
setfn

S = 1

Negative

setf 0x4
setfp

S = 0

Positive

setf 0xC
setfc

CY = 1

Carry

setf 0x1
setfnc

CY = 0

No carry

setf 0x9
setfz

Z = 1

Zero

setf 0x2
setfnz

Z = 0

Not zero

setf 0xA
setft

always 1

Always 1

setf 0x5
setfsa

SAT = 1

Saturated

setf 0xD

[Flag]

CY

---

OV

---

S

---

Z

---

SAT

---

[Caution]

-

If an absolute expression having a value exceeding 4 bits is specified as imm4 of the setf instruction, the assembler outputs the following message and continues assembling using four low-order bits of a specified value.

W0550011: illegal operand (range error in immediate).