RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
PCOS::CMDFormat::MemoryBlock Class Reference

Represents a block of data in the file, also an end-of-block object is an instance of this type. More...

#include <pcos.h>

Inheritance diagram for PCOS::CMDFormat::MemoryBlock:
PCOS::CMDFormat::LoadBlock PCOS::CMDFormat::RelocationBlock PCOS::CMDFormat::UnknownBlock

Public Types

enum  block_type : uint8_t { TYPE_LOAD = 3 , TYPE_OFFSET_RELOCATION = 4 , TYPE_SEGMENT_RELOCATION = 5 , TYPE_END = 6 }
 Every block has a type field. More...
 

Public Member Functions

virtual uint16_t GetLength () const
 The length of the block, not including the type and length fields.
 
virtual void ReadFile (Linker::Reader &rd, uint16_t length)
 Fills the contents of this object.
 
virtual void WriteFile (Linker::Writer &wr) const
 Writes the contents of the block to the file, including the type and length fields.
 
virtual std::unique_ptr< Dumper::RegionMakeRegion (std::string name, offset_t offset, unsigned display_width) const
 Creates a region for displaying the block contents.
 
virtual void AddFields (Dumper::Region &region, const CMDFormat &module) const
 Adds block specific fields.
 
virtual void DumpContents (Dumper::Dumper &dump, offset_t file_offset, const CMDFormat &module) const
 Display block specific contents.
 
void Dump (Dumper::Dumper &dump, offset_t file_offset, const CMDFormat &module) const
 Displays the entire block.
 
 MemoryBlock (int type)
 

Static Public Member Functions

static std::unique_ptr< MemoryBlockReadFile (Linker::Reader &rd)
 Parses a block, including the type and length fields.
 

Public Attributes

block_type type
 The type of the block.
 

Detailed Description

Represents a block of data in the file, also an end-of-block object is an instance of this type.

Member Enumeration Documentation

◆ block_type

Every block has a type field.

Enumerator
TYPE_LOAD 

A block of data to be loaded into memory.

TYPE_OFFSET_RELOCATION 

A sequence of fixups for 16-bit memory offsets.

TYPE_SEGMENT_RELOCATION 

A sequence of fixups for 16-bit memory segments.

TYPE_END 

Terminating block, must be the final one.

Member Function Documentation

◆ AddFields()

void CMDFormat::MemoryBlock::AddFields ( Dumper::Region & region,
const CMDFormat & module ) const
virtual

Adds block specific fields.

Reimplemented in PCOS::CMDFormat::LoadBlock, and PCOS::CMDFormat::RelocationBlock.

◆ DumpContents()

void CMDFormat::MemoryBlock::DumpContents ( Dumper::Dumper & dump,
offset_t file_offset,
const CMDFormat & module ) const
virtual

Display block specific contents.

Reimplemented in PCOS::CMDFormat::RelocationBlock.

◆ GetLength()

uint16_t CMDFormat::MemoryBlock::GetLength ( ) const
virtual

The length of the block, not including the type and length fields.

Reimplemented in PCOS::CMDFormat::LoadBlock, PCOS::CMDFormat::RelocationBlock, and PCOS::CMDFormat::UnknownBlock.

◆ MakeRegion()

std::unique_ptr< Dumper::Region > CMDFormat::MemoryBlock::MakeRegion ( std::string name,
offset_t offset,
unsigned display_width ) const
virtual

Creates a region for displaying the block contents.

Reimplemented in PCOS::CMDFormat::LoadBlock, and PCOS::CMDFormat::UnknownBlock.

◆ ReadFile()

void CMDFormat::MemoryBlock::ReadFile ( Linker::Reader & rd,
uint16_t length )
virtual

Fills the contents of this object.

Parameters
lengthThe number of bytes in the block, not including the type and length fields

Reimplemented in PCOS::CMDFormat::LoadBlock, PCOS::CMDFormat::RelocationBlock, and PCOS::CMDFormat::UnknownBlock.

◆ WriteFile()

void CMDFormat::MemoryBlock::WriteFile ( Linker::Writer & wr) const
virtual

Writes the contents of the block to the file, including the type and length fields.

Reimplemented in PCOS::CMDFormat::LoadBlock, PCOS::CMDFormat::RelocationBlock, and PCOS::CMDFormat::UnknownBlock.


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