summaryrefslogtreecommitdiffstats
path: root/src/devices/bus/msx_cart
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/msx_cart')
-rw-r--r--src/devices/bus/msx_cart/arc.cpp11
-rw-r--r--src/devices/bus/msx_cart/arc.h8
-rw-r--r--src/devices/bus/msx_cart/ascii.cpp50
-rw-r--r--src/devices/bus/msx_cart/ascii.h25
-rw-r--r--src/devices/bus/msx_cart/bm_012.cpp17
-rw-r--r--src/devices/bus/msx_cart/cartridge.cpp19
-rw-r--r--src/devices/bus/msx_cart/cartridge.h21
-rw-r--r--src/devices/bus/msx_cart/crossblaim.cpp10
-rw-r--r--src/devices/bus/msx_cart/crossblaim.h5
-rw-r--r--src/devices/bus/msx_cart/disk.cpp74
-rw-r--r--src/devices/bus/msx_cart/disk.h18
-rw-r--r--src/devices/bus/msx_cart/dooly.cpp4
-rw-r--r--src/devices/bus/msx_cart/dooly.h4
-rw-r--r--src/devices/bus/msx_cart/fmpac.cpp29
-rw-r--r--src/devices/bus/msx_cart/fmpac.h9
-rw-r--r--src/devices/bus/msx_cart/fs_sr022.cpp4
-rw-r--r--src/devices/bus/msx_cart/fs_sr022.h4
-rw-r--r--src/devices/bus/msx_cart/halnote.cpp10
-rw-r--r--src/devices/bus/msx_cart/halnote.h5
-rw-r--r--src/devices/bus/msx_cart/hfox.cpp10
-rw-r--r--src/devices/bus/msx_cart/hfox.h5
-rw-r--r--src/devices/bus/msx_cart/holy_quran.cpp10
-rw-r--r--src/devices/bus/msx_cart/holy_quran.h5
-rw-r--r--src/devices/bus/msx_cart/konami.cpp142
-rw-r--r--src/devices/bus/msx_cart/konami.h32
-rw-r--r--src/devices/bus/msx_cart/korean.cpp35
-rw-r--r--src/devices/bus/msx_cart/korean.h17
-rw-r--r--src/devices/bus/msx_cart/majutsushi.cpp22
-rw-r--r--src/devices/bus/msx_cart/majutsushi.h5
-rw-r--r--src/devices/bus/msx_cart/moonsound.cpp29
-rw-r--r--src/devices/bus/msx_cart/moonsound.h10
-rw-r--r--src/devices/bus/msx_cart/msx_audio.cpp43
-rw-r--r--src/devices/bus/msx_cart/msx_audio.h18
-rw-r--r--src/devices/bus/msx_cart/msx_audio_kb.cpp16
-rw-r--r--src/devices/bus/msx_cart/msx_audio_kb.h9
-rw-r--r--src/devices/bus/msx_cart/msxdos2.cpp10
-rw-r--r--src/devices/bus/msx_cart/msxdos2.h5
-rw-r--r--src/devices/bus/msx_cart/nomapper.cpp2
-rw-r--r--src/devices/bus/msx_cart/nomapper.h2
-rw-r--r--src/devices/bus/msx_cart/rtype.cpp10
-rw-r--r--src/devices/bus/msx_cart/rtype.h5
-rw-r--r--src/devices/bus/msx_cart/super_swangi.cpp10
-rw-r--r--src/devices/bus/msx_cart/super_swangi.h5
-rw-r--r--src/devices/bus/msx_cart/superloderunner.cpp15
-rw-r--r--src/devices/bus/msx_cart/superloderunner.h7
-rw-r--r--src/devices/bus/msx_cart/yamaha.cpp18
-rw-r--r--src/devices/bus/msx_cart/yamaha.h5
47 files changed, 352 insertions, 477 deletions
diff --git a/src/devices/bus/msx_cart/arc.cpp b/src/devices/bus/msx_cart/arc.cpp
index 406ec8f4de3..3504071ec4c 100644
--- a/src/devices/bus/msx_cart/arc.cpp
+++ b/src/devices/bus/msx_cart/arc.cpp
@@ -18,8 +18,9 @@ msx_cart_arc_device::msx_cart_arc_device(const machine_config &mconfig, const ch
void msx_cart_arc_device::device_start()
{
// Install IO read/write handlers
- io_space().install_write_handler(0x7f, 0x7f, write8smo_delegate(FUNC(msx_cart_arc_device::io_7f_w), this));
- io_space().install_read_handler(0x7f, 0x7f, read8smo_delegate(FUNC(msx_cart_arc_device::io_7f_r), this));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0x7f, 0x7f, write8_delegate(FUNC(msx_cart_arc_device::io_7f_w), this));
+ space.install_read_handler(0x7f, 0x7f, read8_delegate(FUNC(msx_cart_arc_device::io_7f_r), this));
}
@@ -38,7 +39,7 @@ void msx_cart_arc_device::initialize_cartridge()
}
-uint8_t msx_cart_arc_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_arc_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -48,7 +49,7 @@ uint8_t msx_cart_arc_device::read_cart(offs_t offset)
}
-void msx_cart_arc_device::io_7f_w(uint8_t data)
+WRITE8_MEMBER(msx_cart_arc_device::io_7f_w)
{
if (data == 0x35)
{
@@ -57,7 +58,7 @@ void msx_cart_arc_device::io_7f_w(uint8_t data)
}
-uint8_t msx_cart_arc_device::io_7f_r()
+READ8_MEMBER(msx_cart_arc_device::io_7f_r)
{
return ((m_7f & 0x03) == 0x03) ? 0xda : 0xff;
}
diff --git a/src/devices/bus/msx_cart/arc.h b/src/devices/bus/msx_cart/arc.h
index 69f4427a01f..308589961fd 100644
--- a/src/devices/bus/msx_cart/arc.h
+++ b/src/devices/bus/msx_cart/arc.h
@@ -18,7 +18,10 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+
+ DECLARE_WRITE8_MEMBER(io_7f_w);
+ DECLARE_READ8_MEMBER(io_7f_r);
protected:
// device-level overrides
@@ -26,9 +29,6 @@ protected:
virtual void device_reset() override;
private:
- void io_7f_w(uint8_t data);
- uint8_t io_7f_r();
-
uint8_t m_7f;
};
diff --git a/src/devices/bus/msx_cart/ascii.cpp b/src/devices/bus/msx_cart/ascii.cpp
index 7d1b354b404..c7598a8ccc0 100644
--- a/src/devices/bus/msx_cart/ascii.cpp
+++ b/src/devices/bus/msx_cart/ascii.cpp
@@ -27,12 +27,8 @@ msx_cart_ascii8_device::msx_cart_ascii8_device(const machine_config &mconfig, co
void msx_cart_ascii8_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_ascii8_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_ascii8_device::restore_banks), this));
}
@@ -76,7 +72,7 @@ void msx_cart_ascii8_device::initialize_cartridge()
}
-uint8_t msx_cart_ascii8_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_ascii8_device::read_cart)
{
if ( offset >= 0x4000 && offset < 0xC000 )
{
@@ -86,7 +82,7 @@ uint8_t msx_cart_ascii8_device::read_cart(offs_t offset)
}
-void msx_cart_ascii8_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_ascii8_device::write_cart)
{
if (offset >= 0x6000 && offset < 0x8000)
{
@@ -115,12 +111,8 @@ msx_cart_ascii16_device::msx_cart_ascii16_device(const machine_config &mconfig,
void msx_cart_ascii16_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_ascii16_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_ascii16_device::restore_banks), this));
}
@@ -164,7 +156,7 @@ void msx_cart_ascii16_device::initialize_cartridge()
}
-uint8_t msx_cart_ascii16_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_ascii16_device::read_cart)
{
if ( offset >= 0x4000 && offset < 0xC000 )
{
@@ -174,7 +166,7 @@ uint8_t msx_cart_ascii16_device::read_cart(offs_t offset)
}
-void msx_cart_ascii16_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_ascii16_device::write_cart)
{
if (offset >= 0x6000 && offset < 0x6800)
{
@@ -210,12 +202,8 @@ msx_cart_ascii8_sram_device::msx_cart_ascii8_sram_device(const machine_config &m
void msx_cart_ascii8_sram_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_ascii8_sram_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_ascii8_sram_device::restore_banks), this));
}
@@ -284,7 +272,7 @@ void msx_cart_ascii8_sram_device::initialize_cartridge()
}
-uint8_t msx_cart_ascii8_sram_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_ascii8_sram_device::read_cart)
{
if ( offset >= 0x4000 && offset < 0xC000 )
{
@@ -299,7 +287,7 @@ uint8_t msx_cart_ascii8_sram_device::read_cart(offs_t offset)
}
-void msx_cart_ascii8_sram_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_ascii8_sram_device::write_cart)
{
if (offset >= 0x6000 && offset < 0x8000)
{
@@ -339,12 +327,8 @@ msx_cart_ascii16_sram_device::msx_cart_ascii16_sram_device(const machine_config
void msx_cart_ascii16_sram_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_ascii16_sram_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_ascii16_sram_device::restore_banks), this));
}
@@ -413,7 +397,7 @@ void msx_cart_ascii16_sram_device::initialize_cartridge()
}
-uint8_t msx_cart_ascii16_sram_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_ascii16_sram_device::read_cart)
{
if ( offset >= 0x4000 && offset < 0xC000 )
{
@@ -435,7 +419,7 @@ uint8_t msx_cart_ascii16_sram_device::read_cart(offs_t offset)
}
-void msx_cart_ascii16_sram_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_ascii16_sram_device::write_cart)
{
if (offset >= 0x6000 && offset < 0x6800)
{
@@ -477,12 +461,8 @@ msx_cart_msxwrite_device::msx_cart_msxwrite_device(const machine_config &mconfig
void msx_cart_msxwrite_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_msxwrite_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_msxwrite_device::restore_banks), this));
}
@@ -526,7 +506,7 @@ void msx_cart_msxwrite_device::initialize_cartridge()
}
-uint8_t msx_cart_msxwrite_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_msxwrite_device::read_cart)
{
if ( offset >= 0x4000 && offset < 0xC000 )
{
@@ -536,7 +516,7 @@ uint8_t msx_cart_msxwrite_device::read_cart(offs_t offset)
}
-void msx_cart_msxwrite_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_msxwrite_device::write_cart)
{
// The rom writes to 6fff and 7fff for banking, unknown whether
// other locations also trigger banking.
diff --git a/src/devices/bus/msx_cart/ascii.h b/src/devices/bus/msx_cart/ascii.h
index 0c5898fed40..2df178dc31d 100644
--- a/src/devices/bus/msx_cart/ascii.h
+++ b/src/devices/bus/msx_cart/ascii.h
@@ -22,14 +22,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
@@ -47,14 +46,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
@@ -72,14 +70,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
@@ -100,14 +97,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
@@ -128,14 +124,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/bm_012.cpp b/src/devices/bus/msx_cart/bm_012.cpp
index f38215ac6cc..db354b1e65c 100644
--- a/src/devices/bus/msx_cart/bm_012.cpp
+++ b/src/devices/bus/msx_cart/bm_012.cpp
@@ -39,8 +39,7 @@ void msx_cart_bm_012_device::bm_012_memory_map(address_map &map)
}
-void msx_cart_bm_012_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_bm_012_device::device_add_mconfig)
// 12MHz XTAL @ X1
// Toshiba TMPZ84C015AF-6 (@U5) components:
// - Z80
@@ -70,12 +69,13 @@ void msx_cart_bm_012_device::device_add_mconfig(machine_config &config)
m_bm012_pio->out_brdy_callback().set("tmpz84c015af", FUNC(tmpz84c015_device::strobe_b));
// MIDI ports
- MIDI_PORT(config, "mdin", midiin_slot, "midiin").rxd_handler().set(FUNC(msx_cart_bm_012_device::midi_in));
+ MCFG_MIDI_PORT_ADD("mdin", midiin_slot, "midiin")
+ MCFG_MIDI_RX_HANDLER(WRITELINE(*this, msx_cart_bm_012_device, midi_in))
- MIDI_PORT(config, "mdthru", midiout_slot, "midiout");
+ MCFG_MIDI_PORT_ADD("mdthru", midiout_slot, "midiout")
- MIDI_PORT(config, "mdout", midiout_slot, "midiout");
-}
+ MCFG_MIDI_PORT_ADD("mdout", midiout_slot, "midiout")
+MACHINE_CONFIG_END
ROM_START( msx_cart_bm_012 )
@@ -94,8 +94,9 @@ const tiny_rom_entry *msx_cart_bm_012_device::device_rom_region() const
void msx_cart_bm_012_device::device_start()
{
// Install IO read/write handlers
- io_space().install_write_handler(0x70, 0x73, write8_delegate(FUNC(z80pio_device::write_alt), m_bm012_pio.target()));
- io_space().install_read_handler(0x70, 0x73, read8_delegate(FUNC(z80pio_device::read_alt), m_bm012_pio.target()));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0x70, 0x73, write8_delegate(FUNC(z80pio_device::write_alt), m_bm012_pio.target()));
+ space.install_read_handler(0x70, 0x73, read8_delegate(FUNC(z80pio_device::read_alt), m_bm012_pio.target()));
}
diff --git a/src/devices/bus/msx_cart/cartridge.cpp b/src/devices/bus/msx_cart/cartridge.cpp
index 3a3af30d191..9c722e74872 100644
--- a/src/devices/bus/msx_cart/cartridge.cpp
+++ b/src/devices/bus/msx_cart/cartridge.cpp
@@ -26,8 +26,6 @@
#include "super_swangi.h"
#include "yamaha.h"
-#include "bus/msx_slot/cartridge.h"
-
void msx_cart(device_slot_interface &device)
{
@@ -74,7 +72,7 @@ void msx_cart(device_slot_interface &device)
msx_cart_interface::msx_cart_interface(const machine_config &mconfig, device_t &device)
: device_slot_card_interface(mconfig, device)
- , m_exp(nullptr)
+ , m_out_irq_cb(*this)
{
}
@@ -102,21 +100,6 @@ void msx_cart_interface::sram_alloc(uint32_t size)
std::fill_n(m_sram.begin(), size, 0x00);
}
-WRITE_LINE_MEMBER(msx_cart_interface::irq_out)
-{
- m_exp->irq_out(state);
-}
-
-address_space &msx_cart_interface::memory_space() const
-{
- return m_exp->memory_space();
-}
-
-address_space &msx_cart_interface::io_space() const
-{
- return m_exp->io_space();
-}
-
// Several yamaha machines had 60 pin expansion slots. The pinouts of these slots was
// exactly the same as the regular 50 pin cartridge slots. The lowest 10 pins are simply
diff --git a/src/devices/bus/msx_cart/cartridge.h b/src/devices/bus/msx_cart/cartridge.h
index 529d2f0a081..381ec09e566 100644
--- a/src/devices/bus/msx_cart/cartridge.h
+++ b/src/devices/bus/msx_cart/cartridge.h
@@ -10,26 +10,19 @@ void msx_cart(device_slot_interface &device);
void msx_yamaha_60pin(device_slot_interface &device); // 60 pin expansion slots as found in yamaha machines
-class msx_slot_cartridge_device;
-
class msx_cart_interface : public device_slot_card_interface
{
- friend class msx_slot_cartridge_device;
-
public:
+ template <class Object> void set_out_irq_cb(Object &&cb) { m_out_irq_cb.set_callback(std::forward<Object>(cb)); }
+
// This is called after loading cartridge contents and allows the cartridge
// implementation to perform some additional initialization based on the
// cartridge contents.
virtual void initialize_cartridge() { }
- virtual void interface_pre_start() override { assert(m_exp != nullptr); }
// reading and writing
- virtual uint8_t read_cart(offs_t offset) { return 0xff; }
- virtual void write_cart(offs_t offset, uint8_t data) { }
-
- DECLARE_WRITE_LINE_MEMBER(irq_out);
- address_space &memory_space() const;
- address_space &io_space() const;
+ virtual DECLARE_READ8_MEMBER(read_cart) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write_cart) { }
// ROM/RAM/SRAM management
// Mainly used by the cartridge slot when loading images
@@ -50,13 +43,13 @@ public:
protected:
msx_cart_interface(const machine_config &mconfig, device_t &device);
+ virtual void interface_pre_start() override { m_out_irq_cb.resolve_safe(); }
+
std::vector<uint8_t> m_rom;
std::vector<uint8_t> m_ram;
std::vector<uint8_t> m_rom_vlm5030;
std::vector<uint8_t> m_sram;
-
-private:
- msx_slot_cartridge_device *m_exp;
+ devcb_write_line m_out_irq_cb;
};
diff --git a/src/devices/bus/msx_cart/crossblaim.cpp b/src/devices/bus/msx_cart/crossblaim.cpp
index 6494e492f5b..dfd7907ac46 100644
--- a/src/devices/bus/msx_cart/crossblaim.cpp
+++ b/src/devices/bus/msx_cart/crossblaim.cpp
@@ -21,12 +21,8 @@ msx_cart_crossblaim_device::msx_cart_crossblaim_device(const machine_config &mco
void msx_cart_crossblaim_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_crossblaim_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_crossblaim_device::restore_banks), this));
}
@@ -62,7 +58,7 @@ void msx_cart_crossblaim_device::initialize_cartridge()
}
-uint8_t msx_cart_crossblaim_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_crossblaim_device::read_cart)
{
uint8_t *bank_base = m_bank_base[offset >> 14];
@@ -75,7 +71,7 @@ uint8_t msx_cart_crossblaim_device::read_cart(offs_t offset)
}
-void msx_cart_crossblaim_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_crossblaim_device::write_cart)
{
m_selected_bank = data & 3;
if (m_selected_bank == 0)
diff --git a/src/devices/bus/msx_cart/crossblaim.h b/src/devices/bus/msx_cart/crossblaim.h
index 04a44c1d905..a1321dd06df 100644
--- a/src/devices/bus/msx_cart/crossblaim.h
+++ b/src/devices/bus/msx_cart/crossblaim.h
@@ -18,14 +18,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/disk.cpp b/src/devices/bus/msx_cart/disk.cpp
index 7bbbdd292c0..a0e03e54920 100644
--- a/src/devices/bus/msx_cart/disk.cpp
+++ b/src/devices/bus/msx_cart/disk.cpp
@@ -197,8 +197,7 @@ void msx_cart_disk_device::initialize_cartridge()
}
-void msx_cart_vy0010_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_vy0010_device::device_add_mconfig)
// From VY-0010 schematic:
// HLT pulled high
// SSO/-ENMF + -DDEN + ENP + -5/8 - pulled low
@@ -207,63 +206,60 @@ void msx_cart_vy0010_device::device_add_mconfig(machine_config &config)
m_fdc->set_force_ready(true);
// Single sided 3.5" floppy drive
- FLOPPY_CONNECTOR(config, "fdc:0", msx_floppies, "35ssdd", msx_cart_disk_device::floppy_formats);
+ MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35ssdd", msx_cart_disk_device::floppy_formats)
// Attach software lists
// We do not know in what kind of machine the user has inserted the floppy interface
// so we list all msx floppy software lists.
//
- SOFTWARE_LIST(config, "flop_list").set_original("msx2_flop");
- SOFTWARE_LIST(config, "msx1_flop_list").set_compatible("msx1_flop");
-}
+ MCFG_SOFTWARE_LIST_ADD("flop_list","msx2_flop")
+ MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flop_list","msx1_flop")
+MACHINE_CONFIG_END
-void msx_cart_fsfd1_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_fsfd1_device::device_add_mconfig)
WD2793(config, m_fdc, 4_MHz_XTAL / 4);
// Double sided 3.5" floppy drive
- FLOPPY_CONNECTOR(config, "fdc:0", msx_floppies, "35dd", msx_cart_disk_device::floppy_formats);
+ MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35dd", msx_cart_disk_device::floppy_formats)
// Attach software lists
// We do not know in what kind of machine the user has inserted the floppy interface
// so we list all msx floppy software lists.
//
- SOFTWARE_LIST(config, "flop_list").set_original("msx2_flop");
- SOFTWARE_LIST(config, "msx1_flop_list").set_compatible("msx1_flop");
-}
+ MCFG_SOFTWARE_LIST_ADD("flop_list","msx2_flop")
+ MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flop_list","msx1_flop")
+MACHINE_CONFIG_END
-void msx_cart_fsfd1a_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_fsfd1a_device::device_add_mconfig)
TC8566AF(config, m_fdc, 16'000'000);
// Double sided 3.5" floppy drive
- FLOPPY_CONNECTOR(config, "fdc:0", msx_floppies, "35dd", msx_cart_disk_device::floppy_formats);
+ MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35dd", msx_cart_disk_device::floppy_formats)
// Attach software lists
// We do not know in what kind of machine the user has inserted the floppy interface
// so we list all msx floppy software lists.
//
- SOFTWARE_LIST(config, "flop_list").set_original("msx2_flop");
- SOFTWARE_LIST(config, "msx1_flop_list").set_compatible("msx1_flop");
-}
+ MCFG_SOFTWARE_LIST_ADD("flop_list","msx2_flop")
+ MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flop_list","msx1_flop")
+MACHINE_CONFIG_END
-void msx_cart_fscf351_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_fscf351_device::device_add_mconfig)
MB8877(config, m_fdc, 4_MHz_XTAL / 4);
m_fdc->set_force_ready(true);
// Double sided 3.5" floppy drive
- FLOPPY_CONNECTOR(config, "fdc:0", msx_floppies, "35dd", msx_cart_disk_device::floppy_formats);
+ MCFG_FLOPPY_DRIVE_ADD("fdc:0", msx_floppies, "35dd", msx_cart_disk_device::floppy_formats)
// Attach software lists
// We do not know in what kind of machine the user has inserted the floppy interface
// so we list all msx floppy software lists.
//
- SOFTWARE_LIST(config, "flop_list").set_original("msx2_flop");
- SOFTWARE_LIST(config, "msx1_flop_list").set_compatible("msx1_flop");
-}
+ MCFG_SOFTWARE_LIST_ADD("flop_list","msx2_flop")
+ MCFG_SOFTWARE_LIST_COMPATIBLE_ADD("msx1_flop_list","msx1_flop")
+MACHINE_CONFIG_END
void msx_cart_disk_type1_device::device_start()
@@ -272,10 +268,12 @@ void msx_cart_disk_type1_device::device_start()
save_item(NAME(m_side_control));
save_item(NAME(m_control));
+
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_disk_type1_device::post_load), this));
}
-void msx_cart_disk_type1_device::device_post_load()
+void msx_cart_disk_type1_device::post_load()
{
uint8_t data = m_control;
@@ -340,7 +338,7 @@ void msx_cart_disk_type1_device::device_reset()
}
-uint8_t msx_cart_disk_type1_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_disk_type1_device::read_cart)
{
switch (offset)
{
@@ -381,7 +379,7 @@ uint8_t msx_cart_disk_type1_device::read_cart(offs_t offset)
}
-void msx_cart_disk_type1_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_disk_type1_device::write_cart)
{
switch (offset)
{
@@ -427,6 +425,8 @@ void msx_cart_disk_type2_device::device_start()
m_led.resolve();
save_item(NAME(m_control));
+
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_disk_type2_device::post_load), this));
}
@@ -436,7 +436,7 @@ void msx_cart_disk_type2_device::device_reset()
}
-void msx_cart_disk_type2_device::device_post_load()
+void msx_cart_disk_type2_device::post_load()
{
uint8_t data = m_control;
@@ -483,7 +483,7 @@ void msx_cart_disk_type2_device::set_control(uint8_t data)
}
-uint8_t msx_cart_disk_type2_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_disk_type2_device::read_cart)
{
switch (offset)
{
@@ -516,7 +516,7 @@ uint8_t msx_cart_disk_type2_device::read_cart(offs_t offset)
}
-void msx_cart_disk_type2_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_disk_type2_device::write_cart)
{
switch (offset)
{
@@ -564,17 +564,17 @@ void msx_cart_fsfd1a_device::device_reset()
}
-uint8_t msx_cart_fsfd1a_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_fsfd1a_device::read_cart)
{
switch (offset)
{
case 0x7ffa:
case 0xbffa:
- return m_fdc->msr_r();
+ return m_fdc->msr_r(space, 4);
case 0x7ffb:
case 0xbffb:
- return m_fdc->fifo_r();
+ return m_fdc->fifo_r(space, 5);
}
if (offset >= 0x4000 && offset < 0x8000)
@@ -585,23 +585,23 @@ uint8_t msx_cart_fsfd1a_device::read_cart(offs_t offset)
}
-void msx_cart_fsfd1a_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_fsfd1a_device::write_cart)
{
switch (offset)
{
case 0x7ff8:
case 0xbff8:
- m_fdc->dor_w(data);
+ m_fdc->dor_w(space, 2, data);
break;
case 0x7ff9:
case 0xbff9:
- m_fdc->cr1_w(data);
+ m_fdc->cr1_w(space, 3, data);
break;
case 0x7ffb:
case 0xbffb:
- m_fdc->fifo_w(data);
+ m_fdc->fifo_w(space, 5, data);
break;
default:
diff --git a/src/devices/bus/msx_cart/disk.h b/src/devices/bus/msx_cart/disk.h
index ce238992349..908f2ef7229 100644
--- a/src/devices/bus/msx_cart/disk.h
+++ b/src/devices/bus/msx_cart/disk.h
@@ -45,8 +45,8 @@ protected:
class msx_cart_disk_type1_device : public msx_cart_disk_wd_device
{
public:
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
msx_cart_disk_type1_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -54,7 +54,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
+
+ void post_load();
output_finder<> m_led;
uint8_t m_side_control;
@@ -68,8 +69,8 @@ protected:
class msx_cart_disk_type2_device : public msx_cart_disk_wd_device
{
public:
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
msx_cart_disk_type2_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -77,7 +78,8 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
+
+ void post_load();
output_finder<> m_led;
uint8_t m_control;
@@ -137,8 +139,8 @@ protected:
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
};
diff --git a/src/devices/bus/msx_cart/dooly.cpp b/src/devices/bus/msx_cart/dooly.cpp
index a0c4c7b4f83..d1d3ad9ff39 100644
--- a/src/devices/bus/msx_cart/dooly.cpp
+++ b/src/devices/bus/msx_cart/dooly.cpp
@@ -36,7 +36,7 @@ void msx_cart_dooly_device::initialize_cartridge()
}
-uint8_t msx_cart_dooly_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_dooly_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -54,7 +54,7 @@ uint8_t msx_cart_dooly_device::read_cart(offs_t offset)
}
-void msx_cart_dooly_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_dooly_device::write_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
diff --git a/src/devices/bus/msx_cart/dooly.h b/src/devices/bus/msx_cart/dooly.h
index 76f58ae762d..3ef7b365c82 100644
--- a/src/devices/bus/msx_cart/dooly.h
+++ b/src/devices/bus/msx_cart/dooly.h
@@ -18,8 +18,8 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
diff --git a/src/devices/bus/msx_cart/fmpac.cpp b/src/devices/bus/msx_cart/fmpac.cpp
index a5229a6c61e..7054c8c366a 100644
--- a/src/devices/bus/msx_cart/fmpac.cpp
+++ b/src/devices/bus/msx_cart/fmpac.cpp
@@ -29,12 +29,12 @@ msx_cart_fmpac_device::msx_cart_fmpac_device(const machine_config &mconfig, cons
}
-void msx_cart_fmpac_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_fmpac_device::device_add_mconfig)
// This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'.
SPEAKER(config, "mono").front_center();
- YM2413(config, m_ym2413, XTAL(10'738'635)/3).add_route(ALL_OUTPUTS, "mono", 0.40);
-}
+ MCFG_DEVICE_ADD("ym2413", YM2413, XTAL(10'738'635)/3)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
+MACHINE_CONFIG_END
void msx_cart_fmpac_device::device_start()
@@ -46,14 +46,11 @@ void msx_cart_fmpac_device::device_start()
save_item(NAME(m_1fff));
save_item(NAME(m_7ff6));
- // Install IO read/write handlers
- io_space().install_write_handler(0x7c, 0x7d, write8sm_delegate(FUNC(msx_cart_fmpac_device::write_ym2413), this));
-}
-
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_fmpac_device::restore_banks), this));
-void msx_cart_fmpac_device::device_post_load()
-{
- restore_banks();
+ // Install IO read/write handlers
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0x7c, 0x7d, write8_delegate(FUNC(msx_cart_fmpac_device::write_ym2413), this));
}
@@ -90,7 +87,7 @@ void msx_cart_fmpac_device::initialize_cartridge()
}
-uint8_t msx_cart_fmpac_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_fmpac_device::read_cart)
{
if (offset >= 0x4000 && offset < 0x8000)
{
@@ -119,7 +116,7 @@ uint8_t msx_cart_fmpac_device::read_cart(offs_t offset)
}
-void msx_cart_fmpac_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_fmpac_device::write_cart)
{
if (offset >= 0x4000 && offset < 0x6000)
{
@@ -144,7 +141,7 @@ void msx_cart_fmpac_device::write_cart(offs_t offset, uint8_t data)
case 0x7ff5:
if (m_opll_active)
{
- m_ym2413->write(offset & 1, data);
+ m_ym2413->write(space, offset & 1, data);
}
break;
@@ -162,10 +159,10 @@ void msx_cart_fmpac_device::write_cart(offs_t offset, uint8_t data)
}
-void msx_cart_fmpac_device::write_ym2413(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_fmpac_device::write_ym2413)
{
if (m_opll_active)
{
- m_ym2413->write(offset & 1, data);
+ m_ym2413->write(space, offset & 1, data);
}
}
diff --git a/src/devices/bus/msx_cart/fmpac.h b/src/devices/bus/msx_cart/fmpac.h
index a0f660b1620..7100fe4a07c 100644
--- a/src/devices/bus/msx_cart/fmpac.h
+++ b/src/devices/bus/msx_cart/fmpac.h
@@ -19,13 +19,14 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
+
+ DECLARE_WRITE8_MEMBER(write_ym2413);
protected:
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
// device-level overrides
virtual void device_add_mconfig(machine_config &config) override;
@@ -33,8 +34,6 @@ protected:
void restore_banks();
private:
- void write_ym2413(offs_t offset, uint8_t data);
-
required_device<ym2413_device> m_ym2413;
uint8_t m_selected_bank;
diff --git a/src/devices/bus/msx_cart/fs_sr022.cpp b/src/devices/bus/msx_cart/fs_sr022.cpp
index bb84a759214..7e0eac793df 100644
--- a/src/devices/bus/msx_cart/fs_sr022.cpp
+++ b/src/devices/bus/msx_cart/fs_sr022.cpp
@@ -38,7 +38,7 @@ void msx_cart_fs_sr022_device::initialize_cartridge()
}
-uint8_t msx_cart_fs_sr022_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_fs_sr022_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -52,7 +52,7 @@ uint8_t msx_cart_fs_sr022_device::read_cart(offs_t offset)
}
-void msx_cart_fs_sr022_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_fs_sr022_device::write_cart)
{
switch (offset)
{
diff --git a/src/devices/bus/msx_cart/fs_sr022.h b/src/devices/bus/msx_cart/fs_sr022.h
index 2456b90a101..bf3259090e1 100644
--- a/src/devices/bus/msx_cart/fs_sr022.h
+++ b/src/devices/bus/msx_cart/fs_sr022.h
@@ -18,8 +18,8 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
diff --git a/src/devices/bus/msx_cart/halnote.cpp b/src/devices/bus/msx_cart/halnote.cpp
index 43f7947ec2c..013d2b83680 100644
--- a/src/devices/bus/msx_cart/halnote.cpp
+++ b/src/devices/bus/msx_cart/halnote.cpp
@@ -19,12 +19,8 @@ msx_cart_halnote_device::msx_cart_halnote_device(const machine_config &mconfig,
void msx_cart_halnote_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_halnote_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_halnote_device::restore_banks), this));
}
@@ -88,7 +84,7 @@ void msx_cart_halnote_device::initialize_cartridge()
}
-uint8_t msx_cart_halnote_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_halnote_device::read_cart)
{
if (offset >= 0xc000)
{
@@ -110,7 +106,7 @@ uint8_t msx_cart_halnote_device::read_cart(offs_t offset)
}
-void msx_cart_halnote_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_halnote_device::write_cart)
{
if (offset < 0x4000)
{
diff --git a/src/devices/bus/msx_cart/halnote.h b/src/devices/bus/msx_cart/halnote.h
index a9c1972afeb..ad64d2539ee 100644
--- a/src/devices/bus/msx_cart/halnote.h
+++ b/src/devices/bus/msx_cart/halnote.h
@@ -18,14 +18,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/hfox.cpp b/src/devices/bus/msx_cart/hfox.cpp
index 181d9710fcc..d7fb793e42d 100644
--- a/src/devices/bus/msx_cart/hfox.cpp
+++ b/src/devices/bus/msx_cart/hfox.cpp
@@ -19,12 +19,8 @@ msx_cart_hfox_device::msx_cart_hfox_device(const machine_config &mconfig, const
void msx_cart_hfox_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_hfox_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_hfox_device::restore_banks), this));
}
@@ -52,7 +48,7 @@ void msx_cart_hfox_device::initialize_cartridge()
}
-uint8_t msx_cart_hfox_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_hfox_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -62,7 +58,7 @@ uint8_t msx_cart_hfox_device::read_cart(offs_t offset)
}
-void msx_cart_hfox_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_hfox_device::write_cart)
{
switch (offset)
{
diff --git a/src/devices/bus/msx_cart/hfox.h b/src/devices/bus/msx_cart/hfox.h
index 6254bae3610..debcbc31308 100644
--- a/src/devices/bus/msx_cart/hfox.h
+++ b/src/devices/bus/msx_cart/hfox.h
@@ -16,14 +16,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/holy_quran.cpp b/src/devices/bus/msx_cart/holy_quran.cpp
index 046ed194502..4c44656a9e3 100644
--- a/src/devices/bus/msx_cart/holy_quran.cpp
+++ b/src/devices/bus/msx_cart/holy_quran.cpp
@@ -30,12 +30,8 @@ void msx_cart_holy_quran_device::device_start()
{
save_item(NAME(m_selected_bank));
save_item(NAME(m_decrypt));
-}
-
-void msx_cart_holy_quran_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_holy_quran_device::restore_banks), this));
}
@@ -68,7 +64,7 @@ void msx_cart_holy_quran_device::initialize_cartridge()
}
-uint8_t msx_cart_holy_quran_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_holy_quran_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -92,7 +88,7 @@ uint8_t msx_cart_holy_quran_device::read_cart(offs_t offset)
}
-void msx_cart_holy_quran_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_holy_quran_device::write_cart)
{
switch (offset)
{
diff --git a/src/devices/bus/msx_cart/holy_quran.h b/src/devices/bus/msx_cart/holy_quran.h
index 8d63a8271d9..b805282790c 100644
--- a/src/devices/bus/msx_cart/holy_quran.h
+++ b/src/devices/bus/msx_cart/holy_quran.h
@@ -18,14 +18,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/konami.cpp b/src/devices/bus/msx_cart/konami.cpp
index f5ac42be362..e1d4e35321f 100644
--- a/src/devices/bus/msx_cart/konami.cpp
+++ b/src/devices/bus/msx_cart/konami.cpp
@@ -35,12 +35,8 @@ msx_cart_konami_device::msx_cart_konami_device(const machine_config &mconfig, co
void msx_cart_konami_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_konami_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_konami_device::restore_banks), this));
}
@@ -88,13 +84,13 @@ void msx_cart_konami_device::initialize_cartridge()
}
-uint8_t msx_cart_konami_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_konami_device::read_cart)
{
return m_bank_base[offset >> 13][offset & 0x1fff];
}
-void msx_cart_konami_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_konami_device::write_cart)
{
switch (offset & 0xe000)
{
@@ -145,24 +141,20 @@ msx_cart_konami_scc_device::msx_cart_konami_scc_device(const machine_config &mco
}
-void msx_cart_konami_scc_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_konami_scc_device::device_add_mconfig)
// This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'.
SPEAKER(config, "mono").front_center();
- K051649(config, m_k051649, XTAL(10'738'635)/3/2).add_route(ALL_OUTPUTS, "mono", 0.15);
-}
+ MCFG_DEVICE_ADD("k051649", K051649, XTAL(10'738'635)/3/2)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
+MACHINE_CONFIG_END
void msx_cart_konami_scc_device::device_start()
{
save_item(NAME(m_selected_bank));
save_item(NAME(m_scc_active));
-}
-
-void msx_cart_konami_scc_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_konami_scc_device::restore_banks), this));
}
@@ -211,7 +203,7 @@ void msx_cart_konami_scc_device::initialize_cartridge()
}
-uint8_t msx_cart_konami_scc_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_konami_scc_device::read_cart)
{
if ( m_scc_active && offset >= 0x9800 && offset < 0xa000 )
{
@@ -219,13 +211,13 @@ uint8_t msx_cart_konami_scc_device::read_cart(offs_t offset)
{
if ((offset & 0xff) >= 0xe0)
{
- return m_k051649->k051649_test_r();
+ return m_k051649->k051649_test_r(space, offset & 0xff);
}
return 0xff;
}
else
{
- return m_k051649->k051649_waveform_r(offset & 0x7f);
+ return m_k051649->k051649_waveform_r(space, offset & 0x7f);
}
}
@@ -233,7 +225,7 @@ uint8_t msx_cart_konami_scc_device::read_cart(offs_t offset)
}
-void msx_cart_konami_scc_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_konami_scc_device::write_cart)
{
switch (offset & 0xf800)
{
@@ -263,27 +255,27 @@ void msx_cart_konami_scc_device::write_cart(offs_t offset, uint8_t data)
if (offset < 0x80)
{
- m_k051649->k051649_waveform_w(offset, data);
+ m_k051649->k051649_waveform_w(space, offset, data);
}
else if (offset < 0xa0)
{
offset &= 0x0f;
if (offset < 0x0a)
{
- m_k051649->k051649_frequency_w(offset, data);
+ m_k051649->k051649_frequency_w(space, offset, data);
}
else if (offset < 0x0f)
{
- m_k051649->k051649_volume_w(offset - 0xa, data);
+ m_k051649->k051649_volume_w(space, offset - 0xa, data);
}
else
{
- m_k051649->k051649_keyonoff_w(data);
+ m_k051649->k051649_keyonoff_w(space, 0, data);
}
}
else if (offset >= 0xe0)
{
- m_k051649->k051649_test_w(data);
+ m_k051649->k051649_test_w(space, offset, data);
}
}
break;
@@ -319,12 +311,8 @@ msx_cart_gamemaster2_device::msx_cart_gamemaster2_device(const machine_config &m
void msx_cart_gamemaster2_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_gamemaster2_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_gamemaster2_device::restore_banks), this));
}
@@ -409,7 +397,7 @@ void msx_cart_gamemaster2_device::initialize_cartridge()
}
-uint8_t msx_cart_gamemaster2_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_gamemaster2_device::read_cart)
{
uint8_t bank = offset >> 13;
@@ -443,7 +431,7 @@ uint8_t msx_cart_gamemaster2_device::read_cart(offs_t offset)
}
-void msx_cart_gamemaster2_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_gamemaster2_device::write_cart)
{
switch (offset & 0xf000)
{
@@ -484,15 +472,13 @@ msx_cart_synthesizer_device::msx_cart_synthesizer_device(const machine_config &m
}
-void msx_cart_synthesizer_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_synthesizer_device::device_add_mconfig)
// This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'.
SPEAKER(config, "speaker").front_center();
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.1); // unknown DAC
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
-}
+ MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.1) // unknown DAC
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT)
+MACHINE_CONFIG_END
void msx_cart_synthesizer_device::device_start()
@@ -511,7 +497,7 @@ void msx_cart_synthesizer_device::initialize_cartridge()
}
-uint8_t msx_cart_synthesizer_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_synthesizer_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000 )
{
@@ -521,7 +507,7 @@ uint8_t msx_cart_synthesizer_device::read_cart(offs_t offset)
}
-void msx_cart_synthesizer_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_synthesizer_device::write_cart)
{
if ((offset & 0xc010) == 0x4000)
{
@@ -559,12 +545,12 @@ msx_cart_konami_sound_device::msx_cart_konami_sound_device(const machine_config
}
-void msx_cart_konami_sound_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_konami_sound_device::device_add_mconfig)
// This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'.
SPEAKER(config, "mono").front_center();
- K051649(config, m_k052539, XTAL(10'738'635)/3/2).add_route(ALL_OUTPUTS, "mono", 0.15);
-}
+ MCFG_DEVICE_ADD("k052539", K051649, XTAL(10'738'635)/3/2)
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.15)
+MACHINE_CONFIG_END
void msx_cart_konami_sound_device::device_start()
@@ -573,12 +559,8 @@ void msx_cart_konami_sound_device::device_start()
save_item(NAME(m_scc_active));
save_item(NAME(m_sccplus_active));
save_item(NAME(m_ram_enabled));
-}
-
-void msx_cart_konami_sound_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_konami_sound_device::restore_banks), this));
}
@@ -636,14 +618,14 @@ void msx_cart_konami_sound_device::initialize_cartridge()
}
-uint8_t msx_cart_konami_sound_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_konami_sound_device::read_cart)
{
if ( m_scc_active && offset >= 0x9800 && offset < 0x9fe0 )
{
offset &= 0xff;
if (offset < 0x80)
{
- return m_k052539->k051649_waveform_r(offset);
+ return m_k052539->k051649_waveform_r(space, offset);
}
if (offset < 0xa0)
{
@@ -651,11 +633,11 @@ uint8_t msx_cart_konami_sound_device::read_cart(offs_t offset)
}
if (offset < 0xc0)
{
- return m_k052539->k051649_waveform_r(offset & 0x9f);
+ return m_k052539->k051649_waveform_r(space, offset & 0x9f);
}
if (offset < 0xe0)
{
- return m_k052539->k051649_test_r();
+ return m_k052539->k051649_test_r(space, offset & 0xff);
}
return 0xff;
}
@@ -665,11 +647,11 @@ uint8_t msx_cart_konami_sound_device::read_cart(offs_t offset)
if (offset < 0xa0)
{
- return m_k052539->k052539_waveform_r(offset);
+ return m_k052539->k052539_waveform_r(space, offset);
}
if (offset >= 0xc0 && offset < 0xe0)
{
- return m_k052539->k051649_test_r();
+ return m_k052539->k051649_test_r(space, offset);
}
return 0xff;
}
@@ -684,7 +666,7 @@ uint8_t msx_cart_konami_sound_device::read_cart(offs_t offset)
}
-void msx_cart_konami_sound_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_konami_sound_device::write_cart)
{
switch (offset & 0xe000)
{
@@ -732,27 +714,27 @@ void msx_cart_konami_sound_device::write_cart(offs_t offset, uint8_t data)
if (offset < 0x80)
{
- m_k052539->k051649_waveform_w(offset, data);
+ m_k052539->k051649_waveform_w(space, offset, data);
}
else if (offset < 0xa0)
{
offset &= 0x0f;
if (offset < 0x0a)
{
- m_k052539->k051649_frequency_w(offset, data);
+ m_k052539->k051649_frequency_w(space, offset, data);
}
else if (offset < 0x0f)
{
- m_k052539->k051649_volume_w(offset - 0xa, data);
+ m_k052539->k051649_volume_w(space, offset - 0xa, data);
}
else
{
- m_k052539->k051649_keyonoff_w(data);
+ m_k052539->k051649_keyonoff_w(space, 0, data);
}
}
else if (offset >= 0xe0)
{
- m_k052539->k051649_test_w(data);
+ m_k052539->k051649_test_w(space, offset, data);
}
}
break;
@@ -795,27 +777,27 @@ void msx_cart_konami_sound_device::write_cart(offs_t offset, uint8_t data)
offset &= 0xff;
if (offset < 0xa0)
{
- m_k052539->k052539_waveform_w(offset, data);
+ m_k052539->k052539_waveform_w(space, offset, data);
}
else if (offset < 0xc0)
{
offset &= 0x0f;
if (offset < 0x0a)
{
- m_k052539->k051649_frequency_w(offset, data);
+ m_k052539->k051649_frequency_w(space, offset, data);
}
else if (offset < 0x0f)
{
- m_k052539->k051649_volume_w(offset - 0x0a, data);
+ m_k052539->k051649_volume_w(space, offset - 0x0a, data);
}
else if (offset == 0x0f)
{
- m_k052539->k051649_keyonoff_w(data);
+ m_k052539->k051649_keyonoff_w(space, 0, data);
}
}
else if (offset < 0xe0)
{
- m_k052539->k051649_test_w(data);
+ m_k052539->k051649_test_w(space, offset, data);
}
}
}
@@ -890,22 +872,22 @@ void msx_cart_keyboard_master_device::vlm_map(address_map &map)
}
-void msx_cart_keyboard_master_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_keyboard_master_device::device_add_mconfig)
// This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'.
SPEAKER(config, "mono").front_center();
- VLM5030(config, m_vlm5030, XTAL(3'579'545));
- m_vlm5030->add_route(ALL_OUTPUTS, "mono", 0.40);
- m_vlm5030->set_addrmap(0, &msx_cart_keyboard_master_device::vlm_map);
-}
+ MCFG_DEVICE_ADD("vlm5030", VLM5030, XTAL(3'579'545))
+ MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.40)
+ MCFG_DEVICE_ADDRESS_MAP(0, vlm_map)
+MACHINE_CONFIG_END
void msx_cart_keyboard_master_device::device_start()
{
// Install IO read/write handlers
- io_space().install_write_handler(0x00, 0x00, write8smo_delegate(FUNC(vlm5030_device::data_w), m_vlm5030.target()));
- io_space().install_write_handler(0x20, 0x20, write8smo_delegate(FUNC(msx_cart_keyboard_master_device::io_20_w), this));
- io_space().install_read_handler(0x00, 0x00, read8smo_delegate(FUNC(msx_cart_keyboard_master_device::io_00_r), this));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0x00, 0x00, write8_delegate(FUNC(vlm5030_device::data_w), m_vlm5030.target()));
+ space.install_write_handler(0x20, 0x20, write8_delegate(FUNC(msx_cart_keyboard_master_device::io_20_w), this));
+ space.install_read_handler(0x00, 0x00, read8_delegate(FUNC(msx_cart_keyboard_master_device::io_00_r), this));
}
@@ -918,7 +900,7 @@ void msx_cart_keyboard_master_device::initialize_cartridge()
}
-uint8_t msx_cart_keyboard_master_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_keyboard_master_device::read_cart)
{
if (offset >= 0x4000 && offset < 0x8000)
{
@@ -928,13 +910,13 @@ uint8_t msx_cart_keyboard_master_device::read_cart(offs_t offset)
}
-uint8_t msx_cart_keyboard_master_device::read_vlm(offs_t offset)
+READ8_MEMBER(msx_cart_keyboard_master_device::read_vlm)
{
return m_rom_vlm5030[offset];
}
-void msx_cart_keyboard_master_device::io_20_w(uint8_t data)
+WRITE8_MEMBER(msx_cart_keyboard_master_device::io_20_w)
{
m_vlm5030->rst((data & 0x01) ? 1 : 0);
m_vlm5030->vcu((data & 0x04) ? 1 : 0);
@@ -942,7 +924,7 @@ void msx_cart_keyboard_master_device::io_20_w(uint8_t data)
}
-uint8_t msx_cart_keyboard_master_device::io_00_r()
+READ8_MEMBER(msx_cart_keyboard_master_device::io_00_r)
{
return m_vlm5030->bsy() ? 0x10 : 0x00;
}
diff --git a/src/devices/bus/msx_cart/konami.h b/src/devices/bus/msx_cart/konami.h
index 58ad4f3cfb7..3985884f568 100644
--- a/src/devices/bus/msx_cart/konami.h
+++ b/src/devices/bus/msx_cart/konami.h
@@ -25,14 +25,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
@@ -50,14 +49,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
virtual void device_add_mconfig(machine_config &config) override;
@@ -80,14 +78,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
@@ -106,8 +103,8 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
@@ -126,8 +123,8 @@ class msx_cart_konami_sound_device : public device_t, public msx_cart_interface
public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
msx_cart_konami_sound_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
@@ -135,7 +132,6 @@ protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
virtual void device_add_mconfig(machine_config &config) override;
@@ -190,14 +186,14 @@ protected:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
private:
required_device<vlm5030_device> m_vlm5030;
- uint8_t read_vlm(offs_t offset);
- void io_20_w(uint8_t data);
- uint8_t io_00_r();
+ DECLARE_READ8_MEMBER(read_vlm);
+ DECLARE_WRITE8_MEMBER(io_20_w);
+ DECLARE_READ8_MEMBER(io_00_r);
void vlm_map(address_map &map);
};
diff --git a/src/devices/bus/msx_cart/korean.cpp b/src/devices/bus/msx_cart/korean.cpp
index 1906a5eb51b..cfa96ecb7aa 100644
--- a/src/devices/bus/msx_cart/korean.cpp
+++ b/src/devices/bus/msx_cart/korean.cpp
@@ -21,12 +21,8 @@ msx_cart_korean_80in1_device::msx_cart_korean_80in1_device(const machine_config
void msx_cart_korean_80in1_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_korean_80in1_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_korean_80in1_device::restore_banks), this));
}
@@ -76,7 +72,7 @@ void msx_cart_korean_80in1_device::initialize_cartridge()
}
-uint8_t msx_cart_korean_80in1_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_korean_80in1_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -87,7 +83,7 @@ uint8_t msx_cart_korean_80in1_device::read_cart(offs_t offset)
}
-void msx_cart_korean_80in1_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_korean_80in1_device::write_cart)
{
if (offset >= 0x4000 && offset < 0x4004)
{
@@ -116,14 +112,11 @@ void msx_cart_korean_90in1_device::device_start()
{
save_item(NAME(m_selected_bank));
- // Install IO read/write handlers
- io_space().install_write_handler(0x77, 0x77, write8smo_delegate(FUNC(msx_cart_korean_90in1_device::banking), this));
-}
-
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_korean_90in1_device::restore_banks), this));
-void msx_cart_korean_90in1_device::device_post_load()
-{
- restore_banks();
+ // Install IO read/write handlers
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0x77, 0x77, write8_delegate(FUNC(msx_cart_korean_90in1_device::banking), this));
}
@@ -188,7 +181,7 @@ void msx_cart_korean_90in1_device::initialize_cartridge()
}
-uint8_t msx_cart_korean_90in1_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_korean_90in1_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -199,7 +192,7 @@ uint8_t msx_cart_korean_90in1_device::read_cart(offs_t offset)
}
-void msx_cart_korean_90in1_device::banking(uint8_t data)
+WRITE8_MEMBER(msx_cart_korean_90in1_device::banking)
{
m_selected_bank = data;
restore_banks();
@@ -222,12 +215,8 @@ msx_cart_korean_126in1_device::msx_cart_korean_126in1_device(const machine_confi
void msx_cart_korean_126in1_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_korean_126in1_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_korean_126in1_device::restore_banks), this));
}
@@ -277,7 +266,7 @@ void msx_cart_korean_126in1_device::initialize_cartridge()
}
-uint8_t msx_cart_korean_126in1_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_korean_126in1_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -288,7 +277,7 @@ uint8_t msx_cart_korean_126in1_device::read_cart(offs_t offset)
}
-void msx_cart_korean_126in1_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_korean_126in1_device::write_cart)
{
if (offset >= 0x4000 && offset < 0x4002)
{
diff --git a/src/devices/bus/msx_cart/korean.h b/src/devices/bus/msx_cart/korean.h
index 62c5a6ba82b..b34438da13e 100644
--- a/src/devices/bus/msx_cart/korean.h
+++ b/src/devices/bus/msx_cart/korean.h
@@ -20,14 +20,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
private:
void restore_banks();
@@ -46,17 +45,16 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+
+ DECLARE_WRITE8_MEMBER(banking);
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
private:
- void banking(uint8_t data);
-
void restore_banks();
uint8_t m_bank_mask;
@@ -72,14 +70,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
private:
void restore_banks();
diff --git a/src/devices/bus/msx_cart/majutsushi.cpp b/src/devices/bus/msx_cart/majutsushi.cpp
index 66efee9188f..ef76b62af2a 100644
--- a/src/devices/bus/msx_cart/majutsushi.cpp
+++ b/src/devices/bus/msx_cart/majutsushi.cpp
@@ -26,26 +26,20 @@ msx_cart_majutsushi_device::msx_cart_majutsushi_device(const machine_config &mco
}
-void msx_cart_majutsushi_device::device_add_mconfig(machine_config &config)
-{
+MACHINE_CONFIG_START(msx_cart_majutsushi_device::device_add_mconfig)
// This is actually incorrect. The sound output is passed back into the MSX machine where it is mixed internally and output through the system 'speaker'.
SPEAKER(config, "speaker").front_center();
- DAC_8BIT_R2R(config, m_dac, 0).add_route(ALL_OUTPUTS, "speaker", 0.05); // unknown DAC
- voltage_regulator_device &vref(VOLTAGE_REGULATOR(config, "vref"));
- vref.add_route(0, "dac", 1.0, DAC_VREF_POS_INPUT);
- vref.add_route(0, "dac", -1.0, DAC_VREF_NEG_INPUT);
-}
+ MCFG_DEVICE_ADD("dac", DAC_8BIT_R2R, 0) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speaker", 0.05) // unknown DAC
+ MCFG_DEVICE_ADD("vref", VOLTAGE_REGULATOR, 0) MCFG_VOLTAGE_REGULATOR_OUTPUT(5.0)
+ MCFG_SOUND_ROUTE(0, "dac", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac", -1.0, DAC_VREF_NEG_INPUT)
+MACHINE_CONFIG_END
void msx_cart_majutsushi_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_majutsushi_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_majutsushi_device::restore_banks), this));
}
@@ -82,13 +76,13 @@ void msx_cart_majutsushi_device::initialize_cartridge()
}
-uint8_t msx_cart_majutsushi_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_majutsushi_device::read_cart)
{
return m_bank_base[offset >> 13][offset & 0x1fff];
}
-void msx_cart_majutsushi_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_majutsushi_device::write_cart)
{
switch (offset & 0xe000)
{
diff --git a/src/devices/bus/msx_cart/majutsushi.h b/src/devices/bus/msx_cart/majutsushi.h
index ebdf549272e..596fac47050 100644
--- a/src/devices/bus/msx_cart/majutsushi.h
+++ b/src/devices/bus/msx_cart/majutsushi.h
@@ -19,14 +19,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
virtual void device_add_mconfig(machine_config &config) override;
diff --git a/src/devices/bus/msx_cart/moonsound.cpp b/src/devices/bus/msx_cart/moonsound.cpp
index e01498c57bc..d8b1fda9a5e 100644
--- a/src/devices/bus/msx_cart/moonsound.cpp
+++ b/src/devices/bus/msx_cart/moonsound.cpp
@@ -67,10 +67,13 @@ const tiny_rom_entry *msx_cart_moonsound_device::device_rom_region() const
void msx_cart_moonsound_device::device_start()
{
+ m_out_irq_cb.resolve_safe();
+
// Install IO read/write handlers
- io_space().install_readwrite_handler(0x7e, 0x7f, read8sm_delegate(FUNC(msx_cart_moonsound_device::read_ymf278b_pcm), this), write8sm_delegate(FUNC(msx_cart_moonsound_device::write_ymf278b_pcm), this));
- io_space().install_readwrite_handler(0xc4, 0xc7, read8sm_delegate(FUNC(msx_cart_moonsound_device::read_ymf278b_fm), this), write8sm_delegate(FUNC(msx_cart_moonsound_device::write_ymf278b_fm), this));
- io_space().install_read_handler(0xc0, 0xc0, read8smo_delegate(FUNC(msx_cart_moonsound_device::read_c0), this));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_readwrite_handler(0x7e, 0x7f, read8_delegate(FUNC(msx_cart_moonsound_device::read_ymf278b_pcm), this), write8_delegate(FUNC(msx_cart_moonsound_device::write_ymf278b_pcm), this));
+ space.install_readwrite_handler(0xc4, 0xc7, read8_delegate(FUNC(msx_cart_moonsound_device::read_ymf278b_fm), this), write8_delegate(FUNC(msx_cart_moonsound_device::write_ymf278b_fm), this));
+ space.install_read_handler(0xc0, 0xc0, read8_delegate(FUNC(msx_cart_moonsound_device::read_c0), this));
}
@@ -82,40 +85,40 @@ void msx_cart_moonsound_device::device_reset()
WRITE_LINE_MEMBER(msx_cart_moonsound_device::irq_w)
{
LOG("moonsound: irq state %d\n", state);
- irq_out(state);
+ m_out_irq_cb(state);
}
-void msx_cart_moonsound_device::write_ymf278b_fm(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_moonsound_device::write_ymf278b_fm)
{
LOG("moonsound: write 0x%02x, data 0x%02x\n", 0xc4 + offset, data);
- m_ymf278b->write(offset, data);
+ m_ymf278b->write(space, offset, data);
}
-uint8_t msx_cart_moonsound_device::read_ymf278b_fm(offs_t offset)
+READ8_MEMBER(msx_cart_moonsound_device::read_ymf278b_fm)
{
LOG("moonsound: read 0x%02x\n", 0xc4 + offset);
- return m_ymf278b->read(offset);
+ return m_ymf278b->read(space, offset);
}
-void msx_cart_moonsound_device::write_ymf278b_pcm(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_moonsound_device::write_ymf278b_pcm)
{
LOG("moonsound: write 0x%02x, data 0x%02x\n", 0x7e + offset, data);
- m_ymf278b->write(4 + offset, data);
+ m_ymf278b->write(space, 4 + offset, data);
}
-uint8_t msx_cart_moonsound_device::read_ymf278b_pcm(offs_t offset)
+READ8_MEMBER(msx_cart_moonsound_device::read_ymf278b_pcm)
{
LOG("moonsound: read 0x%02x\n", 0x7e + offset);
- return m_ymf278b->read(4 + offset);
+ return m_ymf278b->read(space, 4 + offset);
}
// For detecting presence of moonsound cartridge
-uint8_t msx_cart_moonsound_device::read_c0()
+READ8_MEMBER(msx_cart_moonsound_device::read_c0)
{
LOG("moonsound: read 0xc0\n");
return 0x00;
diff --git a/src/devices/bus/msx_cart/moonsound.h b/src/devices/bus/msx_cart/moonsound.h
index ca30dfb5c35..02f16c94ed3 100644
--- a/src/devices/bus/msx_cart/moonsound.h
+++ b/src/devices/bus/msx_cart/moonsound.h
@@ -27,11 +27,11 @@ protected:
private:
DECLARE_WRITE_LINE_MEMBER(irq_w);
- void write_ymf278b_fm(offs_t offset, uint8_t data);
- uint8_t read_ymf278b_fm(offs_t offset);
- void write_ymf278b_pcm(offs_t offset, uint8_t data);
- uint8_t read_ymf278b_pcm(offs_t offset);
- uint8_t read_c0();
+ DECLARE_WRITE8_MEMBER(write_ymf278b_fm);
+ DECLARE_READ8_MEMBER(read_ymf278b_fm);
+ DECLARE_WRITE8_MEMBER(write_ymf278b_pcm);
+ DECLARE_READ8_MEMBER(read_ymf278b_pcm);
+ DECLARE_READ8_MEMBER(read_c0);
void ymf278b_map(address_map &map);
diff --git a/src/devices/bus/msx_cart/msx_audio.cpp b/src/devices/bus/msx_cart/msx_audio.cpp
index 679c035b014..61f96ff1eaa 100644
--- a/src/devices/bus/msx_cart/msx_audio.cpp
+++ b/src/devices/bus/msx_cart/msx_audio.cpp
@@ -96,8 +96,9 @@ void msx_cart_msx_audio_hxmu900_device::device_add_mconfig(machine_config &confi
void msx_cart_msx_audio_hxmu900_device::device_start()
{
// Install IO read/write handlers
- io_space().install_write_handler(0xc0, 0xc1, write8sm_delegate(FUNC(y8950_device::write), m_y8950.target()));
- io_space().install_read_handler(0xc0, 0xc1, read8sm_delegate(FUNC(y8950_device::read), m_y8950.target()));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0xc0, 0xc1, write8_delegate(FUNC(y8950_device::write), m_y8950.target()));
+ space.install_read_handler(0xc0, 0xc1, read8_delegate(FUNC(y8950_device::read), m_y8950.target()));
}
@@ -110,7 +111,7 @@ void msx_cart_msx_audio_hxmu900_device::initialize_cartridge()
}
-uint8_t msx_cart_msx_audio_hxmu900_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_msx_audio_hxmu900_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xC000)
{
@@ -200,10 +201,11 @@ WRITE_LINE_MEMBER(msx_cart_msx_audio_nms1205_device::midi_in)
void msx_cart_msx_audio_nms1205_device::device_start()
{
// Install IO read/write handlers
- io_space().install_write_handler(0xc0, 0xc1, write8sm_delegate(FUNC(y8950_device::write), m_y8950.target()));
- io_space().install_read_handler(0xc0, 0xc1, read8sm_delegate(FUNC(y8950_device::read), m_y8950.target()));
- io_space().install_write_handler(0x00, 0x01, write8sm_delegate(FUNC(acia6850_device::write), m_acia6850.target()));
- io_space().install_read_handler(0x04, 0x05, read8sm_delegate(FUNC(acia6850_device::read), m_acia6850.target()));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0xc0, 0xc1, write8_delegate(FUNC(y8950_device::write), m_y8950.target()));
+ space.install_read_handler(0xc0, 0xc1, read8_delegate(FUNC(y8950_device::read), m_y8950.target()));
+ space.install_write_handler(0x00, 0x01, write8_delegate(FUNC(acia6850_device::write), m_acia6850.target()));
+ space.install_read_handler(0x04, 0x05, read8_delegate(FUNC(acia6850_device::read), m_acia6850.target()));
}
@@ -216,7 +218,7 @@ void msx_cart_msx_audio_nms1205_device::initialize_cartridge()
}
-uint8_t msx_cart_msx_audio_nms1205_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_msx_audio_nms1205_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xC000)
{
@@ -287,8 +289,9 @@ const tiny_rom_entry *msx_cart_msx_audio_fsca1_device::device_rom_region() const
void msx_cart_msx_audio_fsca1_device::device_start()
{
// Install IO read/write handlers
- io_space().install_write_handler(0xc0, 0xc3, write8sm_delegate(FUNC(msx_cart_msx_audio_fsca1_device::write_y8950), this));
- io_space().install_read_handler(0xc0, 0xc3, read8sm_delegate(FUNC(msx_cart_msx_audio_fsca1_device::read_y8950), this));
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
+ space.install_write_handler(0xc0, 0xc3, write8_delegate(FUNC(msx_cart_msx_audio_fsca1_device::write_y8950), this));
+ space.install_read_handler(0xc0, 0xc3, read8_delegate(FUNC(msx_cart_msx_audio_fsca1_device::read_y8950), this));
}
@@ -301,7 +304,7 @@ void msx_cart_msx_audio_fsca1_device::initialize_cartridge()
}
-uint8_t msx_cart_msx_audio_fsca1_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_msx_audio_fsca1_device::read_cart)
{
if (m_7ffe == 0 && (offset & 0xB000) == 0x3000)
{
@@ -311,7 +314,7 @@ uint8_t msx_cart_msx_audio_fsca1_device::read_cart(offs_t offset)
}
-void msx_cart_msx_audio_fsca1_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_msx_audio_fsca1_device::write_cart)
{
if (offset == 0x7ffe)
{
@@ -335,45 +338,45 @@ void msx_cart_msx_audio_fsca1_device::write_cart(offs_t offset, uint8_t data)
}
-void msx_cart_msx_audio_fsca1_device::write_y8950(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_msx_audio_fsca1_device::write_y8950)
{
if (offset & 2)
{
if (m_7fff & 0x02)
{
- m_y8950->write(offset, data);
+ m_y8950->write(space, offset, data);
}
}
else
{
if (m_7fff & 0x01)
{
- m_y8950->write(offset, data);
+ m_y8950->write(space, offset, data);
}
}
}
-uint8_t msx_cart_msx_audio_fsca1_device::read_y8950(offs_t offset)
+READ8_MEMBER(msx_cart_msx_audio_fsca1_device::read_y8950)
{
if (offset & 2)
{
- return (m_7fff & 0x02) ? m_y8950->read(offset) : 0xff;
+ return (m_7fff & 0x02) ? m_y8950->read(space, offset) : 0xff;
}
else
{
- return (m_7fff & 0x01) ? m_y8950->read(offset) : 0xff;
+ return (m_7fff & 0x01) ? m_y8950->read(space, offset) : 0xff;
}
}
-void msx_cart_msx_audio_fsca1_device::y8950_io_w(uint8_t data)
+WRITE8_MEMBER(msx_cart_msx_audio_fsca1_device::y8950_io_w)
{
logerror("msx_fsca1::y8950_io_w: %02x\n", data);
}
-uint8_t msx_cart_msx_audio_fsca1_device::y8950_io_r()
+READ8_MEMBER(msx_cart_msx_audio_fsca1_device::y8950_io_r)
{
return m_io_config->read();
}
diff --git a/src/devices/bus/msx_cart/msx_audio.h b/src/devices/bus/msx_cart/msx_audio.h
index 3aeee7cddf1..d9fc89baa8c 100644
--- a/src/devices/bus/msx_cart/msx_audio.h
+++ b/src/devices/bus/msx_cart/msx_audio.h
@@ -23,7 +23,7 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
protected:
virtual void device_start() override;
@@ -44,7 +44,7 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
protected:
virtual void device_start() override;
@@ -71,8 +71,8 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
virtual void device_start() override;
@@ -82,12 +82,12 @@ protected:
virtual ioport_constructor device_input_ports() const override;
virtual const tiny_rom_entry *device_rom_region() const override;
-private:
- void write_y8950(offs_t offset, uint8_t data);
- uint8_t read_y8950(offs_t offset);
+ DECLARE_WRITE8_MEMBER(write_y8950);
+ DECLARE_READ8_MEMBER(read_y8950);
- void y8950_io_w(uint8_t data);
- uint8_t y8950_io_r();
+private:
+ DECLARE_WRITE8_MEMBER(y8950_io_w);
+ DECLARE_READ8_MEMBER(y8950_io_r);
required_device<y8950_device> m_y8950;
required_ioport m_io_config;
diff --git a/src/devices/bus/msx_cart/msx_audio_kb.cpp b/src/devices/bus/msx_cart/msx_audio_kb.cpp
index 68303c56667..9bbae0aab93 100644
--- a/src/devices/bus/msx_cart/msx_audio_kb.cpp
+++ b/src/devices/bus/msx_cart/msx_audio_kb.cpp
@@ -21,20 +21,20 @@ void msx_audio_kbdc_port_device::device_start()
}
-void msx_audio_kbdc_port_device::write(uint8_t data)
+WRITE8_MEMBER(msx_audio_kbdc_port_device::write)
{
if (m_keyboard)
{
- m_keyboard->write(data);
+ m_keyboard->write(space, offset, data);
}
}
-uint8_t msx_audio_kbdc_port_device::read()
+READ8_MEMBER(msx_audio_kbdc_port_device::read)
{
if (m_keyboard)
{
- return m_keyboard->read();
+ return m_keyboard->read(space, offset);
}
return 0xff;
}
@@ -57,7 +57,7 @@ public:
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t read() override
+ virtual DECLARE_READ8_MEMBER(read) override
{
uint8_t result = 0xff;
@@ -71,7 +71,7 @@ public:
return result;
}
- virtual void write(uint8_t data) override
+ virtual DECLARE_WRITE8_MEMBER(write) override
{
m_row = data;
}
@@ -187,7 +187,7 @@ public:
virtual ioport_constructor device_input_ports() const override;
- virtual uint8_t read() override
+ virtual DECLARE_READ8_MEMBER(read) override
{
uint8_t result = 0xff;
@@ -201,7 +201,7 @@ public:
return result;
}
- virtual void write(uint8_t data) override
+ virtual DECLARE_WRITE8_MEMBER(write) override
{
logerror("msx_nms1160::write %02x\n", data);
m_row = data;
diff --git a/src/devices/bus/msx_cart/msx_audio_kb.h b/src/devices/bus/msx_cart/msx_audio_kb.h
index 93a2d026214..25f0a2d24f8 100644
--- a/src/devices/bus/msx_cart/msx_audio_kb.h
+++ b/src/devices/bus/msx_cart/msx_audio_kb.h
@@ -10,8 +10,9 @@ DECLARE_DEVICE_TYPE(MSX_AUDIO_KBDC_PORT, msx_audio_kbdc_port_device)
class msx_audio_kb_port_interface : public device_slot_card_interface
{
public:
- virtual uint8_t read() { return 0xff; }
- virtual void write(uint8_t data) { }
+
+ virtual DECLARE_READ8_MEMBER(read) { return 0xff; }
+ virtual DECLARE_WRITE8_MEMBER(write) { }
protected:
// construction/destruction
@@ -38,8 +39,8 @@ public:
virtual void device_start() override;
// Physical connection simply consists of 8 input and 8 output lines split across 2 connectors
- void write(uint8_t data);
- uint8_t read();
+ DECLARE_WRITE8_MEMBER(write);
+ DECLARE_READ8_MEMBER(read);
protected:
diff --git a/src/devices/bus/msx_cart/msxdos2.cpp b/src/devices/bus/msx_cart/msxdos2.cpp
index 7f3e506b007..f4e391f66e9 100644
--- a/src/devices/bus/msx_cart/msxdos2.cpp
+++ b/src/devices/bus/msx_cart/msxdos2.cpp
@@ -18,12 +18,8 @@ msx_cart_msxdos2_device::msx_cart_msxdos2_device(const machine_config &mconfig,
void msx_cart_msxdos2_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_msxdos2_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_msxdos2_device::restore_banks), this));
}
@@ -50,7 +46,7 @@ void msx_cart_msxdos2_device::initialize_cartridge()
}
-uint8_t msx_cart_msxdos2_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_msxdos2_device::read_cart)
{
if (offset >= 0x4000 && offset < 0x8000)
{
@@ -61,7 +57,7 @@ uint8_t msx_cart_msxdos2_device::read_cart(offs_t offset)
}
-void msx_cart_msxdos2_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_msxdos2_device::write_cart)
{
if (offset == 0x6000)
{
diff --git a/src/devices/bus/msx_cart/msxdos2.h b/src/devices/bus/msx_cart/msxdos2.h
index dd5eb51d245..b30fbb70bd8 100644
--- a/src/devices/bus/msx_cart/msxdos2.h
+++ b/src/devices/bus/msx_cart/msxdos2.h
@@ -18,14 +18,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/nomapper.cpp b/src/devices/bus/msx_cart/nomapper.cpp
index 24ebbb38e0d..5152464cbc4 100644
--- a/src/devices/bus/msx_cart/nomapper.cpp
+++ b/src/devices/bus/msx_cart/nomapper.cpp
@@ -84,7 +84,7 @@ void msx_cart_nomapper_device::initialize_cartridge()
m_end_address = std::min<uint32_t>(m_start_address + size, 0x10000);
}
-uint8_t msx_cart_nomapper_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_nomapper_device::read_cart)
{
if ( offset >= m_start_address && offset < m_end_address )
{
diff --git a/src/devices/bus/msx_cart/nomapper.h b/src/devices/bus/msx_cart/nomapper.h
index eb5e40e1d08..7b29b6a69b3 100644
--- a/src/devices/bus/msx_cart/nomapper.h
+++ b/src/devices/bus/msx_cart/nomapper.h
@@ -21,7 +21,7 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
private:
uint32_t m_start_address;
diff --git a/src/devices/bus/msx_cart/rtype.cpp b/src/devices/bus/msx_cart/rtype.cpp
index 6cda0efb4e8..3853cfeed9a 100644
--- a/src/devices/bus/msx_cart/rtype.cpp
+++ b/src/devices/bus/msx_cart/rtype.cpp
@@ -21,12 +21,8 @@ msx_cart_rtype_device::msx_cart_rtype_device(const machine_config &mconfig, cons
void msx_cart_rtype_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_rtype_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_rtype_device::restore_banks), this));
}
@@ -58,7 +54,7 @@ void msx_cart_rtype_device::initialize_cartridge()
}
-uint8_t msx_cart_rtype_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_rtype_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -68,7 +64,7 @@ uint8_t msx_cart_rtype_device::read_cart(offs_t offset)
}
-void msx_cart_rtype_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_rtype_device::write_cart)
{
if (offset >= 0x7000 && offset < 0x8000)
{
diff --git a/src/devices/bus/msx_cart/rtype.h b/src/devices/bus/msx_cart/rtype.h
index 31583455a0a..435d8666273 100644
--- a/src/devices/bus/msx_cart/rtype.h
+++ b/src/devices/bus/msx_cart/rtype.h
@@ -18,14 +18,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/super_swangi.cpp b/src/devices/bus/msx_cart/super_swangi.cpp
index a64b0648195..75ee75be6a0 100644
--- a/src/devices/bus/msx_cart/super_swangi.cpp
+++ b/src/devices/bus/msx_cart/super_swangi.cpp
@@ -19,12 +19,8 @@ msx_cart_super_swangi_device::msx_cart_super_swangi_device(const machine_config
void msx_cart_super_swangi_device::device_start()
{
save_item(NAME(m_selected_bank));
-}
-
-void msx_cart_super_swangi_device::device_post_load()
-{
- restore_banks();
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_super_swangi_device::restore_banks), this));
}
@@ -52,7 +48,7 @@ void msx_cart_super_swangi_device::initialize_cartridge()
}
-uint8_t msx_cart_super_swangi_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_super_swangi_device::read_cart)
{
if (offset >= 0x4000 && offset < 0xc000)
{
@@ -62,7 +58,7 @@ uint8_t msx_cart_super_swangi_device::read_cart(offs_t offset)
}
-void msx_cart_super_swangi_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_super_swangi_device::write_cart)
{
if (offset == 0x8000)
{
diff --git a/src/devices/bus/msx_cart/super_swangi.h b/src/devices/bus/msx_cart/super_swangi.h
index f0f5ee216bd..cf3b9f3b7c9 100644
--- a/src/devices/bus/msx_cart/super_swangi.h
+++ b/src/devices/bus/msx_cart/super_swangi.h
@@ -18,14 +18,13 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
- virtual void device_post_load() override;
void restore_banks();
diff --git a/src/devices/bus/msx_cart/superloderunner.cpp b/src/devices/bus/msx_cart/superloderunner.cpp
index b846a935953..51289c24f10 100644
--- a/src/devices/bus/msx_cart/superloderunner.cpp
+++ b/src/devices/bus/msx_cart/superloderunner.cpp
@@ -19,14 +19,11 @@ void msx_cart_superloderunner_device::device_start()
{
save_item(NAME(m_selected_bank));
- // Install evil memory write handler
- memory_space().install_write_handler(0x0000, 0x0000, write8smo_delegate(FUNC(msx_cart_superloderunner_device::banking), this));
-}
-
+ machine().save().register_postload(save_prepost_delegate(FUNC(msx_cart_superloderunner_device::restore_banks), this));
-void msx_cart_superloderunner_device::device_post_load()
-{
- restore_banks();
+ // Install evil memory write handler
+ address_space &space = machine().device<cpu_device>("maincpu")->space(AS_PROGRAM);
+ space.install_write_handler(0x0000, 0x0000, write8_delegate(FUNC(msx_cart_superloderunner_device::banking), this));
}
@@ -47,7 +44,7 @@ void msx_cart_superloderunner_device::initialize_cartridge()
}
-uint8_t msx_cart_superloderunner_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_superloderunner_device::read_cart)
{
if (offset >= 0x8000 && offset < 0xc000)
{
@@ -58,7 +55,7 @@ uint8_t msx_cart_superloderunner_device::read_cart(offs_t offset)
}
-void msx_cart_superloderunner_device::banking(uint8_t data)
+WRITE8_MEMBER(msx_cart_superloderunner_device::banking)
{
m_selected_bank = data;
restore_banks();
diff --git a/src/devices/bus/msx_cart/superloderunner.h b/src/devices/bus/msx_cart/superloderunner.h
index bd763ca2c08..b8e73535ebf 100644
--- a/src/devices/bus/msx_cart/superloderunner.h
+++ b/src/devices/bus/msx_cart/superloderunner.h
@@ -18,18 +18,17 @@ public:
virtual void initialize_cartridge() override;
- virtual uint8_t read_cart(offs_t offset) override;
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+
+ DECLARE_WRITE8_MEMBER(banking);
protected:
// device-level overrides
virtual void device_start() override;
- virtual void device_post_load() override;
void restore_banks();
private:
- void banking(uint8_t data);
-
uint8_t m_selected_bank;
uint8_t *m_bank_base;
};
diff --git a/src/devices/bus/msx_cart/yamaha.cpp b/src/devices/bus/msx_cart/yamaha.cpp
index 9296779f1b3..e6f7dc844fe 100644
--- a/src/devices/bus/msx_cart/yamaha.cpp
+++ b/src/devices/bus/msx_cart/yamaha.cpp
@@ -131,22 +131,22 @@ void msx_cart_sfg_device::check_irq()
{
if (m_ym2151_irq_state != CLEAR_LINE || m_ym2148_irq_state != CLEAR_LINE)
{
- irq_out(ASSERT_LINE);
+ m_out_irq_cb(ASSERT_LINE);
}
else
{
- irq_out(CLEAR_LINE);
+ m_out_irq_cb(CLEAR_LINE);
}
}
-uint8_t msx_cart_sfg_device::read_cart(offs_t offset)
+READ8_MEMBER(msx_cart_sfg_device::read_cart)
{
switch (offset & 0x3fff)
{
case 0x3ff0: // YM-2151 status read
case 0x3ff1: // YM-2151 status read mirror?
- return m_ym2151->status_r();
+ return m_ym2151->status_r(space, 0);
case 0x3ff2: // YM-2148 keyboard column read
case 0x3ff3: // YM-2148 --
@@ -155,7 +155,7 @@ uint8_t msx_cart_sfg_device::read_cart(offs_t offset)
case 0x3ff6: // YM-2148 MIDI UART status register
// ------x- - 1 = received a byte/receive buffer full?
// -------x - 1 = ready to send next byte/send buffer empty?
- return m_ym2148->read(offset & 7);
+ return m_ym2148->read(space, offset & 7);
}
if (offset < 0x8000)
@@ -167,16 +167,16 @@ uint8_t msx_cart_sfg_device::read_cart(offs_t offset)
}
-void msx_cart_sfg_device::write_cart(offs_t offset, uint8_t data)
+WRITE8_MEMBER(msx_cart_sfg_device::write_cart)
{
switch (offset & 0x3fff)
{
case 0x3ff0: // YM-2151 register
- m_ym2151->register_w(data);
+ m_ym2151->register_w(space, 0, data);
break;
case 0x3ff1: // YM-2151 data
- m_ym2151->data_w(data);
+ m_ym2151->data_w(space, 0, data);
break;
case 0x3ff2: // YM-2148 write keyboard row
@@ -191,7 +191,7 @@ void msx_cart_sfg_device::write_cart(offs_t offset, uint8_t data)
// x------- - 1 = reset
// -----x-- - 1 = enable receiving / sending midi data
// -------x - 1 = enable receiving / sending midi data
- m_ym2148->write(offset & 7, data);
+ m_ym2148->write(space, offset & 7, data);
break;
default:
diff --git a/src/devices/bus/msx_cart/yamaha.h b/src/devices/bus/msx_cart/yamaha.h
index e5072dc5dcf..b8f30bf057f 100644
--- a/src/devices/bus/msx_cart/yamaha.h
+++ b/src/devices/bus/msx_cart/yamaha.h
@@ -18,9 +18,8 @@ DECLARE_DEVICE_TYPE(MSX_CART_SFG05, msx_cart_sfg05_device)
class msx_cart_sfg_device : public device_t, public msx_cart_interface
{
public:
- virtual uint8_t read_cart(offs_t offset) override;
- virtual void write_cart(offs_t offset, uint8_t data) override;
-
+ virtual DECLARE_READ8_MEMBER(read_cart) override;
+ virtual DECLARE_WRITE8_MEMBER(write_cart) override;
protected:
msx_cart_sfg_device(const machine_config &mconfig, const device_type type, const char *tag, device_t *owner, uint32_t clock);