RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
|
A representation of segment group within the executable. More...
#include <cpm86.h>
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::Writable > | image = 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. | |
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.
Group type, stored as the first byte of the descriptor.
|
virtual |
Returns the size of the segment group in 16-byte paragraphs.
Reimplemented in DigitalResearch::CPM86Format::LibraryDescriptor, and DigitalResearch::CPM86Format::FastLoadDescriptor.
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.