summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices
diff options
context:
space:
mode:
author Michael Zapf <Michael.Zapf@mizapf.de>2018-08-20 20:21:53 +0200
committer Michael Zapf <Michael.Zapf@mizapf.de>2018-08-20 20:21:53 +0200
commitf554bd91201aa8e12ec0ef3031571040a1db6f0a (patch)
tree7d7f40cf1944796897c96662520ef1b87ef39bf2 /src/devices
parent6811c15785349465b2fc95874217637d02e2d7cc (diff)
ti99: Adapting to common devcb3 slot device handling. (nw)
Diffstat (limited to 'src/devices')
-rw-r--r--src/devices/bus/hexbus/hexbus.cpp13
-rw-r--r--src/devices/bus/hexbus/hexbus.h13
-rw-r--r--src/devices/bus/hexbus/hx5102.cpp9
-rw-r--r--src/devices/bus/hexbus/tp0370.h21
-rw-r--r--src/devices/bus/ti99/colorbus/colorbus.cpp14
-rw-r--r--src/devices/bus/ti99/colorbus/colorbus.h13
-rw-r--r--src/devices/bus/ti99/gromport/gromport.cpp30
-rw-r--r--src/devices/bus/ti99/gromport/gromport.h33
-rw-r--r--src/devices/bus/ti99/internal/ioport.cpp23
-rw-r--r--src/devices/bus/ti99/internal/ioport.h21
-rw-r--r--src/devices/bus/ti99/joyport/joyport.cpp29
-rw-r--r--src/devices/bus/ti99/joyport/joyport.h15
-rw-r--r--src/devices/bus/ti99/peb/evpc.cpp4
-rw-r--r--src/devices/bus/ti99/peb/peribox.cpp224
-rw-r--r--src/devices/bus/ti99/peb/peribox.h28
15 files changed, 271 insertions, 219 deletions
diff --git a/src/devices/bus/hexbus/hexbus.cpp b/src/devices/bus/hexbus/hexbus.cpp
index f1719780011..6b6f19b7d98 100644
--- a/src/devices/bus/hexbus/hexbus.cpp
+++ b/src/devices/bus/hexbus/hexbus.cpp
@@ -211,14 +211,6 @@ uint8_t hexbus_device::read(int dir)
return value;
}
-void hexbus_device::configure_slot()
-{
- option_reset();
- option_add("hx5102", HX5102);
- set_default_option(nullptr);
- set_fixed(false);
-}
-
// ------------------------------------------------------------------------
hexbus_chained_device::hexbus_chained_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock):
@@ -350,3 +342,8 @@ uint8_t hexbus_chained_device::to_line_state(uint8_t data, bool bav, bool hsk)
// ------------------------------------------------------------------------
} } // end namespace bus::hexbus
+
+void hexbus_options(device_slot_interface &device)
+{
+ device.option_add("hx5102", HX5102);
+}
diff --git a/src/devices/bus/hexbus/hexbus.h b/src/devices/bus/hexbus/hexbus.h
index fb558d42517..ca961a39d17 100644
--- a/src/devices/bus/hexbus/hexbus.h
+++ b/src/devices/bus/hexbus/hexbus.h
@@ -108,6 +108,16 @@ protected:
class hexbus_device : public device_t, public device_slot_interface
{
public:
+ template <typename U>
+ hexbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, U &&opts, const char *dflt)
+ : hexbus_device(mconfig, tag, owner, clock)
+ {
+ option_reset();
+ opts(*this);
+ set_default_option(dflt);
+ set_fixed(false);
+ }
+
hexbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// Used to establish the reverse link (inbound)
@@ -116,7 +126,6 @@ public:
// Read and write operations on the bus
uint8_t read(int dir);
void write(int dir, uint8_t data);
- void configure_slot();
protected:
void device_start() override;
@@ -133,4 +142,6 @@ private:
DECLARE_DEVICE_TYPE_NS(HEXBUS, bus::hexbus, hexbus_device)
+void hexbus_options(device_slot_interface &device);
+
#endif // MAME_BUS_HEXBUS_HEXBUS_H
diff --git a/src/devices/bus/hexbus/hx5102.cpp b/src/devices/bus/hexbus/hx5102.cpp
index 4bdb088471a..c8a74e5ba49 100644
--- a/src/devices/bus/hexbus/hx5102.cpp
+++ b/src/devices/bus/hexbus/hx5102.cpp
@@ -633,7 +633,6 @@ WRITE_LINE_MEMBER( hx5102_device::fdc_drq_w )
/*
Define the floppy formats.
- TODO: Define another DSDD format with 16 sectors.
*/
FLOPPY_FORMATS_MEMBER(hx5102_device::floppy_formats)
FLOPPY_TI99_SDF_FORMAT,
@@ -670,12 +669,12 @@ INPUT_PORTS_END
*/
MACHINE_CONFIG_START(hx5102_device::device_add_mconfig)
// Hexbus controller
- MCFG_DEVICE_ADD(IBC_TAG, IBC, 0)
- MCFG_IBC_HEXBUS_OUT_CALLBACK(WRITE8(*this, hx5102_device, hexbus_out))
- MCFG_IBC_HSKLATCH_CALLBACK(WRITELINE(*this, hx5102_device, hsklatch_out))
+ IBC(config, m_hexbus_ctrl, 0);
+ m_hexbus_ctrl->hexbus_cb().set(FUNC(hx5102_device::hexbus_out));
+ m_hexbus_ctrl->hsklatch_cb().set(FUNC(hx5102_device::hsklatch_out));
// Outgoing socket for downstream devices
- HEXBUS(config, "hexbus", 0).configure_slot();
+ HEXBUS(config, "hexbus", 0, hexbus_options, nullptr);
// TMS9995 CPU @ 12.0 MHz
TMS9995(config, m_flopcpu, XTAL(12'000'000));
diff --git a/src/devices/bus/hexbus/tp0370.h b/src/devices/bus/hexbus/tp0370.h
index 5f5c02489c0..385059c7fa3 100644
--- a/src/devices/bus/hexbus/tp0370.h
+++ b/src/devices/bus/hexbus/tp0370.h
@@ -28,9 +28,10 @@ public:
DECLARE_READ8_MEMBER( read );
DECLARE_WRITE8_MEMBER( write );
- template <class Object> static devcb_base &set_ibc_int_callback(device_t &device, Object &&cb) { return downcast<ibc_device &>(device).m_int.set_callback(std::forward<Object>(cb)); }
- template <class Object> static devcb_base &set_hexbus_wr_callback(device_t &device, Object &&cb) { return downcast<ibc_device &>(device).m_hexout.set_callback(std::forward<Object>(cb)); }
- template <class Object> static devcb_base &set_hsklatch_wr_callback(device_t &device, Object &&cb) { return downcast<ibc_device &>(device).m_latch.set_callback(std::forward<Object>(cb)); }
+ // Callbacks
+ auto int_cb() { return m_int.bind(); }
+ auto hexbus_cb() { return m_hexout.bind(); }
+ auto hsklatch_cb() { return m_latch.bind(); }
// INT line
devcb_write_line m_int;
@@ -68,19 +69,5 @@ private:
} }
-
-/*
- Links to outside
-*/
-
-#define MCFG_IBC_HEXBUS_OUT_CALLBACK(_write) \
- ibc_device::set_hexbus_wr_callback(*device, DEVCB_##_write);
-
-#define MCFG_IBC_HSKLATCH_CALLBACK(_write) \
- ibc_device::set_hsklatch_wr_callback(*device, DEVCB_##_write);
-
-#define MCFG_IBC_INT_CALLBACK(_write) \
- ibc_device::set_ibc_int_callback(*device, DEVCB_##_write);
-
DECLARE_DEVICE_TYPE_NS(IBC, bus::hexbus, ibc_device)
#endif
diff --git a/src/devices/bus/ti99/colorbus/colorbus.cpp b/src/devices/bus/ti99/colorbus/colorbus.cpp
index 7b0e8bd2f10..40eb2691804 100644
--- a/src/devices/bus/ti99/colorbus/colorbus.cpp
+++ b/src/devices/bus/ti99/colorbus/colorbus.cpp
@@ -55,15 +55,6 @@ void ti99_colorbus_device::device_config_complete()
m_connected = dynamic_cast<device_ti99_colorbus_interface*>(subdevices().first());
}
-void ti99_colorbus_device::configure_slot()
-{
- option_reset();
- option_add("busmouse", TI99_BUSMOUSE);
- set_default_option("busmouse");
- set_fixed(false);
-}
-
-
/*****************************************************************************/
void device_ti99_colorbus_interface::interface_config_complete()
@@ -72,3 +63,8 @@ void device_ti99_colorbus_interface::interface_config_complete()
}
} } } // end namespace bus::ti99::colorbus
+
+void ti99_colorbus_options(device_slot_interface &device)
+{
+ device.option_add("busmouse", TI99_BUSMOUSE);
+}
diff --git a/src/devices/bus/ti99/colorbus/colorbus.h b/src/devices/bus/ti99/colorbus/colorbus.h
index 30bbfed81ef..c32e242dab8 100644
--- a/src/devices/bus/ti99/colorbus/colorbus.h
+++ b/src/devices/bus/ti99/colorbus/colorbus.h
@@ -43,10 +43,19 @@ protected:
class ti99_colorbus_device : public device_t, public device_slot_interface
{
public:
+ template <typename U>
+ ti99_colorbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, U &&opts, const char *dflt)
+ : ti99_colorbus_device(mconfig, tag, owner, clock)
+ {
+ option_reset();
+ opts(*this);
+ set_default_option(dflt);
+ set_fixed(false);
+ }
+
ti99_colorbus_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
line_state left_button(); // left button is not connected to the V9938 but to a TMS9901 pin
void poll();
- void configure_slot();
protected:
void device_start() override { }
@@ -62,4 +71,6 @@ private:
DECLARE_DEVICE_TYPE_NS(TI99_COLORBUS, bus::ti99::colorbus, ti99_colorbus_device)
+void ti99_colorbus_options(device_slot_interface &device);
+
#endif // MAME_BUS_TI99_COLORBUS_COLORBUS_H
diff --git a/src/devices/bus/ti99/gromport/gromport.cpp b/src/devices/bus/ti99/gromport/gromport.cpp
index 53570f22d79..7b2cc23d72a 100644
--- a/src/devices/bus/ti99/gromport/gromport.cpp
+++ b/src/devices/bus/ti99/gromport/gromport.cpp
@@ -125,9 +125,6 @@ DEFINE_DEVICE_TYPE_NS(TI99_GROMPORT, bus::ti99::gromport, gromport_device, "grom
namespace bus { namespace ti99 { namespace gromport {
-#define TRACE_READ 0
-#define TRACE_WRITE 0
-
gromport_device::gromport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, TI99_GROMPORT, tag, owner, clock),
device_slot_interface(mconfig, *this),
@@ -145,7 +142,7 @@ READ8Z_MEMBER(gromport_device::readz)
{
if (m_connector != nullptr)
{
- m_connector->readz(space, offset & m_mask, value);
+ m_connector->readz(space, offset & get_mask(), value);
if (m_romgq) LOGMASKED(LOG_READ, "Read %04x -> %02x\n", offset | 0x6000, *value);
}
}
@@ -159,7 +156,7 @@ WRITE8_MEMBER(gromport_device::write)
if (m_connector != nullptr)
{
if (m_romgq) LOGMASKED(LOG_WRITE, "Write %04x <- %02x\n", offset | 0x6000, data);
- m_connector->write(space, offset & m_mask, data);
+ m_connector->write(space, offset & get_mask(), data);
}
}
@@ -263,17 +260,6 @@ ioport_constructor gromport_device::device_input_ports() const
return INPUT_PORTS_NAME(gromport);
}
-void gromport_device::configure_slot(bool for998)
-{
- option_reset();
- option_add("single", TI99_GROMPORT_SINGLE);
- option_add("multi", TI99_GROMPORT_MULTI);
- if (!for998) option_add("gkracker", TI99_GROMPORT_GK);
- set_default_option("single");
- set_fixed(false);
- set_mask(for998? 0x3fff : 0x1fff);
-}
-
/***************************************************************************
Different versions of cartridge connections
@@ -303,3 +289,15 @@ void cartridge_connector_device::device_config_complete()
} } } // end namespace bus::ti99::gromport
+void ti99_gromport_options(device_slot_interface &device)
+{
+ device.option_add("single", TI99_GROMPORT_SINGLE);
+ device.option_add("multi", TI99_GROMPORT_MULTI);
+ device.option_add("gkracker", TI99_GROMPORT_GK);
+}
+
+void ti99_gromport_options_998(device_slot_interface &device)
+{
+ device.option_add("single", TI99_GROMPORT_SINGLE);
+ device.option_add("multi", TI99_GROMPORT_MULTI);
+}
diff --git a/src/devices/bus/ti99/gromport/gromport.h b/src/devices/bus/ti99/gromport/gromport.h
index 37460ed3f7a..60875befc0d 100644
--- a/src/devices/bus/ti99/gromport/gromport.h
+++ b/src/devices/bus/ti99/gromport/gromport.h
@@ -28,6 +28,16 @@ class cartridge_connector_device;
class gromport_device : public device_t, public device_slot_interface
{
public:
+ template <typename U>
+ gromport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, U &&opts, const char *dflt)
+ : gromport_device(mconfig, tag, owner, clock)
+ {
+ option_reset();
+ opts(*this);
+ set_default_option(dflt);
+ set_fixed(false);
+ }
+
gromport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
DECLARE_READ8Z_MEMBER(readz);
DECLARE_WRITE8_MEMBER(write);
@@ -38,33 +48,38 @@ public:
void set_gromlines(line_state mline, line_state moline, line_state gsq);
DECLARE_WRITE_LINE_MEMBER(gclock_in);
- void set_mask(int mask) { m_mask = mask; }
-
- template <class Object> devcb_base &set_ready_callback(Object &&cb) { return m_console_ready.set_callback(std::forward<Object>(cb)); }
- template <class Object> devcb_base &set_reset_callback(Object &&cb) { return m_console_reset.set_callback(std::forward<Object>(cb)); }
-
void cartridge_inserted();
bool is_grom_idle();
auto ready_cb() { return m_console_ready.bind(); }
auto reset_cb() { return m_console_reset.bind(); }
- void configure_slot(bool for998);
protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_config_complete() override;
virtual ioport_constructor device_input_ports() const override;
+ virtual const int get_mask() { return 0x1fff; }
private:
cartridge_connector_device* m_connector;
bool m_reset_on_insert;
devcb_write_line m_console_ready;
devcb_write_line m_console_reset;
- int m_mask;
int m_romgq;
};
+// Special subclass for 99/8
+class gromport8_device : public gromport_device
+{
+public:
+ template <typename U>
+ gromport8_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, U &&opts, const char *dflt)
+ : gromport_device(mconfig, tag, owner, clock, opts, dflt) { };
+protected:
+ const int get_mask() override { return 0x3fff; }
+};
+
class cartridge_connector_device : public device_t
{
public:
@@ -97,5 +112,9 @@ protected:
} } } // end namespace bus::ti99::gromport
DECLARE_DEVICE_TYPE_NS(TI99_GROMPORT, bus::ti99::gromport, gromport_device)
+DECLARE_DEVICE_TYPE_NS(TI99_GROMPORT8, bus::ti99::gromport, gromport8_device)
+
+void ti99_gromport_options(device_slot_interface &device);
+void ti99_gromport_options_998(device_slot_interface &device);
#endif // MAME_BUS_TI99_GROMPORT_GROMPORT_H
diff --git a/src/devices/bus/ti99/internal/ioport.cpp b/src/devices/bus/ti99/internal/ioport.cpp
index f3984425a66..3e769086141 100644
--- a/src/devices/bus/ti99/internal/ioport.cpp
+++ b/src/devices/bus/ti99/internal/ioport.cpp
@@ -165,21 +165,14 @@ WRITE_LINE_MEMBER(ioport_attached_device::set_ready)
m_ioport->m_console_ready(state);
}
-void ioport_device::configure_slot(int flags)
+} } } // end namespace bus::ti99::internal
+
+void ti99_ioport_options_plain(device_slot_interface &device)
{
- option_reset();
- if ((flags & WITH_PEB_AND_EVPC)!=0)
- {
- option_add("peb", TI99_PERIBOX_EV);
- set_default_option("peb");
- }
- else
- {
- option_add("peb", TI99_PERIBOX);
- set_default_option(nullptr);
- }
- set_fixed(false);
+ device.option_add("peb", TI99_PERIBOX);
}
-} } } // end namespace bus::ti99::internal
-
+void ti99_ioport_options_evpc(device_slot_interface &device)
+{
+ device.option_add("peb", TI99_PERIBOX_EV);
+}
diff --git a/src/devices/bus/ti99/internal/ioport.h b/src/devices/bus/ti99/internal/ioport.h
index 1bca7d53a29..aa30c51da77 100644
--- a/src/devices/bus/ti99/internal/ioport.h
+++ b/src/devices/bus/ti99/internal/ioport.h
@@ -52,17 +52,21 @@ private:
I/O port
********************************************************************/
-enum
-{
- PLAIN=0,
- WITH_PEB_AND_EVPC
-};
-
class ioport_device : public device_t, public device_slot_interface
{
friend class ioport_attached_device;
public:
+ template <typename U>
+ ioport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, U &&opts, const char *dflt)
+ : ioport_device(mconfig, tag, owner, clock)
+ {
+ option_reset();
+ opts(*this);
+ set_default_option(dflt);
+ set_fixed(false);
+ }
+
ioport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// Methods called from the console
@@ -79,8 +83,6 @@ public:
auto extint_cb() { return m_console_extint.bind(); }
auto ready_cb() { return m_console_ready.bind(); }
- void configure_slot(int flags);
-
protected:
void device_start() override;
void device_config_complete() override;
@@ -96,4 +98,7 @@ private:
DECLARE_DEVICE_TYPE_NS(TI99_IOPORT, bus::ti99::internal, ioport_device)
+void ti99_ioport_options_plain(device_slot_interface &device);
+void ti99_ioport_options_evpc(device_slot_interface &device);
+
#endif /* __TI99IOPORT__ */
diff --git a/src/devices/bus/ti99/joyport/joyport.cpp b/src/devices/bus/ti99/joyport/joyport.cpp
index 536b618eb6b..1a39c0d6dfa 100644
--- a/src/devices/bus/ti99/joyport/joyport.cpp
+++ b/src/devices/bus/ti99/joyport/joyport.cpp
@@ -95,17 +95,6 @@ void joyport_device::device_config_complete()
m_connected = dynamic_cast<device_ti99_joyport_interface*>(subdevices().first());
}
-void joyport_device::configure_slot(int flags)
-{
- option_reset();
- option_add("twinjoy", TI99_JOYSTICK);
- if ((flags & MOUSE)!=0) option_add("mecmouse", TI99_MECMOUSE);
- if ((flags & HANDSET)!=0) option_add("handset", TI99_HANDSET);
- set_default_option("twinjoy");
- set_fixed(false);
-}
-
-
/*****************************************************************************/
void device_ti99_joyport_interface::interface_config_complete()
@@ -115,3 +104,21 @@ void device_ti99_joyport_interface::interface_config_complete()
} } } // end namespace bus::ti99::joyport
+void ti99_joyport_options_plain(device_slot_interface &device)
+{
+ device.option_add("twinjoy", TI99_JOYSTICK);
+}
+
+void ti99_joyport_options_mouse(device_slot_interface &device)
+{
+ device.option_add("twinjoy", TI99_JOYSTICK);
+ device.option_add("mecmouse", TI99_MECMOUSE);
+}
+
+void ti99_joyport_options_994(device_slot_interface &device)
+{
+ device.option_add("twinjoy", TI99_JOYSTICK);
+ device.option_add("handset", TI99_HANDSET);
+ device.option_add("mecmouse", TI99_MECMOUSE);
+}
+
diff --git a/src/devices/bus/ti99/joyport/joyport.h b/src/devices/bus/ti99/joyport/joyport.h
index c67ebd74d74..4011efaaf70 100644
--- a/src/devices/bus/ti99/joyport/joyport.h
+++ b/src/devices/bus/ti99/joyport/joyport.h
@@ -56,13 +56,22 @@ protected:
class joyport_device : public device_t, public device_slot_interface
{
public:
+ template <typename U>
+ joyport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, U &&opts, const char *dflt)
+ : joyport_device(mconfig, tag, owner, clock)
+ {
+ option_reset();
+ opts(*this);
+ set_default_option(dflt);
+ set_fixed(false);
+ }
+
joyport_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
uint8_t read_port();
void write_port(int data);
void set_interrupt(int state);
void pulse_clock();
auto int_cb() { return m_interrupt.bind(); }
- void configure_slot(int flags);
protected:
void device_start() override;
@@ -77,4 +86,8 @@ private:
DECLARE_DEVICE_TYPE_NS(TI99_JOYPORT, bus::ti99::joyport, joyport_device)
+void ti99_joyport_options_plain(device_slot_interface &device);
+void ti99_joyport_options_mouse(device_slot_interface &device);
+void ti99_joyport_options_994(device_slot_interface &device);
+
#endif // MAME_BUS_TI99_JOYPORT_JOYPORT_H
diff --git a/src/devices/bus/ti99/peb/evpc.cpp b/src/devices/bus/ti99/peb/evpc.cpp
index 98b425ba6ef..254b1d08a27 100644
--- a/src/devices/bus/ti99/peb/evpc.cpp
+++ b/src/devices/bus/ti99/peb/evpc.cpp
@@ -506,7 +506,9 @@ void snug_enhanced_video_device::device_add_mconfig(machine_config& config)
soundgen.add_route(ALL_OUTPUTS, "sound_out", 0.75);
// Mouse connected to the color bus of the v9938
- TI99_COLORBUS(config, m_colorbus, 0).configure_slot();
+ TI99_COLORBUS(config, m_colorbus, 0, ti99_colorbus_options, "busmouse");
}
} } } // end namespace bus::ti99::peb
+
+
diff --git a/src/devices/bus/ti99/peb/peribox.cpp b/src/devices/bus/ti99/peb/peribox.cpp
index 0802d1dc1aa..80da29f6dd4 100644
--- a/src/devices/bus/ti99/peb/peribox.cpp
+++ b/src/devices/bus/ti99/peb/peribox.cpp
@@ -464,43 +464,33 @@ void peribox_device::device_config_complete()
m_ready_flag = 0;
}
-void peribox_device::configure_slot(peribox_slot_device &slot, int number)
-{
- slot.set_number(number);
- slot.option_reset();
- slot.option_add("32kmem", TI99_32KMEM);
- slot.option_add("myarcmem", TI99_MYARCMEM);
- slot.option_add("samsmem", TI99_SAMSMEM);
- slot.option_add("pcode", TI99_P_CODE);
- slot.option_add("hsgpl", TI99_HSGPL);
- slot.option_add("tirs232", TI99_RS232);
- slot.option_add("speech", TI99_SPEECH);
- slot.option_add("horizon", TI99_HORIZON);
- slot.option_add("ide", TI99_IDE);
- slot.option_add("usbsm", TI99_USBSM);
- slot.option_add("bwg", TI99_BWG);
- slot.option_add("hfdc", TI99_HFDC);
- slot.option_add("tifdc", TI99_FDC);
- slot.set_default_option(nullptr);
- slot.set_fixed(false);
-}
-
-MACHINE_CONFIG_START(peribox_device::device_add_mconfig)
- TI99_PERIBOX_SLOT(config, m_slot2, 0 );
- m_slot2->configure_slot(2);
- TI99_PERIBOX_SLOT(config, m_slot3, 0 );
- m_slot3->configure_slot(3);
- TI99_PERIBOX_SLOT(config, m_slot4, 0 );
- m_slot4->configure_slot(4);
- TI99_PERIBOX_SLOT(config, m_slot5, 0 );
- m_slot5->configure_slot(5);
- TI99_PERIBOX_SLOT(config, m_slot6, 0 );
- m_slot6->configure_slot(6);
- TI99_PERIBOX_SLOT(config, m_slot7, 0 );
- m_slot7->configure_slot(7);
- TI99_PERIBOX_SLOT(config, m_slot8, 0 );
- m_slot8->configure_slot(8);
-MACHINE_CONFIG_END
+void ti99_peribox_slot_standard(device_slot_interface &device)
+{
+ device.option_add("32kmem", TI99_32KMEM);
+ device.option_add("myarcmem", TI99_MYARCMEM);
+ device.option_add("samsmem", TI99_SAMSMEM);
+ device.option_add("pcode", TI99_P_CODE);
+ device.option_add("hsgpl", TI99_HSGPL);
+ device.option_add("tirs232", TI99_RS232);
+ device.option_add("speech", TI99_SPEECH);
+ device.option_add("horizon", TI99_HORIZON);
+ device.option_add("ide", TI99_IDE);
+ device.option_add("usbsm", TI99_USBSM);
+ device.option_add("bwg", TI99_BWG);
+ device.option_add("hfdc", TI99_HFDC);
+ device.option_add("tifdc", TI99_FDC);
+}
+
+void peribox_device::device_add_mconfig(machine_config &config)
+{
+ TI99_PERIBOX_SLOT(config, m_slot2, 2, ti99_peribox_slot_standard, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot3, 3, ti99_peribox_slot_standard, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot4, 4, ti99_peribox_slot_standard, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot5, 5, ti99_peribox_slot_standard, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot6, 6, ti99_peribox_slot_standard, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot7, 7, ti99_peribox_slot_standard, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot8, 8, ti99_peribox_slot_standard, nullptr);
+}
/****************************************************************************
A variant of the box used for the TI-99/4A with EVPC.
@@ -513,26 +503,33 @@ peribox_ev_device::peribox_ev_device(const machine_config &mconfig, const char *
m_genmod = false;
}
-void peribox_ev_device::configure_slot(peribox_slot_device &slot, int number)
-{
- slot.set_number(number);
- slot.option_reset();
- slot.option_add("evpc", TI99_EVPC);
- slot.option_add("32kmem", TI99_32KMEM);
- slot.option_add("myarcmem", TI99_MYARCMEM);
- slot.option_add("samsmem", TI99_SAMSMEM);
- slot.option_add("pcode", TI99_P_CODE);
- slot.option_add("hsgpl", TI99_HSGPL);
- slot.option_add("tirs232", TI99_RS232);
- slot.option_add("speech", TI99_SPEECH);
- slot.option_add("horizon", TI99_HORIZON);
- slot.option_add("ide", TI99_IDE);
- slot.option_add("usbsm", TI99_USBSM);
- slot.option_add("bwg", TI99_BWG);
- slot.option_add("hfdc", TI99_HFDC);
- slot.option_add("tifdc", TI99_FDC);
- if (number==2) slot.set_default_option("evpc");
- slot.set_fixed(false);
+void ti99_peribox_slot_evpc(device_slot_interface &device)
+{
+ device.option_add("evpc", TI99_EVPC);
+ device.option_add("32kmem", TI99_32KMEM);
+ device.option_add("myarcmem", TI99_MYARCMEM);
+ device.option_add("samsmem", TI99_SAMSMEM);
+ device.option_add("pcode", TI99_P_CODE);
+ device.option_add("hsgpl", TI99_HSGPL);
+ device.option_add("tirs232", TI99_RS232);
+ device.option_add("speech", TI99_SPEECH);
+ device.option_add("horizon", TI99_HORIZON);
+ device.option_add("ide", TI99_IDE);
+ device.option_add("usbsm", TI99_USBSM);
+ device.option_add("bwg", TI99_BWG);
+ device.option_add("hfdc", TI99_HFDC);
+ device.option_add("tifdc", TI99_FDC);
+}
+
+void peribox_ev_device::device_add_mconfig(machine_config &config)
+{
+ TI99_PERIBOX_SLOT(config, m_slot2, 2, ti99_peribox_slot_evpc, "evpc");
+ TI99_PERIBOX_SLOT(config, m_slot3, 3, ti99_peribox_slot_evpc, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot4, 4, ti99_peribox_slot_evpc, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot5, 5, ti99_peribox_slot_evpc, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot6, 6, ti99_peribox_slot_evpc, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot7, 7, ti99_peribox_slot_evpc, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot8, 8, ti99_peribox_slot_evpc, nullptr);
}
/****************************************************************************
@@ -563,35 +560,38 @@ peribox_genmod_device::peribox_genmod_device(const machine_config &mconfig, cons
// The BwG controller will not run with the Geneve due to its wait state
// logic (see bwg.c)
-void peribox_gen_device::configure_slot(peribox_slot_device &slot, int number)
-{
- slot.set_number(number);
- slot.option_reset();
- slot.option_add("memex", TI99_MEMEX);
- slot.option_add("tirs232", TI99_RS232);
- slot.option_add("speech", TI99_SPEECH);
- slot.option_add("horizon", TI99_HORIZON);
- slot.option_add("ide", TI99_IDE);
- slot.option_add("usbsm", TI99_USBSM);
- slot.option_add("hfdc", TI99_HFDC);
- slot.option_add("tifdc", TI99_FDC);
- slot.set_fixed(false);
-}
-
-void peribox_genmod_device::configure_slot(peribox_slot_device &slot, int number)
-{
- slot.set_number(number);
- slot.option_reset();
- slot.option_add("memex", TI99_MEMEX);
- slot.option_add("tirs232", TI99_RS232);
- slot.option_add("speech", TI99_SPEECH);
- slot.option_add("horizon", TI99_HORIZON);
- slot.option_add("ide", TI99_IDE);
- slot.option_add("usbsm", TI99_USBSM);
- slot.option_add("hfdc", TI99_HFDC);
- slot.option_add("tifdc", TI99_FDC);
- if (number==2) slot.set_default_option("memex");
- slot.set_fixed(false);
+void ti99_peribox_slot_geneve(device_slot_interface &device)
+{
+ device.option_add("memex", TI99_MEMEX);
+ device.option_add("tirs232", TI99_RS232);
+ device.option_add("speech", TI99_SPEECH);
+ device.option_add("horizon", TI99_HORIZON);
+ device.option_add("ide", TI99_IDE);
+ device.option_add("usbsm", TI99_USBSM);
+ device.option_add("hfdc", TI99_HFDC);
+ device.option_add("tifdc", TI99_FDC);
+}
+
+void peribox_gen_device::device_add_mconfig(machine_config &config)
+{
+ TI99_PERIBOX_SLOT(config, m_slot2, 2, ti99_peribox_slot_geneve, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot3, 3, ti99_peribox_slot_geneve, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot4, 4, ti99_peribox_slot_geneve, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot5, 5, ti99_peribox_slot_geneve, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot6, 6, ti99_peribox_slot_geneve, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot7, 7, ti99_peribox_slot_geneve, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot8, 8, ti99_peribox_slot_geneve, nullptr);
+}
+
+void peribox_genmod_device::device_add_mconfig(machine_config &config)
+{
+ TI99_PERIBOX_SLOT(config, m_slot2, 2, ti99_peribox_slot_geneve, "memex");
+ TI99_PERIBOX_SLOT(config, m_slot3, 3, ti99_peribox_slot_geneve, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot4, 4, ti99_peribox_slot_geneve, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot5, 5, ti99_peribox_slot_geneve, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot6, 6, ti99_peribox_slot_geneve, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot7, 7, ti99_peribox_slot_geneve, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot8, 8, ti99_peribox_slot_geneve, nullptr);
}
/****************************************************************************
@@ -605,26 +605,32 @@ peribox_sg_device::peribox_sg_device(const machine_config &mconfig, const char *
m_genmod = false;
}
-void peribox_sg_device::configure_slot(peribox_slot_device &slot, int number)
-{
- slot.set_number(number);
- slot.option_reset();
- slot.option_add("evpc", TI99_EVPC);
- slot.option_add("myarcmem", TI99_MYARCMEM);
- slot.option_add("samsmem", TI99_SAMSMEM);
- slot.option_add("pcode", TI99_P_CODE);
- slot.option_add("hsgpl", TI99_HSGPL);
- slot.option_add("tirs232", TI99_RS232);
- slot.option_add("speech", TI99_SPEECH);
- slot.option_add("horizon", TI99_HORIZON);
- slot.option_add("ide", TI99_IDE);
- slot.option_add("usbsm", TI99_USBSM);
- slot.option_add("bwg", TI99_BWG);
- slot.option_add("hfdc", TI99_HFDC);
- slot.option_add("tifdc", TI99_FDC);
- if (number==2) slot.set_default_option("evpc");
- else if (number==3) slot.set_default_option("hsgpl");
- slot.set_fixed(false);
+void ti99_peribox_slot_sgcpu(device_slot_interface &device)
+{
+ device.option_add("evpc", TI99_EVPC);
+ device.option_add("myarcmem", TI99_MYARCMEM);
+ device.option_add("samsmem", TI99_SAMSMEM);
+ device.option_add("pcode", TI99_P_CODE);
+ device.option_add("hsgpl", TI99_HSGPL);
+ device.option_add("tirs232", TI99_RS232);
+ device.option_add("speech", TI99_SPEECH);
+ device.option_add("horizon", TI99_HORIZON);
+ device.option_add("ide", TI99_IDE);
+ device.option_add("usbsm", TI99_USBSM);
+ device.option_add("bwg", TI99_BWG);
+ device.option_add("hfdc", TI99_HFDC);
+ device.option_add("tifdc", TI99_FDC);
+}
+
+void peribox_sg_device::device_add_mconfig(machine_config &config)
+{
+ TI99_PERIBOX_SLOT(config, m_slot2, 2, ti99_peribox_slot_sgcpu, "evpc");
+ TI99_PERIBOX_SLOT(config, m_slot3, 3, ti99_peribox_slot_sgcpu, "hsgpl");
+ TI99_PERIBOX_SLOT(config, m_slot4, 4, ti99_peribox_slot_sgcpu, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot5, 5, ti99_peribox_slot_sgcpu, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot6, 6, ti99_peribox_slot_sgcpu, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot7, 7, ti99_peribox_slot_sgcpu, nullptr);
+ TI99_PERIBOX_SLOT(config, m_slot8, 8, ti99_peribox_slot_sgcpu, nullptr);
}
/***************************************************************************
@@ -699,12 +705,6 @@ void peribox_slot_device::device_config_complete()
peb->set_slot_loaded(m_slotnumber, m_card ? this : nullptr);
}
-void peribox_slot_device::configure_slot(int number)
-{
- peribox_device *peb = dynamic_cast<peribox_device*>(owner());
- if (peb) peb->configure_slot(*this, number);
-}
-
/*
These methods are called from the expansion cards. They add the
slot number to identify the slot to the box.
diff --git a/src/devices/bus/ti99/peb/peribox.h b/src/devices/bus/ti99/peb/peribox.h
index 7ba65b5cbd0..a936a5346ef 100644
--- a/src/devices/bus/ti99/peb/peribox.h
+++ b/src/devices/bus/ti99/peb/peribox.h
@@ -65,8 +65,7 @@ protected:
virtual void device_start() override;
virtual void device_config_complete() override;
- void device_add_mconfig(machine_config &config) override;
- virtual void configure_slot(peribox_slot_device &slot, int number);
+ virtual void device_add_mconfig(machine_config &config) override;
// Next three methods call back the console via slot 1
devcb_write_line m_slot1_inta; // INTA line (Box to console)
@@ -126,7 +125,7 @@ public:
peribox_sg_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
- void configure_slot(peribox_slot_device &slot, int number) override;
+ void device_add_mconfig(machine_config &config) override;
};
/*
@@ -138,7 +137,7 @@ public:
peribox_ev_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
- void configure_slot(peribox_slot_device &slot, int number) override;
+ void device_add_mconfig(machine_config &config) override;
};
@@ -152,7 +151,7 @@ public:
protected:
peribox_gen_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
- virtual void configure_slot(peribox_slot_device &slot, int number) override;
+ virtual void device_add_mconfig(machine_config &config) override;
};
/*
@@ -164,7 +163,7 @@ public:
peribox_genmod_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
- void configure_slot(peribox_slot_device &slot, int number) override;
+ void device_add_mconfig(machine_config &config) override;
};
/*****************************************************************************
@@ -217,6 +216,17 @@ class peribox_slot_device : public device_t, public device_slot_interface
{
friend class peribox_device;
public:
+ template <typename U>
+ peribox_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, int slot, U &&opts, const char *dflt)
+ : peribox_slot_device(mconfig, tag, owner, 0)
+ {
+ option_reset();
+ opts(*this);
+ set_default_option(dflt);
+ set_fixed(false);
+ m_slotnumber = slot;
+ }
+
peribox_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
// Called from the box (direction to card)
@@ -239,7 +249,6 @@ public:
// called from the box itself
void set_genmod(bool set);
- void configure_slot(int number);
void set_number(int number) { m_slotnumber = number; }
protected:
@@ -262,4 +271,9 @@ DECLARE_DEVICE_TYPE_NS(TI99_PERIBOX_SG, bus::ti99::peb, peribox_sg_device)
DECLARE_DEVICE_TYPE_NS(TI99_PERIBOX_GEN, bus::ti99::peb, peribox_gen_device)
DECLARE_DEVICE_TYPE_NS(TI99_PERIBOX_GENMOD, bus::ti99::peb, peribox_genmod_device)
+void ti99_peribox_slot_standard(device_slot_interface &device);
+void ti99_peribox_slot_evpc(device_slot_interface &device);
+void ti99_peribox_slot_geneve(device_slot_interface &device);
+void ti99_peribox_slot_sgcpu(device_slot_interface &device);
+
#endif // MAME_BUS_TI99_PEB_PERIBOX_H