BMCnd

Conditional bit transfer

BMCnd

Bit Move Conditional


[Syntax]

BMCnd src, dest

 

[Operation]

(1)When dest is a memory location:

unsigned char dest;

if ( Cnd )

dest |= ( 1 << ( src & 7 ));

else

dest &= ~( 1 << ( src & 7 ));

 

(2)When dest is a register:

register unsigned long dest;

if ( Cnd )

dest |= ( 1 << ( src & 31 ));

else

dest &= ~( 1 << ( src & 31 ));

 

 

[Function]

-

This instruction moves the truth-value of the condition specified by Cnd to the bit of dest, which is specified by src; that is, 1 or 0 is transferred to the bit if the condition is true or false, respectively.

-

The following table lists the types of BMCnd.

BCnd

 

Condition

Expression

BMGEU,

BMC

C == 1

Equal to or greater than/C flag is 1

<=

BMEQ,

BMZ

Z == 1

Equal to/Z flag is 1

=

BMGTU

(C & ~Z) == 1

Greater than

<

BMPZ

S == 0

Positive or zero

> 0

BMGE

(S ^ O) == 0

Equal to or greater than as signed integer

<=

BMGT

((S ^ O) |Z) == 0

Greater than as signed integer

<

BMO

O == 1

O flag is 1

 

BMLTU,

BMNC

C == 0

Less than/C flag is 0

<=

BMNE,

BMNZ

Z == 0

Not equal to/Z flag is 0

 

BMLEU

(C & ~Z) == 0

Equal to or less than

 

BMN

S == 1

Negative

0>

BMLE

((S ^ O) |Z) == 1

Equal to or less than as signed integer

>=

BMLT

(S ^ O) == 1

Less than as signed integer

>

BMNO

O == 0

O flag is 0

 

-

The immediate value given as src is the number (position) of the bit.

-

The range for IMM:3 operands is 0 ? IMM:3 ? 7. The range for IMM:5 is 0 ? IMM:5 ? 31.

 

[Instruction Format]

Syntax

Processng Size

src

dest

Code size

(Byte)

BMCnd src, dest

B

#IMM:3

[Rd].B

3

B

#IMM:3

dsp:8[Rd].B

4

B

#IMM:3

dsp16[Rd].B

5

L

#IMM:5

Rd

3

[Flag Change]

This instruction does not affect the states of flags.

 

[Description Example]

BMC #7, [R2]

BMZ #31, R2