mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-16 18:30:32 +00:00
Added an extra sanity check on treating system disks as system disks.
This commit is contained in:
parent
0c8769e335
commit
7e35e44934
@ -7,7 +7,9 @@
|
||||
//
|
||||
|
||||
#include "StaticAnalyser.hpp"
|
||||
|
||||
#include "../../Storage/Disk/Parsers/CPM.hpp"
|
||||
#include "../../Storage/Disk/Encodings/MFM.hpp"
|
||||
|
||||
static bool strcmp_insensitive(const char *a, const char *b) {
|
||||
if(strlen(a) != strlen(b)) return false;
|
||||
@ -64,12 +66,17 @@ static void InspectDataCatalogue(
|
||||
}
|
||||
|
||||
static void InspectSystemCatalogue(
|
||||
const std::unique_ptr<Storage::Disk::CPM::Catalogue> &data_catalogue,
|
||||
const std::shared_ptr<Storage::Disk::Disk> &disk,
|
||||
const std::unique_ptr<Storage::Disk::CPM::Catalogue> &catalogue,
|
||||
StaticAnalyser::Target &target) {
|
||||
// TODO: does track 0, side 0, sector 0x41 exist? If not, InspectDataCatalogue.
|
||||
|
||||
// If this is a system disk, then launch it as though it were CP/M.
|
||||
target.loadingCommand = "|cpm\n";
|
||||
Storage::Encodings::MFM::Parser parser(true, disk);
|
||||
// Check that the boot sector exists.
|
||||
if(parser.get_sector(0, 0, 0x41) != nullptr) {
|
||||
// This is a system disk, then launch it as though it were CP/M.
|
||||
target.loadingCommand = "|cpm\n";
|
||||
} else {
|
||||
InspectDataCatalogue(catalogue, target);
|
||||
}
|
||||
}
|
||||
|
||||
void StaticAnalyser::AmstradCPC::AddTargets(
|
||||
@ -116,7 +123,7 @@ void StaticAnalyser::AmstradCPC::AddTargets(
|
||||
|
||||
std::unique_ptr<Storage::Disk::CPM::Catalogue> system_catalogue = Storage::Disk::CPM::GetCatalogue(target.disks.front(), system_format);
|
||||
if(system_catalogue) {
|
||||
InspectSystemCatalogue(data_catalogue, target);
|
||||
InspectSystemCatalogue(target.disks.front(), data_catalogue, target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user