RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
DigitalResearch::CPM86Format::Descriptor Class Reference
module nullptr

A representation of segment group within the executable. More...

#include <cpm86.h>

Inheritance diagram for DigitalResearch::CPM86Format::Descriptor:
DigitalResearch::CPM86Format::FastLoadDescriptor DigitalResearch::CPM86Format::LibraryDescriptor

Public Types

enum  group_type {
  Undefined , Code = 1 , Data , Extra ,
  Stack , Auxiliary1 , Auxiliary2 , Auxiliary3 ,
  Auxiliary4 , SharedCode , Fixups = Auxiliary4 , FastLoad = 0xFE ,
  Libraries = 0xFF , ActualAuxiliary4 = 0x100 | Auxiliary4 , ActualFixups = 0x200 | Fixups
}
 Group type, stored as the first byte of the descriptor. More...
 

Public Member Functions

virtual void Clear ()
 
virtual uint16_t GetSizeParas (const CPM86Format &module) const
 Returns the size of the segment group in 16-byte paragraphs.
 
void ReadDescriptor (Linker::Reader &rd)
 
void WriteDescriptor (Linker::Writer &wr, const CPM86Format &module)
 
virtual void WriteData (Linker::Writer &wr, const CPM86Format &module)
 
std::string GetDefaultName ()
 
virtual void ReadData (Linker::Reader &rd, const CPM86Format &module)
 

Public Attributes

group_type type = Undefined
 The type of the group.
 
uint16_t size_paras = 0
 Size of the group, as stored on disk, in 16-byte paragraphs.
 
uint16_t load_segment = 0
 Load segment address of the group, or 0 if it can be relocated. Not to be used outside of system drivers.
 
uint16_t min_size_paras = 0
 Minimum required size of the group, when loaded into memory, in 16-byte paragraphs.
 
uint16_t max_size_paras = 0
 Maximum required size of the group, when loaded into memory, in 16-byte paragraphs.
 
uint32_t offset = 0
 Offset to image in file.
 
std::shared_ptr< Linker::Writableimage = nullptr
 The actual binary image of the group.
 
bool attach_zero_page = false
 Set to true if a supplementary 256 bytes of zeros are required. When generating image, it is easier to just insert 256 bytes of 0 instead of modifying the image. This is not required when storing a file loaded from disk.
 

Detailed Description

A representation of segment group within the executable.

CMD files begin with up to 8 9-byte group descriptors (with two special group descriptors following for FlexOS 286) that identify segment groups within the file. Each segment group has a type (code, data, stack, etc.), a size of stored data, a minimum and maximum memory requirement, as well an optional loading address, all of which are expressed in paragraphs (16-byte units). The UNIX text, data, bss segments are usually stored as a single code and data segment, with the data segment containing the bss as part of its minimum memory requirement.

Aside from the typical segment groups, some system versions (particularly FlexOS 286) support certain specialized segment groups. Relocations are usually stored in the file at a 128-byte boundary, but their presence can be represented as a special segment group.

Another specialized segment group allows executables to reference shared runtime libraries. The segment descriptor is stored at a special offset, and the segment group stores a sequence of library identifiers (name, version, flags), together with a number of relocations referencing the segment base of the shared library.

It is also possible to include a segment group for faster loading, however this is not yet fully supported.

Member Enumeration Documentation

◆ group_type

Group type, stored as the first byte of the descriptor.

Enumerator
Undefined 

This group type is not the type of an actual group. Instead, it signals the end of the group descriptor table.

Code 

A group containing executable instructions, the starting segment will be loaded into CS. Unlike SharedCode, this segment cannot be shared between different instances.

Data 

A group containing data, the starting segment will be loaded into DS.

Extra 

A group containing data, the starting semgnet will be loaded into ES.

Stack 

A group describing the stack data. Unlike the other associated segments, SS does not point to it at the start of code execution.

Auxiliary1 

A group containing data.

Auxiliary2 

A group containing data.

Auxiliary3 

A group containing data.

Auxiliary4 

A group containing data. The group type was later repurposed to represent the relocations in a file. This can refer to either.

SharedCode 

A group containing executable instructions, the starting segment will be loaded into CS. This segment can be shared between different instances.

Fixups 

(FlexOS 286 only) The group containing the relocations. Not required, since the offset to the relocations is also stored at offset 0x7D in the header, in 128-byte units

FastLoad 

(FlexOS 286 only) The fast load group descriptor is stored at offset 0x51 in the header, and the group data appears before the other groups. Not implemented, no documentation

Libraries 

(FlexOS 286 only) The shared runtime library group descriptor is stored at offset 0x48 in the header, and the group data appears before the other groups. Not tested

ActualAuxiliary4 

A group containing data, used when it is clear this is an auxiliary group.

ActualFixups 

(FlexOS 286 only) The group containing the relocations, used when it is clear this is a fixup group

Member Function Documentation

◆ GetSizeParas()

uint16_t CPM86Format::Descriptor::GetSizeParas ( const CPM86Format & module) const
virtual

Returns the size of the segment group in 16-byte paragraphs.

Reimplemented in DigitalResearch::CPM86Format::LibraryDescriptor, and DigitalResearch::CPM86Format::FastLoadDescriptor.

Member Data Documentation

◆ offset

uint32_t DigitalResearch::CPM86Format::Descriptor::offset = 0

Offset to image in file.

This value is not actually stored on disk. Instead, it can be determined from the lengths of the segments preceding it in the descriptor arrays. The first group is stored at offset 0x80, the next one at the paragraph boundary, and so on.


The documentation for this class was generated from the following files: