.cseg


Indicate to the assembler the start of a code section.

[Syntax]

Symbol field

Mnemonic field

Operand field

Comment field

[section-name]
.cseg
[relocation-attribute]
[; comment]

[Function]

-

The .cseg directive indicates to the assembler the start of a code section.

-

All instructions described following the .cseg directive belong to the code section until it comes across a section definition directives.

[Use]

-

The .cseg directive is used to describe instructions, .db, .dw directives, etc. in the code section defined by the .cseg directive.

-

Description of one functional unit such as a subroutine should be defined as a single code section.

[Description]

-

The start address of a code section can be specified with the .org directive.

-

A relocation attribute defines a range of location addresses for a code section.

Table 5.8

Relocation Attributes of .cseg

Relocation Attribute

Explanation

Default Section Name

Default Value of Alignment Condition

TEXT

Allocates the program.

.text

2

PCTEXT

[V1.07.00 or later]

Allocates position-independent programs.

.pctext

2

ZCONST

This section is for constant (read-only) data. It allocates a memory range (up to 32 Kbytes, in the positive direction from r0), referenced with 1 instruction using r0 and 16-bit displacement.

.zconst

4

ZCONST23

This section is for constant (read-only) data. It allocates a memory range (up to 4 Mbytes, in the positive direction from r0), referenced with 1 instruction using r0 and 23-bit displacement.

.zconst23

4

CONST

This section is for constant (read-only) data. It allocates a memory range (up to 4 Gbytes, in the positive direction from r0), referenced with 2 instructions using r0 and 32-bit displacement.

.const

4

PCCONST16

[V1.07.00 or later]

This section is for position-independent constant data (read-only). It allocates a memory range (up to ±32 Kbytes from __pc_data) referenced with 1 instruction using 16-bit displacement from the __pc_data symbol.

.pcconst16

4

PCCONST23

[V1.07.00 or later]

This section is for position-independent constant data (read-only). It allocates a memory range (up to ±4 Mbytes from __pc_data) referenced with 1 instruction using 23-bit displacement from the __pc_data symbol.

.pcconst23

4

PCCONST32

[V1.07.00 or later]

This section is for position-independent constant data (read-only). It allocates a memory range referenced with 2 instructions using 32-bit displacement from the __pc_data symbol.

.pcconst32

4

 

-

An error will occur in any of the following cases.

-

When a relocation attribute other than those in "Table 5.8 Relocation Attributes of .cseg" is specified

-

If TEXT is specified when the -pic option has been specified

-

If PCTEXT is specified when the -pic option has not been specified

-

If CONST, ZCONST, or ZCONST23 is specified when the -pirod option has been specified

-

If PCCONST16, PCCONST23, or PCCONST32 is specified when the -pirod option has not been specified

-

The allocation section of instructions or data when no symbol definition directive has been written is the ".text” section if the -pic option has not been specified and the ".pctext” section if the -pic option has been specified.

-

By describing a section name in the symbol field of the .cseg directive, the code section can be named. If no section name is specified for a code section, the assembler will automatically give a default section name to the code section.
The default section names of the code sections are shown below.

-

The default section names have the relocation attributes shown above. Giving them any other attributes is not possible.

 

Example

test        .cseg   text
            nop
            nop

 

-

The following characters are usable in section names.

-

Alphanumeric characters (0-9, a-z, A-Z)

-

Special characters (@, _, .)