2016-11-22 00:12:53 +00:00
|
|
|
//
|
|
|
|
// Microdisc.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 22/11/2016.
|
2018-05-13 19:19:52 +00:00
|
|
|
// Copyright 2016 Thomas Harte. All rights reserved.
|
2016-11-22 00:12:53 +00:00
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef Microdisc_hpp
|
|
|
|
#define Microdisc_hpp
|
|
|
|
|
|
|
|
#include "../../Components/1770/1770.hpp"
|
2018-05-12 03:05:36 +00:00
|
|
|
#include "../../Activity/Observer.hpp"
|
|
|
|
|
|
|
|
#include <array>
|
2016-11-22 00:12:53 +00:00
|
|
|
|
|
|
|
namespace Oric {
|
|
|
|
|
2017-07-26 00:09:13 +00:00
|
|
|
class Microdisc: public WD::WD1770 {
|
2016-11-22 00:12:53 +00:00
|
|
|
public:
|
|
|
|
Microdisc();
|
|
|
|
|
2018-05-12 03:05:36 +00:00
|
|
|
void set_disk(std::shared_ptr<Storage::Disk::Disk> disk, size_t drive);
|
2016-11-22 00:12:53 +00:00
|
|
|
void set_control_register(uint8_t control);
|
|
|
|
uint8_t get_interrupt_request_register();
|
|
|
|
uint8_t get_data_request_register();
|
|
|
|
|
|
|
|
bool get_interrupt_request_line();
|
|
|
|
|
2017-07-28 02:05:29 +00:00
|
|
|
void run_for(const Cycles cycles);
|
2016-12-02 02:13:16 +00:00
|
|
|
|
2016-11-22 14:09:52 +00:00
|
|
|
enum PagingFlags {
|
2018-05-24 22:57:35 +00:00
|
|
|
/// Indicates that the BASIC ROM should be disabled; if this is set then either
|
|
|
|
/// the Microdisc ROM or overlay RAM will be visible. If it is not set, BASIC
|
|
|
|
/// should be visible.
|
|
|
|
BASICDisable = (1 << 0),
|
|
|
|
|
|
|
|
/// Indicates that the Microdisc ROM is disabled. If BASIC is disabled and the Microdisc
|
|
|
|
/// is also disabled, overlay RAM should be visible.
|
|
|
|
MicrodiscDisable = (1 << 1)
|
2016-11-22 14:09:52 +00:00
|
|
|
};
|
|
|
|
|
2016-11-22 14:11:11 +00:00
|
|
|
class Delegate: public WD1770::Delegate {
|
2016-11-22 14:09:52 +00:00
|
|
|
public:
|
|
|
|
virtual void microdisc_did_change_paging_flags(Microdisc *microdisc) = 0;
|
|
|
|
};
|
2016-11-22 14:11:11 +00:00
|
|
|
inline void set_delegate(Delegate *delegate) { delegate_ = delegate; WD1770::set_delegate(delegate); }
|
|
|
|
inline int get_paging_flags() { return paging_flags_; }
|
2016-11-22 14:09:52 +00:00
|
|
|
|
2018-05-12 03:05:36 +00:00
|
|
|
void set_activity_observer(Activity::Observer *observer);
|
|
|
|
|
2016-11-22 00:12:53 +00:00
|
|
|
private:
|
2016-12-28 23:49:32 +00:00
|
|
|
void set_control_register(uint8_t control, uint8_t changes);
|
2018-05-28 03:17:06 +00:00
|
|
|
void set_head_load_request(bool head_load) override;
|
2016-12-02 02:13:16 +00:00
|
|
|
bool get_drive_is_ready();
|
2018-05-28 03:17:06 +00:00
|
|
|
|
2018-05-12 03:05:36 +00:00
|
|
|
std::array<std::shared_ptr<Storage::Disk::Drive>, 4> drives_;
|
|
|
|
size_t selected_drive_;
|
2017-11-11 03:20:44 +00:00
|
|
|
bool irq_enable_ = false;
|
|
|
|
int paging_flags_ = BASICDisable;
|
2019-10-30 02:36:29 +00:00
|
|
|
Cycles::IntType head_load_request_counter_ = -1;
|
2018-05-12 03:05:36 +00:00
|
|
|
bool head_load_request_ = false;
|
2017-11-11 03:20:44 +00:00
|
|
|
Delegate *delegate_ = nullptr;
|
|
|
|
uint8_t last_control_ = 0;
|
2018-05-12 03:05:36 +00:00
|
|
|
Activity::Observer *observer_ = nullptr;
|
2018-05-12 21:32:53 +00:00
|
|
|
|
|
|
|
std::string drive_name(size_t index);
|
2016-11-22 00:12:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* Microdisc_hpp */
|