From 1d8fbe90681eae6eebb9c5f9bd6e7bf9eff6b3a9 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Thu, 15 Sep 2016 19:21:09 -0400 Subject: [PATCH] With minor cleaning, this should now do Commodore disks correctly (?) --- StaticAnalyser/Commodore/CommodoreAnalyser.cpp | 6 ++++-- StaticAnalyser/Commodore/Disk.cpp | 9 +-------- 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/StaticAnalyser/Commodore/CommodoreAnalyser.cpp b/StaticAnalyser/Commodore/CommodoreAnalyser.cpp index 47cab467c..2c88a6fbf 100644 --- a/StaticAnalyser/Commodore/CommodoreAnalyser.cpp +++ b/StaticAnalyser/Commodore/CommodoreAnalyser.cpp @@ -26,6 +26,7 @@ void StaticAnalyser::Commodore::AddTargets( int device = 0; std::list files; + bool is_disk = false; // strip out inappropriate cartridges // target.cartridges = AcornCartridgesFrom(cartridges); @@ -36,6 +37,7 @@ void StaticAnalyser::Commodore::AddTargets( std::list disk_files = GetFiles(disk); if(disk_files.size()) { + is_disk = true; files.splice(files.end(), disk_files); target.disks = disks; if(!device) device = 8; @@ -60,13 +62,13 @@ void StaticAnalyser::Commodore::AddTargets( if(files.front().is_basic()) { char command[16]; - snprintf(command, 16, "LOAD\"\",%d,0\nRUN\n", device); + snprintf(command, 16, "LOAD\"%s\",%d,0\nRUN\n", is_disk ? "*" : "", device); target.loadingCommand = command; } else { char command[16]; - snprintf(command, 16, "LOAD\"\",%d,1\nRUN\n", device); + snprintf(command, 16, "LOAD\"%s\",%d,1\nRUN\n", is_disk ? "*" : "", device); target.loadingCommand = command; } diff --git a/StaticAnalyser/Commodore/Disk.cpp b/StaticAnalyser/Commodore/Disk.cpp index 850a5ad90..df987d691 100644 --- a/StaticAnalyser/Commodore/Disk.cpp +++ b/StaticAnalyser/Commodore/Disk.cpp @@ -236,19 +236,12 @@ std::list StaticAnalyser::Commodore::GetFiles(const std::shared_ptrdata[0]; next_sector = sector->data[1]; - if(is_first_sector) - { - new_file.starting_address = (uint16_t)sector->data[2] | (uint16_t)(sector->data[3] << 8); - } + if(is_first_sector) new_file.starting_address = (uint16_t)sector->data[2] | (uint16_t)(sector->data[3] << 8); if(next_track) - { new_file.data.insert(new_file.data.end(), sector->data.begin() + (is_first_sector ? 4 : 2), sector->data.end()); - } else - { new_file.data.insert(new_file.data.end(), sector->data.begin() + 2, sector->data.begin() + next_sector); - } is_first_sector = false; }