blob: 1a99f756cd246a89731d3c9b428e616ebc968bbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
#pragma once
struct Settings {
bool marks{};
bool rel_marks{};
bool abs_marks{};
bool xrefs_to{};
bool xrefs_from{};
bool raw_data_comment{};
};
constexpr size_t kInstructionSizeStepBytes = 2;
constexpr size_t kRomSizeBytes = 4 * 1024 * 1024;
constexpr size_t kDisasmMapSizeElements = kRomSizeBytes / kInstructionSizeStepBytes;
constexpr size_t Min(size_t a, size_t b) { return a < b ? a : b; }
constexpr uint16_t GetU16BE(uint8_t *buffer)
{
return (static_cast<uint16_t>(buffer[0]) << 8) | static_cast<uint16_t>(buffer[1]);
}
constexpr int16_t GetI16BE(uint8_t *buffer)
{
return (static_cast<uint16_t>(buffer[0]) << 8) | static_cast<uint16_t>(buffer[1]);
}
constexpr int32_t GetI32BE(uint8_t *buffer)
{
return (static_cast<uint32_t>(buffer[0]) << 24) |
(static_cast<uint32_t>(buffer[1]) << 16) |
(static_cast<uint32_t>(buffer[2]) << 8) |
static_cast<uint32_t>(buffer[3]);
}
|