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

This is not actually a file format, but an interface to permit generating multiple binary outputs for Apple ][ binaries. More...

#include <8bitexe.h>

Inheritance diagram for Binary::AppleDriver:
Binary::GSOutput Linker::OutputFormat Linker::Format Linker::Contents

Public Types

enum  header_format_t { HEADER_BIN , HEADER_DOS33 , HEADER_RAW }
 
- Public Types inherited from Binary::GSOutput
enum  target_format_t {
  TARGET_NONE , TARGET_DATA_FORK , TARGET_RESOURCE_FORK , TARGET_APPLE_SINGLE ,
  TARGET_APPLE_DOUBLE
}
 Represents the file type of the main file. More...
 
enum  produce_format_t { PRODUCE_RESOURCE_FORK = 1 << 0 , PRODUCE_APPLE_DOUBLE = 1 << 2 , PRODUCE_NAPS_SUFFIX = 1 << 4 }
 Represents what additional files should be generated. More...
 
enum  file_type_t : uint8_t {
  FILE_TYPE_BIN = 0x06 , FILE_TYPE_SOS = 0x0C , FILE_TYPE_S16 = 0xB3 , FILE_TYPE_EXE = 0xB5 ,
  FILE_TYPE_SYS = 0xFF
}
 

Public Member Functions

 AppleDriver (file_type_t file_type=FILE_TYPE_BIN, header_format_t header=HEADER_BIN)
 
 AppleDriver (file_type_t file_type, target_format_t target)
 
void ReadFile (Linker::Reader &rd) override
 Loads file into memory.
 
void GenerateFile (std::string filename, Linker::Module &module) override
 The main function that handles processing, calculating and generating the final image.
 
void Dump (Dumper::Dumper &dump) const override
 Display file contents in a nice manner.
 
uint8_t GetFileType () const
 
uint16_t GetAuxiliaryFileType () const
 
bool UseDOS33Header () const
 
std::string GetDefaultExtension (Linker::Module &module, std::string filename) const override
 Appends a default extension to the filename.
 
- Public Member Functions inherited from Binary::GSOutput
 GSOutput (target_format_t target=TARGET_DATA_FORK)
 
 GSOutput (target_format_t target, int produce)
 
bool AddSupplementaryOutputFormat (std::string subformat) override
 If the output format actually drives multiple output formats (resource file, apple double, etc.), specify multiple types, return false if unknown.
 
void GenerateFiles (std::string filename, std::shared_ptr< Contents > data_fork, std::shared_ptr< Contents > resource_fork, uint8_t file_type, uint16_t auxiliary_file_type)
 Tasked to create all the requested files.
 
void ReadFile (Linker::Reader &rd) override
 Loads file into memory.
 
offset_t WriteFile (Linker::Writer &wr) const override
 Stores data in memory to file.
 
void Dump (Dumper::Dumper &dump) const override
 Display file contents in a nice manner.
 
- Public Member Functions inherited from Linker::OutputFormat
virtual std::vector< OptionDescription< void > > GetMemoryModelNames ()
 Returns a list of the supported memory models, used for documentation.
 
virtual std::vector< OptionDescription< void > * > GetLinkerScriptParameterNames ()
 Returns a list of the parameters used in the linker scripts, used for documentation.
 
virtual std::vector< OptionDescription< void > > GetSpecialSymbolNames ()
 Returns a list of special symbol names recognized by the format, used for documentation.
 
virtual std::shared_ptr< OptionCollectorGetOptions ()
 Returns object containing a sequence of option fields provided with the -S command line flag.
 
virtual void SetOptions (std::map< std::string, std::string > &options)
 Passes command line parameters as settings over to format object.
 
std::optional< std::string > FetchOption (std::map< std::string, std::string > &options, std::string name)
 Convenience method to look up option by name.
 
std::string FetchOption (std::map< std::string, std::string > &options, std::string name, std::string default_value)
 Convenience method to look up option by name, returning default value if name is missing.
 
std::optional< offset_t > FetchIntegerOption (std::map< std::string, std::string > &options, std::string name)
 Convenience method to look up option by name and convert it to integer.
 
virtual void SetModel (std::string model)
 Sets the way memory is organized, typically modifying a built-in script.
 
virtual void SetLinkScript (std::string script_file, std::map< std::string, std::string > &options)
 Selects a script file to use for linking.
 
virtual void ProcessModule (Module &object)
 Processes the module object and initializes format fields.
 
virtual void CalculateValues ()
 Intermediate step between processing module and generating output file to set up headers and management sections It is expected that after a module is processed, additional steps are required to evaluate the final values of the fields.
 
virtual std::string GetDefaultExtension (Module &module) const
 Provides a default filename for the output file.
 
virtual bool FormatSupportsSegmentation () const
 Whether the format supports multiple segments.
 
virtual bool FormatIs16bit () const
 Whether the format is 16-bit or not.
 
virtual bool FormatIsProtectedMode () const
 Whether the format is in protected mode or not (x86 only)
 
virtual bool FormatIsLinear () const
 Whether the address space is linear or segmented.
 
virtual bool FormatSupportsResources () const
 Whether the format supports resources.
 
virtual bool FormatSupportsLibraries () const
 Whether the format supports libraries.
 
virtual unsigned FormatAdditionalSectionFlags (std::string section_name) const
 
virtual void AllocateSymbols (Module &module) const
 Instructs the module to allocate any unallocated local symbols.
 
- Public Member Functions inherited from Linker::Format
 Format (offset_t file_offset=0)
 
virtual void Clear ()
 Resets all fields to their default values, deallocate memory.
 
offset_t ImageSize () const override
 Retrieves size of stored data.
 
offset_t WriteFile (Writer &wr, offset_t count, offset_t offset=0) const override
 Writes data of non-zero filled sections.
 
- Public Member Functions inherited from Linker::Contents
virtual std::shared_ptr< const ImageAsImage () const
 Retrieves a randomly accessible image.
 
std::shared_ptr< ImageAsImage ()
 Retrieves a randomly accessible image.
 

Public Attributes

std::shared_ptr< AppleFormatdata_fork
 
header_format_t header
 
file_type_t file_type
 
- Public Attributes inherited from Binary::GSOutput
target_format_t target
 Format of "filename".
 
produce_format_t produce
 Bitset of other files to produce.
 
unsigned apple_single_double_version = 2
 
Apple::AppleSingleDouble::hfs_type home_file_system = Apple::AppleSingleDouble::HFS_UNDEFINED
 
- Public Attributes inherited from Linker::Format
offset_t file_offset
 

Protected Member Functions

void OnContainerCreated () override
 Called after the container is created.
 
void OnCalculateValues () override
 Called if there is no container allocated.
 
void OnReadFile (Linker::Reader &rd) override
 Called if there is no container allocated.
 
offset_t OnWriteFile (Linker::Writer &wr) const override
 Called if there is no container allocated.
 
void OnDump (Dumper::Dumper &dump) const override
 Called if there is no container allocated.
 

Additional Inherited Members

- Protected Types inherited from Binary::GSOutput
enum  container_format_t { CONTAINER_NONE , CONTAINER_APPLE_SINGLE }
 Format of container stored in memory. More...
 
- Protected Attributes inherited from Binary::GSOutput
container_format_t container = CONTAINER_NONE
 The container type used to store metainformation while processing.
 
std::shared_ptr< Apple::AppleSingleDoubleapple_single
 Container for all the necessary additional information.
 

Detailed Description

This is not actually a file format, but an interface to permit generating multiple binary outputs for Apple ][ binaries.

Depending on the target disk file system and tools, there are a variety of ways to prepare a binary file for Apple ][. The ones currently implemented are:

Member Enumeration Documentation

◆ header_format_t

Enumerator
HEADER_BIN 

For a BIN file, there may or may not be a DOS 3.3 header (if no "+naps" is specified)

HEADER_DOS33 

For a BIN file, the DOS 3.3 header is included (even if "+naps" is specified)

HEADER_RAW 

For a BIN file, there is no DOS 3.3 header (even if no "+naps" is specified)

Member Function Documentation

◆ Dump()

void AppleDriver::Dump ( Dumper::Dumper dump) const
overridevirtual

Display file contents in a nice manner.

Reimplemented from Linker::Format.

◆ GenerateFile()

void AppleDriver::GenerateFile ( std::string  filename,
Linker::Module module 
)
overridevirtual

The main function that handles processing, calculating and generating the final image.

Reimplemented from Linker::OutputFormat.

◆ GetDefaultExtension()

std::string AppleDriver::GetDefaultExtension ( Linker::Module module,
std::string  filename 
) const
overridevirtual

Appends a default extension to the filename.

A typical behavior would be to append .exe at the end of the filename. The default action is to leave it intact.

Reimplemented from Linker::OutputFormat.

◆ OnCalculateValues()

void AppleDriver::OnCalculateValues ( )
overrideprotectedvirtual

Called if there is no container allocated.

Reimplemented from Binary::GSOutput.

◆ OnContainerCreated()

void AppleDriver::OnContainerCreated ( )
overrideprotectedvirtual

Called after the container is created.

Reimplemented from Binary::GSOutput.

◆ OnDump()

void AppleDriver::OnDump ( Dumper::Dumper dump) const
overrideprotectedvirtual

Called if there is no container allocated.

Reimplemented from Binary::GSOutput.

◆ OnReadFile()

void AppleDriver::OnReadFile ( Linker::Reader rd)
overrideprotectedvirtual

Called if there is no container allocated.

Reimplemented from Binary::GSOutput.

◆ OnWriteFile()

offset_t AppleDriver::OnWriteFile ( Linker::Writer wr) const
overrideprotectedvirtual

Called if there is no container allocated.

Reimplemented from Binary::GSOutput.

◆ ReadFile()

void AppleDriver::ReadFile ( Linker::Reader rd)
overridevirtual

Loads file into memory.

Implements Linker::Format.


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