mirror of
https://github.com/TomHarte/CLK.git
synced 2026-04-26 03:29:40 +00:00
Add some CP/M smarts to +3 disk analysis.
This commit is contained in:
@@ -71,3 +71,15 @@ const Sector *Parser::sector(int head, int track, uint8_t sector) {
|
||||
|
||||
return &stored_sector->second;
|
||||
}
|
||||
|
||||
const Sector *Parser::any_sector(int head, int track) {
|
||||
const Disk::Track::Address address(head, Storage::Disk::HeadPosition(track));
|
||||
install_track(address);
|
||||
|
||||
const auto sectors = sectors_by_address_by_track_.find(address);
|
||||
if(sectors == sectors_by_address_by_track_.end()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return §ors->second.begin()->second;
|
||||
}
|
||||
|
||||
@@ -37,6 +37,14 @@ class Parser {
|
||||
*/
|
||||
const Storage::Encodings::MFM::Sector *sector(int head, int track, uint8_t sector);
|
||||
|
||||
|
||||
/*!
|
||||
Seeks to the physical track at @c head and @c track. Searches on it for any sector.
|
||||
|
||||
@returns a sector if one was found; @c nullptr otherwise.
|
||||
*/
|
||||
const Storage::Encodings::MFM::Sector *any_sector(int head, int track);
|
||||
|
||||
// TODO: set_sector.
|
||||
|
||||
private:
|
||||
|
||||
@@ -24,6 +24,29 @@ struct ParameterBlock {
|
||||
int first_sector;
|
||||
uint16_t catalogue_allocation_bitmap;
|
||||
int reserved_tracks;
|
||||
|
||||
// Some well-known formats.
|
||||
static ParameterBlock cpc_data_format() {
|
||||
Storage::Disk::CPM::ParameterBlock data_format;
|
||||
data_format.sectors_per_track = 9;
|
||||
data_format.tracks = 40;
|
||||
data_format.block_size = 1024;
|
||||
data_format.first_sector = 0xc1;
|
||||
data_format.catalogue_allocation_bitmap = 0xc000;
|
||||
data_format.reserved_tracks = 0;
|
||||
return data_format;
|
||||
}
|
||||
|
||||
static ParameterBlock cpc_system_format() {
|
||||
Storage::Disk::CPM::ParameterBlock system_format;
|
||||
system_format.sectors_per_track = 9;
|
||||
system_format.tracks = 40;
|
||||
system_format.block_size = 1024;
|
||||
system_format.first_sector = 0x41;
|
||||
system_format.catalogue_allocation_bitmap = 0xc000;
|
||||
system_format.reserved_tracks = 2;
|
||||
return system_format;
|
||||
}
|
||||
};
|
||||
|
||||
struct File {
|
||||
|
||||
Reference in New Issue
Block a user