1
0
mirror of https://github.com/TomHarte/CLK.git synced 2025-09-12 02:24:31 +00:00

Compare commits

...

13 Commits

Author SHA1 Message Date
Thomas Harte
cad42beef4 Roll in some random style improvements. 2025-09-08 20:38:50 -04:00
Thomas Harte
96fd0b7892 Merge pull request #1553 from TomHarte/IndentationSomeMore
Further reduce indentation.
2025-09-05 23:20:19 -04:00
Thomas Harte
6f1db15d7c Further reduce indentation. 2025-09-05 23:07:45 -04:00
Thomas Harte
1854296ee8 Merge pull request #1552 from TomHarte/ElectronIDE
Reduce code duplication within the ROM catalogue.
2025-09-05 22:45:55 -04:00
Thomas Harte
515cc5f326 Correct spelling. 2025-09-05 22:09:38 -04:00
Thomas Harte
091be7eafe Remove unused header. 2025-09-05 22:03:45 -04:00
Thomas Harte
27a19ea417 Eliminate line-length violations. 2025-09-05 22:03:19 -04:00
Thomas Harte
9a5e9af67c Standardise layout. 2025-09-05 22:00:42 -04:00
Thomas Harte
3a493f2428 Merge pull request #1551 from TomHarte/LogLevels
Allow logging of errors but not info.
2025-09-05 21:04:56 -04:00
Thomas Harte
ca6e34f4b4 Fix dangling OpenGL accesses. 2025-09-05 19:30:33 -04:00
Thomas Harte
e1e68312c4 Transcribe remaining catalogue entries. 2025-09-05 17:23:38 -04:00
Thomas Harte
c7ff2cece4 Head in search of a more-compact form. 2025-09-05 16:55:00 -04:00
Thomas Harte
8e6f4fa36f Fix NDEBUG route. 2025-09-05 14:34:08 -04:00
30 changed files with 5022 additions and 4187 deletions

View File

