Wire drives for IBM-style RDY.

This commit is contained in:
Thomas Harte 2024-04-30 22:18:17 -04:00
parent 72d4f638aa
commit a997b6c677
4 changed files with 12 additions and 2 deletions

View File

@ -16,7 +16,7 @@ template <typename InterruptObserverT>
class FloppyDisc: public WD::WD1770, public WD::WD1770::Delegate {
public:
FloppyDisc(InterruptObserverT &observer) : WD::WD1770(P1772), observer_(observer) {
emplace_drives(1, 8000000, 300, 2);
emplace_drives(1, 8000000, 300, 2, Storage::Disk::Drive::ReadyType::IBMRDY); // A guess at RDY type.
set_delegate(this);
}
@ -40,6 +40,10 @@ public:
get_drive(drive).set_disk(disk);
}
bool ready() const {
return get_drive().get_is_ready();
}
private:
InterruptObserverT &observer_;
};

View File

@ -200,8 +200,9 @@ struct InputOutputController: public ClockingHint::Observer {
case 0x00: {
uint8_t value = control_ | 0xc0;
value &= ~(i2c_.clock() ? 0x02 : 0x00);
value &= ~(i2c_.data() ? 0x01 : 0x00);
value &= ~(i2c_.clock() ? 0x02 : 0x00);
value &= ~(floppy_.ready() ? 0x04 : 0x00);
value &= ~(video_.flyback_active() ? 0x00 : 0x80); // i.e. high during flyback.
set_byte(value);
// logger.error().append("IOC control read: C:%d D:%d", !(value & 2), !(value & 1));

View File

@ -50,6 +50,10 @@ Drive &Controller::get_drive() {
return *drive_;
}
const Drive &Controller::get_drive() const {
return *drive_;
}
// MARK: - Drive::EventDelegate
void Controller::process_event(const Drive::Event &event) {

View File

@ -117,6 +117,7 @@ class Controller:
made about the lifetime or the exclusivity of the invented drive.
*/
Drive &get_drive();
const Drive &get_drive() const;
Drive &get_drive(size_t index) {
return *drives_[index];