1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-11-25 16:31:42 +00:00

Switches Jasmin drive selection logic.

This commit is contained in:
Thomas Harte 2020-02-16 21:15:16 -05:00
parent aca41ac089
commit 4153442703
2 changed files with 16 additions and 5 deletions

View File

@ -43,11 +43,21 @@ void Jasmin::write(int address, uint8_t value) {
select_paged_item();
break;
case 0x3fc: case 0x3fd: case 0x3fe: case 0x3ff:
get_drive().set_motor_on(false);
set_drive(1 << (address - 0x3fc));
get_drive().set_motor_on(motor_on_);
break;
case 0x3fc: case 0x3fd: case 0x3fe: case 0x3ff: {
// Updated selected drives mask.
const uint8_t mask = uint8_t(1 << (address - 0x3fc));
selected_drives_ = (selected_drives_ & ~mask) | (mask * (value & 1));
// Select drive.
set_drive(selected_drives_);
// Update motor inputs: apply the motor only to selected drives.
// Which may or may not be correct.
for_all_drives([mask, this] (Storage::Disk::Drive &drive, size_t index) {
const uint8_t shift_mask = uint8_t(1 << index);
drive.set_motor_on( (mask & shift_mask) ? motor_on_ : false );
});
} break;
default:
return WD::WD1770::write(address, value);

View File

@ -26,6 +26,7 @@ class Jasmin: public DiskController {
private:
void set_motor_on(bool on) final;
bool motor_on_ = false;
uint8_t selected_drives_ = 0;
Activity::Observer *observer_ = nullptr;
};