1
0
mirror of https://github.com/TomHarte/CLK.git synced 2026-04-21 02:17:08 +00:00

Completed curly bracket movement.

This commit is contained in:
Thomas Harte
2017-03-26 14:34:47 -04:00
parent 3229502fa1
commit e01f3f06c8
83 changed files with 1542 additions and 3077 deletions
+9 -18
View File
@@ -14,53 +14,44 @@ using namespace Storage::Disk;
Drive::Drive()
: head_position_(0), head_(0) {}
void Drive::set_disk(const std::shared_ptr<Disk> &disk)
{
void Drive::set_disk(const std::shared_ptr<Disk> &disk) {
disk_ = disk;
track_ = nullptr;
}
void Drive::set_disk_with_track(const std::shared_ptr<Track> &track)
{
void Drive::set_disk_with_track(const std::shared_ptr<Track> &track) {
disk_ = nullptr;
track_ = track;
}
bool Drive::has_disk()
{
bool Drive::has_disk() {
return (bool)disk_ || (bool)track_;
}
bool Drive::get_is_track_zero()
{
bool Drive::get_is_track_zero() {
return head_position_ == 0;
}
void Drive::step(int direction)
{
void Drive::step(int direction) {
head_position_ = std::max(head_position_ + direction, 0);
}
void Drive::set_head(unsigned int head)
{
void Drive::set_head(unsigned int head) {
head_ = head;
}
bool Drive::get_is_read_only()
{
bool Drive::get_is_read_only() {
if(disk_) return disk_->get_is_read_only();
if(track_) return true;
return false;
}
std::shared_ptr<Track> Drive::get_track()
{
std::shared_ptr<Track> Drive::get_track() {
if(disk_) return disk_->get_track_at_position(head_, (unsigned int)head_position_);
if(track_) return track_;
return nullptr;
}
void Drive::set_track(const std::shared_ptr<Track> &track)
{
void Drive::set_track(const std::shared_ptr<Track> &track) {
if(disk_) disk_->set_track_at_position(head_, (unsigned int)head_position_, track);
}