5.2.4 Address Directives

These directives control address specifications in the assembler.

The assembler handles relocatable address values except for the addresses in absolute-addressing sections.

 

.ORG

This directive applies the absolute addressing mode to the section containing this directive.

[Format]

.ORGΔ<numeric value>

[Description]

This directive applies the absolute addressing mode to the section containing this directive.

All addresses in the section containing this directive are handled as absolute values.

This directive determines the address for storing the mnemonic code written in the line immediately after this directive.

It also determines the address of the memory area to be allocated by the area allocation directive written in the line immediately after this directive.

[Examples]

.SECTION value,ROMDATA

.ORG 0FF00H

.BYTE "abcdefghijklmnopqrstuvwxyz"

.ORG 0FF80H

.BYTE "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

.END

The following example will generate an error because .ORG is not written immediately after .SECTION.

.SECTION value,ROMDATA

.BYTE "abcdefghijklmnopqrstuvwxyz"

.ORG 0FF80H

.BYTE "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

.END

[Remarks]

When using this directive, be sure to place it immediately after a .SECTION directive.

When .ORG is not written immediately after .SECTION, the section is handled as a relative-addressing section.

Be sure to insert a space character or a tab between this directive and the operand.

The operand should be a value from 0 to 0FFFFFFFFH.

An expression or a symbol can be specified as the operand. Note that the value of the expression or symbol should be determined at assembly.

This directive must not be used in a relative-addressing section.

This directive can be used multiple times in an absolute-addressing section. Note that if the value specified as the operand is smaller than the address of the line where this directive is written, an error will be output.

This directive embeds 0 or more bytes that indicate disabling (03H) for the number of addresses preceding the location specified by the offset.

 

.OFFSET

This directive specifies an offset from the beginning of the section.

[Format]

OFFSETΔ<numeric value>

[Description]

This directive specifies an offset from the beginning of the section.

This directive determines the offset from the beginning of the section to the area that stores the mnemonic code written in the line immediately after this directive.

It also determines the offset from the beginning of the section to the memory area to be allocated by the area allocation directive written in the line immediately after this directive.

[Examples]

.SECTION value,ROMDATA

.BYTE "abcdefghijklmnopqrstuvwxyz"

.OFFSET 80H

.BYTE "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

.END

The following example will generate an error because the value specified in the second .OFFSET line is smaller than the offset to that line.

.SECTION value,ROMDATA

.OFFSET 80H

.BYTE "abcdefghijklmnopqrstuvwxyz"

.OFFSET 70H

.BYTE "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

.END

[Remarks]

Be sure to insert a space character or a tab between this directive and the operand.

The operand should be a value from 0 to 0FFFFFFFFH.

An expression or a symbol can be specified as the operand. Note that the value of the expression or symbol should be determined at assembly.

This directive must not be used in an absolute-addressing section.

This directive can be used multiple times in a relative-addressing section. Note that if the value specified as the operand is smaller than the offset to the line where this directive is written, an error will be output.

This directive embeds 0 or more bytes that indicate disabling (03H) for the number of addresses preceding the location specified by the offset.

 

.ENDIAN

This directive specifies the endian for the section containing this directive.

[Format]

.ENDIANΔBIG

.ENDIANΔLITTLE

[Description]

This directive specifies the endian for the section containing this directive.

When .ENDIAN BIG is written in a section, the byte order in the section is set to big endian.

When .ENDIAN LITTLE is written in a section, the byte order in the section is set to little endian.

When the directive is not written in a section, the byte order in the section depends on the -endian option setting.

[Examples]

.SECTION value,ROMDATA

.ORG 0FF00H

.ENDIAN BIG

.BYTE "abcdefghijklmnopqrstuvwxyz"

The following example will generate an error because .ENDIAN is not written immediately after .SECTION or .ORG.

.SECTION value,ROMDATA

.ORG 0FF00H

.BYTE "abcdefghijklmnopqrstuvwxyz"

.ENDIAN BIG

.BYTE "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

[Remarks]

Be sure to write this directive immediately after a .SECTION or .ORG directive.

Be sure to insert a space character or a tab between this directive and the operand.

This directive must not be used in CODE sections.

 

.BLKB

This directive allocates a RAM area with the size specified in 1-byte units

[Format]

Δ.BLKBΔ<operand>

Δ<label name:>Δ.BLKBΔ<operand>

[Description]

This directive allocates a RAM area with the size specified in 1-byte units.

A label name can be defined for the address of the allocated RAM area.

[Examples]

symbol .EQU 1

.SECTION area,DATA

work1: .BLKB 1

work2: .BLKB symbol

.BLKB symbol+1

[Remarks]

Be sure to write this directive in DATA sections. In section definition, write ",DATA" after a section name to specify a DATA section.

Be sure to insert a space character or a tab between this directive and the operand.

