RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
8bitexe.h
1#ifndef _8BITEXE_H
2#define _8BITEXE_H
3
4#include <algorithm>
5#include "binary.h"
6#include "macos.h"
7#include "../common.h"
8#include "../dumper/dumper.h"
9#include "../linker/module.h"
10#include "../linker/options.h"
11#include "../linker/reader.h"
12#include "../linker/segment.h"
13#include "../linker/writer.h"
14
15/* TODO: this is all pretty much preliminary */
16/* TODO: combine into binary.h? */
17
18namespace Binary
19{
24 {
25 public:
26 /* TODO: untested */
27 bool dos33_header;
28
29 /* TODO: enable setting the base address as a parameter */
30 /* TODO: SYS files are pure binary loaded at 0x2000 */
31
32 AppleFormat(uint64_t default_base_address = 0x0803, std::string default_extension = "", bool dos33_header = true)
33 : GenericBinaryFormat(default_base_address, default_extension), dos33_header(dos33_header)
34 {
35 }
36
37 void ReadFile(Linker::Reader& rd) override;
38
40 offset_t WriteFile(Linker::Writer& wr) const override;
41 void Dump(Dumper::Dumper& dump) const override;
42 };
43
45 {
46 public:
49 {
60 // /** @brief Main file as a MacBinary */
61 // TARGET_MAC_BINARY,
62 // TODO: Binary II
63 };
66
69 {
72 // /** @brief Places a Finder Information file under the directory .finf */
73 // PRODUCE_FINDER_INFO = 1 << 1,
76 // /** @brief Creates a MacBinary with the .mbin extension */
77 // PRODUCE_MAC_BINARY = 1 << 3,
80 };
83
84 /* the ProDOS file type */
85 enum file_type_t : uint8_t
86 {
87 FILE_TYPE_BIN = 0x06,
88 FILE_TYPE_SOS = 0x0C,
89 FILE_TYPE_S16 = 0xB3,
90 FILE_TYPE_EXE = 0xB5,
91 FILE_TYPE_SYS = 0xFF,
92 };
93
94 unsigned apple_single_double_version = 2;
95 /* Only relevant for version 1 */
96 Apple::AppleSingleDouble::hfs_type home_file_system = Apple::AppleSingleDouble::HFS_UNDEFINED;
97
98 //MacBinary::version_t macbinary_version = MacBinary::MACBIN3, macbinary_minimum_version = MacBinary::MACBIN2;
99
101 : target(target),
103 : produce_format_t(0))
104 {
105 }
106
107 GSOutput(target_format_t target, int produce)
109 {
110 }
111
112 bool AddSupplementaryOutputFormat(std::string subformat) override;
113
114 protected:
117 {
122 // /** @brief Use a MacBinary container as well as an AppleSingle container */
123 // CONTAINER_MAC_BINARY,
124 };
127
129 std::shared_ptr<Apple::AppleSingleDouble> apple_single;
130 // /** @brief Container for MacBinary */
131 // std::shared_ptr<MacBinary> mac_binary;
132
134 virtual void OnContainerCreated();
136 virtual void OnCalculateValues();
138 virtual void OnReadFile(Linker::Reader& rd);
140 virtual offset_t OnWriteFile(Linker::Writer& wr) const;
142 virtual void OnDump(Dumper::Dumper& dump) const;
143
144 public:
146 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);
147
148 void ReadFile(Linker::Reader& rd) override;
149
151 offset_t WriteFile(Linker::Writer& wr) const override;
152
153 void Dump(Dumper::Dumper& dump) const override;
154 };
155
169 class AppleDriver : public GSOutput
170 {
171 public:
172 std::shared_ptr<AppleFormat> data_fork;
173
183 header_format_t header;
184
185 file_type_t file_type;
186 /* TODO: enable setting the base address as a parameter */
187
188 AppleDriver(file_type_t file_type = FILE_TYPE_BIN, header_format_t header = HEADER_BIN)
190 header(header),
191 file_type(file_type)
192 {
193 }
194
195 AppleDriver(file_type_t file_type, target_format_t target)
196 : GSOutput(target, 0),
197 header(HEADER_BIN),
198 file_type(file_type)
199 {
200 }
201
202 protected:
203 void OnContainerCreated() override;
204 void OnCalculateValues() override;
205 void OnReadFile(Linker::Reader& rd) override;
206 offset_t OnWriteFile(Linker::Writer& wr) const override;
207 void OnDump(Dumper::Dumper& dump) const override;
208
209 public:
210 void ReadFile(Linker::Reader& rd) override;
211
212 void GenerateFile(std::string filename, Linker::Module& module) override;
213 void Dump(Dumper::Dumper& dump) const override;
214
215 uint8_t GetFileType() const;
216 uint16_t GetAuxiliaryFileType() const;
217
218 bool UseDOS33Header() const
219 {
220 if(file_type != FILE_TYPE_BIN || target != TARGET_DATA_FORK)
221 {
222 return false;
223 }
224
225 switch(header)
226 {
227 case HEADER_BIN:
228 // only apply header if there is no NAPS suffix
229 return (produce & PRODUCE_NAPS_SUFFIX) == 0;
230 case HEADER_DOS33:
231 return true;
232 default:
233 case HEADER_RAW:
234 return false;
235 }
236 }
237
239 std::string GetDefaultExtension(Linker::Module& module, std::string filename) const override;
240 };
241
246 {
247 public:
248 /* exe, obj, com are also used */
249 AtariFormat(uint64_t default_base_address = 0, std::string default_extension = ".xex")
250 : GenericBinaryFormat(default_base_address, default_extension)
251 {
252 }
253
257 struct Segment
258 {
259 public:
263 enum segment_type : uint16_t
264 {
268 SDX_FIXED = 0xFFFA,
270 SDX_SYMREQ = 0xFFFB,
272 SDX_SYMDEF = 0xFFFC,
274 SDX_FIXUPS = 0xFFFD,
276 SDX_RAMALLOC = 0xFFFE,
278 SDX_POSIND = 0xFFFE,
281 };
293 uint16_t address = 0;
297 uint8_t block_number = 0;
298 enum control_byte_type : uint8_t
299 {
310 };
318 uint16_t size = 0;
322 char symbol_name[8] = { };
326 std::shared_ptr<Linker::Contents> image;
330 std::set<uint16_t> relocations; // TODO: multiple blocks?
331
332 Segment(bool header_type_optional = true)
334 {
335 }
336
337 Segment(uint16_t header_type)
339 {
340 }
341
345 offset_t GetSize() const;
346
350 void ReadFile(Linker::Reader& rd);
351
355 void WriteFile(Linker::Writer& wr) const;
356
361
365 void WriteRelocations(Linker::Writer& wr) const;
366 };
367
371 std::vector<std::unique_ptr<Segment>> segments;
372
374 static const uint16_t LOADER_ADDRESS = 0x02E2;
375
380 static const uint16_t ENTRY_ADDRESS = 0x02E0;
381
383 bool HasEntryPoint() const;
385 void AddEntryPoint(uint16_t entry);
386
387 void OnNewSegment(std::shared_ptr<Linker::Segment> segment) override;
388
389 void ProcessModule(Linker::Module& module) override;
390
391 void ReadFile(Linker::Reader& rd) override;
392
394 offset_t WriteFile(Linker::Writer& wr) const override;
395 void Dump(Dumper::Dumper& dump) const override;
396 };
397
402 {
403 public:
404 /* TODO */
405
407 static const uint16_t BASIC_START = 0x0801;
408
409 enum
410 {
411 BASIC_SYS = 0x9E, /* BASIC token */
412 };
413
414 std::shared_ptr<Linker::Segment> loader; /* loader routine in BASIC */
415
416 void Clear() override;
417
419 {
420 Clear();
421 }
422
423 void SetupDefaultLoader();
424
425 void ProcessModule(Linker::Module& module) override;
426
428 offset_t WriteFile(Linker::Writer& wr) const override;
429 void Dump(Dumper::Dumper& dump) const override;
430
432 std::string GetDefaultExtension(Linker::Module& module, std::string filename) const override;
433 };
434
435 class PRLFormat;
436
441 {
442 public:
444 {
445 public:
446 Linker::Option<std::optional<std::vector<std::string>>> rsx_file_names{"rsx", "List of filenames to append as Resident System Extensions"};
447
449 {
450 InitializeFields(rsx_file_names);
451 }
452 };
453
455 uint8_t preinit_code[10] = { 0xC9 }; /* z80 return instruction */
457 bool loader_active = true;
460 {
462 std::string rsx_file_name;
464 std::string name;
466 uint16_t offset = 0;
468 uint16_t length = 0;
470 bool nonbanked_only = false;
472 std::shared_ptr<PRLFormat> module;
473
475 void OpenAndPrepare();
476 };
478 std::vector<rsx_record> rsx_table;
479
480 void Clear() override;
481
482 CPM3Format()
483 : GenericBinaryFormat(0x0100, ".com")
484 {
485 }
486
488 {
489 Clear();
490 }
491
492 std::shared_ptr<Linker::OptionCollector> GetOptions() override;
493
494 void SetOptions(std::map<std::string, std::string>& options) override;
495
496 void ReadFile(Linker::Reader& rd) override;
497
499 offset_t WriteFile(Linker::Writer& wr) const override;
500 void Dump(Dumper::Dumper& dump) const override;
501
502 void CalculateValues() override;
503 };
504
509 {
510 public:
511 /* TODO: enable setting the base address, default should be ??? */
512
513 struct Segment
514 {
515 public:
516 uint16_t address;
517 uint16_t size; /* it is supposed to be at most 255, but we can store larger segments by cutting them into pieces */
518 std::shared_ptr<Linker::Contents> image;
519
520 void WriteFile(Linker::Writer& wr) const;
521 };
522
523 std::vector<std::unique_ptr<Segment>> segments;
524
525 void OnNewSegment(std::shared_ptr<Linker::Segment> segment) override;
526
528 offset_t WriteFile(Linker::Writer& wr) const override;
529 void Dump(Dumper::Dumper& dump) const override;
530
532 std::string GetDefaultExtension(Linker::Module& module, std::string filename) const override;
533 };
534
539 {
540 public:
542 {
543 public:
544 Linker::Option<bool> banked{"banked", "Generated .SPR file for banked CP/M 3"};
545
547 {
548 InitializeFields(banked);
549 }
550 };
551
553 uint16_t zero_fill = 0;
555 uint16_t load_address = 0; // TODO: implement
557 uint16_t cslen = 0; // TODO: implement
558
561
563 bool option_banked_bios = false; // TODO: make flag, implement behavior
564
566 std::set<uint16_t> relocations;
567
595
596 static uint16_t GetDefaultBaseAddress(application_type application);
597 static std::string GetDefaultApplicationExtension(application_type application);
598
600 :
601 GenericBinaryFormat(GetDefaultBaseAddress(application), GetDefaultApplicationExtension(application)),
604 {
605 }
606
607 std::shared_ptr<Linker::OptionCollector> GetOptions() override;
608 void SetOptions(std::map<std::string, std::string>& options) override;
609
610 std::unique_ptr<Script::List> GetScript(Linker::Module& module) override;
611
612 void OnNewSegment(std::shared_ptr<Linker::Segment> segment) override;
613
614 bool ProcessRelocation(Linker::Module& module, Linker::Relocation& rel, Linker::Resolution resolution) override;
615
616 void ProcessModule(Linker::Module& module) override;
617
618 void ReadFile(Linker::Reader& rd) override;
619
621 offset_t WriteFile(Linker::Writer& wr) const override;
622
624 void ReadWithoutHeader(Linker::Reader& rd, uint16_t image_size);
625
627 void WriteWithoutHeader(Linker::Writer& wr) const;
628
629 void Dump(Dumper::Dumper& dump) const override;
630 };
631
636 {
637 public:
638 /* TODO */
639 bool uzi180_header;
640 uint16_t entry;
641
642 void ProcessModule(Linker::Module& module) override;
643
645 offset_t WriteFile(Linker::Writer& wr) const override;
646 void Dump(Dumper::Dumper& dump) const override;
647
649 std::string GetDefaultExtension(Linker::Module& module) const override;
650 };
651
656 {
657 public:
658 std::shared_ptr<Linker::Contents> code, data;
659
660 void OnNewSegment(std::shared_ptr<Linker::Segment> segment) override;
661
662 /* TODO: apparently both .code and .data are loaded at 0x0100 */
663
665 offset_t WriteFile(Linker::Writer& wr) const override;
666 void Dump(Dumper::Dumper& dump) const override;
667
669 std::string GetDefaultExtension(Linker::Module& module) const override;
670 };
671}
672
673#endif /* _8BITEXE_H */
This is not actually a file format, but an interface to permit generating multiple binary outputs for...
Definition 8bitexe.h:170
void OnReadFile(Linker::Reader &rd) override
Called if there is no container allocated.
Definition 8bitexe.cc:438
header_format_t
Definition 8bitexe.h:175
@ HEADER_BIN
For a BIN file, there may or may not be a DOS 3.3 header (if no "+naps" is specified)
Definition 8bitexe.h:177
@ HEADER_RAW
For a BIN file, there is no DOS 3.3 header (even if no "+naps" is specified)
Definition 8bitexe.h:181
@ HEADER_DOS33
For a BIN file, the DOS 3.3 header is included (even if "+naps" is specified)
Definition 8bitexe.h:179
void OnCalculateValues() override
Called if there is no container allocated.
Definition 8bitexe.cc:433
std::string GetDefaultExtension(Linker::Module &module, std::string filename) const override
Appends a default extension to the filename.
Definition 8bitexe.cc:484
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition 8bitexe.cc:496
void GenerateFile(std::string filename, Linker::Module &module) override
The main function that handles processing, calculating and generating the final image.
Definition 8bitexe.cc:403
void OnContainerCreated() override
Called after the container is created.
Definition 8bitexe.cc:426
void OnDump(Dumper::Dumper &dump) const override
Called if there is no container allocated.
Definition 8bitexe.cc:455
offset_t OnWriteFile(Linker::Writer &wr) const override
Called if there is no container allocated.
Definition 8bitexe.cc:450
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition 8bitexe.cc:393
BIN file for Apple ][.
Definition 8bitexe.h:24
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition 8bitexe.cc:25
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition 8bitexe.cc:12
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition 8bitexe.cc:39
EXE file for Atari 400/800.
Definition 8bitexe.h:246
static const uint16_t LOADER_ADDRESS
Address which contains a loader between to execute between loading segments.
Definition 8bitexe.h:374
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition 8bitexe.cc:668
void AddEntryPoint(uint16_t entry)
Attaches a new segment that contains the entry point.
Definition 8bitexe.cc:518
std::vector< std::unique_ptr< Segment > > segments
Sequence of segments.
Definition 8bitexe.h:371
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition 8bitexe.cc:685
void ProcessModule(Linker::Module &module) override
Processes the module object and initializes format fields.
Definition 8bitexe.cc:652
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition 8bitexe.cc:695
static const uint16_t ENTRY_ADDRESS
Address which contains the actual entry address after loading.
Definition 8bitexe.h:380
bool HasEntryPoint() const
An entry point is present if the memory address at EntryAddress has been filled by a segment.
Definition 8bitexe.cc:508
CP/M Plus .com file format.
Definition 8bitexe.h:441
void CalculateValues() override
Intermediate step between processing module and generating output file to set up headers and manageme...
Definition 8bitexe.cc:919
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition 8bitexe.cc:845
uint8_t preinit_code[10]
Pre-initialization code to be executed before fully loading program.
Definition 8bitexe.h:455
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition 8bitexe.cc:880
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition 8bitexe.cc:908
bool loader_active
Whether loader should be active, even if no RSXs are attached.
Definition 8bitexe.h:457
void SetOptions(std::map< std::string, std::string > &options) override
Passes command line parameters as settings over to format object.
Definition 8bitexe.cc:812
std::shared_ptr< Linker::OptionCollector > GetOptions() override
Returns object containing a sequence of option fields provided with the -S command line flag.
Definition 8bitexe.cc:807
void Clear() override
Resets all fields to their default values, deallocate memory.
Definition 8bitexe.cc:802
std::vector< rsx_record > rsx_table
The attached RSX records.
Definition 8bitexe.h:478
PRG file for Commodore PET/VIC-20/64.
Definition 8bitexe.h:402
void Clear() override
Resets all fields to their default values, deallocate memory.
Definition 8bitexe.cc:708
void ProcessModule(Linker::Module &module) override
Processes the module object and initializes format fields.
Definition 8bitexe.cc:735
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition 8bitexe.cc:741
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition 8bitexe.cc:750
static const uint16_t BASIC_START
Address at which the BASIC program should start.
Definition 8bitexe.h:407
std::string GetDefaultExtension(Linker::Module &module, std::string filename) const override
Appends a default extension to the filename.
Definition 8bitexe.cc:761
FLEX .cmd file format.
Definition 8bitexe.h:509
std::string GetDefaultExtension(Linker::Module &module, std::string filename) const override
Appends a default extension to the filename.
Definition 8bitexe.cc:975
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition 8bitexe.cc:954
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition 8bitexe.cc:964
Definition 8bitexe.h:45
std::shared_ptr< Apple::AppleSingleDouble > apple_single
Container for all the necessary additional information.
Definition 8bitexe.h:129
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition 8bitexe.cc:358
virtual void OnReadFile(Linker::Reader &rd)
Called if there is no container allocated.
Definition 8bitexe.cc:105
bool AddSupplementaryOutputFormat(std::string subformat) override
If the output format actually drives multiple output formats (resource file, apple double,...
Definition 8bitexe.cc:58
container_format_t container
The container type used to store metainformation while processing.
Definition 8bitexe.h:126
produce_format_t produce
Bitset of other files to produce.
Definition 8bitexe.h:82
produce_format_t
Represents what additional files should be generated.
Definition 8bitexe.h:69
@ PRODUCE_APPLE_DOUBLE
Creates an AppleDouble binary with the '' prefix.
Definition 8bitexe.h:75
@ PRODUCE_RESOURCE_FORK
Places a GS/OS format resource file under the directory .rsrc.
Definition 8bitexe.h:71
@ PRODUCE_NAPS_SUFFIX
NuLib2 attribute preservation string suffix, such as #06xxxx.
Definition 8bitexe.h:79
target_format_t
Represents the file type of the main file.
Definition 8bitexe.h:49
@ TARGET_NONE
Do not generate main file.
Definition 8bitexe.h:51
@ TARGET_APPLE_DOUBLE
Main file is an AppleDouble.
Definition 8bitexe.h:59
@ TARGET_DATA_FORK
Main file is a data fork, typically empty.
Definition 8bitexe.h:53
@ TARGET_RESOURCE_FORK
Main file is a resource fork.
Definition 8bitexe.h:55
@ TARGET_APPLE_SINGLE
Main file is an AppleSingle.
Definition 8bitexe.h:57
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition 8bitexe.cc:303
virtual offset_t OnWriteFile(Linker::Writer &wr) const
Called if there is no container allocated.
Definition 8bitexe.cc:110
virtual void OnContainerCreated()
Called after the container is created.
Definition 8bitexe.cc:98
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.
Definition 8bitexe.cc:121
virtual void OnDump(Dumper::Dumper &dump) const
Called if there is no container allocated.
Definition 8bitexe.cc:116
virtual void OnCalculateValues()
Called if there is no container allocated.
Definition 8bitexe.cc:100
target_format_t target
Format of "filename".
Definition 8bitexe.h:65
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition 8bitexe.cc:373
container_format_t
Format of container stored in memory.
Definition 8bitexe.h:117
@ CONTAINER_APPLE_SINGLE
Use an AppleSingle container.
Definition 8bitexe.h:121
@ CONTAINER_NONE
No container is stored.
Definition 8bitexe.h:119
A template for flat binary formats.
Definition binary.h:21
MP/M .prl file format.
Definition 8bitexe.h:539
std::set< uint16_t > relocations
Offsets to bytes referencing pages that must be relocated.
Definition 8bitexe.h:566
void WriteWithoutHeader(Linker::Writer &wr) const
Write without header, only needed for RSX files stored inside a CP/M 3 .COM file.
Definition 8bitexe.cc:1169
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition 8bitexe.cc:1107
bool suppress_relocations
Do not include relocations, only used for .OVL files.
Definition 8bitexe.h:560
uint16_t load_address
Address to be loaded at, only used for .OVL files.
Definition 8bitexe.h:555
uint16_t cslen
Code segment length, only used for .SPR files in banked systems.
Definition 8bitexe.h:557
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 8bitexe.cc:1064
bool ProcessRelocation(Linker::Module &module, Linker::Relocation &rel, Linker::Resolution resolution) override
Callback function to process relocations.
Definition 8bitexe.cc:1074
void ReadWithoutHeader(Linker::Reader &rd, uint16_t image_size)
Read without header, only needed for RSX files stored inside a CP/M 3 .COM file.
Definition 8bitexe.cc:1122
std::shared_ptr< Linker::OptionCollector > GetOptions() override
Returns object containing a sequence of option fields provided with the -S command line flag.
Definition 8bitexe.cc:982
application_type
The format of the generated binary.
Definition 8bitexe.h:575
@ APPL_OVL
CP/M-80 .ovl overlay (unsupported)
Definition 8bitexe.h:591
@ APPL_SPR
MP/M-80 .spr system module file (unsupported)
Definition 8bitexe.h:589
@ APPL_RSX
CP/M-80 Plus .rsx resident system extension file (unsupported)
Definition 8bitexe.h:581
@ APPL_RSP
MP/M-80 .rsp resident system process file (unsupported)
Definition 8bitexe.h:585
@ APPL_RSM
CP/M-80 2 .rsm resident system extension file (unsupported)
Definition 8bitexe.h:583
@ APPL_BRS
MP/M-80 .brs banked resident system process file (unsupported)
Definition 8bitexe.h:587
@ APPL_UNKNOWN
Unspecified.
Definition 8bitexe.h:577
@ APPL_PRL
MP/M-80 .prl executable file.
Definition 8bitexe.h:579
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition 8bitexe.cc:1192
void ProcessModule(Linker::Module &module) override
Processes the module object and initializes format fields.
Definition 8bitexe.cc:1090
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition 8bitexe.cc:1153
void SetOptions(std::map< std::string, std::string > &options) override
Passes command line parameters as settings over to format object.
Definition 8bitexe.cc:987
uint16_t zero_fill
Additional memory to allocate, similar to .bss.
Definition 8bitexe.h:553
bool option_banked_bios
On a banked BIOS, align the data segment of the .SPR on a page boundary and store the length of the c...
Definition 8bitexe.h:563
application_type application
Target application type.
Definition 8bitexe.h:594
UZI280 file format.
Definition 8bitexe.h:656
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 8bitexe.cc:1265
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition 8bitexe.cc:1297
std::string GetDefaultExtension(Linker::Module &module) const override
Provides a default filename for the output file.
Definition 8bitexe.cc:1308
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition 8bitexe.cc:1283
UZI/UZI280 file formats.
Definition 8bitexe.h:636
std::string GetDefaultExtension(Linker::Module &module) const override
Provides a default filename for the output file.
Definition 8bitexe.cc:1258
offset_t WriteFile(Linker::Writer &wr) const override
Stores data in memory to file.
Definition 8bitexe.cc:1234
void Dump(Dumper::Dumper &dump) const override
Display file contents in a nice manner.
Definition 8bitexe.cc:1247
void ProcessModule(Linker::Module &module) override
Processes the module object and initializes format fields.
Definition 8bitexe.cc:1228
An abstract interface that separates structure and presentation of the data inside a file.
Definition dumper.h:828
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
Helper class that contains the options interpreted by the format.
Definition options.h:474
Documents and handles command line options.
Definition options.h:306
A class that provides a general interface to setting up generation for a format.
Definition format.h:64
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:20
A representation of a value within some binary data that has to be fixed up once the exact position o...
Definition relocation.h:27
Representing a resolved relocation.
Definition resolution.h:17
A helper class, encapsulating functionality needed to export binary data.
Definition writer.h:15
Represents a loadable segment in the binary.
Definition 8bitexe.h:258
uint16_t address
Address at which segment must be loaded.
Definition 8bitexe.h:293
offset_t GetSize() const
Retrieves the number of bytes in the segment body.
Definition 8bitexe.cc:503
uint8_t block_number
Only used for SDX_RAMALLOC/SDX_POSIND, SDX_SYMREQ.
Definition 8bitexe.h:297
char symbol_name[8]
Only used for SDX_SYMREQ, SDX_SYMDEF.
Definition 8bitexe.h:322
std::set< uint16_t > relocations
Relocations, only used for SDX_SYMREQ and SDX_FIXUPS.
Definition 8bitexe.h:330
void ReadRelocations(Linker::Reader &rd)
Read relocations.
Definition 8bitexe.cc:631
uint16_t size
Only used for SDX_RAMALLOC/SDX_POSIND.
Definition 8bitexe.h:318
bool header_type_optional
Set if placing header type is optional, also set when signature is absent in file when reading.
Definition 8bitexe.h:289
control_byte_type control_byte
Only used for SDX_RAMALLOC/SDX_POSIND.
Definition 8bitexe.h:314
control_byte_type
Definition 8bitexe.h:299
@ CB_RAMALLOC
SDX_RAMALLOC instead of SDX_POSIND.
Definition 8bitexe.h:309
@ CB_CONVRAM
allocate in conventional RAM
Definition 8bitexe.h:301
@ CB_PROGEXTAREA
(SDX 4.47+) allocate in program extended area
Definition 8bitexe.h:305
@ CB_SYSEXTAREA
allocate in system extended area
Definition 8bitexe.h:303
@ CB_PAGEALIGNED
(SDX 4.43+) page aligned
Definition 8bitexe.h:307
void WriteRelocations(Linker::Writer &wr) const
Writes relocations.
Definition 8bitexe.cc:636
void WriteFile(Linker::Writer &wr) const
Writes the segment into a file.
Definition 8bitexe.cc:580
void ReadFile(Linker::Reader &rd)
Reads a segment from a file into this object.
Definition 8bitexe.cc:528
segment_type
Types of segments, represented by their signature values.
Definition 8bitexe.h:264
@ ATARI_SEGMENT
Atari segment type.
Definition 8bitexe.h:280
@ SDX_FIXUPS
SpartaDOS X fixup information (not implemented)
Definition 8bitexe.h:274
@ SDX_SYMREQ
SpartaDOS X required symbols (not implemented)
Definition 8bitexe.h:270
@ SDX_FIXED
SpartaDOS X fixed-address segment (not implemented)
Definition 8bitexe.h:268
@ SDX_RAMALLOC
SpartaDOS X RAM allocation block (not implemented)
Definition 8bitexe.h:276
@ SDX_POSIND
SpartaDOS X position independent (not implemented)
Definition 8bitexe.h:278
@ SIGNATURE_LOW
Lowest currently defined signature to check on reading.
Definition 8bitexe.h:266
@ SDX_SYMDEF
SpartaDOS X symbol definitions (not implemented)
Definition 8bitexe.h:272
std::shared_ptr< Linker::Contents > image
The binary data in the segment.
Definition 8bitexe.h:326
segment_type header_type
Header type, Atari DOS uses only 0xFFFF, signature only obligatory for the first segment.
Definition 8bitexe.h:285
A single RSX record.
Definition 8bitexe.h:460
std::string name
Name of RSX file, as stored inside RSX.
Definition 8bitexe.h:464
uint16_t offset
Offset to RSX block.
Definition 8bitexe.h:466
std::string rsx_file_name
Name of RSX file to load, only used for writing.
Definition 8bitexe.h:462
uint16_t length
Length of RSX module, only used for reading.
Definition 8bitexe.h:468
bool nonbanked_only
Whether RSX is only loaded on non-banked systems.
Definition 8bitexe.h:470
std::shared_ptr< PRLFormat > void OpenAndPrepare()
The actual RSX data, stored in PRLFormat (on disk, without the header)
Definition 8bitexe.cc:768
Definition 8bitexe.h:514