RetroLinker
Linker for several 8-bit, 16-bit and 32-bit formats
Loading...
Searching...
No Matches
dosexe.h
1#ifndef DOSEXE_H
2#define DOSEXE_H
3
4#include "../common.h"
5#include "../linker/linker.h"
6#include "../linker/section.h"
7#include "mzexe.h"
8
9namespace SeychellDOS32
10{
14 class AdamFormat : public virtual Linker::Format, public virtual Linker::OutputFormat
15 {
16 public:
17 bool is_v35; /* based on Michael Tippach's research */
18
19 AdamFormat(bool is_v35 = false)
20 : is_v35(is_v35)
21 {
22 if(is_v35)
23 {
24 Linker::FatalError("Fatal error: 3.5 format unimplemented");
25 }
26 }
27
28 bool is_dll = false;
29 uint16_t minimum_dos_version = 0;
30 uint16_t dlink_version = 0;
31 uint32_t image_size = 0;
32 uint32_t header_size = 0;
33 uint32_t extra_memory_size = 0;
34 uint32_t eip = 0;
35 uint32_t esp = 0;
36 std::set<uint32_t> relocations;
37 uint32_t flags = 0;
38 uint32_t relocation_start = 0;
40 uint32_t last_header_field = 0;
41
42 std::shared_ptr<Linker::Writable> image;
43
44 enum
45 {
46 FLAG_COMPRESSED = 0x0001,
47 FLAG_DISPLAY_LOGO = 0x0002,
48 };
49
50 void CalculateValues() override;
51
52 void ReadFile(Linker::Reader& rd) override;
53
54 void WriteFile(Linker::Writer& wr) override;
55 };
56};
57
58namespace BrocaD3X
59{
63 class D3X1Format : public virtual Linker::Format
64 {
65 public:
66 uint32_t header_size = 0;
67 uint32_t binary_size = 0;
68 uint32_t extra_size = 0;
69 uint32_t entry = 0;
70 uint32_t stack_top = 0;
71
73 : header_size(24)
74 {
75 }
76
77 void ReadFile(Linker::Reader& rd) override;
78
79 void WriteFile(Linker::Writer& wr) override;
80 };
81};
82
83namespace DX64
84{
88 class LVFormat : public virtual Linker::Format
89 {
90 public:
91 enum format_type
92 {
93 FORMAT_FLAT,
94 FORMAT_LV,
95 };
96
97 char signature[4];
98 uint32_t eip = 0;
99 uint32_t esp = 0;
100 uint32_t extra_memory_size = 0;
101 std::shared_ptr<Linker::Writable> image;
102
103 LVFormat(format_type type)
104 {
105 SetSignature(type);
106 }
107
108 void SetSignature(format_type type);
109
110 void ReadFile(Linker::Reader& rd) override;
111
112 void WriteFile(Linker::Writer& wr) override;
113 };
114}
115
116/* TODO: other formats? */
117
118#endif /* DOSEXE_H */
Daniel Broca's D3X executable format.
Definition dosexe.h:64
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition dosexe.cc:130
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition dosexe.cc:142
CandyMan's DX64 "Flat" and "LV" executable formats.
Definition dosexe.h:89
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition dosexe.cc:185
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition dosexe.cc:169
A class to encode a general file format.
Definition format.h:24
A class that provides a general interface to setting up generation for a format.
Definition format.h:56
A helper class, encapsulating functionality needed to import binary data.
Definition reader.h:16
A helper class, encapsulating functionality needed to export binary data.
Definition writer.h:15
Adam Seychell's DOS32 "Adam" executable format.
Definition dosexe.h:15
uint32_t last_header_field
Unknown field for version 3.5.
Definition dosexe.h:40
void CalculateValues() override
Intermediate step between processing module and generating output file to set up headers and manageme...
Definition dosexe.cc:6
void ReadFile(Linker::Reader &rd) override
Loads file into memory.
Definition dosexe.cc:22
void WriteFile(Linker::Writer &wr) override
Stores data in memory to file.
Definition dosexe.cc:84