A numeric value, a symbol, or an expression can be specified as the operand.

The operand value should be determined at assembly.

Write a label name before this directive to define the label name for the allocated area.

Be sure to append a colon (:) to the label name.

The maximum value that can be specified for the operand is 7FFFFFFFH.

 

.BLKW

This directive allocates 2-byte RAM areas for the specified number.

[Format]

Δ.BLKWΔ<operand>

Δ<label name:>Δ.BLKWΔ<operand>

[Description]

This directive allocates 2-byte RAM areas for the specified number.

A label name can be defined for the address of the allocated RAM area.

[Examples]

symbol .EQU 1

.SECTION area,DATA

work1: .BLKW 1

work2: .BLKW symbol

.BLKW symbol+1

[Remarks]

Be sure to write this directive in DATA sections. In section definition, write ",DATA" after a section name to specify a DATA section.

Be sure to insert a space character or a tab between this directive and the operand.

A numeric value, a symbol, or an expression can be specified as the operand.

The operand value should be determined at assembly.

Write a label name before this directive to define the label name for the allocated area.

Be sure to append a colon (:) to the label name.

The maximum value that can be specified for the operand is 3FFFFFFFH.

 

.BLKL

This directive allocates 4-byte RAM areas for the specified number.

[Format]

Δ.BLKLΔ<operand>

Δ<label name:>Δ.BLKLΔ<operand>

[Description]

This directive allocates 4-byte RAM areas for the specified number.

A label name can be defined for the address of the allocated RAM area.

[Examples]

symbol .EQU 1

.SECTION area,DATA

work1: .BLKL 1

work2: .BLKL symbol

.BLKL symbol+1

[Remarks]

Be sure to write this directive in DATA sections. In section definition, write ",DATA" after a section name to specify a DATA section.

Be sure to insert a space character or a tab between this directive and the operand.

A numeric value, a symbol, or an expression can be specified as the operand.

The operand value should be determined at assembly.

Write a label name before this directive to define the label name for the allocated area.

Be sure to append a colon (:) to the label name.

The maximum value that can be specified for the operand is 1FFFFFFFH.

 

.BLKD

This directive allocates 8-byte RAM areas for the specified number.

[Format]

Δ.BLKDΔ<operand>

Δ<label name:>Δ.BLKDΔ<operand>

[Description]

This directive allocates 8-byte RAM areas for the specified number.

A label name can be defined for the address of the allocated RAM area.

[Examples]

symbol .EQU 1

.SECTION area,DATA

work1: .BLKD 1

work2: .BLKD symbol

.BLKD symbol+1

[Remarks]

Be sure to write this directive in DATA sections. In section definition, write ",DATA" after a section name to specify a DATA section.

Be sure to insert a space character or a tab between this directive and the operand.

A numeric value, a symbol, or an expression can be specified as the operand.

The operand value should be determined at assembly.

Write a label name before this directive to define the label name for the allocated area.

Be sure to append a colon (:) to the label name.

The maximum value that can be specified for the operand is 0FFFFFFFH.

 

.BYTE

This directive stores 1-byte fixed data in ROM.

[Format]

Δ.BYTEΔ<operand>

Δ<label name:>Δ.BYTEΔ<operand>

[Description]

This directive stores 1-byte fixed data in ROM.

A label name can be defined for the address of the area for storing the data.

[Examples]

<When endian=little is specified>

.SECTION value,ROMDATA

.BYTE 1

.BYTE "data"

.BYTE symbol

.BYTE symbol+1

.BYTE 1,2,3,4,5

.END

<When endian=big is specified>

.SECTION program,CODE,ALIGN=4

MOV.L R1,R2

.ALIGN 4

.BYTE 080H,00H,00H,00H

.END

[Remarks]

Be sure to use this directive in a ROMDATA section. To specify attribute ROMDATA for a section, add ,ROMDATA after the section name when defining the section.

Be sure to insert a space character or a tab between this directive and the operand.

A numeric value, a symbol, or an expression can be specified as the operand.

