summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author angelosa <salese_corp_ltd@email.it>2018-05-26 17:19:29 +0200
committer angelosa <salese_corp_ltd@email.it>2018-05-26 17:19:29 +0200
commite08ff4118cb64fb9babf60d4fdec61190e4d5599 (patch)
treecbd4305041df630445f2065ef2932bef6d2aed93
parent91ebb2f21fcf165b498357e3f8647fbe39b11deb (diff)
pc9801_cbus.cpp: bulk replace install_device() -> install_io(), made it a bus responsibility (nw)
-rw-r--r--src/devices/bus/cbus/mpu_pc98.cpp3
-rw-r--r--src/devices/bus/cbus/pc9801_118.cpp26
-rw-r--r--src/devices/bus/cbus/pc9801_118.h1
-rw-r--r--src/devices/bus/cbus/pc9801_26.cpp21
-rw-r--r--src/devices/bus/cbus/pc9801_26.h1
-rw-r--r--src/devices/bus/cbus/pc9801_86.cpp29
-rw-r--r--src/devices/bus/cbus/pc9801_86.h4
-rw-r--r--src/devices/bus/cbus/pc9801_amd98.cpp24
-rw-r--r--src/devices/bus/cbus/pc9801_amd98.h1
-rw-r--r--src/devices/bus/cbus/pc9801_cbus.cpp19
-rw-r--r--src/devices/bus/cbus/pc9801_cbus.h1
11 files changed, 36 insertions, 94 deletions
diff --git a/src/devices/bus/cbus/mpu_pc98.cpp b/src/devices/bus/cbus/mpu_pc98.cpp
index 7978cbd75e6..a3a8a6667f7 100644
--- a/src/devices/bus/cbus/mpu_pc98.cpp
+++ b/src/devices/bus/cbus/mpu_pc98.cpp
@@ -71,8 +71,7 @@ void mpu_pc98_device::map(address_map &map)
void mpu_pc98_device::device_start()
{
- address_space &iospace = m_bus->io_space();
- iospace.install_device(0xe0d0, 0xe0d3, *this, &mpu_pc98_device::map);
+ m_bus->io_space().install_device(0xe0d0, 0xe0d3, *this, &mpu_pc98_device::map);
}
//-------------------------------------------------
diff --git a/src/devices/bus/cbus/pc9801_118.cpp b/src/devices/bus/cbus/pc9801_118.cpp
index 8242d5aeeb7..eee4232c92d 100644
--- a/src/devices/bus/cbus/pc9801_118.cpp
+++ b/src/devices/bus/cbus/pc9801_118.cpp
@@ -109,28 +109,12 @@ void pc9801_118_device::device_validity_check(validity_checker &valid) const
// device_start - device-specific startup
//-------------------------------------------------
-void pc9801_118_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler)
-{
- int buswidth = m_bus->io_space().data_width();
- switch(buswidth)
- {
- case 8:
- m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0);
- break;
- case 16:
- m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffff);
- break;
- case 32:
- m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff);
- break;
- default:
- fatalerror("PC-9801-118: Bus width %d not supported\n", buswidth);
- }
-}
-
void pc9801_118_device::device_start()
{
+ m_bus->install_io(0xa460, 0xa463, read8_delegate(FUNC(pc9801_118_device::id_r), this), write8_delegate(FUNC(pc9801_118_device::ext_w), this) );
+
+ save_item(NAME(m_ext_reg));
}
@@ -141,8 +125,8 @@ void pc9801_118_device::device_start()
void pc9801_118_device::device_reset()
{
uint16_t port_base = (ioport("OPN3_DSW")->read() & 1) << 8;
- install_device(port_base + 0x0088, port_base + 0x008f, read8_delegate(FUNC(pc9801_118_device::opn3_r), this), write8_delegate(FUNC(pc9801_118_device::opn3_w), this) );
- install_device(0xa460, 0xa463, read8_delegate(FUNC(pc9801_118_device::id_r), this), write8_delegate(FUNC(pc9801_118_device::ext_w), this) );
+ m_bus->io_space().unmap_readwrite(0x0088, 0x008b, 0x100);
+ m_bus->install_io(port_base + 0x0088, port_base + 0x008f, read8_delegate(FUNC(pc9801_118_device::opn3_r), this), write8_delegate(FUNC(pc9801_118_device::opn3_w), this) );
m_ext_reg = 1; // TODO: enabled or disabled?
}
diff --git a/src/devices/bus/cbus/pc9801_118.h b/src/devices/bus/cbus/pc9801_118.h
index a565e24eded..491179a478c 100644
--- a/src/devices/bus/cbus/pc9801_118.h
+++ b/src/devices/bus/cbus/pc9801_118.h
@@ -42,7 +42,6 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
virtual const tiny_rom_entry *device_rom_region() const override;
- void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler);
private:
required_device<pc9801_slot_device> m_bus;
diff --git a/src/devices/bus/cbus/pc9801_26.cpp b/src/devices/bus/cbus/pc9801_26.cpp
index 6c60bcaa969..30dbe96711e 100644
--- a/src/devices/bus/cbus/pc9801_26.cpp
+++ b/src/devices/bus/cbus/pc9801_26.cpp
@@ -118,25 +118,6 @@ void pc9801_26_device::device_validity_check(validity_checker &valid) const
// device_start - device-specific startup
//-------------------------------------------------
-void pc9801_26_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler)
-{
- int buswidth = m_bus->io_space().data_width();
- switch(buswidth)
- {
- case 8:
- m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0);
- break;
- case 16:
- m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffff);
- break;
- case 32:
- m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff);
- break;
- default:
- fatalerror("PC-9801-26: Bus width %d not supported\n", buswidth);
- }
-}
-
void pc9801_26_device::device_start()
{
@@ -153,7 +134,7 @@ void pc9801_26_device::device_reset()
uint16_t port_base = (ioport("OPN_DSW")->read() & 1) << 8;
m_bus->io_space().unmap_readwrite(0x0088, 0x008b, 0x100);
- install_device(port_base + 0x0088, port_base + 0x008b, read8_delegate(FUNC(pc9801_26_device::opn_r), this), write8_delegate(FUNC(pc9801_26_device::opn_w), this) );
+ m_bus->install_io(port_base + 0x0088, port_base + 0x008b, read8_delegate(FUNC(pc9801_26_device::opn_r), this), write8_delegate(FUNC(pc9801_26_device::opn_w), this) );
}
diff --git a/src/devices/bus/cbus/pc9801_26.h b/src/devices/bus/cbus/pc9801_26.h
index fe3c8b7667b..eb5049db2bd 100644
--- a/src/devices/bus/cbus/pc9801_26.h
+++ b/src/devices/bus/cbus/pc9801_26.h
@@ -39,7 +39,6 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
virtual const tiny_rom_entry *device_rom_region() const override;
- void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler);
private:
required_device<pc9801_slot_device> m_bus;
diff --git a/src/devices/bus/cbus/pc9801_86.cpp b/src/devices/bus/cbus/pc9801_86.cpp
index f45255d1696..8743aeb7243 100644
--- a/src/devices/bus/cbus/pc9801_86.cpp
+++ b/src/devices/bus/cbus/pc9801_86.cpp
@@ -153,32 +153,13 @@ void pc9801_86_device::device_validity_check(validity_checker &valid) const
// device_start - device-specific startup
//-------------------------------------------------
-void pc9801_86_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler)
-{
- int buswidth = m_bus->io_space().data_width();
- switch(buswidth)
- {
- case 8:
- m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0);
- break;
- case 16:
- m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffff);
- break;
- case 32:
- m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff);
- break;
- default:
- fatalerror("PC-9801-86: Bus width %d not supported\n", buswidth);
- }
-}
-
void pc9801_86_device::device_start()
{
m_bus->program_space().install_rom(0xcc000,0xcffff,memregion(this->subtag("sound_bios").c_str())->base());
- install_device(0xa460, 0xa463, read8_delegate(FUNC(pc9801_86_device::id_r), this), write8_delegate(FUNC(pc9801_86_device::mask_w), this));
- install_device(0xa464, 0xa46f, read8_delegate(FUNC(pc9801_86_device::pcm_r), this), write8_delegate(FUNC(pc9801_86_device::pcm_w), this));
- install_device(0xa66c, 0xa66f, read8_delegate([this](address_space &s, offs_t o, u8 mm){ return o == 2 ? m_pcm_mute : 0xff; }, "pc9801_86_mute_r"),
+ m_bus->install_io(0xa460, 0xa463, read8_delegate(FUNC(pc9801_86_device::id_r), this), write8_delegate(FUNC(pc9801_86_device::mask_w), this));
+ m_bus->install_io(0xa464, 0xa46f, read8_delegate(FUNC(pc9801_86_device::pcm_r), this), write8_delegate(FUNC(pc9801_86_device::pcm_w), this));
+ m_bus->install_io(0xa66c, 0xa66f, read8_delegate([this](address_space &s, offs_t o, u8 mm){ return o == 2 ? m_pcm_mute : 0xff; }, "pc9801_86_mute_r"),
write8_delegate([this](address_space &s, offs_t o, u8 d, u8 mm){ if(o == 2) m_pcm_mute = d; }, "pc9801_86_mute_w"));
m_dac_timer = timer_alloc();
@@ -196,7 +177,7 @@ void pc9801_86_device::device_reset()
{
uint16_t port_base = (ioport("OPNA_DSW")->read() & 1) << 8;
m_bus->io_space().unmap_readwrite(0x0088, 0x008f, 0x100);
- install_device(port_base + 0x0088, port_base + 0x008f, read8_delegate(FUNC(pc9801_86_device::opna_r), this), write8_delegate(FUNC(pc9801_86_device::opna_w), this) );
+ m_bus->install_io(port_base + 0x0088, port_base + 0x008f, read8_delegate(FUNC(pc9801_86_device::opna_r), this), write8_delegate(FUNC(pc9801_86_device::opna_w), this) );
m_mask = 0;
m_head = m_tail = m_count = 0;
@@ -419,7 +400,7 @@ void pc9801_speakboard_device::device_start()
{
pc9801_86_device::device_start();
- install_device(0x0588, 0x058f, read8_delegate(FUNC(pc9801_speakboard_device::opna_slave_r), this), write8_delegate(FUNC(pc9801_speakboard_device::opna_slave_w), this) );
+ m_bus->install_io(0x0588, 0x058f, read8_delegate(FUNC(pc9801_speakboard_device::opna_slave_r), this), write8_delegate(FUNC(pc9801_speakboard_device::opna_slave_w), this) );
}
void pc9801_speakboard_device::device_reset()
diff --git a/src/devices/bus/cbus/pc9801_86.h b/src/devices/bus/cbus/pc9801_86.h
index 4394cb72451..910713a0b35 100644
--- a/src/devices/bus/cbus/pc9801_86.h
+++ b/src/devices/bus/cbus/pc9801_86.h
@@ -47,15 +47,15 @@ protected:
virtual void device_add_mconfig(machine_config &config) override;
virtual ioport_constructor device_input_ports() const override;
virtual const tiny_rom_entry *device_rom_region() const override;
- void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler);
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
void pc9801_86_config(machine_config &config);
+ required_device<pc9801_slot_device> m_bus;
+
private:
int queue_count();
uint8_t queue_pop();
- required_device<pc9801_slot_device> m_bus;
uint8_t m_mask, m_pcm_mode, m_vol[7], m_pcm_ctrl, m_pcm_mute;
uint16_t m_head, m_tail, m_count, m_irq_rate;
diff --git a/src/devices/bus/cbus/pc9801_amd98.cpp b/src/devices/bus/cbus/pc9801_amd98.cpp
index 0e5d39579da..84f69c47999 100644
--- a/src/devices/bus/cbus/pc9801_amd98.cpp
+++ b/src/devices/bus/cbus/pc9801_amd98.cpp
@@ -124,26 +124,6 @@ void pc9801_amd98_device::device_validity_check(validity_checker &valid) const
// device_start - device-specific startup
//-------------------------------------------------
-void pc9801_amd98_device::install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler)
-{
- int buswidth = m_bus->io_space().data_width();
- switch(buswidth)
- {
- case 8:
- m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0);
- break;
- case 16:
- m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffff);
- break;
- case 32:
- m_bus->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff);
- break;
- default:
- fatalerror("PC-9801-AMD98: Bus width %d not supported\n", buswidth);
- }
-}
-
-
void pc9801_amd98_device::device_start()
{
}
@@ -155,9 +135,9 @@ void pc9801_amd98_device::device_start()
void pc9801_amd98_device::device_reset()
{
- install_device(0x00d8, 0x00df, read8_delegate(FUNC(pc9801_amd98_device::read), this), write8_delegate(FUNC(pc9801_amd98_device::write), this) );
+ m_bus->install_io(0x00d8, 0x00df, read8_delegate(FUNC(pc9801_amd98_device::read), this), write8_delegate(FUNC(pc9801_amd98_device::write), this) );
// Thexder access with following
- install_device(0x38d8, 0x38df, read8_delegate(FUNC(pc9801_amd98_device::read), this), write8_delegate(FUNC(pc9801_amd98_device::write), this) );
+ m_bus->install_io(0x38d8, 0x38df, read8_delegate(FUNC(pc9801_amd98_device::read), this), write8_delegate(FUNC(pc9801_amd98_device::write), this) );
}
diff --git a/src/devices/bus/cbus/pc9801_amd98.h b/src/devices/bus/cbus/pc9801_amd98.h
index db5d6d89727..993cd6e9e4b 100644
--- a/src/devices/bus/cbus/pc9801_amd98.h
+++ b/src/devices/bus/cbus/pc9801_amd98.h
@@ -39,7 +39,6 @@ protected:
virtual void device_reset() override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
- void install_device(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler);
virtual ioport_constructor device_input_ports() const override;
private:
diff --git a/src/devices/bus/cbus/pc9801_cbus.cpp b/src/devices/bus/cbus/pc9801_cbus.cpp
index 70f22990159..528dd86ce43 100644
--- a/src/devices/bus/cbus/pc9801_cbus.cpp
+++ b/src/devices/bus/cbus/pc9801_cbus.cpp
@@ -94,3 +94,22 @@ void pc9801_slot_device::device_start()
{
// m_card = dynamic_cast<device_pc9801_slot_card_interface *>(get_card_device());
}
+
+void pc9801_slot_device::install_io(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler)
+{
+ int buswidth = this->io_space().data_width();
+ switch(buswidth)
+ {
+ case 8:
+ this->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0);
+ break;
+ case 16:
+ this->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffff);
+ break;
+ case 32:
+ this->io_space().install_readwrite_handler(start, end, rhandler, whandler, 0xffffffff);
+ break;
+ default:
+ fatalerror("PC-9801-26: Bus width %d not supported\n", buswidth);
+ }
+}
diff --git a/src/devices/bus/cbus/pc9801_cbus.h b/src/devices/bus/cbus/pc9801_cbus.h
index 4b5dba8fa76..5508e1297d8 100644
--- a/src/devices/bus/cbus/pc9801_cbus.h
+++ b/src/devices/bus/cbus/pc9801_cbus.h
@@ -84,6 +84,7 @@ public:
address_space &program_space() const { return m_cpu->space(AS_PROGRAM); }
address_space &io_space() const { return m_cpu->space(AS_IO); }
template<int I> void int_w(bool state) { m_int_callback[I](state); }
+ void install_io(offs_t start, offs_t end, read8_delegate rhandler, write8_delegate whandler);
protected:
// device-level overrides