1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-23 03:32:32 +00:00

Added just enough for a complete manual test of writing to a .ADF with the 1770 then getting the correct result parsing it back on the host side in order potentially to update a file.

... which means that now it's time to worry about when and how mounted files should actually update themselves. Which will make for some fun with threading, I dare say.
This commit is contained in:
Thomas Harte 2016-12-28 23:00:47 -05:00
parent af1b396c9e
commit b9fad184d7
2 changed files with 24 additions and 0 deletions

View File

@ -37,6 +37,29 @@ AcornADF::AcornADF(const char *file_name) :
if(bytes[0] != 'H' || bytes[1] != 'u' || bytes[2] != 'g' || bytes[3] != 'o') throw ErrorNotAcornADF;
}
AcornADF::~AcornADF()
{
if(get_is_modified())
{
for(unsigned int head = 0; head < get_head_count(); head++)
{
for(unsigned int track = 0; track < get_head_position_count(); track++)
{
std::shared_ptr<Storage::Disk::Track> modified_track = get_modified_track_at_position(head, track);
if(modified_track)
{
Storage::Encodings::MFM::Parser parser(true, modified_track);
for(unsigned int c = 0; c < sectors_per_track; c++)
{
std::shared_ptr<Storage::Encodings::MFM::Sector> sector = parser.get_sector((uint8_t)track, (uint8_t)c);
printf("Sector %d: %p\n", c, sector.get());
}
}
}
}
}
}
unsigned int AcornADF::get_head_position_count()
{
return 80;

View File

@ -27,6 +27,7 @@ class AcornADF: public Disk, public Storage::FileHolder {
@throws ErrorNotAcornADF if the file doesn't appear to contain an Acorn .ADF format image.
*/
AcornADF(const char *file_name);
~AcornADF();
enum {
ErrorNotAcornADF,