mirror of
https://github.com/TomHarte/CLK.git
synced 2024-11-22 12:33:29 +00:00
Merge pull request #1367 from TomHarte/FloppyHeft
Slightly reduce processing heft of floppy accesses.
This commit is contained in:
commit
b66d69b60c
@ -16,7 +16,7 @@ template <typename InterruptObserverT>
|
|||||||
class FloppyDisc: public WD::WD1770, public WD::WD1770::Delegate {
|
class FloppyDisc: public WD::WD1770, public WD::WD1770::Delegate {
|
||||||
public:
|
public:
|
||||||
FloppyDisc(InterruptObserverT &observer) : WD::WD1770(P1772), observer_(observer) {
|
FloppyDisc(InterruptObserverT &observer) : WD::WD1770(P1772), observer_(observer) {
|
||||||
emplace_drives(4, 8000000, 300, 2);
|
emplace_drives(1, 8000000, 300, 2);
|
||||||
set_delegate(this);
|
set_delegate(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,13 +25,12 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void set_control(uint8_t value) {
|
void set_control(uint8_t value) {
|
||||||
// TODO:
|
|
||||||
// b0, b1, b2, b3 = drive selects;
|
// b0, b1, b2, b3 = drive selects;
|
||||||
// b4 = side select;
|
// b4 = side select;
|
||||||
// b5 = motor on/off
|
// b5 = motor on/off
|
||||||
// b6 = floppy in use (i.e. LED?);
|
// b6 = floppy in use (i.e. LED?);
|
||||||
// b7 = disc eject/change reset.
|
// b7 = disc eject/change reset.
|
||||||
set_drive((value & 0xf) ^ 0xf);
|
set_drive((value & 0x1) ^ 0x1);
|
||||||
get_drive().set_head(1 ^ ((value >> 4) & 1));
|
get_drive().set_head(1 ^ ((value >> 4) & 1));
|
||||||
get_drive().set_motor_on(!(value & 0x20));
|
get_drive().set_motor_on(!(value & 0x20));
|
||||||
}
|
}
|
||||||
|
@ -203,8 +203,9 @@ void Drive::advance(const Cycles cycles) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Drive::run_for(const Cycles cycles) {
|
void Drive::run_for(const Cycles cycles) {
|
||||||
// Assumed: the index pulse pulses even if the drive has stopped spinning.
|
// Assumed: the index pulse will end even if the drive has stopped spinning.
|
||||||
index_pulse_remaining_ = std::max(index_pulse_remaining_ - cycles, Cycles(0));
|
// Also: because the count here is a 64-bit integer, the std::max can be ignored.
|
||||||
|
index_pulse_remaining_ -= cycles;// std::max(index_pulse_remaining_ - cycles, Cycles(0));
|
||||||
|
|
||||||
if(time_until_motor_transition > Cycles(0)) {
|
if(time_until_motor_transition > Cycles(0)) {
|
||||||
if(time_until_motor_transition > cycles) {
|
if(time_until_motor_transition > cycles) {
|
||||||
|
Loading…
Reference in New Issue
Block a user