summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatarGravatar yz70s <yz70s@users.noreply.github.com>2019-12-23 18:01:35 +0100
committerGravatarGravatar yz70s <yz70s@users.noreply.github.com>2019-12-23 18:07:47 +0100
commit11a58eeee4595b15feb03d52190ddad688be411e (patch)
tree4132e14de196140596d161ee7ae0cdd7398769f7
parent8bb5b6bcdcb3d9971ad46dce747e0088f98120c5 (diff)
downloadmame-11a58eeee4595b15feb03d52190ddad688be411e.tar.xz
mame-11a58eeee4595b15feb03d52190ddad688be411e.zip
Halt cpu by isa rdy line in poisk-1 and mc1502 fdc devices (nw)
-rw-r--r--src/devices/bus/isa/isa.cpp4
-rw-r--r--src/devices/bus/isa/isa.h2
-rw-r--r--src/devices/bus/isa/mc1502_fdc.cpp8
-rw-r--r--src/devices/bus/isa/mc1502_fdc.h4
-rw-r--r--src/devices/bus/isa/p1_fdc.cpp8
-rw-r--r--src/devices/bus/isa/p1_fdc.h5
-rw-r--r--src/mame/drivers/mc1502.cpp9
-rw-r--r--src/mame/drivers/poisk1.cpp19
-rw-r--r--src/mame/includes/mc1502.h3
9 files changed, 44 insertions, 18 deletions
diff --git a/src/devices/bus/isa/isa.cpp b/src/devices/bus/isa/isa.cpp
index 303ffb289ae..df21453268f 100644
--- a/src/devices/bus/isa/isa.cpp
+++ b/src/devices/bus/isa/isa.cpp
@@ -409,9 +409,9 @@ void isa8_device::eop_w(int channel, int state)
m_dma_device[channel]->eop_w(state);
}
-void isa8_device::set_ready(bool ready)
+void isa8_device::set_ready(int state)
{
- m_write_iochrdy(ready);
+ m_write_iochrdy(state);
}
void isa8_device::nmi()
diff --git a/src/devices/bus/isa/isa.h b/src/devices/bus/isa/isa.h
index 0da8b483be8..4eefa1ff548 100644
--- a/src/devices/bus/isa/isa.h
+++ b/src/devices/bus/isa/isa.h
@@ -182,7 +182,7 @@ public:
void dack_line_w(int line, int state);
void eop_w(int channels, int state);
- void set_ready(bool ready);
+ void set_ready(int state);
void nmi();
virtual void set_dma_channel(uint8_t channel, device_isa8_card_interface *dev, bool do_eop);
diff --git a/src/devices/bus/isa/mc1502_fdc.cpp b/src/devices/bus/isa/mc1502_fdc.cpp
index b9ec465bf77..e533b82626a 100644
--- a/src/devices/bus/isa/mc1502_fdc.cpp
+++ b/src/devices/bus/isa/mc1502_fdc.cpp
@@ -113,8 +113,8 @@ uint8_t mc1502_fdc_device::mc1502_wd17xx_drq_r()
if (!m_fdc->drq_r() && !m_fdc->intrq_r())
{
// fake cpu wait by resetting PC one insn back
- m_maincpu->set_state_int(I8086_IP, m_maincpu->state_int(I8086_IP) - 1);
- m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
+ m_cpu->set_state_int(I8086_IP, m_cpu->state_int(I8086_IP) - 1);
+ m_isa->set_ready(ASSERT_LINE); // assert I/O CH RDY
}
return m_fdc->drq_r();
@@ -128,7 +128,7 @@ uint8_t mc1502_fdc_device::mc1502_wd17xx_motor_r()
WRITE_LINE_MEMBER(mc1502_fdc_device::mc1502_fdc_irq_drq)
{
if (state)
- m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
+ m_isa->set_ready(CLEAR_LINE); // deassert I/O CH RDY
}
READ8_MEMBER(mc1502_fdc_device::mc1502_fdc_r)
@@ -191,7 +191,7 @@ mc1502_fdc_device::mc1502_fdc_device(const machine_config &mconfig, const char *
, m_fdc(*this, "fdc")
, motor_on(0)
, motor_timer(nullptr)
- , m_maincpu(*this, ":maincpu")
+ , m_cpu(*this, finder_base::DUMMY_TAG)
{
}
diff --git a/src/devices/bus/isa/mc1502_fdc.h b/src/devices/bus/isa/mc1502_fdc.h
index f211a9392c2..5689409e63e 100644
--- a/src/devices/bus/isa/mc1502_fdc.h
+++ b/src/devices/bus/isa/mc1502_fdc.h
@@ -27,6 +27,8 @@ public:
// construction/destruction
mc1502_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <typename T>
+ void set_cpu(T &&tag) { m_cpu.set_tag(std::forward<T>(tag)); }
TIMER_CALLBACK_MEMBER(motor_callback);
@@ -50,7 +52,7 @@ private:
required_device<fd1793_device> m_fdc;
int motor_on;
emu_timer *motor_timer;
- required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_cpu;
public:
void mc1502_wd17xx_aux_w(uint8_t data);
diff --git a/src/devices/bus/isa/p1_fdc.cpp b/src/devices/bus/isa/p1_fdc.cpp
index 416a07cd206..822a14f1e27 100644
--- a/src/devices/bus/isa/p1_fdc.cpp
+++ b/src/devices/bus/isa/p1_fdc.cpp
@@ -84,8 +84,8 @@ uint8_t p1_fdc_device::p1_wd17xx_aux_r()
if (!m_fdc->drq_r() && !m_fdc->intrq_r())
{
// fake cpu wait by resetting PC one insn back
- m_maincpu->set_state_int(I8086_IP, m_maincpu->state_int(I8086_IP) - 2);
- m_maincpu->set_input_line(INPUT_LINE_HALT, ASSERT_LINE);
+ m_cpu->set_state_int(I8086_IP, m_cpu->state_int(I8086_IP) - 2);
+ m_isa->set_ready(ASSERT_LINE); // assert I/O CH RDY
}
return m_fdc->drq_r();
@@ -122,7 +122,7 @@ void p1_fdc_device::p1_wd17xx_aux_w(int data)
WRITE_LINE_MEMBER(p1_fdc_device::p1_fdc_irq_drq)
{
if (state)
- m_maincpu->set_input_line(INPUT_LINE_HALT, CLEAR_LINE);
+ m_isa->set_ready(CLEAR_LINE); // deassert I/O CH RDY
}
READ8_MEMBER(p1_fdc_device::p1_fdc_r)
@@ -160,7 +160,7 @@ p1_fdc_device::p1_fdc_device(const machine_config &mconfig, const char *tag, dev
: device_t(mconfig, P1_FDC, tag, owner, clock)
, device_isa8_card_interface(mconfig, *this)
, m_fdc(*this, "fdc")
- , m_maincpu(*this, ":maincpu")
+ , m_cpu(*this, finder_base::DUMMY_TAG)
{
}
diff --git a/src/devices/bus/isa/p1_fdc.h b/src/devices/bus/isa/p1_fdc.h
index a80d76b057d..d2c5e4605e7 100644
--- a/src/devices/bus/isa/p1_fdc.h
+++ b/src/devices/bus/isa/p1_fdc.h
@@ -27,6 +27,9 @@ public:
// construction/destruction
p1_fdc_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ template <typename T>
+ void set_cpu(T &&tag) { m_cpu.set_tag(std::forward<T>(tag)); }
+
DECLARE_READ8_MEMBER(p1_fdc_r);
DECLARE_WRITE8_MEMBER(p1_fdc_w);
@@ -45,7 +48,7 @@ private:
DECLARE_WRITE_LINE_MEMBER(p1_fdc_irq_drq);
required_device<fd1793_device> m_fdc;
- required_device<cpu_device> m_maincpu;
+ required_device<cpu_device> m_cpu;
public:
void p1_wd17xx_aux_w(int data);
diff --git a/src/mame/drivers/mc1502.cpp b/src/mame/drivers/mc1502.cpp
index 99107023d23..fa8957a2ed5 100644
--- a/src/mame/drivers/mc1502.cpp
+++ b/src/mame/drivers/mc1502.cpp
@@ -209,6 +209,12 @@ MACHINE_RESET_MEMBER(mc1502_state, mc1502)
* macros
*/
+void mc1502_state::fdc_config(device_t *device)
+{
+ mc1502_fdc_device &fdc = *downcast<mc1502_fdc_device*>(device);
+ fdc.set_cpu(m_maincpu);
+}
+
void mc1502_state::mc1502_map(address_map &map)
{
map.unmap_value_high();
@@ -284,9 +290,10 @@ void mc1502_state::mc1502(machine_config &config)
isa.irq5_callback().set(m_pic8259, FUNC(pic8259_device::ir5_w));
isa.irq6_callback().set(m_pic8259, FUNC(pic8259_device::ir6_w));
isa.irq7_callback().set(m_pic8259, FUNC(pic8259_device::ir7_w));
+ isa.iochrdy_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
ISA8_SLOT(config, "board0", 0, "isa", mc1502_isa8_cards, "cga_mc1502", true); // FIXME: determine ISA bus clock
- ISA8_SLOT(config, "isa1", 0, "isa", mc1502_isa8_cards, "fdc", false);
+ ISA8_SLOT(config, "isa1", 0, "isa", mc1502_isa8_cards, "fdc", false).set_option_machine_config("fdc", [this](device_t *device) { fdc_config(device); });
ISA8_SLOT(config, "isa2", 0, "isa", mc1502_isa8_cards, "rom", false);
SPEAKER(config, "mono").front_center();
diff --git a/src/mame/drivers/poisk1.cpp b/src/mame/drivers/poisk1.cpp
index 0fce384ab3a..7e6b36023b2 100644
--- a/src/mame/drivers/poisk1.cpp
+++ b/src/mame/drivers/poisk1.cpp
@@ -34,6 +34,7 @@
#include "machine/ram.h"
#include "sound/spkrdev.h"
#include "video/cgapal.h"
+#include "bus/isa/p1_fdc.h"
#include "emupal.h"
#include "screen.h"
@@ -85,6 +86,8 @@ public:
void init_poisk1();
+ void fdc_config(device_t *device);
+
protected:
virtual void machine_start() override;
virtual void machine_reset() override;
@@ -613,6 +616,12 @@ void p1_state::machine_reset()
* macros
*/
+void p1_state::fdc_config(device_t *device)
+{
+ p1_fdc_device &fdc = *downcast<p1_fdc_device*>(device);
+ fdc.set_cpu(m_maincpu);
+}
+
void p1_state::poisk1_map(address_map &map)
{
map.unmap_value_high();
@@ -673,11 +682,13 @@ void p1_state::poisk1(machine_config &config)
m_isabus->irq4_callback().set(m_pic8259, FUNC(pic8259_device::ir4_w));
m_isabus->irq5_callback().set(m_pic8259, FUNC(pic8259_device::ir5_w));
m_isabus->irq7_callback().set(m_pic8259, FUNC(pic8259_device::ir7_w));
+ m_isabus->iochrdy_callback().set_inputline(m_maincpu, INPUT_LINE_HALT);
- ISA8_SLOT(config, "isa1", 0, m_isabus, p1_isa8_cards, "fdc", false); // FIXME: determine ISA bus clock
- ISA8_SLOT(config, "isa2", 0, m_isabus, p1_isa8_cards, nullptr, false);
- ISA8_SLOT(config, "isa3", 0, m_isabus, p1_isa8_cards, nullptr, false);
- ISA8_SLOT(config, "isa4", 0, m_isabus, p1_isa8_cards, nullptr, false);
+ // FIXME: determine ISA bus clock
+ ISA8_SLOT(config, "isa1", 0, m_isabus, p1_isa8_cards, "fdc", false).set_option_machine_config("fdc", [this](device_t *device) { fdc_config(device); });
+ ISA8_SLOT(config, "isa2", 0, m_isabus, p1_isa8_cards, nullptr, false).set_option_machine_config("fdc", [this](device_t *device) { fdc_config(device); });
+ ISA8_SLOT(config, "isa3", 0, m_isabus, p1_isa8_cards, nullptr, false).set_option_machine_config("fdc", [this](device_t *device) { fdc_config(device); });
+ ISA8_SLOT(config, "isa4", 0, m_isabus, p1_isa8_cards, nullptr, false).set_option_machine_config("fdc", [this](device_t *device) { fdc_config(device); });
SPEAKER(config, "mono").front_center();
SPEAKER_SOUND(config, m_speaker).add_route(ALL_OUTPUTS, "mono", 1.00);
diff --git a/src/mame/includes/mc1502.h b/src/mame/includes/mc1502.h
index 25eda38b881..eafd294bc7a 100644
--- a/src/mame/includes/mc1502.h
+++ b/src/mame/includes/mc1502.h
@@ -22,6 +22,7 @@
#include "bus/centronics/ctronics.h"
#include "bus/isa/isa.h"
#include "bus/isa/xsu_cards.h"
+#include "bus/isa/mc1502_fdc.h"
class mc1502_state : public driver_device
@@ -47,6 +48,8 @@ public:
void init_mc1502();
+ void fdc_config(device_t *device);
+
private:
required_device<cpu_device> m_maincpu;
required_device<i8251_device> m_upd8251;