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

Classes

class  DataRecord
 Represents a CONST or LCONST record, containing a sequence of bytes. More...
 
class  EntryRecord
 Represents an ENTRY record. More...
 
class  Expression
 
class  ExpressionRecord
 Represents an EXPR, ZEXPR, BEXPR or LEXPR record. More...
 
class  IntersegmentRelocationRecord
 Represents an INTERSEG or cINTERSEG record, containing an intersegment relocation. More...
 
class  LabelExpressionRecord
 Represents an EQU or GEQU record. More...
 
class  LabelRecord
 Represents a LOCAL or GLOBAL record. More...
 
class  RangeRecord
 Represents a MEM record. More...
 
class  Record
 A single record inside the segment body, also represents an END record. More...
 
class  RelativeExpressionRecord
 Represents a RELEXPR record. More...
 
class  RelocationRecord
 Represents a RELOC or cRELOC record, containing an intrasegment relocation. More...
 
class  StringRecord
 Represents a USING or STRONG record, containing a string. More...
 
class  SuperCompactRecord
 Represents a SUPER record. More...
 
class  ValueRecord
 Represents an ALIGN, ORG or DS record, containing an integer. More...
 

Public Types

enum  segment_kind {
  SEG_CODE = 0x00 , SEG_DATA = 0x01 , SEG_JUMPTABLE = 0x02 , SEG_PATHNAME = 0x04 ,
  SEG_LIBDICT = 0x08 , SEG_INIT = 0x10 , SEG_ABSBANK = 0x11 , SEG_DIRPAGE = 0x12
}
 
enum  omf_version { OMF_VERSION_0 = 0x0000 , OMF_VERSION_1 = 0x0100 , OMF_VERSION_2 = 0x0200 , OMF_VERSION_2_1 = 0x0201 }
 

Public Member Functions

::EndianType GetEndianType () const
 
offset_t ReadUnsigned (Linker::Reader &rd) const
 Reads a number the size of number_length.
 
void WriteWord (Linker::Writer &wr, offset_t value) const
 Writes a number the size of number_length.
 
std::string ReadLabel (Linker::Reader &rd) const
 Reads a string the size of label_length, or variable length if it is 0.
 
void WriteLabel (Linker::Writer &wr, std::string text) const
 Writes a string the size of label_length, or variable length if it is 0.
 
offset_t CalculateValues (uint16_t segment_number, offset_t current_offset)
 Calculates the values needed to generate segment images.
 
void ReadFile (Linker::Reader &rd)
 
void WriteFile (Linker::Writer &wr) const
 
void Dump (Dumper::Dumper &dump, const OMFFormat &omf, unsigned segment_index) const
 
size_t ReadData (size_t bytes, offset_t offset, void *buffer) const
 
offset_t ReadUnsigned (size_t bytes, offset_t offset) const
 
std::unique_ptr< ExpressionReadExpression (Linker::Reader &rd)
 
std::unique_ptr< RecordReadRecord (Linker::Reader &rd)
 
std::unique_ptr< RecordmakeEND ()
 
std::unique_ptr< RecordmakeCONST (std::shared_ptr< Linker::Image > image)
 
std::unique_ptr< RecordmakeCONST (size_t length)
 
std::unique_ptr< RecordmakeALIGN (offset_t align=0)
 
std::unique_ptr< RecordmakeORG (offset_t value=0)
 
std::unique_ptr< RecordmakeRELOC (uint8_t size, uint8_t shift, offset_t source, offset_t target)
 
std::unique_ptr< RecordmakeRELOC ()
 
std::unique_ptr< RecordmakeINTERSEG (uint8_t size, uint8_t shift, offset_t source, uint16_t file_number, uint16_t segment_number, offset_t target)
 
std::unique_ptr< RecordmakeINTERSEG ()
 
std::unique_ptr< RecordmakeUSING (std::string name="")
 
std::unique_ptr< RecordmakeSTRONG (std::string name="")
 
std::unique_ptr< RecordmakeGLOBAL ()
 
std::unique_ptr< RecordmakeGLOBAL (std::string name, uint16_t line_length, int operation, uint16_t private_flag)
 
std::unique_ptr< RecordmakeGEQU ()
 
std::unique_ptr< RecordmakeGEQU (std::string name, uint16_t line_length, int operation, uint16_t private_flag, std::unique_ptr< Expression > expression)
 
std::unique_ptr< RecordmakeMEM ()
 
std::unique_ptr< RecordmakeMEM (offset_t start, offset_t end)
 
std::unique_ptr< RecordmakeEXPR ()
 
std::unique_ptr< RecordmakeEXPR (uint8_t size, std::unique_ptr< Expression > expression)
 
std::unique_ptr< RecordmakeZEXPR ()
 
std::unique_ptr< RecordmakeZEXPR (uint8_t size, std::unique_ptr< Expression > expression)
 
std::unique_ptr< RecordmakeBEXPR ()
 
std::unique_ptr< RecordmakeBEXPR (uint8_t size, std::unique_ptr< Expression > expression)
 
std::unique_ptr< RecordmakeRELEXPR ()
 
std::unique_ptr< RecordmakeRELEXPR (uint8_t size, offset_t origin, std::unique_ptr< Expression > expression)
 
std::unique_ptr< RecordmakeLOCAL ()
 
