5.1.4 Coding of Operation

-

Format

mnemonic [size specifier (branch distance specifier)]

-

Description

An instruction consists of the following two elements.

(1) Mnemonic: Specifies the operation of the instruction.

(2) Size specifier: Specifies the size of the data which undergoes the operation.

(1)

Mnemonic

A mnemonic specifies the operation of the instruction.

Example:
MOV: Transfer instruction
ADD: Arithmetic instruction (addition instruction)

(2)

Size Specifier

A size specifier specifies the size of the operand(s) in the instruction code.

-

Format

.size

-

Description

A size specifier specifies the operation size of the operand(s). More exactly, it specifies the size of data to be read to execute the instruction. The following can be specified as size.

Table 5.2

Size Specifiers

size

Description

B

Byte (8 bits)

W

Word (16 bits)

L

Longword (32 bits)

A size specifier can be written in either uppercase or lowercase.

Example: MOV.B #0, R3 ... Specifies the byte size.

Size specifiers can be and must be used for the instructions whose mnemonics are suffixed with ".size" in the Instruction Format description of the RX Family Software Manual.

(3)

Branch Distance Specifier

Branch distance specifiers are used in branch and relative subroutine branch instructions.

-

Format

.length

-

Description

The following can be specified as length.

Table 5.3

Branch Distance Specifiers

length

Description

 

S

3-bit PC forward relative

(+3 to +10)

B

8-bit PC relative

(128 to +127)

W

16-bit PC relative

(32768 to +32767)

A

24-bit PC relative

(8388608 to +8388607)

L

Register relative

(2147483648 to +2147183647)

A distance specifier can be written either in uppercase or lowercase.

Examples:

BRA.W label ... Specifies 16-bit relative.

BRA.L R1 ... Specifies register relative.

This specifier can be omitted. When the specifier is omitted, the assembler automatically selects the distance from among S, B, W, and A to generate the smallest opcode when the following conditions are all satisfied.

(1) The operand is not a register.

(2) The operand specifies the destination for which the branch distance is determined at assembly.

Examples: Label + value determined at assembly

Label - value determined at assembly

Value determined at assembly + label

(3) The label of the operand is defined within the same section.

Note that when a register is specified as the operand, branch distance specifier L is selected.

For a conditional branch instruction, if the branch distance is beyond the allowed range, a code is generated by inverting the branch condition.

The following shows the branch distance specifiers that can be used in each instruction.

Table 5.4

Branch Distance Specifiers for Each Branch Instruction

Instruction

.S

.B

.W

.A

.L

BCnd

(Cnd = EQ/Z)

Allowed

Allowed

Allowed

(Cnd = NE/NZ)

Allowed

Allowed

Allowed

(Cnd = others)

Allowed

BRA

Allowed

Allowed

Allowed

Allowed

Allowed

BSR

Allowed

Allowed

Allowed