diff --git a/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp b/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp index bdf536ed6..676bc729e 100644 --- a/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp +++ b/StaticAnalyser/AmstradCPC/StaticAnalyser.cpp @@ -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 &data_catalogue, + const std::shared_ptr &disk, + const std::unique_ptr &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 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); } } }