diff --git a/Components/8272/i8272.cpp b/Components/8272/i8272.cpp index 78a24a89a..194b8595b 100644 --- a/Components/8272/i8272.cpp +++ b/Components/8272/i8272.cpp @@ -11,7 +11,7 @@ #include -using namespace Intel; +using namespace Intel::i8272; #define SetDataRequest() (main_status_ |= 0x80) #define ResetDataRequest() (main_status_ &= ~0x80) @@ -52,8 +52,9 @@ using namespace Intel; #define SetBadCylinder() (status_[2] |= 0x02) #define SetMissingDataAddressMark() (status_[2] |= 0x01) -i8272::i8272(Cycles clock_rate, int clock_rate_multiplier, int revolutions_per_minute) : +i8272::i8272(BusHandler &bus_handler, Cycles clock_rate, int clock_rate_multiplier, int revolutions_per_minute) : Storage::Disk::MFMController(clock_rate, clock_rate_multiplier, revolutions_per_minute), + bus_handler_(bus_handler), main_status_(0), interesting_event_mask_((int)Event8272::CommandByte), resume_point_(0), @@ -773,3 +774,9 @@ bool i8272::Drive::seek_is_satisfied() { return (target_head_position == head_position) || (target_head_position == -1 && drive->get_is_track_zero()); } + +void i8272::set_dma_acknowledge(bool dack) { +} + +void i8272::set_terminal_count(bool tc) { +} diff --git a/Components/8272/i8272.hpp b/Components/8272/i8272.hpp index 00810ea7b..26766abd3 100644 --- a/Components/8272/i8272.hpp +++ b/Components/8272/i8272.hpp @@ -13,22 +13,38 @@ #include "../../Storage/Disk/Drive.hpp" #include +#include #include namespace Intel { +namespace i8272 { + +class BusHandler { + public: + virtual void set_dma_data_request(bool drq) {} + virtual void set_interrupt(bool irq) {} +}; class i8272: public Storage::Disk::MFMController { public: - i8272(Cycles clock_rate, int clock_rate_multiplier, int revolutions_per_minute); + i8272(BusHandler &bus_handler, Cycles clock_rate, int clock_rate_multiplier, int revolutions_per_minute); void run_for(Cycles); void set_register(int address, uint8_t value); uint8_t get_register(int address); + void set_dma_acknowledge(bool dack); + void set_terminal_count(bool tc); + void set_disk(std::shared_ptr disk, int drive); private: + + // The bus handler, for interrupt and DMA-driven usage. + BusHandler &bus_handler_; + std::unique_ptr allocated_bus_handler_; + // Status registers. uint8_t main_status_; uint8_t status_[3]; @@ -110,6 +126,6 @@ class i8272: public Storage::Disk::MFMController { }; } - +} #endif /* i8272_hpp */ diff --git a/Machines/AmstradCPC/AmstradCPC.cpp b/Machines/AmstradCPC/AmstradCPC.cpp index 328c233c3..92b5a786e 100644 --- a/Machines/AmstradCPC/AmstradCPC.cpp +++ b/Machines/AmstradCPC/AmstradCPC.cpp @@ -438,12 +438,15 @@ struct KeyboardState { Wraps the 8272 so as to provide proper clocking and RPM counts, and just directly exposes motor control, applying the same value to all drives. */ -class FDC: public Intel::i8272 { +class FDC: public Intel::i8272::i8272 { + private: + Intel::i8272::BusHandler bus_handler_; + public: - FDC() : i8272(Cycles(8000000), 16, 300) {} + FDC() : i8272(bus_handler_, Cycles(8000000), 16, 300) {} void set_motor_on(bool on) { - Intel::i8272::set_motor_on(on); + Intel::i8272::i8272::set_motor_on(on); } };