mirror of
https://github.com/TomHarte/CLK.git
synced 2025-01-27 06:35:04 +00:00
With minor cleaning, this should now do Commodore disks correctly (?)
This commit is contained in:
parent
9827466297
commit
1d8fbe9068
@ -26,6 +26,7 @@ void StaticAnalyser::Commodore::AddTargets(
|
||||
|
||||
int device = 0;
|
||||
std::list<File> files;
|
||||
bool is_disk = false;
|
||||
|
||||
// strip out inappropriate cartridges
|
||||
// target.cartridges = AcornCartridgesFrom(cartridges);
|
||||
@ -36,6 +37,7 @@ void StaticAnalyser::Commodore::AddTargets(
|
||||
std::list<File> 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;
|
||||
}
|
||||
|
||||
|
@ -236,19 +236,12 @@ std::list<File> StaticAnalyser::Commodore::GetFiles(const std::shared_ptr<Storag
|
||||
|
||||
next_track = sector->data[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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user