mirror of
https://github.com/holub/mame
synced 2025-06-01 10:31:48 +03:00
spectrum: Removed machine().device from expansion devices (nw)
This commit is contained in:
parent
63f29019c4
commit
bd1fc3d9dc
@ -32,15 +32,6 @@ device_spectrum_expansion_interface::device_spectrum_expansion_interface(const m
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// ~device_spectrum_expansion_interface - destructor
|
||||
//-------------------------------------------------
|
||||
|
||||
device_spectrum_expansion_interface::~device_spectrum_expansion_interface()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
//**************************************************************************
|
||||
@ -52,6 +43,7 @@ device_spectrum_expansion_interface::~device_spectrum_expansion_interface()
|
||||
spectrum_expansion_slot_device::spectrum_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
device_t(mconfig, SPECTRUM_EXPANSION_SLOT, tag, owner, clock),
|
||||
device_slot_interface(mconfig, *this),
|
||||
m_io(nullptr),
|
||||
m_card(nullptr),
|
||||
m_irq_handler(*this),
|
||||
m_nmi_handler(*this)
|
||||
@ -59,15 +51,6 @@ spectrum_expansion_slot_device::spectrum_expansion_slot_device(const machine_con
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// expansion_slot_device - destructor
|
||||
//-------------------------------------------------
|
||||
|
||||
spectrum_expansion_slot_device::~spectrum_expansion_slot_device()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_validity_check - device-specific checks
|
||||
//-------------------------------------------------
|
||||
@ -103,6 +86,15 @@ void spectrum_expansion_slot_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// set_io_space - set address space we are attached to
|
||||
//-------------------------------------------------
|
||||
|
||||
void spectrum_expansion_slot_device::set_io_space(address_space *io)
|
||||
{
|
||||
m_io = io;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// port_fe_r
|
||||
//-------------------------------------------------
|
||||
|
@ -45,33 +45,6 @@
|
||||
#pragma once
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// CONSTANTS
|
||||
//**************************************************************************
|
||||
|
||||
#define SPECTRUM_EXPANSION_SLOT_TAG "exp"
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INTERFACE CONFIGURATION MACROS
|
||||
//**************************************************************************
|
||||
|
||||
#define MCFG_SPECTRUM_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot) \
|
||||
MCFG_DEVICE_ADD(_tag, SPECTRUM_EXPANSION_SLOT, 0) \
|
||||
MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
|
||||
|
||||
#define MCFG_SPECTRUM_PASSTHRU_EXPANSION_SLOT_ADD() \
|
||||
MCFG_SPECTRUM_EXPANSION_SLOT_ADD(SPECTRUM_EXPANSION_SLOT_TAG, spectrum_expansion_devices, nullptr) \
|
||||
MCFG_SPECTRUM_EXPANSION_SLOT_IRQ_HANDLER(WRITELINE(DEVICE_SELF_OWNER, spectrum_expansion_slot_device, irq_w)) \
|
||||
MCFG_SPECTRUM_EXPANSION_SLOT_NMI_HANDLER(WRITELINE(DEVICE_SELF_OWNER, spectrum_expansion_slot_device, nmi_w))
|
||||
|
||||
#define MCFG_SPECTRUM_EXPANSION_SLOT_IRQ_HANDLER(_devcb) \
|
||||
downcast<spectrum_expansion_slot_device &>(*device).set_irq_handler(DEVCB_##_devcb);
|
||||
|
||||
#define MCFG_SPECTRUM_EXPANSION_SLOT_NMI_HANDLER(_devcb) \
|
||||
downcast<spectrum_expansion_slot_device &>(*device).set_nmi_handler(DEVCB_##_devcb);
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// TYPE DEFINITIONS
|
||||
//**************************************************************************
|
||||
@ -84,12 +57,23 @@ class spectrum_expansion_slot_device : public device_t, public device_slot_inter
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
spectrum_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
virtual ~spectrum_expansion_slot_device();
|
||||
template <typename T>
|
||||
spectrum_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, T &&slot_options, const char *default_option)
|
||||
: spectrum_expansion_slot_device(mconfig, tag, owner)
|
||||
{
|
||||
option_reset();
|
||||
slot_options(*this);
|
||||
set_default_option(default_option);
|
||||
set_fixed(false);
|
||||
}
|
||||
|
||||
spectrum_expansion_slot_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0);
|
||||
|
||||
void set_io_space(address_space *io);
|
||||
|
||||
// callbacks
|
||||
template <class Object> devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_nmi_handler(Object &&cb) { return m_nmi_handler.set_callback(std::forward<Object>(cb)); }
|
||||
auto irq_handler() { return m_irq_handler.bind(); }
|
||||
auto nmi_handler() { return m_nmi_handler.bind(); }
|
||||
|
||||
DECLARE_READ8_MEMBER( mreq_r );
|
||||
DECLARE_WRITE8_MEMBER( mreq_w );
|
||||
@ -99,6 +83,8 @@ public:
|
||||
DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_irq_handler(state); }
|
||||
DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); }
|
||||
|
||||
address_space *m_io;
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_validity_check(validity_checker &valid) const override;
|
||||
@ -119,7 +105,7 @@ class device_spectrum_expansion_interface : public device_slot_card_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
virtual ~device_spectrum_expansion_interface();
|
||||
device_spectrum_expansion_interface(const machine_config &mconfig, device_t &device);
|
||||
|
||||
// reading and writing
|
||||
virtual DECLARE_READ8_MEMBER(mreq_r) { return 0xff; }
|
||||
@ -128,7 +114,7 @@ public:
|
||||
virtual DECLARE_READ_LINE_MEMBER(romcs) { return 0; }
|
||||
|
||||
protected:
|
||||
device_spectrum_expansion_interface(const machine_config &mconfig, device_t &device);
|
||||
address_space &io_space() { return *m_slot->m_io; }
|
||||
|
||||
spectrum_expansion_slot_device *m_slot;
|
||||
};
|
||||
|
@ -44,15 +44,18 @@ ioport_constructor spectrum_fuller_device::device_input_ports() const
|
||||
// device_add_mconfig - add device configuration
|
||||
//-------------------------------------------------
|
||||
|
||||
MACHINE_CONFIG_START(spectrum_fuller_device::device_add_mconfig)
|
||||
void spectrum_fuller_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
/* sound hardware */
|
||||
SPEAKER(config, "mono").front_center();
|
||||
MCFG_DEVICE_ADD("ay8912", AY8912, XTAL(3'579'545) / 2) // unverified clock
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
|
||||
AY8912(config, m_psg, 3.579545_MHz_XTAL / 2); // unverified clock
|
||||
m_psg->add_route(ALL_OUTPUTS, "mono", 0.25);
|
||||
|
||||
/* passthru */
|
||||
MCFG_SPECTRUM_PASSTHRU_EXPANSION_SLOT_ADD()
|
||||
MACHINE_CONFIG_END
|
||||
SPECTRUM_EXPANSION_SLOT(config, m_exp, spectrum_expansion_devices, nullptr);
|
||||
m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::irq_w));
|
||||
m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::nmi_w));
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
@ -78,12 +81,6 @@ spectrum_fuller_device::spectrum_fuller_device(const machine_config &mconfig, co
|
||||
|
||||
void spectrum_fuller_device::device_start()
|
||||
{
|
||||
address_space& spaceio = machine().device("maincpu")->memory().space(AS_IO);
|
||||
m_slot = dynamic_cast<spectrum_expansion_slot_device *>(owner());
|
||||
|
||||
spaceio.install_write_handler(0x3f, 0x3f, 0, 0xff00, 0, write8_delegate(FUNC(ay8910_device::address_w), (ay8910_device*)m_psg));
|
||||
spaceio.install_readwrite_handler(0x5f, 0x5f, 0, 0xff00, 0, read8_delegate(FUNC(ay8910_device::data_r), (ay8910_device*)m_psg), write8_delegate(FUNC(ay8910_device::data_w), (ay8910_device*)m_psg));
|
||||
spaceio.install_read_handler(0x7f, 0x7f, 0, 0xff00, 0, read8_delegate(FUNC(spectrum_fuller_device::joystick_r), this));
|
||||
}
|
||||
|
||||
|
||||
@ -93,6 +90,11 @@ void spectrum_fuller_device::device_start()
|
||||
|
||||
void spectrum_fuller_device::device_reset()
|
||||
{
|
||||
m_exp->set_io_space(&io_space());
|
||||
|
||||
io_space().install_write_handler(0x3f, 0x3f, 0, 0xff00, 0, write8_delegate(FUNC(ay8910_device::address_w), m_psg.target()));
|
||||
io_space().install_readwrite_handler(0x5f, 0x5f, 0, 0xff00, 0, read8_delegate(FUNC(ay8910_device::data_r), m_psg.target()), write8_delegate(FUNC(ay8910_device::data_w), m_psg.target()));
|
||||
io_space().install_read_handler(0x7f, 0x7f, 0, 0xff00, 0, read8_delegate(FUNC(spectrum_fuller_device::joystick_r), this));
|
||||
}
|
||||
|
||||
|
||||
|
@ -41,7 +41,7 @@ ROM_END
|
||||
|
||||
MACHINE_CONFIG_START(spectrum_intf1_device::device_add_mconfig)
|
||||
/* rs232 */
|
||||
MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, nullptr)
|
||||
RS232_PORT(config, m_rs232, default_rs232_devices, nullptr);
|
||||
|
||||
/* microdrive */
|
||||
MCFG_MICRODRIVE_ADD("mdv1")
|
||||
@ -49,7 +49,9 @@ MACHINE_CONFIG_START(spectrum_intf1_device::device_add_mconfig)
|
||||
MCFG_MICRODRIVE_ADD("mdv2")
|
||||
|
||||
/* passthru */
|
||||
MCFG_SPECTRUM_PASSTHRU_EXPANSION_SLOT_ADD()
|
||||
SPECTRUM_EXPANSION_SLOT(config, m_exp, spectrum_expansion_devices, nullptr);
|
||||
m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::irq_w));
|
||||
m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::nmi_w));
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
const tiny_rom_entry *spectrum_intf1_device::device_rom_region() const
|
||||
@ -66,13 +68,13 @@ const tiny_rom_entry *spectrum_intf1_device::device_rom_region() const
|
||||
//-------------------------------------------------
|
||||
|
||||
spectrum_intf1_device::spectrum_intf1_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, SPECTRUM_INTF1, tag, owner, clock),
|
||||
device_spectrum_expansion_interface(mconfig, *this),
|
||||
m_exp(*this, "exp"),
|
||||
m_rs232(*this, "rs232"),
|
||||
m_mdv1(*this, "mdv1"),
|
||||
m_mdv2(*this, "mdv2"),
|
||||
m_rom(*this, "rom")
|
||||
: device_t(mconfig, SPECTRUM_INTF1, tag, owner, clock)
|
||||
, device_spectrum_expansion_interface(mconfig, *this)
|
||||
, m_exp(*this, "exp")
|
||||
, m_rs232(*this, "rs232")
|
||||
, m_mdv1(*this, "mdv1")
|
||||
, m_mdv2(*this, "mdv2")
|
||||
, m_rom(*this, "rom")
|
||||
{
|
||||
}
|
||||
|
||||
@ -82,7 +84,6 @@ spectrum_intf1_device::spectrum_intf1_device(const machine_config &mconfig, cons
|
||||
|
||||
void spectrum_intf1_device::device_start()
|
||||
{
|
||||
m_slot = dynamic_cast<spectrum_expansion_slot_device *>(owner());
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -91,6 +92,8 @@ void spectrum_intf1_device::device_start()
|
||||
|
||||
void spectrum_intf1_device::device_reset()
|
||||
{
|
||||
m_exp->set_io_space(&io_space());
|
||||
|
||||
m_romcs = 0;
|
||||
}
|
||||
|
||||
@ -112,8 +115,6 @@ READ8_MEMBER(spectrum_intf1_device::mreq_r)
|
||||
{
|
||||
if (offset == 0x0008 || offset == 0x1708)
|
||||
m_romcs = 1;
|
||||
if (offset == 0x0700)
|
||||
m_romcs = 0;
|
||||
}
|
||||
|
||||
temp = m_exp->mreq_r(space, offset);
|
||||
@ -123,6 +124,12 @@ READ8_MEMBER(spectrum_intf1_device::mreq_r)
|
||||
if (m_romcs)
|
||||
data &= m_rom->base()[offset & 0x1fff];
|
||||
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
if (offset == 0x0700)
|
||||
m_romcs = 0;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
|
@ -54,14 +54,14 @@ ioport_constructor spectrum_intf2_device::device_input_ports() const
|
||||
// device_add_mconfig - add device configuration
|
||||
//-------------------------------------------------
|
||||
|
||||
MACHINE_CONFIG_START(spectrum_intf2_device::device_add_mconfig)
|
||||
void spectrum_intf2_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
/* cartridge */
|
||||
MCFG_GENERIC_CARTSLOT_ADD("cartslot", generic_plain_slot, "spectrum_cart")
|
||||
MCFG_GENERIC_EXTENSIONS("bin,rom")
|
||||
MCFG_GENERIC_LOAD(spectrum_intf2_device, spectrum_cart)
|
||||
GENERIC_CARTSLOT(config, m_cart, generic_plain_slot, "spectrum_cart", "bin,rom");
|
||||
m_cart->set_device_load(device_image_load_delegate(&spectrum_intf2_device::device_image_load_spectrum_cart, this));
|
||||
|
||||
MCFG_SOFTWARE_LIST_ADD("cart_list", "spectrum_cart")
|
||||
MACHINE_CONFIG_END
|
||||
SOFTWARE_LIST(config, "cart_list").set_original("spectrum_cart");
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
@ -72,11 +72,11 @@ MACHINE_CONFIG_END
|
||||
//-------------------------------------------------
|
||||
|
||||
spectrum_intf2_device::spectrum_intf2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
|
||||
: device_t(mconfig, SPECTRUM_INTF2, tag, owner, clock),
|
||||
device_spectrum_expansion_interface(mconfig, *this),
|
||||
m_cart(*this, "cartslot"),
|
||||
m_exp_line3(*this, "LINE3"),
|
||||
m_exp_line4(*this, "LINE4")
|
||||
: device_t(mconfig, SPECTRUM_INTF2, tag, owner, clock)
|
||||
, device_spectrum_expansion_interface(mconfig, *this)
|
||||
, m_cart(*this, "cartslot")
|
||||
, m_exp_line3(*this, "LINE3")
|
||||
, m_exp_line4(*this, "LINE4")
|
||||
{
|
||||
}
|
||||
|
||||
@ -85,15 +85,6 @@ spectrum_intf2_device::spectrum_intf2_device(const machine_config &mconfig, cons
|
||||
//-------------------------------------------------
|
||||
|
||||
void spectrum_intf2_device::device_start()
|
||||
{
|
||||
m_slot = dynamic_cast<spectrum_expansion_slot_device *>(owner());
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void spectrum_intf2_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -29,7 +29,6 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
// optional information overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
@ -62,10 +62,6 @@ spectrum_kempjoy_device::spectrum_kempjoy_device(const machine_config &mconfig,
|
||||
|
||||
void spectrum_kempjoy_device::device_start()
|
||||
{
|
||||
address_space& spaceio = machine().device("maincpu")->memory().space(AS_IO);
|
||||
m_slot = dynamic_cast<spectrum_expansion_slot_device *>(owner());
|
||||
|
||||
spaceio.install_read_handler(0x1f, 0x1f, 0, 0xff00, 0, read8_delegate(FUNC(spectrum_kempjoy_device::joystick_r), this));
|
||||
}
|
||||
|
||||
|
||||
@ -75,6 +71,7 @@ void spectrum_kempjoy_device::device_start()
|
||||
|
||||
void spectrum_kempjoy_device::device_reset()
|
||||
{
|
||||
io_space().install_read_handler(0x1f, 0x1f, 0, 0xff00, 0, read8_delegate(FUNC(spectrum_kempjoy_device::joystick_r), this));
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,15 +21,18 @@ DEFINE_DEVICE_TYPE(SPECTRUM_MELODIK, spectrum_melodik_device, "spectrum_melodik"
|
||||
// device_add_mconfig - add device configuration
|
||||
//-------------------------------------------------
|
||||
|
||||
MACHINE_CONFIG_START(spectrum_melodik_device::device_add_mconfig)
|
||||
void spectrum_melodik_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
/* sound hardware */
|
||||
SPEAKER(config, "mono").front_center();
|
||||
MCFG_DEVICE_ADD("ay8912", AY8912, XTAL(3'579'545) / 2)
|
||||
MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
|
||||
AY8912(config, m_psg, 3.579545_MHz_XTAL / 2);
|
||||
m_psg->add_route(ALL_OUTPUTS, "mono", 0.25);
|
||||
|
||||
/* passthru */
|
||||
MCFG_SPECTRUM_PASSTHRU_EXPANSION_SLOT_ADD()
|
||||
MACHINE_CONFIG_END
|
||||
SPECTRUM_EXPANSION_SLOT(config, m_exp, spectrum_expansion_devices, nullptr);
|
||||
m_exp->irq_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::irq_w));
|
||||
m_exp->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::nmi_w));
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
@ -54,11 +57,6 @@ spectrum_melodik_device::spectrum_melodik_device(const machine_config &mconfig,
|
||||
|
||||
void spectrum_melodik_device::device_start()
|
||||
{
|
||||
address_space& spaceio = machine().device("maincpu")->memory().space(AS_IO);
|
||||
m_slot = dynamic_cast<spectrum_expansion_slot_device *>(owner());
|
||||
|
||||
spaceio.install_write_handler(0x8000, 0x8000, 0, 0x3ffd, 0, write8_delegate(FUNC(ay8910_device::address_w), (ay8910_device*)m_psg));
|
||||
spaceio.install_readwrite_handler(0xc000, 0xc000, 0, 0x3ffd, 0, read8_delegate(FUNC(ay8910_device::data_r), (ay8910_device*)m_psg), write8_delegate(FUNC(ay8910_device::data_w), (ay8910_device*)m_psg));
|
||||
}
|
||||
|
||||
|
||||
@ -68,6 +66,10 @@ void spectrum_melodik_device::device_start()
|
||||
|
||||
void spectrum_melodik_device::device_reset()
|
||||
{
|
||||
m_exp->set_io_space(&io_space());
|
||||
|
||||
io_space().install_write_handler(0x8000, 0x8000, 0, 0x3ffd, 0, write8_delegate(FUNC(ay8910_device::address_w), m_psg.target()));
|
||||
io_space().install_readwrite_handler(0xc000, 0xc000, 0, 0x3ffd, 0, read8_delegate(FUNC(ay8910_device::data_r), m_psg.target()), write8_delegate(FUNC(ay8910_device::data_w), m_psg.target()));
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
|
@ -82,10 +82,6 @@ spectrum_mikroplus_device::spectrum_mikroplus_device(const machine_config &mconf
|
||||
|
||||
void spectrum_mikroplus_device::device_start()
|
||||
{
|
||||
address_space& spaceio = machine().device("maincpu")->memory().space(AS_IO);
|
||||
m_slot = dynamic_cast<spectrum_expansion_slot_device *>(owner());
|
||||
|
||||
spaceio.install_read_handler(0xdf, 0xdf, 0, 0xff00, 0, read8_delegate(FUNC(spectrum_mikroplus_device::joystick_r), this));
|
||||
}
|
||||
|
||||
|
||||
@ -95,6 +91,7 @@ void spectrum_mikroplus_device::device_start()
|
||||
|
||||
void spectrum_mikroplus_device::device_reset()
|
||||
{
|
||||
io_space().install_read_handler(0xdf, 0xdf, 0, 0xff00, 0, read8_delegate(FUNC(spectrum_mikroplus_device::joystick_r), this));
|
||||
}
|
||||
|
||||
|
||||
|
@ -55,16 +55,6 @@ spectrum_plus2test_device::spectrum_plus2test_device(const machine_config &mconf
|
||||
//-------------------------------------------------
|
||||
|
||||
void spectrum_plus2test_device::device_start()
|
||||
{
|
||||
m_slot = dynamic_cast<spectrum_expansion_slot_device *>(owner());
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void spectrum_plus2test_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@ public:
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
// optional information overrides
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
@ -64,16 +64,6 @@ spectrum_protek_device::spectrum_protek_device(const machine_config &mconfig, co
|
||||
//-------------------------------------------------
|
||||
|
||||
void spectrum_protek_device::device_start()
|
||||
{
|
||||
m_slot = dynamic_cast<spectrum_expansion_slot_device *>(owner());
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void spectrum_protek_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@ public:
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
// optional information overrides
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
@ -20,16 +20,17 @@ DEFINE_DEVICE_TYPE(SPECTRUM_USLOT, spectrum_uslot_device, "spectrum_uslot", "Spe
|
||||
// device_add_mconfig - add device configuration
|
||||
//-------------------------------------------------
|
||||
|
||||
MACHINE_CONFIG_START(spectrum_uslot_device::device_add_mconfig)
|
||||
void spectrum_uslot_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
/* passthru */
|
||||
MCFG_SPECTRUM_EXPANSION_SLOT_ADD("exp1", spectrum_expansion_devices, nullptr)
|
||||
MCFG_SPECTRUM_EXPANSION_SLOT_IRQ_HANDLER(WRITELINE(DEVICE_SELF_OWNER, spectrum_expansion_slot_device, irq_w))
|
||||
MCFG_SPECTRUM_EXPANSION_SLOT_NMI_HANDLER(WRITELINE(DEVICE_SELF_OWNER, spectrum_expansion_slot_device, nmi_w))
|
||||
SPECTRUM_EXPANSION_SLOT(config, m_exp1, spectrum_expansion_devices, nullptr);
|
||||
m_exp1->irq_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::irq_w));
|
||||
m_exp1->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::nmi_w));
|
||||
|
||||
MCFG_SPECTRUM_EXPANSION_SLOT_ADD("exp2", spectrum_expansion_devices, nullptr)
|
||||
MCFG_SPECTRUM_EXPANSION_SLOT_IRQ_HANDLER(WRITELINE(DEVICE_SELF_OWNER, spectrum_expansion_slot_device, irq_w))
|
||||
MCFG_SPECTRUM_EXPANSION_SLOT_NMI_HANDLER(WRITELINE(DEVICE_SELF_OWNER, spectrum_expansion_slot_device, nmi_w))
|
||||
MACHINE_CONFIG_END
|
||||
SPECTRUM_EXPANSION_SLOT(config, m_exp2, spectrum_expansion_devices, nullptr);
|
||||
m_exp2->irq_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::irq_w));
|
||||
m_exp2->nmi_handler().set(DEVICE_SELF_OWNER, FUNC(spectrum_expansion_slot_device::nmi_w));
|
||||
}
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
@ -54,7 +55,6 @@ spectrum_uslot_device::spectrum_uslot_device(const machine_config &mconfig, cons
|
||||
|
||||
void spectrum_uslot_device::device_start()
|
||||
{
|
||||
m_slot = dynamic_cast<spectrum_expansion_slot_device *>(owner());
|
||||
}
|
||||
|
||||
|
||||
@ -64,6 +64,8 @@ void spectrum_uslot_device::device_start()
|
||||
|
||||
void spectrum_uslot_device::device_reset()
|
||||
{
|
||||
m_exp1->set_io_space(&io_space());
|
||||
m_exp2->set_io_space(&io_space());
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,7 +60,6 @@ spectrum_usource_device::spectrum_usource_device(const machine_config &mconfig,
|
||||
|
||||
void spectrum_usource_device::device_start()
|
||||
{
|
||||
m_slot = dynamic_cast<spectrum_expansion_slot_device *>(owner());
|
||||
}
|
||||
|
||||
|
||||
|
@ -76,7 +76,6 @@ spectrum_uspeech_device::spectrum_uspeech_device(const machine_config &mconfig,
|
||||
|
||||
void spectrum_uspeech_device::device_start()
|
||||
{
|
||||
m_slot = dynamic_cast<spectrum_expansion_slot_device *>(owner());
|
||||
}
|
||||
|
||||
|
||||
|
@ -250,6 +250,12 @@ void spectrum_state::spectrum_128_mem(address_map &map)
|
||||
map(0xc000, 0xffff).bankrw("bank4");
|
||||
}
|
||||
|
||||
void spectrum_state::init_spec128()
|
||||
{
|
||||
// setup expansion slot
|
||||
m_exp->set_io_space(&m_maincpu->space(AS_IO));
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(spectrum_state,spectrum_128)
|
||||
{
|
||||
uint8_t *messram = m_ram->pointer();
|
||||
@ -376,8 +382,8 @@ ROM_START(hc2000)
|
||||
ROMX_LOAD("hc2000.v2", 0x14000,0x4000, CRC(65d90464) SHA1(5e2096e6460ff2120c8ada97579fdf82c1199c09), ROM_BIOS(1))
|
||||
ROM_END
|
||||
|
||||
// YEAR NAME PARENT COMPAT MACHINE CLASS STATE INIT COMPANY FULLNAME FLAGS
|
||||
COMP( 1986, spec128, 0, 0, spectrum_128, spec128, spectrum_state, empty_init, "Sinclair Research Ltd", "ZX Spectrum 128", 0 )
|
||||
COMP( 1986, specpls2, spec128, 0, spectrum_128, spec_plus, spectrum_state, empty_init, "Amstrad plc", "ZX Spectrum +2", 0 )
|
||||
COMP( 1991, hc128, spec128, 0, spectrum_128, spec_plus, spectrum_state, empty_init, "ICE-Felix", "HC-128", 0 )
|
||||
COMP( 1992, hc2000, spec128, 0, spectrum_128, spec_plus, spectrum_state, empty_init, "ICE-Felix", "HC-2000", MACHINE_NOT_WORKING )
|
||||
// YEAR NAME PARENT COMPAT MACHINE CLASS STATE INIT COMPANY FULLNAME FLAGS
|
||||
COMP( 1986, spec128, 0, 0, spectrum_128, spec128, spectrum_state, init_spec128, "Sinclair Research Ltd", "ZX Spectrum 128", 0 )
|
||||
COMP( 1986, specpls2, spec128, 0, spectrum_128, spec_plus, spectrum_state, init_spec128, "Amstrad plc", "ZX Spectrum +2", 0 )
|
||||
COMP( 1991, hc128, spec128, 0, spectrum_128, spec_plus, spectrum_state, init_spec128, "ICE-Felix", "HC-128", 0 )
|
||||
COMP( 1992, hc2000, spec128, 0, spectrum_128, spec_plus, spectrum_state, init_spec128, "ICE-Felix", "HC-2000", MACHINE_NOT_WORKING )
|
||||
|
@ -341,11 +341,17 @@ MACHINE_RESET_MEMBER(spectrum_state,spectrum_plus3)
|
||||
void spectrum_state::init_plus3()
|
||||
{
|
||||
m_floppy = 1;
|
||||
|
||||
// setup expansion slot
|
||||
m_exp->set_io_space(&m_maincpu->space(AS_IO));
|
||||
}
|
||||
|
||||
void spectrum_state::init_plus2()
|
||||
{
|
||||
m_floppy = 0;
|
||||
|
||||
// setup expansion slot
|
||||
m_exp->set_io_space(&m_maincpu->space(AS_IO));
|
||||
}
|
||||
|
||||
static void specpls3_floppies(device_slot_interface &device)
|
||||
|
@ -435,8 +435,8 @@ void spectrum_state::spectrum_mem(address_map &map)
|
||||
{
|
||||
map(0x0000, 0x3fff).rw(FUNC(spectrum_state::spectrum_rom_r), FUNC(spectrum_state::spectrum_rom_w));
|
||||
map(0x4000, 0x5aff).ram().share("video_ram");
|
||||
// AM_RANGE(0x5b00, 0x7fff) AM_RAM
|
||||
// AM_RANGE(0x8000, 0xffff) AM_RAM
|
||||
// AM_RANGE(0x5b00, 0x7fff) AM_RAM
|
||||
// AM_RANGE(0x8000, 0xffff) AM_RAM
|
||||
}
|
||||
|
||||
/* ports are not decoded full.
|
||||
@ -613,10 +613,13 @@ void spectrum_state::init_spectrum()
|
||||
switch (m_ram->size())
|
||||
{
|
||||
case 48*1024:
|
||||
space.install_ram(0x8000, 0xffff, nullptr); // Fall through
|
||||
space.install_ram(0x8000, 0xffff, nullptr); // Fall through
|
||||
case 16*1024:
|
||||
space.install_ram(0x5b00, 0x7fff, nullptr);
|
||||
space.install_ram(0x5b00, 0x7fff, nullptr);
|
||||
}
|
||||
|
||||
// setup expansion slot
|
||||
m_exp->set_io_space(&m_maincpu->space(AS_IO));
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(spectrum_state,spectrum)
|
||||
@ -668,27 +671,26 @@ INTERRUPT_GEN_MEMBER(spectrum_state::spec_interrupt)
|
||||
MACHINE_CONFIG_START(spectrum_state::spectrum_common)
|
||||
|
||||
/* basic machine hardware */
|
||||
MCFG_DEVICE_ADD("maincpu", Z80, X1 / 4) /* This is verified only for the ZX Spectrum. Other clones are reported to have different clocks */
|
||||
MCFG_DEVICE_PROGRAM_MAP(spectrum_mem)
|
||||
MCFG_DEVICE_IO_MAP(spectrum_io)
|
||||
MCFG_DEVICE_VBLANK_INT_DRIVER("screen", spectrum_state, spec_interrupt)
|
||||
MCFG_QUANTUM_TIME(attotime::from_hz(60))
|
||||
Z80(config, m_maincpu, X1 / 4); /* This is verified only for the ZX Spectrum. Other clones are reported to have different clocks */
|
||||
m_maincpu->set_addrmap(AS_PROGRAM, &spectrum_state::spectrum_mem);
|
||||
m_maincpu->set_addrmap(AS_IO, &spectrum_state::spectrum_io);
|
||||
m_maincpu->set_vblank_int("screen", FUNC(spectrum_state::spec_interrupt));
|
||||
|
||||
config.m_minimum_quantum = attotime::from_hz(60);
|
||||
|
||||
MCFG_MACHINE_RESET_OVERRIDE(spectrum_state, spectrum )
|
||||
|
||||
/* video hardware */
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
|
||||
m_screen->set_raw(X1 / 2, 448, 0, 352, 312, 0, 296);
|
||||
m_screen->set_screen_update(FUNC(spectrum_state::screen_update_spectrum));
|
||||
m_screen->screen_vblank().set(FUNC(spectrum_state::screen_vblank_spectrum));
|
||||
m_screen->set_palette("palette");
|
||||
|
||||
MCFG_SCREEN_RAW_PARAMS(X1 / 2, 448, 0, 352, 312, 0, 296)
|
||||
palette_device &palette(PALETTE(config, "palette", 16));
|
||||
palette.set_init(palette_init_delegate(FUNC(spectrum_state::palette_init_spectrum), this));
|
||||
|
||||
MCFG_SCREEN_UPDATE_DRIVER(spectrum_state, screen_update_spectrum)
|
||||
MCFG_SCREEN_VBLANK_CALLBACK(WRITELINE(*this, spectrum_state, screen_vblank_spectrum))
|
||||
MCFG_SCREEN_PALETTE("palette")
|
||||
|
||||
MCFG_PALETTE_ADD("palette", 16)
|
||||
MCFG_PALETTE_INIT_OWNER(spectrum_state, spectrum )
|
||||
|
||||
MCFG_DEVICE_ADD("gfxdecode", GFXDECODE, "palette", gfx_spectrum)
|
||||
GFXDECODE(config, "gfxdecode", "palette", gfx_spectrum);
|
||||
MCFG_VIDEO_START_OVERRIDE(spectrum_state, spectrum )
|
||||
|
||||
/* sound hardware */
|
||||
@ -697,17 +699,22 @@ MACHINE_CONFIG_START(spectrum_state::spectrum_common)
|
||||
SPEAKER_SOUND(config, "speaker").add_route(ALL_OUTPUTS, "mono", 0.50);
|
||||
|
||||
/* expansion port */
|
||||
MCFG_SPECTRUM_EXPANSION_SLOT_ADD("exp", spectrum_expansion_devices, "kempjoy")
|
||||
SPECTRUM_EXPANSION_SLOT(config, m_exp, spectrum_expansion_devices, "kempjoy");
|
||||
m_exp->irq_handler().set_inputline(m_maincpu, INPUT_LINE_IRQ0);
|
||||
m_exp->nmi_handler().set_inputline(m_maincpu, INPUT_LINE_NMI);
|
||||
|
||||
/* devices */
|
||||
MCFG_SNAPSHOT_ADD("snapshot", spectrum_state, spectrum, "ach,frz,plusd,prg,sem,sit,sna,snp,snx,sp,z80,zx", 0)
|
||||
MCFG_QUICKLOAD_ADD("quickload", spectrum_state, spectrum, "raw,scr", 2) // The delay prevents the screen from being cleared by the RAM test at boot
|
||||
MCFG_CASSETTE_ADD( "cassette" )
|
||||
MCFG_CASSETTE_FORMATS(tzx_cassette_formats)
|
||||
MCFG_CASSETTE_DEFAULT_STATE(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED)
|
||||
MCFG_CASSETTE_INTERFACE("spectrum_cass")
|
||||
snapshot_image_device &snapshot(SNAPSHOT(config, "snapshot", 0));
|
||||
snapshot.set_handler(snapquick_load_delegate(&SNAPSHOT_LOAD_NAME(spectrum_state, spectrum), this), "ach,frz,plusd,prg,sem,sit,sna,snp,snx,sp,z80,zx", 0);
|
||||
quickload_image_device &quickload(QUICKLOAD(config, "quickload", 0));
|
||||
quickload.set_handler(snapquick_load_delegate(&QUICKLOAD_LOAD_NAME(spectrum_state, spectrum), this), "raw,scr", 2); // The delay prevents the screen from being cleared by the RAM test at boot
|
||||
|
||||
MCFG_SOFTWARE_LIST_ADD("cass_list", "spectrum_cass")
|
||||
CASSETTE(config, m_cassette);
|
||||
m_cassette->set_formats(tzx_cassette_formats);
|
||||
m_cassette->set_default_state(CASSETTE_STOPPED | CASSETTE_SPEAKER_ENABLED | CASSETTE_MOTOR_ENABLED);
|
||||
m_cassette->set_interface("spectrum_cass");
|
||||
|
||||
SOFTWARE_LIST(config, "cass_list").set_original("spectrum_cass");
|
||||
MACHINE_CONFIG_END
|
||||
|
||||
void spectrum_state::spectrum(machine_config &config)
|
||||
|
@ -583,6 +583,12 @@ void spectrum_state::tc2048_mem(address_map &map)
|
||||
map(0x4000, 0xffff).bankr("bank1").bankw("bank2");
|
||||
}
|
||||
|
||||
void spectrum_state::init_timex()
|
||||
{
|
||||
// setup expansion slot
|
||||
m_exp->set_io_space(&m_maincpu->space(AS_IO));
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(spectrum_state,tc2048)
|
||||
{
|
||||
uint8_t *messram = m_ram->pointer();
|
||||
@ -780,6 +786,6 @@ ROM_START(uk2086)
|
||||
ROM_END
|
||||
|
||||
// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS
|
||||
COMP( 1984, tc2048, spectrum, 0, tc2048, spectrum, spectrum_state, empty_init, "Timex of Portugal", "TC-2048" , 0 )
|
||||
COMP( 1983, ts2068, spectrum, 0, ts2068, spectrum, spectrum_state, empty_init, "Timex Sinclair", "TS-2068" , 0 )
|
||||
COMP( 1986, uk2086, spectrum, 0, uk2086, spectrum, spectrum_state, empty_init, "Unipolbrit", "UK-2086 ver. 1.2" , 0 )
|
||||
COMP( 1984, tc2048, spectrum, 0, tc2048, spectrum, spectrum_state, init_timex, "Timex of Portugal", "TC-2048" , 0 )
|
||||
COMP( 1983, ts2068, spectrum, 0, ts2068, spectrum, spectrum_state, init_timex, "Timex Sinclair", "TS-2068" , 0 )
|
||||
COMP( 1986, uk2086, spectrum, 0, uk2086, spectrum, spectrum_state, init_timex, "Unipolbrit", "UK-2086 ver. 1.2" , 0 )
|
||||
|
@ -105,6 +105,8 @@ public:
|
||||
void spectrum_128(machine_config &config);
|
||||
|
||||
void init_spectrum();
|
||||
void init_spec128();
|
||||
void init_timex();
|
||||
void init_plus2();
|
||||
void init_plus3();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user