2018-04-22 04:21:57 +00:00
|
|
|
//
|
|
|
|
// NIB.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 21/04/2018.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2018 Thomas Harte. All rights reserved.
|
2018-04-22 04:21:57 +00:00
|
|
|
//
|
|
|
|
|
2024-01-17 04:34:46 +00:00
|
|
|
#pragma once
|
2018-04-22 04:21:57 +00:00
|
|
|
|
|
|
|
#include "../DiskImage.hpp"
|
|
|
|
#include "../../../FileHolder.hpp"
|
2023-12-09 04:12:41 +00:00
|
|
|
#include "../../Track/PCMTrack.hpp"
|
|
|
|
|
|
|
|
#include <memory>
|
2018-04-22 04:21:57 +00:00
|
|
|
|
2023-05-10 21:02:18 +00:00
|
|
|
namespace Storage::Disk {
|
2018-04-22 04:21:57 +00:00
|
|
|
|
|
|
|
/*!
|
|
|
|
Provides a @c DiskImage describing an Apple NIB disk image:
|
2018-05-25 22:30:55 +00:00
|
|
|
a bit stream capture that omits sync zeroes, and doesn't define
|
|
|
|
the means for full reconstruction.
|
2018-04-22 04:21:57 +00:00
|
|
|
*/
|
|
|
|
class NIB: public DiskImage {
|
|
|
|
public:
|
|
|
|
NIB(const std::string &file_name);
|
|
|
|
|
2018-05-25 22:30:55 +00:00
|
|
|
// Implemented to satisfy @c DiskImage.
|
2020-01-24 03:57:51 +00:00
|
|
|
HeadPosition get_maximum_head_position() final;
|
|
|
|
std::shared_ptr<::Storage::Disk::Track> get_track_at_position(::Storage::Disk::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-22 04:21:57 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
FileHolder file_;
|
|
|
|
long get_file_offset_for_position(Track::Address address);
|
2018-05-25 22:30:55 +00:00
|
|
|
long file_offset(Track::Address address);
|
2023-12-09 04:12:41 +00:00
|
|
|
|
|
|
|
// Cache for the last-generated track, given that head steps on an Apple II
|
|
|
|
// occur in quarter-track increments, so there'll routinely be four gets in
|
|
|
|
// a row for the same data.
|
|
|
|
long cached_offset_ = 0;
|
|
|
|
std::shared_ptr<Storage::Disk::PCMTrack> cached_track_;
|
2018-04-22 04:21:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|