2018-04-28 03:18:45 +00:00
|
|
|
//
|
|
|
|
// AppleDSK.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 27/04/2018.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2018 Thomas Harte. All rights reserved.
|
2018-04-28 03:18:45 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef AppleDSK_hpp
|
|
|
|
#define AppleDSK_hpp
|
|
|
|
|
|
|
|
#include "../DiskImage.hpp"
|
|
|
|
#include "../../../FileHolder.hpp"
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2023-05-10 21:02:18 +00:00
|
|
|
namespace Storage::Disk {
|
2018-04-28 03:18:45 +00:00
|
|
|
|
|
|
|
/*!
|
2018-05-13 19:34:31 +00:00
|
|
|
Provides a @c DiskImage containing an Apple DSK disk image: a representation of sector contents,
|
2018-04-28 03:18:45 +00:00
|
|
|
implicitly numbered and located.
|
|
|
|
*/
|
|
|
|
class AppleDSK: public DiskImage {
|
|
|
|
public:
|
|
|
|
/*!
|
|
|
|
Construct an @c AppleDSK containing content from the file with name @c file_name.
|
|
|
|
|
|
|
|
@throws Storage::FileHolder::Error::CantOpen if this file can't be opened.
|
2023-11-29 04:09:35 +00:00
|
|
|
@throws Error::InvalidFormat if the file doesn't appear to contain an Apple DSK format image.
|
2018-04-28 03:18:45 +00:00
|
|
|
*/
|
|
|
|
AppleDSK(const std::string &file_name);
|
|
|
|
|
2018-05-25 22:31:20 +00:00
|
|
|
// Implemented to satisfy @c DiskImage.
|
2020-01-24 03:57:51 +00:00
|
|
|
HeadPosition get_maximum_head_position() final;
|
|
|
|
std::shared_ptr<Track> get_track_at_position(Track::Address address) final;
|
|
|
|
void set_tracks(const std::map<Track::Address, std::shared_ptr<Track>> &tracks) final;
|
|
|
|
bool get_is_read_only() final;
|
2018-05-18 01:39:11 +00:00
|
|
|
|
2018-04-28 03:18:45 +00:00
|
|
|
private:
|
|
|
|
Storage::FileHolder file_;
|
2018-04-29 20:18:14 +00:00
|
|
|
int sectors_per_track_ = 16;
|
|
|
|
bool is_prodos_ = false;
|
2018-05-20 02:30:52 +00:00
|
|
|
|
|
|
|
long file_offset(Track::Address address);
|
2018-05-20 02:59:59 +00:00
|
|
|
size_t logical_sector_for_physical_sector(size_t physical);
|
2018-04-28 03:18:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* AppleDSK_hpp */
|