std::unique_ptr< RecordmakeLOCAL (std::string name, uint16_t line_length, int operation, uint16_t private_flag)
 
std::unique_ptr< RecordmakeEQU ()
 
std::unique_ptr< RecordmakeEQU (std::string name, uint16_t line_length, int operation, uint16_t private_flag, std::unique_ptr< Expression > expression)
 
std::unique_ptr< RecordmakeDS (offset_t count=0)
 
std::unique_ptr< RecordmakeLCONST ()
 
std::unique_ptr< RecordmakeLCONST (std::shared_ptr< Linker::Image > image)
 
std::unique_ptr< RecordmakeLEXPR ()
 
std::unique_ptr< RecordmakeLEXPR (uint8_t size, std::unique_ptr< Expression > expression)
 
std::unique_ptr< RecordmakeENTRY ()
 
std::unique_ptr< RecordmakeENTRY (uint16_t segment_number, offset_t location, std::string name)
 
std::unique_ptr< RecordmakecRELOC (uint8_t size, uint8_t shift, uint16_t source, uint16_t target)
 
std::unique_ptr< RecordmakecRELOC ()
 
std::unique_ptr< RecordmakecINTERSEG (uint8_t size, uint8_t shift, uint16_t source, uint16_t segment_number, uint16_t target)
 
std::unique_ptr< RecordmakecINTERSEG ()
 
std::unique_ptr< RecordmakeSUPER (SuperCompactRecord::super_record_type super_type=SuperCompactRecord::super_record_type(0))
 

Public Attributes

offset_t segment_offset = 0
 Offset of segment within file.
 
offset_t total_segment_size = 0
 (BYTECNT/BLKCNT) Total size of the segment, including the header, as stored in file
 
offset_t bss_size = 0
 (RESSPC) Additional zeroes to append to segment
 
offset_t total_size = 0
 (LENGTH) Total size of segment when loaded into memory, including the additional zeroes
 
segment_kind kind = SEG_CODE
 (KIND) Segment type
 
uint16_t flags = 0
 (KIND) Segment flags
 
uint8_t label_length = 0
 (LABLEN) Label length, or 0 for variable length labels
 
uint8_t number_length = 4
 (NUMLEN) Number length, must be 4
 
omf_version version = OMF_VERSION_2
 (VERSION, REVISION) OMF file format version
 
offset_t bank_size = 0
 (BANKSIZE) Maximum bank size of segment
 
offset_t base_address = 0
 (ORG) Base address of segment
 
offset_t align = 0x100
 (ALIGN) Segment alignment
 
uint8_t endiantype = 0
 (NUMSEX) Endianness, must be 0 for LittleEndian
 
uint8_t language_card_bank = 0
 (LCBANK) Language card bank
 
uint16_t segment_number = 0
 (SEGNUM) Segment number (not present in version 0)
 
offset_t entry = 0
 (ENTRY) Entry point (not present in version 0)
 
offset_t segment_name_offset = 0x2C
 (DISPNAME) Offset to linker_segment_name (LOADNAME), (not present in version 0)
 
offset_t segment_data_offset = 0
 (DISPDATA) Offset to segment data, typically appearing after segment_name (not present in version 0)
 
offset_t temp_org = 0
 (tempOrg) (only version 2.1, optional)
 
std::string linker_segment_name
 (LOADNAME) Name of segment according to linker
 
std::string segment_name
 (LOADNAME) Name of segment
 
std::vector< std::unique_ptr< Record > > records
 

Static Public Attributes

static const uint16_t FLAG_BANK_RELATIVE = 0x0100
 Segment flag: Bank relative (version 2 only)
 
static const uint16_t FLAG_SKIP_SEGMENT = 0x0200
 Segment flag: Skip segment (version 2 only)
 
static const uint16_t FLAG_RELOAD = 0x0400
 Segment flag: Reload segment (version 2 only)
 
static const uint16_t FLAG_ABSOLUTE_BANK = 0x0800
 Segment flag: Absolute bank segment (version 2 only)
 
static const uint16_t FLAG_NO_SPECIAL_MEMORY = 0x1000
 Segment flag: Do not load in special memory (version 2 only)
 
static const uint16_t FLAG_POSITION_INDEPENDENT = 0x2000
 Segment flag: Position independent.
 
static const uint16_t FLAG_PRIVATE = 0x4000
 Segment flag: Private.
 
static const uint16_t FLAG_DYNAMIC = 0x8000
 Segment flag: Dynamic.
 

Member Enumeration Documentation

◆ segment_kind

Enumerator
SEG_CODE 

Code segment.

SEG_DATA 

Data segment.

SEG_JUMPTABLE 

Jump table segment.

SEG_PATHNAME 

Pathname segment.

SEG_LIBDICT 

Library dictionary segment.

SEG_INIT 

Initialization segment.

SEG_ABSBANK 

Absolute bank segment (version 1 only)

SEG_DIRPAGE 

Direct page/stack segment.

Member Function Documentation

◆ CalculateValues()

offset_t OMFFormat::Segment::CalculateValues ( uint16_t segment_number,
offset_t current_offset )

Calculates the values needed to generate segment images.

Parameters
segment_numberThe index of the current segment (1 based)
current_offsetOffset to current segment
Returns
Offset to end of segment

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