RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
huexe.h
1#ifndef HUEXE_H
2#define HUEXE_H
3
4#include "../common.h"
5#include "../dumper/dumper.h"
6#include "../linker/module.h"
7#include "../linker/segment.h"
8#include "../linker/segment_manager.h"
9#include "../linker/writer.h"
10
11namespace X68000
12{
16 class HUFormat : public virtual Linker::SegmentManager
17 {
18 public:
19 void ReadFile(Linker::Reader& rd) override;
20
21 enum load_mode_type
22 {
23 MODE_NORMAL,
24 MODE_SMALLEST,
25 MODE_HIGHEST,
26 };
27 load_mode_type load_mode = MODE_NORMAL; /* TODO: make parameter */
28 uint32_t entry_address = 0;
29 bool option_no_relocation = false; /* TODO: make parameter */
30
31 /* filled in automatically */
32 std::shared_ptr<Linker::Segment> code, data, bss;
33 uint32_t relocation_size = 0;
34 std::map<uint32_t, unsigned char> relocations;
35
36 void OnNewSegment(std::shared_ptr<Linker::Segment> segment) override;
37
38 void CreateDefaultSegments();
39
40 std::unique_ptr<Script::List> GetScript(Linker::Module& module);
41
42 void Link(Linker::Module& module);
43
44 void ProcessModule(Linker::Module& module) override;
45
46 void CalculateValues() override;
47
49 offset_t WriteFile(Linker::Writer& wr) const override;
50 void Dump(Dumper::Dumper& dump) const override;
51
52 void GenerateFile(std::string filename, Linker::Module& module) override;
53
55 std::string GetDefaultExtension(Linker::Module& module, std::string filename) const override;
56 };
57
58}
59
60#endif /* HUEXE_H */
An abstract interface that separates structure and presentation of the data inside a file.
Definition dumper.h:586
offset_t WriteFile(Writer &wr) const override=0
Stores data in memory to file.
Encodes an object module file as a collection of sections, symbols and relocations.
Definition module.h:24
virtual std::string GetDefaultExtension(Module &module, std::string filename) const
Appends a default extension to the filename.
A helper class, encapsulating functionality needed to import binary data.
Definition reader.h:16
A helper class to collect sections into segments.
Definition segment_manager.h:32
A helper class, encapsulating functionality needed to export binary data.
Definition writer.h:15
Human68k "HU" .X file.
Definition huexe.h:17
void ProcessModule(Linker::Module &module) override
Processes the module object and initializes format fields.
Definition huexe.cc:92
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition huexe.cc:199
void OnNewSegment(std::shared_ptr< Linker::Segment > segment) override
Callback function when allocating a new segment When the linker script runs, it creates segments cons...
Definition huexe.cc:13
void CalculateValues() override
Intermediate step between processing module and generating output file to set up headers and manageme...
Definition huexe.cc:143
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition huexe.cc:158
void GenerateFile(std::string filename, Linker::Module &module) override
The main function that handles processing, calculating and generating the final image.
Definition huexe.cc:210
std::string GetDefaultExtension(Linker::Module &module, std::string filename) const override
Appends a default extension to the filename.
Definition huexe.cc:220
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition huexe.cc:8