.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.7

Relocation Attributes of .cseg

Relocation Attribute

Description Format

Explanation

Default Value of Alignment Condition

TEXT

TEXT

Allocates the program.

2

ZCONST

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 instructions using r0 and 16-bit displacement.

4

ZCONST23

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 instructions using r0 and 23-bit displacement.

4

CONST

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.

4

 

-

If there is a label or an instruction to output object code before a section definition directive, a relocatable code section is generated as the default section. The section name here will be ".text", and the relocation attribute will be "TEXT".

-

The assembler will output an error if a relocation attribute other than "Table 5.7 Relocation Attributes of .cseg" is 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.

Relocation Attribute

Default Section Name

TEXT

.text

ZCONST

.zconst

ZCONST23

.zconst23

CONST

.const

 

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

 

test        .cseg   text
            nop
            nop

 

-

The following characters are usable in section names.

-

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

-

Special characters (@, _, .)