Files
CLK/Machines/Tandy/CoCo/DiskController.hpp

62 lines
1.1 KiB
C++

//
// DiskController.hpp
// Clock Signal
//
// Created by Thomas Harte on 18/05/2026.
// Copyright © 2026 Thomas Harte. All rights reserved.
//
#pragma once
#include "Components/1770/1770.hpp"
#include "Activity/Observer.hpp"
#include <string>
namespace Tandy::CoCo {
class DiskController final: private WD::WD1770, public WD::WD1770::Delegate {
public:
DiskController();
using WD::WD1770::run_for;
void set_control(uint8_t);
template <int address>
uint8_t read() {
if(address & 8) {
return WD::WD1770::read(address);
} else {
return 0xff;
}
}
template <int address>
void write(const uint8_t value) {
if(address & 8) {
WD::WD1770::write(address, value);
} else {
set_control(value);
}
}
void set_activity_observer(Activity::Observer *);
void set_disk(std::shared_ptr<Storage::Disk::Disk>, size_t drive);
const Storage::Disk::Disk *disk(const std::string &);
bool halt() const { return halt_; }
bool nmi() const { return nmi_; }
private:
bool double_density_ = false;
bool enable_halt_ = false;
bool nmi_ = false;
bool halt_ = false;
void wd1770_did_change_output(WD::WD1770 &) final;
void update_halt_nmi();
};
}