Attach NMI and HALT.
This commit is contained in:
1 parent
f30cec0e8a
commit
b03db5fdf9
4 files changed
+26
-5
No files matched your search
@@ -63,15 +63,15 @@ public:
|
||||
};
|
||||
|
||||
/// @returns The current value of the IRQ line output.
|
||||
inline bool get_interrupt_request_line() const { return status_.interrupt_request; }
|
||||
inline bool get_interrupt_request_line() const { return status_.interrupt_request; }
|
||||
|
||||
/// @returns The current value of the DRQ line output.
|
||||
inline bool get_data_request_line() const { return status_.data_request; }
|
||||
inline bool get_data_request_line() const { return status_.data_request; }
|
||||
|
||||
struct Delegate {
|
||||
virtual void wd1770_did_change_output(WD1770 &) = 0;
|
||||
};
|
||||
inline void set_delegate(Delegate *delegate) { delegate_ = delegate; }
|
||||
inline void set_delegate(Delegate *const delegate) { delegate_ = delegate; }
|
||||
|
||||
ClockingHint::Preference preferred_clocking() const final;
|
||||
|
||||
@@ -127,7 +127,7 @@ private:
|
||||
IndexHoleTarget = (1 << 6), // Indicates that index_hole_count_ has reached index_hole_count_target_.
|
||||
ForceInterrupt = (1 << 7) // Indicates a forced interrupt.
|
||||
};
|
||||
void posit_event(int type);
|
||||
void posit_event(int);
|
||||
int interesting_event_mask_;
|
||||
Cycles::IntType delay_time_ = 0;
|
||||
|
||||
|
||||
@@ -387,7 +387,8 @@ class ConcreteMachine:
|
||||
public MachineTypes::MediaTarget,
|
||||
public MachineTypes::ScanProducer,
|
||||
public MachineTypes::TimedMachine,
|
||||
public Utility::TypeRecipient<Tandy::CoCo::Keyboard::CharacterMapper>
|
||||
public Utility::TypeRecipient<Tandy::CoCo::Keyboard::CharacterMapper>,
|
||||
public WD::WD1770::Delegate
|
||||
{
|
||||
public:
|
||||
ConcreteMachine(const Analyser::Static::TandyCoCo::Target &target, const ROMMachine::ROMFetcher &rom_fetcher) :
|
||||
@@ -453,6 +454,7 @@ public:
|
||||
|
||||
if(has_disk_drive) {
|
||||
sam_.insert_cartridge(roms.find(DiskBASIC)->second);
|
||||
disk_controller_.set_delegate(this);
|
||||
}
|
||||
|
||||
insert_media(target.media);
|
||||
@@ -1109,6 +1111,10 @@ private:
|
||||
|
||||
DiskController disk_controller_;
|
||||
Cycles cycles_16mhz_;
|
||||
void wd1770_did_change_output(WD::WD1770 &) override {
|
||||
m6809_.template set<CPU::M6809::Line::NMI>(disk_controller_.nmi());
|
||||
m6809_.template set<CPU::M6809::Line::Halt>(disk_controller_.halt());
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ void DiskController::set_control(const uint8_t value) {
|
||||
// b3: drive motors, 1 = on
|
||||
// b0–b2: drive selects
|
||||
|
||||
double_density_ = value & 0x20;
|
||||
set_is_double_density(value & 0x20);
|
||||
for_all_drives([&] (Storage::Disk::Drive &drive, size_t) {
|
||||
drive.set_motor_on(value & 0x8);
|
||||
@@ -60,3 +61,11 @@ const Storage::Disk::Disk *DiskController::disk(const std::string &name) {
|
||||
// * not INTRQ hits a NOR gate with DDEN; NOR of that is piped to NMI; and
|
||||
// * DRQ informs HALT, if enabled.
|
||||
//
|
||||
|
||||
bool DiskController::halt() const {
|
||||
return get_data_request_line();
|
||||
}
|
||||
|
||||
bool DiskController::nmi() const {
|
||||
return get_interrupt_request_line() && double_density_;
|
||||
}
|
||||
@@ -42,6 +42,12 @@ public:
|
||||
void set_activity_observer(Activity::Observer *);
|
||||
void set_disk(std::shared_ptr<Storage::Disk::Disk>, size_t drive);
|
||||
const Storage::Disk::Disk *disk(const std::string &);
|
||||
|
||||
bool halt() const;
|
||||
bool nmi() const;
|
||||
|
||||
private:
|
||||
bool double_density_ = false;
|
||||
};
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user