1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-03 11:30:02 +00:00

Connects up the AY to floppy drive/side selection.

This commit is contained in:
Thomas Harte 2019-11-02 23:04:08 -04:00
parent f40dbefa67
commit 6d1e09ba55
3 changed files with 40 additions and 13 deletions

View File

@ -47,7 +47,8 @@ class ConcreteMachine:
public Motorola::MFP68901::MFP68901::InterruptDelegate,
public DMAController::InterruptDelegate,
public MouseMachine::Machine,
public KeyboardMachine::MappedMachine {
public KeyboardMachine::MappedMachine,
public GI::AY38910::PortHandler {
public:
ConcreteMachine(const Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
mc68000_(*this),
@ -99,6 +100,7 @@ class ConcreteMachine:
mfp_->set_interrupt_delegate(this);
dma_->set_interrupt_delegate(this);
ay_.set_port_handler(this);
set_gpip_input();
}
@ -235,18 +237,6 @@ class ConcreteMachine:
ay_.set_data_input(cycle.value8_high());
ay_.set_control_lines(GI::AY38910::ControlLines(0));
}
/*
TODO: Port A:
b7: reserved
b6: "freely usable output (monitor jack)"
b5: centronics strobe
b4: RS-232 DTR output
b3: RS-232 RTS output
b2: select floppy drive 1
b1: select floppy drive 0
b0: "page choice signal for double-sided floppy drive"
*/
return HalfCycles(2);
// The MFP block:
@ -501,6 +491,25 @@ class ConcreteMachine:
return &keyboard_mapper_;
}
// MARK: - AYPortHandler
void set_port_output(bool port_b, uint8_t value) final {
if(port_b) {
// TODO: ?
} else {
/*
TODO: Port A:
b7: reserved
b6: "freely usable output (monitor jack)"
b5: centronics strobe
b4: RS-232 DTR output
b3: RS-232 RTS output
b2: select floppy drive 1
b1: select floppy drive 0
b0: "page choice signal for double-sided floppy drive"
*/
dma_->set_floppy_drive_selection(value & 2, value & 4, value & 1);
}
}
};
}

View File

@ -81,6 +81,10 @@ void DMAController::write(int address, uint16_t value) {
}
}
void DMAController::set_floppy_drive_selection(bool drive1, bool drive2, bool side2) {
fdc_.set_floppy_drive_selection(drive1, drive2, side2);
}
void DMAController::run_for(HalfCycles duration) {
running_time_ += duration;
fdc_.run_for(duration.flush<Cycles>());

View File

@ -29,6 +29,8 @@ class DMAController: public WD::WD1770::Delegate, public ClockingHint::Source, p
bool get_interrupt_line();
void set_floppy_drive_selection(bool drive1, bool drive2, bool side2);
struct InterruptDelegate {
virtual void dma_controller_did_change_interrupt_status(DMAController *) = 0;
};
@ -51,6 +53,18 @@ class DMAController: public WD::WD1770::Delegate, public ClockingHint::Source, p
drives_[1]->set_motor_on(motor_on);
}
void set_floppy_drive_selection(bool drive1, bool drive2, bool side2) {
// TODO: handle no drives and/or both drives selected.
if(drive1) {
set_drive(drives_[0]);
} else {
set_drive(drives_[1]);
}
drives_[0]->set_head(side2);
drives_[1]->set_head(side2);
}
std::vector<std::shared_ptr<Storage::Disk::Drive>> drives_;
} fdc_;