beautypg.com

Seg (segment control) – Echelon Neuron User Manual

Page 167

background image

SEG (Segment Control)

The SEG directive controls the currently open segment type. Any of the

supported segment types (including the one that is currently active) can be

selected. The active segment selection can be changed as needed.
The assembler groups assembly instructions and data blocks into one or more

segments. A segment is a group of assembly instructions and data blocks that are

assembled into consecutive bytes of machine instructions and data, at

consecutive and ascending addresses. The basic unit for the assembler is a

statement, but the basic unit for the linker is a segment. The linker relocates

code and data on a segment-by-segment basis.
During assembly:

One segment of each type is always open.

Additional code and data can be added only to an open segment.

Only one of the open segments is the currently active segment.

The next assembly instruction or data statement encountered in the

assembly file is added to the active segment.

The segment type does not affect the assembly of the source lines within it, but

does affect the linking of the segment.
The SEG directive does not cause additional segments to be opened, but instead

selects which of the open segments is active. When the assembler starts, it opens

an empty, relocatable segment of each type, and selects the ROM segment as the

active segment. Thus, the simplest assembly files need not use either a SEG or

ORG directive if only a single ROM segment is needed.
Typical assembly programs use SEG CODE for code and constant data, SEG

RAMFAR or RAMNEAR for RAM variables, and EEFAR or EENEAR for non-

volatile, persistent, variables.
See also ORG (Segment Control).
Syntax:
The SEG directive requires one argument for the type of segment that is being

made active. This directive cannot have a label.

SEG CODE

SEG EECODE

SEG EEFAR

SEG EENEAR

SEG INITCODE

SEG RAMCODE

SEG RAMFAR

SEG RAMNEAR

SEG ROM

SEG SIDATA

Segment type names can be specified in either lower or upper case. See Segments

for information about the segment types.

Neuron Assembly Language Reference

157