2020-01-06 01:05:55 +00:00
|
|
|
//
|
|
|
|
// Jasmin.cpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 05/01/2020.
|
|
|
|
// Copyright © 2020 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#include "Jasmin.hpp"
|
|
|
|
|
|
|
|
using namespace Oric;
|
|
|
|
|
|
|
|
// NB: there's some controversy here on WD1770 versus WD1772, but between those two I think
|
|
|
|
// the only difference is stepping rates, and it says 1770 on the schematic I'm looking at.
|
2020-01-17 02:34:57 +00:00
|
|
|
Jasmin::Jasmin() : DiskController(P1770, 8000000, Storage::Disk::Drive::ReadyType::ShugartRDY) {
|
2020-01-06 01:05:55 +00:00
|
|
|
set_is_double_density(true);
|
2020-01-15 03:53:27 +00:00
|
|
|
select_paged_item();
|
2020-01-06 01:05:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Jasmin::write(int address, uint8_t value) {
|
|
|
|
switch(address) {
|
|
|
|
// Set side.
|
2020-02-12 02:59:13 +00:00
|
|
|
case 0x3f8: {
|
|
|
|
const int head = value & 1;
|
|
|
|
for_all_drives([head] (Storage::Disk::Drive &drive, size_t) {
|
|
|
|
drive.set_head(head);
|
|
|
|
});
|
|
|
|
} break;
|
2020-01-06 01:05:55 +00:00
|
|
|
|
|
|
|
case 0x3f9:
|
|
|
|
/* TODO: reset. */
|
|
|
|
break;
|
|
|
|
|
|
|
|
case 0x3fa: {
|
|
|
|
// If b0, enable overlay RAM.
|
2020-01-15 03:53:27 +00:00
|
|
|
enable_overlay_ram_ = value & 1;
|
|
|
|
select_paged_item();
|
2020-01-06 01:05:55 +00:00
|
|
|
} break;
|
|
|
|
|
|
|
|
case 0x3fb:
|
|
|
|
// If b0, disable BASIC ROM.
|
2020-01-15 03:53:27 +00:00
|
|
|
disable_basic_rom_ = value & 1;
|
|
|
|
select_paged_item();
|
2020-01-06 01:05:55 +00:00
|
|
|
break;
|
|
|
|
|
2020-02-12 02:59:13 +00:00
|
|
|
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;
|
2020-01-06 01:05:55 +00:00
|
|
|
|
|
|
|
default:
|
|
|
|
return WD::WD1770::write(address, value);
|
|
|
|
}
|
|
|
|
}
|
2020-01-06 02:35:20 +00:00
|
|
|
|
|
|
|
void Jasmin::set_motor_on(bool on) {
|
|
|
|
motor_on_ = on;
|
2020-02-12 02:59:13 +00:00
|
|
|
get_drive().set_motor_on(motor_on_);
|
2020-01-16 04:39:15 +00:00
|
|
|
if(observer_) {
|
2020-01-17 03:59:43 +00:00
|
|
|
observer_->set_led_status("Jasmin", on);
|
2020-01-16 04:39:15 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void Jasmin::set_activity_observer(Activity::Observer *observer) {
|
|
|
|
observer_ = observer;
|
|
|
|
if(observer) {
|
|
|
|
observer->register_led("Jasmin");
|
|
|
|
observer_->set_led_status("Jasmin", motor_on_);
|
|
|
|
}
|
2020-01-06 02:35:20 +00:00
|
|
|
}
|