2016-11-22 00:12:53 +00:00
|
|
|
//
|
|
|
|
// Microdisc.hpp
|
|
|
|
// Clock Signal
|
|
|
|
//
|
|
|
|
// Created by Thomas Harte on 22/11/2016.
|
|
|
|
// Copyright © 2016 Thomas Harte. All rights reserved.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef Microdisc_hpp
|
|
|
|
#define Microdisc_hpp
|
|
|
|
|
|
|
|
#include "../../Components/1770/1770.hpp"
|
|
|
|
|
|
|
|
namespace Oric {
|
|
|
|
|
|
|
|
class Microdisc: public WD::WD1770 {
|
|
|
|
public:
|
|
|
|
Microdisc();
|
|
|
|
|
|
|
|
void set_disk(std::shared_ptr<Storage::Disk::Disk> disk, int drive);
|
|
|
|
void set_control_register(uint8_t control);
|
|
|
|
uint8_t get_interrupt_request_register();
|
|
|
|
uint8_t get_data_request_register();
|
|
|
|
|
|
|
|
bool get_interrupt_request_line();
|
|
|
|
|
2016-12-02 02:13:16 +00:00
|
|
|
void run_for_cycles(unsigned int number_of_cycles);
|
|
|
|
|
2016-11-22 14:09:52 +00:00
|
|
|
enum PagingFlags {
|
|
|
|
BASICDisable = (1 << 0),
|
|
|
|
MicrodscDisable = (1 << 1)
|
|
|
|
};
|
|
|
|
|
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
|
|
|
|
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);
|
2016-12-02 01:12:22 +00:00
|
|
|
void set_head_load_request(bool head_load);
|
2016-12-02 02:13:16 +00:00
|
|
|
bool get_drive_is_ready();
|
2016-11-22 00:12:53 +00:00
|
|
|
std::shared_ptr<Storage::Disk::Drive> drives_[4];
|
|
|
|
int selected_drive_;
|
|
|
|
bool irq_enable_;
|
2016-11-22 14:09:52 +00:00
|
|
|
int paging_flags_;
|
2016-12-02 02:13:16 +00:00
|
|
|
int head_load_request_counter_;
|
2016-11-22 14:09:52 +00:00
|
|
|
Delegate *delegate_;
|
2016-12-28 23:29:37 +00:00
|
|
|
uint8_t last_control_;
|
2016-11-22 00:12:53 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif /* Microdisc_hpp */
|