To specify a character or a string for the operand, enclose it within single-quotes (') or double-quotes ("). In this case, the ASCII code for the specified characters is stored.

Write a label name before this directive to define the label name for the area storing the data.

Be sure to append a colon (:) to the label name.

When the endian=big option is specified, this directive can be used only in the sections that satisfy the following conditions. An error will be output if this directive is used in a section that does not satisfy the conditions.

 

(1) ROMDATA section

.SECTION data,ROMDATA

(2) Relative-addressing CODE section for which the address alignment value is set to 4 or 8 in section definition

.SECTION program,CODE,ALIGN=4

(3) Absolute-addressing CODE section

.SECTION program,CODE

.ORG 0fff00000H

To use a .BYTE directive in a CODE section while the endian=big option is specified, be sure to write an address correction directive (.ALIGN 4) in the line immediately before the .BYTE directive so that the data is aligned to a 4-byte boundary. If this address correction directive is not written, the assembler outputs a warning message and automatically aligns the data to a 4-byte boundary.

When the endian=big option is specified, the data area size in a CODE section must be specified to become a multiple of 4. If the data area size in a CODE section is not a multiple of 4, the assembler outputs a warning message and writes NOP (0x03) to make the data area size become a multiple of 4.

 

.WORD

This directive stores 2-byte fixed data in ROM.

[Format]

Δ.WORDΔ<operand>

Δ<label name:>Δ.WORDΔ<operand>

[Description]

This directive stores 2-byte fixed data in ROM.

A label name can be defined for the address of the area for storing the data.

[Examples]

.SECTION value,ROMDATA

.WORD 1

.WORD symbol

.WORD symbol+1

.WORD 1,2,3,4,5

.END

[Remarks]

Be sure to use this directive in a ROMDATA section. To specify attribute ROMDATA for a section, add ,ROMDATA after the section name when defining the section.

Be sure to insert a space character or a tab between this directive and the operand.

A numeric value, a symbol, or an expression can be specified as the operand.

Neither a character nor a string can be specified for an operand.

Write a label name before this directive to define the label name for the area storing the data.

Be sure to append a colon (:) to the label name.

 

.LWORD

This directive stores 4-byte fixed data in ROM.

[Format]

Δ.LWORDΔ<operand>

Δ<label name:>Δ.LWORDΔ<operand>

[Description]

This directive stores 4-byte fixed data in ROM.

A label name can be defined for the address of the area for storing the data.

.SECTION value,ROMDATA

.LWORD 1

.LWORD symbol

.LWORD symbol+1

.LWORD 1,2,3,4,5

.END

[Remarks]

Be sure to use this directive in a ROMDATA section. To specify attribute ROMDATA for a section, add ,ROMDATA after the section name when defining the section.

Be sure to insert a space character or a tab between this directive and the operand.

A numeric value, a symbol, or an expression can be specified as the operand.

Neither a character nor a string can be specified for an operand.

Write a label name before this directive to define the label name for the area storing the data.

Be sure to append a colon (:) to the label name.

.FLOAT

This directive stores 4-byte fixed data in ROM.

[Format]

Δ.FLOATΔ<numeric value>

Δ<label name:>Δ.FLOATΔ<numeric value>

[Description]

This directive stores 4-byte fixed data in ROM.

A label name can be defined for the address of the area for storing the data.

[Examples]

.FLOAT 5E2

constant: .FLOAT 5e2

[Remarks]

Be sure to use this directive in a ROMDATA section. To specify attribute ROMDATA for a section, add ,ROMDATA after the section name when defining the section.

Specify a floating-point number as the operand.

Be sure to insert a space character or a tab between this directive and the operand.

Write a label name before this directive to define the label name for the area storing the data.

Be sure to append a colon (:) to the label name.

 

.DOUBLE

This directive stores 8-byte fixed data in ROM.

[Format]

Δ.DOUBLEΔ<numeric value>

Δ<label name:>Δ.DOUBLEΔ<numeric value>

[Description]

This directive stores 8-byte fixed data in ROM.

A label name can be defined for the address of the area for storing the data.

[Examples]

.DOUBLE 5E2

constant: .DOUBLE 5e2

[Remarks]

Be sure to use this directive in a ROMDATA section. To specify attribute ROMDATA for a section, add ,ROMDATA after the section name when defining the section.

Specify a floating-point number as the operand.

Be sure to insert a space character or a tab between this directive and the operand.

Write a label name before this directive to define the label name for the area storing the data.

Be sure to append a colon (:) to the label name.

 

.ALIGN

This directive corrects the address for storing the code written in the line immediately after this directive to a multiple of two, four, or eight bytes.

[Format]

Δ.ALIGNΔ<alignment value>

<alignment value>: [2|4|8]

[Description]

This directive corrects the address for storing the code written in the line immediately after this directive to a multiple of two, four, or eight bytes.

In a CODE or ROMDATA section, NOP code (03H) is written to the empty space generated as a result of address correction.

In a DATA section, only address correction is performed.

[Examples]

.SECTION program,CODE,ALIGN=4

MOV.L R1, R2

.ALIGN 4 ; Corrects the address to a multiple of 4

RTS

.END

[Remarks]

This directive can be used in the sections that satisfy the following conditions.

 

(1) Relative-addressing section for which address correction is specified in section definition

.SECTION program,CODE,ALIGN=4

(2) Absolute-addressing section

.SECTION program,CODE

.ORG 0fff00000H

A warning message will be output if this directive is used for a relative-addressing section in which ALIGN is not specified in the .SECTION directive line.

A warning message will be output if the specified value is larger than the boundary alignment value specified for the section.