@@ -16,20 +16,20 @@ class ASCII16kbROMSlotHandler: public MemorySlotHandler {
public:
ASCII16kbROMSlotHandler(MSX::MemorySlot &slot) : slot_(slot) {}
void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) final {
void write(const uint16_t address, const uint8_t value, const bool pc_is_outside_bios) final {
switch(address >> 11) {
default:
if(pc_is_outside_bios) confidence_counter_.add_miss();
break;
case 0xc:
if(pc_is_outside_bios) {
if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
hit_or_equivocal(address == 0x6000);
}
slot_.map(value * 0x4000, 0x4000, 0x4000);
break;
case 0xe:
if(pc_is_outside_bios) {
if(address == 0x7000 || address == 0x77ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
hit_or_equivocal(address == 0x7000 || address == 0x77ff);
}
slot_.map(value * 0x4000, 0x8000, 0x4000);
break;

View File

@@ -16,32 +16,32 @@ class ASCII8kbROMSlotHandler: public MemorySlotHandler {
public:
ASCII8kbROMSlotHandler(MSX::MemorySlot &slot) : slot_(slot) {}
void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) final {
void write(const uint16_t address, const uint8_t value, const bool pc_is_outside_bios) final {
switch(address >> 11) {
default:
if(pc_is_outside_bios) confidence_counter_.add_miss();
break;
case 0xc:
if(pc_is_outside_bios) {
if(address == 0x6000 || address == 0x60ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
hit_or_equivocal(address == 0x6000 || address == 0x60ff);
}
slot_.map(value * 0x2000, 0x4000, 0x2000);
break;
case 0xd:
if(pc_is_outside_bios) {
if(address == 0x6800 || address == 0x68ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
hit_or_equivocal(address == 0x6800 || address == 0x68ff);
}
slot_.map(value * 0x2000, 0x6000, 0x2000);
break;
case 0xe:
if(pc_is_outside_bios) {
if(address == 0x7000 || address == 0x70ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
hit_or_equivocal(address == 0x7000 || address == 0x70ff);
}
slot_.map(value * 0x2000, 0x8000, 0x2000);
break;
case 0xf:
if(pc_is_outside_bios) {
if(address == 0x7800 || address == 0x78ff) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
hit_or_equivocal(address == 0x7800 || address == 0x78ff);
}
slot_.map(value * 0x2000, 0xa000, 0x2000);
break;

View File

@@ -23,19 +23,19 @@ class KonamiROMSlotHandler: public MemorySlotHandler {
break;
case 3:
if(pc_is_outside_bios) {
if(address == 0x6000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
hit_or_equivocal(address == 0x6000);
}
slot_.map(value * 0x2000, 0x6000, 0x2000);
break;
case 4:
if(pc_is_outside_bios) {
if(address == 0x8000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
hit_or_equivocal(address == 0x8000);
}
slot_.map(value * 0x2000, 0x8000, 0x2000);
break;
case 5:
if(pc_is_outside_bios) {
if(address == 0xa000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
hit_or_equivocal(address == 0xa000);
}
slot_.map(value * 0x2000, 0xa000, 0x2000);
break;
@@ -45,6 +45,7 @@ class KonamiROMSlotHandler: public MemorySlotHandler {
virtual std::string debug_type() final {
return "K";
}
private:
MSX::MemorySlot &slot_;
};

View File

@@ -18,26 +18,26 @@ class KonamiWithSCCROMSlotHandler: public MemorySlotHandler {
KonamiWithSCCROMSlotHandler(MSX::MemorySlot &slot, Konami::SCC &scc) :
slot_(slot), scc_(scc) {}
void write(uint16_t address, uint8_t value, bool pc_is_outside_bios) final {
void write(const uint16_t address, const uint8_t value, const bool pc_is_outside_bios) final {
switch(address >> 11) {
default:
if(pc_is_outside_bios) confidence_counter_.add_miss();
break;
case 0x0a:
if(pc_is_outside_bios) {
if(address == 0x5000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
hit_or_equivocal(address == 0x5000);
}
slot_.map(value * 0x2000, 0x4000, 0x2000);
break;
case 0x0e:
if(pc_is_outside_bios) {
if(address == 0x7000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
hit_or_equivocal(address == 0x7000);
}
slot_.map(value * 0x2000, 0x6000, 0x2000);
break;
case 0x12:
if(pc_is_outside_bios) {
if(address == 0x9000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
hit_or_equivocal(address == 0x9000);
}
if((value&0x3f) == 0x3f) {
scc_is_visible_ = true;
@@ -57,7 +57,7 @@ class KonamiWithSCCROMSlotHandler: public MemorySlotHandler {
break;
case 0x16:
if(pc_is_outside_bios) {
if(address == 0xb000) confidence_counter_.add_hit(); else confidence_counter_.add_equivocal();
hit_or_equivocal(address == 0xb000);
}
slot_.map(value * 0x2000, 0xa000, 0x2000);
break;

View File

@@ -143,6 +143,13 @@ class MemorySlotHandler {
protected:
Analyser::Dynamic::ConfidenceCounter confidence_counter_;
void hit_or_equivocal(const bool is_hit) {
if(is_hit) {
confidence_counter_.add_hit();
} else {
confidence_counter_.add_equivocal();
}
}
};
}

View File

@@ -995,7 +995,6 @@ template<Model model> class ConcreteMachine:
}
};
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -30,6 +30,7 @@ enum Name {
AcornADFS,
PRESAdvancedPlus6,
Acorn1770DFS,
AcornIDEADFS103,
// Acorn Archimedes.
AcornArthur030,
@@ -223,8 +224,20 @@ struct Description {
private:
template <typename FileNameT, typename CRC32T> Description(
Name name, std::string machine_name, std::string descriptive_name, FileNameT file_names, size_t size, CRC32T crc32s = uint32_t(0)
) : name{name}, machine_name{machine_name}, descriptive_name{descriptive_name}, file_names{file_names}, size{size}, crc32s{crc32s} {
const Name name,
const char *machine_name,
const char *descriptive_name,
const FileNameT &file_names,
const size_t size,
const CRC32T crc32s = uint32_t(0)
) :
name{name},
machine_name{machine_name},
descriptive_name{descriptive_name},
file_names{file_names},
size{size},
crc32s{crc32s}
{
// Slightly lazy: deal with the case where the constructor wasn't provided with any
// CRCs by spotting that the set has exactly one member, which has value 0. The alternative
// would be to provide a partial specialisation that never put anything into the set.
@@ -232,6 +245,8 @@ private:
this->crc32s.clear();
}
}
static const std::vector<Description> &all_roms();
};
/// @returns a vector of all possible instances of ROM::Description — i.e. descriptions of every ROM

View File

@@ -16,7 +16,7 @@ namespace Numeric {
/// keeping the least-significant bit in its original position.
///
/// i.e. if @c input is abcdefgh then the result is 0a0b0c0d0e0f0g0h
constexpr uint16_t spread_bits(uint8_t input) {
constexpr uint16_t spread_bits(const uint8_t input) {
uint16_t result = uint16_t(input); // 0000 0000 abcd efgh
result = (result | (result << 4)) & 0x0f0f; // 0000 abcd 0000 efgh
result = (result | (result << 2)) & 0x3333; // 00ab 00cd 00ef 00gh
@@ -26,11 +26,12 @@ constexpr uint16_t spread_bits(uint8_t input) {
/// Performs the opposite action to @c spread_bits; given the 16-bit input
/// @c abcd @c efgh @c ijkl @c mnop, returns the byte value @c bdfhjlnp
/// i.e. every other bit is retained, keeping the least-significant bit in place.
constexpr uint8_t unspread_bits(uint16_t input) {
input &= 0x5555; // 0a0b 0c0d 0e0f 0g0h
input = (input | (input >> 1)) & 0x3333; // 00ab 00cd 00ef 00gh
input = (input | (input >> 2)) & 0x0f0f; // 0000 abcd 0000 efgh
return uint8_t(input | (input >> 4)); // 0000 0000 abcd efgh
constexpr uint8_t unspread_bits(const uint16_t input) {
uint16_t result = input;
result &= 0x5555; // 0a0b 0c0d 0e0f 0g0h
result = (result | (result >> 1)) & 0x3333; // 00ab 00cd 00ef 00gh
result = (result | (result >> 2)) & 0x0f0f; // 0000 abcd 0000 efgh
return uint8_t(result | (result >> 4)); // 0000 0000 abcd efgh
}
}

View File

@@ -61,7 +61,7 @@ public:
An initial value of 0 is invalid.
*/
LFSR(IntType initial_value) : value_(initial_value) {}
LFSR(const IntType initial_value) : value_(initial_value) {}
/*!
Advances the LSFR, returning either an @c IntType of value @c 1 or @c 0,

View File

@@ -30,13 +30,13 @@ namespace Numeric {
template <int... Sizes> class NumericCoder {
public:
/// Modifies @c target to hold @c value at @c index.
template <int index> static void encode(int &target, int value) {
template <int index> static void encode(int &target, const int value) {
static_assert(index < sizeof...(Sizes), "Index must be within range");
NumericEncoder<Sizes...>::template encode<index>(target, value);
}
/// @returns The value from @c source at @c index.
template <int index> static int decode(int source) {
template <int index> static int decode(const int source) {
static_assert(index < sizeof...(Sizes), "Index must be within range");
return NumericDecoder<Sizes...>::template decode<index>(source);
}
@@ -45,7 +45,7 @@ private:
template <int size, int... Tail>
struct NumericEncoder {
template <int index, int i = 0, int divider = 1> static void encode(int &target, int value) {
template <int index, int i = 0, int divider = 1> static void encode(int &target, const int value) {
if constexpr (i == index) {
const int suffix = target % divider;
target /= divider;
@@ -61,7 +61,7 @@ private:
template <int size, int... Tail>
struct NumericDecoder {
template <int index, int i = 0, int divider = 1> static int decode(int source) {
template <int index, int i = 0, int divider = 1> static int decode(const int source) {
if constexpr (i == index) {
return (source / divider) % size;
} else {

View File

@@ -62,7 +62,7 @@
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
buildConfiguration = "Release"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
enableASanStackUseAfterReturn = "YES"

View File

@@ -76,7 +76,7 @@ enum class EnabledLevel {
constexpr EnabledLevel enabled_level(const Source source) {
#ifdef NDEBUG
return false;
return EnabledLevel::None;
#endif
// Allow for compile-time source-level enabling and disabling of different sources.

View File

@@ -24,7 +24,7 @@ GLuint Shader::compile_shader(const std::string &source, GLenum type) {
test_gl(glShaderSource, shader, 1, &c_str, NULL);
test_gl(glCompileShader, shader);
if constexpr (logger.enabled) {
if constexpr (logger.ErrorsEnabled) {
GLint isCompiled = 0;
test_gl(glGetShaderiv, shader, GL_COMPILE_STATUS, &isCompiled);
if(isCompiled == GL_FALSE) {
@@ -69,7 +69,7 @@ void Shader::init(const std::string &vertex_shader, const std::string &fragment_
for(const auto &binding : attribute_bindings) {
test_gl(glBindAttribLocation, shader_program_, binding.index, binding.name.c_str());
if constexpr (logger.enabled) {
if constexpr (logger.ErrorsEnabled) {
const auto error = glGetError();
switch(error) {
case 0: break;
@@ -88,7 +88,7 @@ void Shader::init(const std::string &vertex_shader, const std::string &fragment_
test_gl(glLinkProgram, shader_program_);
if constexpr (logger.enabled) {
if constexpr (logger.ErrorsEnabled) {
GLint logLength;
test_gl(glGetProgramiv, shader_program_, GL_INFO_LOG_LENGTH, &logLength);
if(logLength > 0) {

View File

@@ -8,7 +8,8 @@ DFS-1770-2.20.rom — used only if the user opens a DFS disk image
ADFS-E00_1.rom — used only if the user opens an ADFS disk image
ADFS-E00_2.rom
AP6v133.rom — used only if the user opens a disk image that makes use of any of the commands given below.
adfs.rom - used only if the user opens a hard disk image
adfs.rom used only if the user opens a hard disk image or requests a SCSI interface
ELK103.rom — used only if the user requests an IDE interface
Possibly to be desired in the future:
* os300.rom