1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-04 18:29:40 +00:00

Added the infrastructure necessary for Oric disks to appear writeable to the machine and to receive changed tracks.

This commit is contained in:
Thomas Harte 2016-12-30 22:51:48 -05:00
parent d581294479
commit 632b3c63b1
2 changed files with 26 additions and 2 deletions

View File

@ -26,6 +26,11 @@ OricMFMDSK::OricMFMDSK(const char *file_name) :
throw ErrorNotOricMFMDSK;
}
OricMFMDSK::~OricMFMDSK()
{
flush_updates();
}
unsigned int OricMFMDSK::get_head_position_count()
{
return track_count_;
@ -36,7 +41,12 @@ unsigned int OricMFMDSK::get_head_count()
return head_count_;
}
std::shared_ptr<Track> OricMFMDSK::get_uncached_track_at_position(unsigned int head, unsigned int position)
bool OricMFMDSK::get_is_read_only()
{
return is_read_only_;
}
long OricMFMDSK::get_file_offset_for_position(unsigned int head, unsigned int position)
{
long seek_offset = 0;
switch(geometry_type_)
@ -48,7 +58,12 @@ std::shared_ptr<Track> OricMFMDSK::get_uncached_track_at_position(unsigned int h
seek_offset = (position * track_count_ * head_count_) + head;
break;
}
fseek(file_, (seek_offset * 6400) + 256, SEEK_SET);
return (seek_offset * 6400) + 256;
}
std::shared_ptr<Track> OricMFMDSK::get_uncached_track_at_position(unsigned int head, unsigned int position)
{
fseek(file_, get_file_offset_for_position(head, position), SEEK_SET);
PCMSegment segment;
@ -115,3 +130,7 @@ std::shared_ptr<Track> OricMFMDSK::get_uncached_track_at_position(unsigned int h
std::shared_ptr<PCMTrack> track(new PCMTrack(segment));
return track;
}
void OricMFMDSK::store_updated_track_at_position(unsigned int head, unsigned int position, const std::shared_ptr<Track> &track, std::mutex &file_access_mutex)
{
}

View File

@ -27,6 +27,7 @@ class OricMFMDSK: public Disk, public Storage::FileHolder {
@throws ErrorNotAcornADF if the file doesn't appear to contain an Acorn .ADF format image.
*/
OricMFMDSK(const char *file_name);
~OricMFMDSK();
enum {
ErrorNotOricMFMDSK,
@ -35,9 +36,13 @@ class OricMFMDSK: public Disk, public Storage::FileHolder {
// implemented to satisfy @c Disk
unsigned int get_head_position_count();
unsigned int get_head_count();
bool get_is_read_only();
private:
void store_updated_track_at_position(unsigned int head, unsigned int position, const std::shared_ptr<Track> &track, std::mutex &file_access_mutex);
std::shared_ptr<Track> get_uncached_track_at_position(unsigned int head, unsigned int position);
long get_file_offset_for_position(unsigned int head, unsigned int position);
uint32_t head_count_;
uint32_t track_count_;
uint32_t geometry_type_;