Crossware

Table of Contents        Previous topic       Next topic       

ASSEMBLER DIRECTIVES->Other Assembler Directives->COMMON

COMMON    Specify common section

The COMMON directive causes the statements following it to be relocatably assembled into the named common section.  This directive remains in effect until another absolute or relocatable section is specified.

Only data and romable data can be common.  As a common section, the data space will be shared by other data using a common section.

The formats for the directive are:
    
[label]COMMON[.S]<section name>[,type][,relocation type]
COMMON[.S]<section number>[,type][,relocation type]
[label]COMMON[.S]<section number>[,type][,relocation type]

<section name> can be any valid section name.
<section number> consists of up to two decimal characters.

type can be

    'D' or 'DATA' to specify data space or
    'R' or 'ROMABLEDATA' to specify romable data space.

The default type is DATA.

If <section name> is used, the optional label takes the value of the program counter in the usual way.

If <section number> is used without a label, the name of the section is the same as <section number>.

If <section number> is used with a label, the name of the section is constructed from the <section number> and the label by appending the label name to <section number>.  For instance if the label is 'cdata' and <section number> is '23', the section name becomes '23cdata'.

The optional .S can be used to force the linker to place the section in data space accessible with 8 bit addressing (ie below address 0FFH).

Once a section name has been used for a COMMON directive, it can only be re-used with another COMMON directive.  The attributes (alignment, type, etc.) used must be identical to the first usage.  When the COMMON directive is repeated with the same section name as before in the same module, the program counter is reset to the current value for this named section.  It is therefore possible to alternate between named sections - the assembler will keep track of each of them.

<relocation type> is one of the following:
    
'P' or 'POSTPONE'This specifies that the segment should be relocated to an address higher than all other segments in the same address space except segments with the relocation type HIGH.  This type is only valid in data segments.  Typically this should be used for the heap segment which grows upwards during run time.
'H' or 'HIGH'This specifies that the segment should be relocated as high as possible in the available address space.  This type is only valid in data segments. Typically this should be used for the stack segment which grows downwards during run time.
'I' or 'INPAGE'This specifies that the segment should be relocated into a single page of memory.  Segments must have this relocation type if they are to be addressed using the direct addressing mode.  See section  for an example of the use of this relocation type.