2018-04-24 02:57:45 +00:00
|
|
|
//
|
|
|
|
// WOZ.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 23/04/2018.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2018 Thomas Harte. All rights reserved.
|
2018-04-24 02:57:45 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef WOZ_hpp
|
|
|
|
#define WOZ_hpp
|
|
|
|
|
|
|
|
#include "../DiskImage.hpp"
|
|
|
|
#include "../../../FileHolder.hpp"
|
2020-01-20 04:14:35 +00:00
|
|
|
#include "../../../../Numeric/CRC.hpp"
|
2018-04-24 02:57:45 +00:00
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
namespace Storage {
|
|
|
|
namespace Disk {
|
|
|
|
|
|
|
|
/*!
|
2018-05-13 19:34:31 +00:00
|
|
|
Provides a @c DiskImage containing a WOZ: a bit stream representation of a floppy.
|
2018-04-24 02:57:45 +00:00
|
|
|
*/
|
|
|
|
class WOZ: public DiskImage {
|
|
|
|
public:
|
|
|
|
WOZ(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;
|
|
|
|
int get_head_count() 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-04-24 02:57:45 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
Storage::FileHolder file_;
|
|
|
|
bool is_read_only_ = false;
|
|
|
|
bool is_3_5_disk_ = false;
|
|
|
|
uint8_t track_map_[160];
|
2018-04-28 03:18:45 +00:00
|
|
|
long tracks_offset_ = -1;
|
2018-05-24 22:45:00 +00:00
|
|
|
|
2018-05-25 01:44:31 +00:00
|
|
|
std::vector<uint8_t> post_crc_contents_;
|
|
|
|
CRC::CRC32 crc_generator;
|
|
|
|
|
2018-05-24 22:45:00 +00:00
|
|
|
/*!
|
|
|
|
Gets the in-file offset of a track.
|
|
|
|
|
|
|
|
@returns The offset within the file of the track at @c address or @c NoSuchTrack if
|
|
|
|
the track does not exit.
|
|
|
|
*/
|
|
|
|
long file_offset(Track::Address address);
|
|
|
|
constexpr static long NoSuchTrack = 0; // This is definitely an offset a track can't lie at.
|
2018-04-24 02:57:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* WOZ_hpp */
|