The Linker memory space may be partitioned into several segments. The Compiler allows attributing a certain segment name to certain global variables or functions, which the Linker then allocates into that segment. An entry in the Linker parameter file determines where that segment actually lies.
Three pragmas specify code segments and data segments:
#pragma DATA_SEG [__SHORT_SEG] <name>
#pragma CONST_SEG [__LINEAR_SEG] <name>
#pragma STRING_SEG [__LINEAR_SEG] <name>
All remain valid until the Compiler encounters the next pragma of the same kind. Unless you specify different segments, the Compiler assumes two default segments named DEFAULT_ROM (the default code segment) and DEFAULT_RAM (the default data segment). To explicitly set these default segments as the current segments, use the segment name DEFAULT ():
#pragma CODE_SEG DEFAULT #pragma DATA_SEG DEFAULT
The additional keyword __SHORT_SEG informs the Compiler that a data segment is allocated in the zero page (address range from 0x0000 to 0x00FF):
#pragma DATA_SEG __SHORT_SEG <segment_name>
or
#pragma DATA_SEG __SHORT_SEG DEFAULT
Using the zero page enables the Compiler to generate much denser code because it uses DIRECT addressing mode instead of EXTENDED.