mirror of
https://github.com/TomHarte/CLK.git
synced 2025-04-10 22:37:30 +00:00
Remove more get_
s.
This commit is contained in:
parent
47bd4dade5
commit
ff86cbd48e
@ -60,7 +60,7 @@ Analyser::Static::TargetList Analyser::Static::DiskII::GetTargets(
|
||||
TargetList targets;
|
||||
|
||||
// If the disk image is too large for a 5.25" disk, map this to the IIgs.
|
||||
if(disk->get_maximum_head_position() > Storage::Disk::HeadPosition(40)) {
|
||||
if(disk->maximum_head_position() > Storage::Disk::HeadPosition(40)) {
|
||||
targets.push_back(std::unique_ptr<Analyser::Static::Target>(AppleIIgsTarget()));
|
||||
targets.back()->media = media;
|
||||
return targets;
|
||||
|
@ -39,7 +39,7 @@ Analyser::Static::TargetList Analyser::Static::FAT12::GetTargets(
|
||||
|
||||
// If the disk image is very small or large, map it to the PC. That's the only option old enough
|
||||
// to have used 5.25" media.
|
||||
if(disk->get_maximum_head_position() <= Storage::Disk::HeadPosition(40)) {
|
||||
if(disk->maximum_head_position() <= Storage::Disk::HeadPosition(40)) {
|
||||
return Analyser::Static::PCCompatible::GetTargets(media, file_name, platforms, true);
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,7 @@ Analyser::Static::TargetList Analyser::Static::Macintosh::GetTargets(
|
||||
if(media.mass_storage_devices.empty()) {
|
||||
bool has_800kb_disks = false;
|
||||
for(const auto &disk: media.disks) {
|
||||
has_800kb_disks |= disk->get_head_count() > 1;
|
||||
has_800kb_disks |= disk->head_count() > 1;
|
||||
}
|
||||
|
||||
if(!has_800kb_disks) {
|
||||
|
@ -77,7 +77,7 @@ uint8_t WD1770::read(const int address) {
|
||||
status |=
|
||||
(status_.track_zero ? Flag::TrackZero : 0) |
|
||||
(status_.seek_error ? Flag::SeekError : 0) |
|
||||
(get_drive().get_is_read_only() ? Flag::WriteProtect : 0) |
|
||||
(get_drive().is_read_only() ? Flag::WriteProtect : 0) |
|
||||
(get_drive().get_index_pulse() ? Flag::Index : 0);
|
||||
break;
|
||||
|
||||
@ -417,7 +417,7 @@ void WD1770::posit_event(const int new_event_type) {
|
||||
WAIT_FOR_TIME(30);
|
||||
|
||||
test_type2_write_protection:
|
||||
if(command_&0x20 && get_drive().get_is_read_only()) {
|
||||
if(command_&0x20 && get_drive().is_read_only()) {
|
||||
update_status([] (Status &status) {
|
||||
status.write_protect = true;
|
||||
});
|
||||
@ -716,7 +716,7 @@ void WD1770::posit_event(const int new_event_type) {
|
||||
status.lost_data = false;
|
||||
});
|
||||
|
||||
if(get_drive().get_is_read_only()) {
|
||||
if(get_drive().is_read_only()) {
|
||||
update_status([] (Status &status) {
|
||||
status.write_protect = true;
|
||||
});
|
||||
|
@ -447,7 +447,7 @@ void i8272::posit_event(const int event_type) {
|
||||
// command_[6],
|
||||
// command_[8]);
|
||||
|
||||
if(get_drive().get_is_read_only()) {
|
||||
if(get_drive().is_read_only()) {
|
||||
status_.set(Status1::NotWriteable);
|
||||
goto abort;
|
||||
}
|
||||
@ -564,7 +564,7 @@ void i8272::posit_event(const int event_type) {
|
||||
// Performs format [/write] track.
|
||||
format_track:
|
||||
logger.info().append("Format track");
|
||||
if(get_drive().get_is_read_only()) {
|
||||
if(get_drive().is_read_only()) {
|
||||
status_.set(Status1::NotWriteable);
|
||||
goto abort;
|
||||
}
|
||||
@ -745,7 +745,7 @@ void i8272::posit_event(const int event_type) {
|
||||
0x08 | // single sided
|
||||
(get_drive().get_is_track_zero() ? 0x10 : 0x00) |
|
||||
(get_drive().get_is_ready() ? 0x20 : 0x00) |
|
||||
(get_drive().get_is_read_only() ? 0x40 : 0x00)
|
||||
(get_drive().is_read_only() ? 0x40 : 0x00)
|
||||
)
|
||||
};
|
||||
}
|
||||
|
@ -184,7 +184,7 @@ void DiskII::decide_clocking_preference() {
|
||||
}
|
||||
|
||||
bool DiskII::is_write_protected() const {
|
||||
return (stepper_mask_ & 2) || drives_[active_drive_].get_is_read_only();
|
||||
return (stepper_mask_ & 2) || drives_[active_drive_].is_read_only();
|
||||
}
|
||||
|
||||
void DiskII::set_state_machine(const std::vector<uint8_t> &state_machine) {
|
||||
|
@ -41,5 +41,5 @@ void DiskIIDrive::set_control_lines(const int lines) {
|
||||
}
|
||||
|
||||
bool DiskIIDrive::read() {
|
||||
return !!(stepper_mask_ & 2) || get_is_read_only();
|
||||
return !!(stepper_mask_ & 2) || is_read_only();
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ bool DoubleDensityDrive::read() {
|
||||
|
||||
case CA0|SEL: // Disk locked.
|
||||
// (0 = write protected)
|
||||
return !get_is_read_only();
|
||||
return !is_read_only();
|
||||
|
||||
case CA1: // Disk motor running.
|
||||
// (0 = motor on)
|
||||
@ -161,7 +161,7 @@ bool DoubleDensityDrive::read() {
|
||||
|
||||
case CA2|CA1: // Single- or double-sided drive.
|
||||
// (0 = single sided)
|
||||
return get_head_count() != 1;
|
||||
return head_count() != 1;
|
||||
|
||||
case CA2|CA1|CA0: // "Present/HD" (per the Mac Plus ROM)
|
||||
// (0 = ??HD??)
|
||||
|
@ -232,7 +232,7 @@ uint8_t Chipset::DiskController::get_rdy_trk0_wpro_chng() {
|
||||
(drive.get_motor_on() ? 0x20 : 0x00) |
|
||||
(drive.get_is_ready() ? 0x00 : 0x04) |
|
||||
(drive.get_is_track_zero() ? 0x10 : 0x00) |
|
||||
(drive.get_is_read_only() ? 0x08 : 0x00);
|
||||
(drive.is_read_only() ? 0x08 : 0x00);
|
||||
|
||||
return ~active_high;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ public:
|
||||
bool insert_media(const Analyser::Static::Media &media) final {
|
||||
if(!media.disks.empty()) {
|
||||
const auto disk = media.disks[0];
|
||||
if(disk->get_maximum_head_position().as_int() > 35) {
|
||||
if(disk->maximum_head_position().as_int() > 35) {
|
||||
drives35_[0].set_disk(media.disks[0]);
|
||||
} else {
|
||||
drives525_[0].set_disk(media.disks[0]);
|
||||
|
@ -32,12 +32,12 @@ public:
|
||||
This is not necessarily a track count. There is no implicit guarantee that every position will
|
||||
return a distinct track, or, e.g. if the media is holeless, will return any track at all.
|
||||
*/
|
||||
virtual HeadPosition get_maximum_head_position() const = 0;
|
||||
virtual HeadPosition maximum_head_position() const = 0;
|
||||
|
||||
/*!
|
||||
@returns the number of heads (and, therefore, impliedly surfaces) available on this disk.
|
||||
*/
|
||||
virtual int get_head_count() const = 0;
|
||||
virtual int head_count() const = 0;
|
||||
|
||||
/*!
|
||||
@returns the @c Track at @c position underneath @c head if there are any detectable events there;
|
||||
@ -58,7 +58,7 @@ public:
|
||||
/*!
|
||||
@returns whether the disk image is read only. Defaults to @c true if not overridden.
|
||||
*/
|
||||
virtual bool get_is_read_only() const = 0;
|
||||
virtual bool is_read_only() const = 0;
|
||||
|
||||
/*!
|
||||
@returns @c true if the tracks at the two addresses are different. @c false if they are the same track.
|
||||
|
@ -39,12 +39,12 @@ public:
|
||||
This is not necessarily a track count. There is no implicit guarantee that every position will
|
||||
return a distinct track, or, e.g. if the media is holeless, will return any track at all.
|
||||
*/
|
||||
// virtual HeadPosition get_maximum_head_position() = 0;
|
||||
// virtual HeadPosition maximum_head_position() = 0;
|
||||
|
||||
/*!
|
||||
@returns the number of heads (and, therefore, impliedly surfaces) available on this disk.
|
||||
*/
|
||||
int get_head_count() const { return 1; }
|
||||
int head_count() const { return 1; }
|
||||
|
||||
/*!
|
||||
@returns the @c Track at @c position underneath @c head if there are any detectable events there;
|
||||
@ -65,7 +65,7 @@ public:
|
||||
/*!
|
||||
@returns whether the disk image is read only. Defaults to @c true if not overridden.
|
||||
*/
|
||||
bool get_is_read_only() const { return true; }
|
||||
bool is_read_only() const { return true; }
|
||||
|
||||
/*!
|
||||
@returns @c true if the tracks at the two addresses are different. @c false if they are the same track.
|
||||
@ -102,13 +102,13 @@ public:
|
||||
disk_image_(args...) {}
|
||||
~DiskImageHolder();
|
||||
|
||||
HeadPosition get_maximum_head_position() const override;
|
||||
int get_head_count() const override;
|
||||
HeadPosition maximum_head_position() const override;
|
||||
int head_count() const override;
|
||||
Track *track_at_position(Track::Address address) const override;
|
||||
void set_track_at_position(Track::Address address, const std::shared_ptr<Track> &track) override;
|
||||
void flush_tracks() override;
|
||||
bool tracks_differ(Track::Address lhs, Track::Address rhs) const override;
|
||||
bool get_is_read_only() const override;
|
||||
bool is_read_only() const override;
|
||||
bool represents(const std::string &) const override;
|
||||
bool has_written() const override;
|
||||
|
||||
|
@ -7,18 +7,18 @@
|
||||
//
|
||||
|
||||
template <typename T>
|
||||
HeadPosition DiskImageHolder<T>::get_maximum_head_position() const {
|
||||
return disk_image_.get_maximum_head_position();
|
||||
HeadPosition DiskImageHolder<T>::maximum_head_position() const {
|
||||
return disk_image_.maximum_head_position();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int DiskImageHolder<T>::get_head_count() const {
|
||||
return disk_image_.get_head_count();
|
||||
int DiskImageHolder<T>::head_count() const {
|
||||
return disk_image_.head_count();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
bool DiskImageHolder<T>::get_is_read_only() const {
|
||||
return disk_image_.get_is_read_only();
|
||||
bool DiskImageHolder<T>::is_read_only() const {
|
||||
return disk_image_.is_read_only();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
@ -51,7 +51,7 @@ void DiskImageHolder<T>::flush_tracks() {
|
||||
|
||||
template <typename T>
|
||||
void DiskImageHolder<T>::set_track_at_position(Track::Address address, const std::shared_ptr<Track> &track) {
|
||||
if(disk_image_.get_is_read_only()) return;
|
||||
if(disk_image_.is_read_only()) return;
|
||||
has_written_ = true;
|
||||
|
||||
unwritten_tracks_.insert(address);
|
||||
@ -60,8 +60,8 @@ void DiskImageHolder<T>::set_track_at_position(Track::Address address, const std
|
||||
|
||||
template <typename T>
|
||||
Track *DiskImageHolder<T>::track_at_position(Track::Address address) const {
|
||||
if(address.head >= get_head_count()) return nullptr;
|
||||
if(address.position >= get_maximum_head_position()) return nullptr;
|
||||
if(address.head >= head_count()) return nullptr;
|
||||
if(address.position >= maximum_head_position()) return nullptr;
|
||||
|
||||
const auto canonical_address = disk_image_.canonical_address(address);
|
||||
auto cached_track = cached_tracks_.find(canonical_address);
|
||||
|
@ -111,11 +111,11 @@ AcornADF::AcornADF(const std::string &file_name) : MFMSectorDump(file_name) {
|
||||
set_geometry(sectors_per_track_, sector_size_, 0, density);
|
||||
}
|
||||
|
||||
HeadPosition AcornADF::get_maximum_head_position() const {
|
||||
HeadPosition AcornADF::maximum_head_position() const {
|
||||
return HeadPosition(80);
|
||||
}
|
||||
|
||||
int AcornADF::get_head_count() const {
|
||||
int AcornADF::head_count() const {
|
||||
return head_count_;
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,8 @@ public:
|
||||
*/
|
||||
AcornADF(const std::string &file_name);
|
||||
|
||||
HeadPosition get_maximum_head_position() const final;
|
||||
int get_head_count() const final;
|
||||
HeadPosition maximum_head_position() const final;
|
||||
int head_count() const final;
|
||||
|
||||
private:
|
||||
long get_file_offset_for_position(Track::Address) const final;
|
||||
|
@ -116,11 +116,11 @@ AmigaADF::AmigaADF(const std::string &file_name) :
|
||||
if(file_.stats().st_size != 901120) throw Error::InvalidFormat;
|
||||
}
|
||||
|
||||
HeadPosition AmigaADF::get_maximum_head_position() const {
|
||||
HeadPosition AmigaADF::maximum_head_position() const {
|
||||
return HeadPosition(80);
|
||||
}
|
||||
|
||||
int AmigaADF::get_head_count() const {
|
||||
int AmigaADF::head_count() const {
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,8 @@ public:
|
||||
AmigaADF(const std::string &file_name);
|
||||
|
||||
// implemented to satisfy @c Disk
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
int get_head_count() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
int head_count() const;
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
bool represents(const std::string &) const;
|
||||
|
||||
|
@ -42,11 +42,11 @@ AppleDSK::AppleDSK(const std::string &file_name) :
|
||||
}
|
||||
}
|
||||
|
||||
HeadPosition AppleDSK::get_maximum_head_position() const {
|
||||
HeadPosition AppleDSK::maximum_head_position() const {
|
||||
return HeadPosition(number_of_tracks);
|
||||
}
|
||||
|
||||
bool AppleDSK::get_is_read_only() const {
|
||||
bool AppleDSK::is_read_only() const {
|
||||
return file_.is_known_read_only();
|
||||
}
|
||||
|
||||
|
@ -30,10 +30,10 @@ public:
|
||||
AppleDSK(const std::string &file_name);
|
||||
|
||||
// Implemented to satisfy @c DiskImage.
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
void set_tracks(const std::map<Track::Address, std::unique_ptr<Track>> &);
|
||||
bool get_is_read_only() const;
|
||||
bool is_read_only() const;
|
||||
bool represents(const std::string &) const;
|
||||
|
||||
private:
|
||||
|
@ -186,11 +186,11 @@ CPCDSK::CPCDSK(const std::string &file_name) :
|
||||
}
|
||||
}
|
||||
|
||||
HeadPosition CPCDSK::get_maximum_head_position() const {
|
||||
HeadPosition CPCDSK::maximum_head_position() const {
|
||||
return HeadPosition(head_position_count_);
|
||||
}
|
||||
|
||||
int CPCDSK::get_head_count() const {
|
||||
int CPCDSK::head_count() const {
|
||||
return head_count_;
|
||||
}
|
||||
|
||||
@ -385,7 +385,7 @@ void CPCDSK::set_tracks(const std::map<::Storage::Disk::Track::Address, std::uni
|
||||
}
|
||||
}
|
||||
|
||||
bool CPCDSK::get_is_read_only() const {
|
||||
bool CPCDSK::is_read_only() const {
|
||||
return is_read_only_;
|
||||
}
|
||||
|
||||
|
@ -31,9 +31,9 @@ public:
|
||||
CPCDSK(const std::string &file_name);
|
||||
|
||||
// DiskImage interface.
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
int get_head_count() const;
|
||||
bool get_is_read_only() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
int head_count() const;
|
||||
bool is_read_only() const;
|
||||
bool represents(const std::string &) const;
|
||||
void set_tracks(const std::map<Track::Address, std::unique_ptr<Track>> &);
|
||||
std::unique_ptr<::Storage::Disk::Track> track_at_position(::Storage::Disk::Track::Address) const;
|
||||
|
@ -34,7 +34,7 @@ D64::D64(const std::string &file_name) :
|
||||
}
|
||||
}
|
||||
|
||||
HeadPosition D64::get_maximum_head_position() const {
|
||||
HeadPosition D64::maximum_head_position() const {
|
||||
return HeadPosition(number_of_tracks_);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
*/
|
||||
D64(const std::string &file_name);
|
||||
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
bool represents(const std::string &) const;
|
||||
|
||||
|
@ -61,15 +61,15 @@ DMK::DMK(const std::string &file_name) :
|
||||
if(format) throw Error::InvalidFormat;
|
||||
}
|
||||
|
||||
HeadPosition DMK::get_maximum_head_position() const {
|
||||
HeadPosition DMK::maximum_head_position() const {
|
||||
return HeadPosition(head_position_count_);
|
||||
}
|
||||
|
||||
int DMK::get_head_count() const {
|
||||
int DMK::head_count() const {
|
||||
return head_count_;
|
||||
}
|
||||
|
||||
bool DMK::get_is_read_only() const {
|
||||
bool DMK::is_read_only() const {
|
||||
return true;
|
||||
// Given that track serialisation is not yet implemented, treat all DMKs as read-only.
|
||||
// return is_read_only_;
|
||||
|
@ -28,9 +28,9 @@ public:
|
||||
*/
|
||||
DMK(const std::string &file_name);
|
||||
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
int get_head_count() const;
|
||||
bool get_is_read_only() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
int head_count() const;
|
||||
bool is_read_only() const;
|
||||
bool represents(const std::string &) const;
|
||||
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
|
@ -49,11 +49,11 @@ FAT12::FAT12(const std::string &file_name) :
|
||||
);
|
||||
}
|
||||
|
||||
HeadPosition FAT12::get_maximum_head_position() const {
|
||||
HeadPosition FAT12::maximum_head_position() const {
|
||||
return HeadPosition(track_count_);
|
||||
}
|
||||
|
||||
int FAT12::get_head_count() const {
|
||||
int FAT12::head_count() const {
|
||||
return head_count_;
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ namespace Storage::Disk {
|
||||
class FAT12: public MFMSectorDump {
|
||||
public:
|
||||
FAT12(const std::string &file_name);
|
||||
HeadPosition get_maximum_head_position() const final;
|
||||
int get_head_count() const final;
|
||||
HeadPosition maximum_head_position() const final;
|
||||
int head_count() const final;
|
||||
|
||||
private:
|
||||
long get_file_offset_for_position(Track::Address address) const;
|
||||
|
@ -30,7 +30,7 @@ G64::G64(const std::string &file_name) :
|
||||
maximum_track_size_ = file_.get_le<uint16_t>();
|
||||
}
|
||||
|
||||
HeadPosition G64::get_maximum_head_position() const {
|
||||
HeadPosition G64::maximum_head_position() const {
|
||||
// give at least 84 tracks, to yield the normal geometry but,
|
||||
// if there are more, shove them in
|
||||
return HeadPosition(number_of_tracks_ > 84 ? number_of_tracks_ : 84, 2);
|
||||
|
@ -30,9 +30,9 @@ public:
|
||||
G64(const std::string &file_name);
|
||||
|
||||
// implemented to satisfy @c Disk
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
using DiskImage::get_is_read_only;
|
||||
using DiskImage::is_read_only;
|
||||
bool represents(const std::string &) const;
|
||||
|
||||
private:
|
||||
|
@ -25,11 +25,11 @@ HFE::HFE(const std::string &file_name) :
|
||||
track_list_offset_ = long(file_.get_le<uint16_t>()) << 9;
|
||||
}
|
||||
|
||||
HeadPosition HFE::get_maximum_head_position() const {
|
||||
HeadPosition HFE::maximum_head_position() const {
|
||||
return HeadPosition(track_count_);
|
||||
}
|
||||
|
||||
int HFE::get_head_count() const {
|
||||
int HFE::head_count() const {
|
||||
return head_count_;
|
||||
}
|
||||
|
||||
@ -125,7 +125,7 @@ void HFE::set_tracks(const std::map<Track::Address, std::unique_ptr<Track>> &tra
|
||||
}
|
||||
}
|
||||
|
||||
bool HFE::get_is_read_only() const {
|
||||
bool HFE::is_read_only() const {
|
||||
return file_.is_known_read_only();
|
||||
}
|
||||
|
||||
|
@ -30,9 +30,9 @@ public:
|
||||
HFE(const std::string &file_name);
|
||||
|
||||
// implemented to satisfy @c Disk
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
int get_head_count() const;
|
||||
bool get_is_read_only() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
int head_count() const;
|
||||
bool is_read_only() const;
|
||||
bool represents(const std::string &) const;
|
||||
void set_tracks(const std::map<Track::Address, std::unique_ptr<Track>> &tracks);
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
|
@ -90,11 +90,11 @@ IMD::IMD(const std::string &file_name) : file_(file_name) {
|
||||
++ heads_;
|
||||
}
|
||||
|
||||
HeadPosition IMD::get_maximum_head_position() const {
|
||||
HeadPosition IMD::maximum_head_position() const {
|
||||
return HeadPosition(cylinders_);
|
||||
}
|
||||
|
||||
int IMD::get_head_count() const {
|
||||
int IMD::head_count() const {
|
||||
return heads_ + 1;
|
||||
}
|
||||
|
||||
|
@ -29,8 +29,8 @@ public:
|
||||
IMD(const std::string &file_name);
|
||||
|
||||
// DiskImage interface.
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
int get_head_count() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
int head_count() const;
|
||||
bool represents(const std::string &) const;
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
|
||||
|
@ -178,11 +178,11 @@ IPF::IPF(const std::string &file_name) : file_(file_name) {
|
||||
}
|
||||
}
|
||||
|
||||
HeadPosition IPF::get_maximum_head_position() const {
|
||||
HeadPosition IPF::maximum_head_position() const {
|
||||
return HeadPosition(track_count_);
|
||||
}
|
||||
|
||||
int IPF::get_head_count() const {
|
||||
int IPF::head_count() const {
|
||||
return head_count_;
|
||||
}
|
||||
|
||||
|
@ -36,8 +36,8 @@ public:
|
||||
IPF(const std::string &file_name);
|
||||
|
||||
// implemented to satisfy @c Disk
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
int get_head_count() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
int head_count() const;
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
bool represents(const std::string &) const;
|
||||
|
||||
|
@ -22,8 +22,8 @@ void MFMSectorDump::set_geometry(int sectors_per_track, uint8_t sector_size, uin
|
||||
}
|
||||
|
||||
std::unique_ptr<Track> MFMSectorDump::track_at_position(Track::Address address) const {
|
||||
if(address.head >= get_head_count()) return nullptr;
|
||||
if(address.position.as_largest() >= get_maximum_head_position().as_largest()) return nullptr;
|
||||
if(address.head >= head_count()) return nullptr;
|
||||
if(address.position.as_largest() >= maximum_head_position().as_largest()) return nullptr;
|
||||
|
||||
uint8_t sectors[(128 << sector_size_)*sectors_per_track_];
|
||||
const long file_offset = get_file_offset_for_position(address);
|
||||
@ -68,7 +68,7 @@ void MFMSectorDump::set_tracks(const std::map<Track::Address, std::unique_ptr<Tr
|
||||
file_.flush();
|
||||
}
|
||||
|
||||
bool MFMSectorDump::get_is_read_only() const {
|
||||
bool MFMSectorDump::is_read_only() const {
|
||||
return file_.is_known_read_only();
|
||||
}
|
||||
|
||||
|
@ -23,7 +23,7 @@ class MFMSectorDump: public DiskImage {
|
||||
public:
|
||||
MFMSectorDump(const std::string &file_name);
|
||||
|
||||
bool get_is_read_only() const;
|
||||
bool is_read_only() const;
|
||||
bool represents(const std::string &) const;
|
||||
void set_tracks(const std::map<Track::Address, std::unique_ptr<Track>> &tracks);
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
@ -33,8 +33,8 @@ protected:
|
||||
void set_geometry(int sectors_per_track, uint8_t sector_size, uint8_t first_sector, Encodings::MFM::Density);
|
||||
|
||||
private:
|
||||
virtual int get_head_count() const = 0;
|
||||
virtual HeadPosition get_maximum_head_position() const = 0;
|
||||
virtual int head_count() const = 0;
|
||||
virtual HeadPosition maximum_head_position() const = 0;
|
||||
virtual long get_file_offset_for_position(Track::Address) const = 0;
|
||||
|
||||
int sectors_per_track_ = 0;
|
||||
|
@ -87,11 +87,11 @@ std::unique_ptr<Track> MSA::track_at_position(Track::Address address) const {
|
||||
return track_for_sectors(track.data(), sectors_per_track_, uint8_t(position), uint8_t(address.head), 1, 2, Storage::Encodings::MFM::Density::Double);
|
||||
}
|
||||
|
||||
HeadPosition MSA::get_maximum_head_position() const {
|
||||
HeadPosition MSA::maximum_head_position() const {
|
||||
return HeadPosition(ending_track_ + 1);
|
||||
}
|
||||
|
||||
int MSA::get_head_count() const {
|
||||
int MSA::head_count() const {
|
||||
return sides_;
|
||||
}
|
||||
|
||||
|
@ -24,10 +24,10 @@ public:
|
||||
MSA(const std::string &file_name);
|
||||
|
||||
// Implemented to satisfy @c DiskImage.
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
int get_head_count() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
int head_count() const;
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
bool get_is_read_only() const { return false; }
|
||||
bool is_read_only() const { return false; }
|
||||
bool represents(const std::string &) const;
|
||||
|
||||
private:
|
||||
|
@ -157,17 +157,17 @@ uint32_t MacintoshIMG::checksum(const std::vector<uint8_t> &data, size_t bytes_t
|
||||
return result;
|
||||
}
|
||||
|
||||
HeadPosition MacintoshIMG::get_maximum_head_position() const {
|
||||
HeadPosition MacintoshIMG::maximum_head_position() const {
|
||||
return HeadPosition(80);
|
||||
}
|
||||
|
||||
int MacintoshIMG::get_head_count() const {
|
||||
int MacintoshIMG::head_count() const {
|
||||
// Bit 5 in the format field indicates whether this disk is double
|
||||
// sided, regardless of whether it is GCR or MFM.
|
||||
return 1 + ((format_ & 0x20) >> 5);
|
||||
}
|
||||
|
||||
bool MacintoshIMG::get_is_read_only() const {
|
||||
bool MacintoshIMG::is_read_only() const {
|
||||
return file_.is_known_read_only();
|
||||
}
|
||||
|
||||
@ -198,7 +198,7 @@ std::unique_ptr<Track> MacintoshIMG::track_at_position(Track::Address address) c
|
||||
if(encoding_ == Encoding::GCR400 || encoding_ == Encoding::GCR800) {
|
||||
// Perform a GCR encoding.
|
||||
const auto included_sectors = Storage::Encodings::AppleGCR::Macintosh::sectors_in_track(address.position.as_int());
|
||||
const size_t start_sector = size_t(included_sectors.start * get_head_count() + included_sectors.length * address.head);
|
||||
const size_t start_sector = size_t(included_sectors.start * head_count() + included_sectors.length * address.head);
|
||||
|
||||
if(start_sector*512 >= data_.size()) return nullptr;
|
||||
|
||||
@ -287,7 +287,7 @@ void MacintoshIMG::set_tracks(const std::map<Track::Address, std::unique_ptr<Tra
|
||||
std::lock_guard buffer_lock(buffer_mutex_);
|
||||
for(const auto &pair: tracks_by_address) {
|
||||
const auto included_sectors = Storage::Encodings::AppleGCR::Macintosh::sectors_in_track(pair.first.position.as_int());
|
||||
size_t start_sector = size_t(included_sectors.start * get_head_count() + included_sectors.length * pair.first.head);
|
||||
size_t start_sector = size_t(included_sectors.start * head_count() + included_sectors.length * pair.first.head);
|
||||
|
||||
for(int c = 0; c < included_sectors.length; ++c) {
|
||||
const auto sector_plus_tags = &pair.second[size_t(c)*524];
|
||||
|
@ -43,9 +43,9 @@ public:
|
||||
MacintoshIMG(const std::string &file_name, FixedType type, size_t offset = 0, size_t length = 0);
|
||||
|
||||
// implemented to satisfy @c Disk
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
int get_head_count() const;
|
||||
bool get_is_read_only() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
int head_count() const;
|
||||
bool is_read_only() const;
|
||||
bool represents(const std::string &) const;
|
||||
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
|
@ -42,11 +42,11 @@ NIB::NIB(const std::string &file_name) :
|
||||
}
|
||||
}
|
||||
|
||||
HeadPosition NIB::get_maximum_head_position() const {
|
||||
HeadPosition NIB::maximum_head_position() const {
|
||||
return HeadPosition(number_of_tracks);
|
||||
}
|
||||
|
||||
bool NIB::get_is_read_only() const {
|
||||
bool NIB::is_read_only() const {
|
||||
return file_.is_known_read_only();
|
||||
}
|
||||
|
||||
|
@ -26,11 +26,11 @@ public:
|
||||
NIB(const std::string &file_name);
|
||||
|
||||
// Implemented to satisfy @c DiskImage.
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
Track::Address canonical_address(Track::Address) const;
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
void set_tracks(const std::map<Track::Address, std::unique_ptr<Track>> &tracks);
|
||||
bool get_is_read_only() const;
|
||||
bool is_read_only() const;
|
||||
bool represents(const std::string &) const;
|
||||
|
||||
private:
|
||||
|
@ -29,11 +29,11 @@ OricMFMDSK::OricMFMDSK(const std::string &file_name) :
|
||||
throw Error::InvalidFormat;
|
||||
}
|
||||
|
||||
HeadPosition OricMFMDSK::get_maximum_head_position() const {
|
||||
HeadPosition OricMFMDSK::maximum_head_position() const {
|
||||
return HeadPosition(int(track_count_));
|
||||
}
|
||||
|
||||
int OricMFMDSK::get_head_count() const {
|
||||
int OricMFMDSK::head_count() const {
|
||||
return int(head_count_);
|
||||
}
|
||||
|
||||
@ -164,7 +164,7 @@ void OricMFMDSK::set_tracks(const std::map<Track::Address, std::unique_ptr<Track
|
||||
}
|
||||
}
|
||||
|
||||
bool OricMFMDSK::get_is_read_only() const {
|
||||
bool OricMFMDSK::is_read_only() const {
|
||||
return file_.is_known_read_only();
|
||||
}
|
||||
|
||||
|
@ -28,9 +28,9 @@ public:
|
||||
OricMFMDSK(const std::string &file_name);
|
||||
|
||||
// implemented to satisfy @c DiskImage
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
int get_head_count() const;
|
||||
bool get_is_read_only() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
int head_count() const;
|
||||
bool is_read_only() const;
|
||||
bool represents(const std::string &) const;
|
||||
|
||||
void set_tracks(const std::map<Track::Address, std::unique_ptr<Track>> &tracks);
|
||||
|
@ -55,11 +55,11 @@ PCBooter::PCBooter(const std::string &file_name) :
|
||||
// as it can also be used to disambiguate FAT12 disks.
|
||||
}
|
||||
|
||||
HeadPosition PCBooter::get_maximum_head_position() const {
|
||||
HeadPosition PCBooter::maximum_head_position() const {
|
||||
return HeadPosition(track_count_);
|
||||
}
|
||||
|
||||
int PCBooter::get_head_count() const {
|
||||
int PCBooter::head_count() const {
|
||||
return head_count_;
|
||||
}
|
||||
|
||||
|
@ -21,8 +21,8 @@ namespace Storage::Disk {
|
||||
class PCBooter: public MFMSectorDump {
|
||||
public:
|
||||
PCBooter(const std::string &file_name);
|
||||
HeadPosition get_maximum_head_position() const final;
|
||||
int get_head_count() const final;
|
||||
HeadPosition maximum_head_position() const final;
|
||||
int head_count() const final;
|
||||
|
||||
private:
|
||||
long get_file_offset_for_position(Track::Address address) const final;
|
||||
|
@ -32,11 +32,11 @@ SSD::SSD(const std::string &file_name) : MFMSectorDump(file_name) {
|
||||
set_geometry(sectors_per_track, sector_size, 0, Encodings::MFM::Density::Single);
|
||||
}
|
||||
|
||||
HeadPosition SSD::get_maximum_head_position() const {
|
||||
HeadPosition SSD::maximum_head_position() const {
|
||||
return HeadPosition(track_count_);
|
||||
}
|
||||
|
||||
int SSD::get_head_count() const {
|
||||
int SSD::head_count() const {
|
||||
return head_count_;
|
||||
}
|
||||
|
||||
|
@ -25,8 +25,8 @@ public:
|
||||
*/
|
||||
SSD(const std::string &file_name);
|
||||
|
||||
HeadPosition get_maximum_head_position() const final;
|
||||
int get_head_count() const final;
|
||||
HeadPosition maximum_head_position() const final;
|
||||
int head_count() const final;
|
||||
|
||||
private:
|
||||
long get_file_offset_for_position(Track::Address address) const final;
|
||||
|
@ -440,11 +440,11 @@ STX::STX(const std::string &file_name) : file_(file_name) {
|
||||
}
|
||||
}
|
||||
|
||||
HeadPosition STX::get_maximum_head_position() const {
|
||||
HeadPosition STX::maximum_head_position() const {
|
||||
return HeadPosition(track_count_ + 1); // Same issue as MSA; must fix!
|
||||
}
|
||||
|
||||
int STX::get_head_count() const {
|
||||
int STX::head_count() const {
|
||||
return head_count_;
|
||||
}
|
||||
|
||||
|
@ -27,8 +27,8 @@ public:
|
||||
*/
|
||||
STX(const std::string &file_name);
|
||||
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
int get_head_count() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
int head_count() const;
|
||||
bool represents(const std::string &) const;
|
||||
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
|
@ -107,11 +107,11 @@ WOZ::WOZ(const std::string &file_name) :
|
||||
if(tracks_offset_ == -1 || !has_tmap) throw Error::InvalidFormat;
|
||||
}
|
||||
|
||||
HeadPosition WOZ::get_maximum_head_position() const {
|
||||
HeadPosition WOZ::maximum_head_position() const {
|
||||
return is_3_5_disk_ ? HeadPosition(80) : HeadPosition(160, 4);
|
||||
}
|
||||
|
||||
int WOZ::get_head_count() const {
|
||||
int WOZ::head_count() const {
|
||||
return is_3_5_disk_ ? 2 : 1;
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ void WOZ::set_tracks(const std::map<Track::Address, std::unique_ptr<Track>> &tra
|
||||
file_.write(post_crc_contents_);
|
||||
}
|
||||
|
||||
bool WOZ::get_is_read_only() const {
|
||||
bool WOZ::is_read_only() const {
|
||||
/*
|
||||
There is an unintended issue with the disk code that sits above here: it doesn't understand the idea
|
||||
of multiple addresses mapping to the same track, yet it maintains a cache of track contents. Therefore
|
||||
|
@ -24,11 +24,11 @@ public:
|
||||
WOZ(const std::string &file_name);
|
||||
|
||||
// Implemented to satisfy @c DiskImage.
|
||||
HeadPosition get_maximum_head_position() const;
|
||||
int get_head_count() const;
|
||||
HeadPosition maximum_head_position() const;
|
||||
int head_count() const;
|
||||
std::unique_ptr<Track> track_at_position(Track::Address) const;
|
||||
void set_tracks(const std::map<Track::Address, std::unique_ptr<Track>> &tracks);
|
||||
bool get_is_read_only() const;
|
||||
bool is_read_only() const;
|
||||
bool tracks_differ(Track::Address, Track::Address) const;
|
||||
bool represents(const std::string &) const;
|
||||
|
||||
|
@ -129,7 +129,7 @@ void Drive::set_head(int head) {
|
||||
}
|
||||
}
|
||||
|
||||
int Drive::get_head_count() const {
|
||||
int Drive::head_count() const {
|
||||
return available_heads_;
|
||||
}
|
||||
|
||||
@ -151,8 +151,8 @@ float Drive::get_time_into_track() const {
|
||||
return float(cycles_since_index_hole_) / (float(get_input_clock_rate()) * rotational_multiplier_);
|
||||
}
|
||||
|
||||
bool Drive::get_is_read_only() const {
|
||||
if(disk_) return disk_->get_is_read_only();
|
||||
bool Drive::is_read_only() const {
|
||||
if(disk_) return disk_->is_read_only();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -79,12 +79,12 @@ public:
|
||||
/*!
|
||||
Gets the head count for this disk.
|
||||
*/
|
||||
int get_head_count() const;
|
||||
int head_count() const;
|
||||
|
||||
/*!
|
||||
@returns @c true if the inserted disk is read-only or no disk is inserted; @c false otherwise.
|
||||
*/
|
||||
bool get_is_read_only() const;
|
||||
bool is_read_only() const;
|
||||
|
||||
/*!
|
||||
@returns @c true if the drive is ready; @c false otherwise.
|
||||
|
Loading…
x
Reference in New Issue
Block a user