-ie15kbd, im6402, ins8154: De-MCFG, nw

This commit is contained in:
mooglyguy 2018-09-04 17:22:51 +02:00
parent 9ee8c458e2
commit de24e3bfdc
10 changed files with 48 additions and 115 deletions

View File

@ -577,8 +577,8 @@ MACHINE_CONFIG_START(ie15_device::ie15core)
config.set_default_layout(layout_ie15);
/* Devices */
MCFG_DEVICE_ADD("keyboard", IE15_KEYBOARD, 0)
MCFG_IE15_KEYBOARD_CB(WRITE16(*this, ie15_device, kbd_put))
IE15_KEYBOARD(config, m_keyboard, 0)
.keyboard_cb().set(FUNC(ie15_device::kbd_put));
MCFG_DEVICE_ADD("rs232", RS232_PORT, default_rs232_devices, "null_modem")
MCFG_RS232_RXD_HANDLER(WRITELINE(*this, ie15_device, serial_rx_callback))

View File

@ -5,18 +5,6 @@
#pragma once
/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/
#define MCFG_IE15_KEYBOARD_CB(_devcb) \
downcast<ie15_keyboard_device &>(*device).set_keyboard_callback(DEVCB_##_devcb);
/***************************************************************************
FUNCTION PROTOTYPES
***************************************************************************/
class ie15_keyboard_device : public device_t
{
public:
@ -47,7 +35,7 @@ public:
ie15_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
template <class Object> devcb_base &set_keyboard_callback(Object &&cb) { return m_keyboard_cb.set_callback(std::forward<Object>(cb)); }
auto keyboard_cb() { return m_keyboard_cb.bind(); }
protected:
ie15_keyboard_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);

View File

@ -43,49 +43,21 @@
#include "diserial.h"
/***************************************************************************
INTERFACE CONFIGURATION MACROS
***************************************************************************/
#define MCFG_IM6402_ADD(_tag, _rrc, _trc) \
MCFG_DEVICE_ADD(_tag, IM6402, 0) \
downcast<im6402_device &>(*device).set_rrc(_rrc); \
downcast<im6402_device &>(*device).set_trc(_trc);
#define MCFG_IM6402_TRO_CALLBACK(_write) \
downcast<im6402_device &>(*device).set_tro_wr_callback(DEVCB_##_write);
#define MCFG_IM6402_DR_CALLBACK(_write) \
downcast<im6402_device &>(*device).set_dr_wr_callback(DEVCB_##_write);
#define MCFG_IM6402_TBRE_CALLBACK(_write) \
downcast<im6402_device &>(*device).set_tbre_wr_callback(DEVCB_##_write);
#define MCFG_IM6402_TRE_CALLBACK(_write) \
downcast<im6402_device &>(*device).set_tre_wr_callback(DEVCB_##_write);
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
// ======================> im6402_device
class im6402_device : public device_t, public device_serial_interface
{
public:
// construction/destruction
im6402_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t rrc, uint32_t trc)
: im6402_device(mconfig, tag, owner, 0)
{
set_rrc(rrc);
set_trc(trc);
}
im6402_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
void set_rrc(int rrc) { m_rrc = rrc; }
void set_trc(int trc) { m_trc = trc; }
template <class Object> devcb_base &set_tro_wr_callback(Object &&cb) { return m_write_tro.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_dr_wr_callback(Object &&cb) { return m_write_dr.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_tbre_wr_callback(Object &&cb) { return m_write_tbre.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_tre_wr_callback(Object &&cb) { return m_write_tre.set_callback(std::forward<Object>(cb)); }
auto tro_callback() { return m_write_tro.bind(); }
auto dr_callback() { return m_write_dr.bind(); }
@ -164,8 +136,6 @@ private:
int m_trc_count;
};
// device type definition
DECLARE_DEVICE_TYPE(IM6402, im6402_device)
#endif // MAME_MACHINE_IM6402_H

View File

@ -35,45 +35,17 @@
#pragma once
/***************************************************************************
DEVICE CONFIGURATION MACROS
***************************************************************************/
#define MCFG_INS8154_IN_A_CB(_devcb) \
downcast<ins8154_device &>(*device).set_in_a_callback(DEVCB_##_devcb);
#define MCFG_INS8154_OUT_A_CB(_devcb) \
downcast<ins8154_device &>(*device).set_out_a_callback(DEVCB_##_devcb);
#define MCFG_INS8154_IN_B_CB(_devcb) \
downcast<ins8154_device &>(*device).set_in_b_callback(DEVCB_##_devcb);
#define MCFG_INS8154_OUT_B_CB(_devcb) \
downcast<ins8154_device &>(*device).set_out_b_callback(DEVCB_##_devcb);
#define MCFG_INS8154_OUT_IRQ_CB(_devcb) \
downcast<ins8154_device &>(*device).set_out_irq_callback(DEVCB_##_devcb); //currently unused
/***************************************************************************
TYPE DEFINITIONS
***************************************************************************/
// ======================> ins8154_device
class ins8154_device : public device_t
{
public:
// construction/destruction
ins8154_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
ins8154_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
template <class Object> devcb_base &set_in_a_callback(Object &&cb) { return m_in_a_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_out_a_callback(Object &&cb) { return m_out_a_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_in_b_callback(Object &&cb) { return m_in_b_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_out_b_callback(Object &&cb) { return m_out_b_cb.set_callback(std::forward<Object>(cb)); }
template <class Object> devcb_base &set_out_irq_callback(Object &&cb) { return m_out_irq_cb.set_callback(std::forward<Object>(cb)); }
auto in_a() { return m_in_a_cb.bind(); }
auto out_a() { return m_out_a_cb.bind(); }
auto in_b() { return m_in_b_cb.bind(); }
auto out_b() { return m_out_b_cb.bind(); }
auto out_irq() { return m_out_irq_cb.bind(); }
DECLARE_READ8_MEMBER( ins8154_r );
DECLARE_WRITE8_MEMBER( ins8154_w );

View File

@ -366,10 +366,10 @@ MACHINE_CONFIG_START(acrnsys_state::a6502)
INPUT_MERGER_ANY_HIGH(config, m_irqs).output_handler().set_inputline(m_maincpu, M6502_IRQ_LINE);
MCFG_DEVICE_ADD(m_ins8154, INS8154, 0)
//MCFG_INS8154_IN_A_CB(READ8(*this, acrnsys_state, ins8154_pa_r))
//MCFG_INS8154_OUT_A_CB(WRITE8(*this, acrnsys_state, ins8154_pa_w))
MCFG_INS8154_IN_B_CB(READ8(*this, acrnsys_state, kbd_r))
INS8154(config, m_ins8154);
//m_ins8154->in_a().set(FUNC(acrnsys_state::ins8154_pa_r));
//m_ins8154->out_a().set(FUNC(acrnsys_state::ins8154_pa_w));
m_ins8154->in_b().set(FUNC(acrnsys_state::kbd_r));
MCFG_DEVICE_ADD("keyboard", GENERIC_KEYBOARD, 0)
MCFG_GENERIC_KEYBOARD_CB(PUT(acrnsys_state, kbd_put))

View File

@ -276,10 +276,10 @@ MACHINE_CONFIG_START(acrnsys1_state::acrnsys1)
WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "mono", 0.25);
/* devices */
MCFG_DEVICE_ADD("b1", INS8154, 0)
MCFG_INS8154_IN_A_CB(READ8(*this, acrnsys1_state, ins8154_b1_port_a_r))
MCFG_INS8154_OUT_A_CB(WRITE8(*this, acrnsys1_state, ins8154_b1_port_a_w))
MCFG_INS8154_OUT_B_CB(WRITE8(*this, acrnsys1_state, acrnsys1_led_segment_w))
ins8154_device &b1(INS8154(config, "b1"));
b1.in_a().set(FUNC(acrnsys1_state::ins8154_b1_port_a_r));
b1.out_a().set(FUNC(acrnsys1_state::ins8154_b1_port_a_w));
b1.out_b().set(FUNC(acrnsys1_state::acrnsys1_led_segment_w));
TTL74145(config, m_ttl74145, 0);

View File

@ -1371,10 +1371,11 @@ MACHINE_CONFIG_START(kc85_state::kc85)
MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL(32'768), NOOP, INPUTLINE(I8085_TAG, I8085_RST75_LINE))
MCFG_IM6402_ADD(IM6402_TAG, 0, 0)
MCFG_IM6402_TRO_CALLBACK(WRITELINE(RS232_TAG, rs232_port_device, write_txd))
IM6402(config, m_uart, 0, 0);
m_uart->tro_callback().set(RS232_TAG, FUNC(rs232_port_device::write_txd));
MCFG_DEVICE_ADD(RS232_TAG, RS232_PORT, default_rs232_devices, nullptr)
MCFG_RS232_RXD_HANDLER(WRITELINE(IM6402_TAG, im6402_device, write_rri))
MCFG_RS232_RXD_HANDLER(WRITELINE(m_uart, im6402_device, write_rri))
MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer")
MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, kc85_state, write_centronics_busy))
@ -1419,10 +1420,11 @@ MACHINE_CONFIG_START(pc8201_state::pc8201)
MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL(32'768), NOOP, INPUTLINE(I8085_TAG, I8085_RST75_LINE))
MCFG_IM6402_ADD(IM6402_TAG, 0, 0)
MCFG_IM6402_TRO_CALLBACK(WRITELINE(RS232_TAG, rs232_port_device, write_txd))
IM6402(config, m_uart, 0, 0);
m_uart->tro_callback().set(RS232_TAG, FUNC(rs232_port_device::write_txd));
MCFG_DEVICE_ADD(RS232_TAG, RS232_PORT, default_rs232_devices, nullptr)
MCFG_RS232_RXD_HANDLER(WRITELINE(IM6402_TAG, im6402_device, write_rri))
MCFG_RS232_RXD_HANDLER(WRITELINE(m_uart, im6402_device, write_rri))
MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer")
MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(*this, kc85_state, write_centronics_busy))
@ -1477,10 +1479,11 @@ MACHINE_CONFIG_START(trsm100_state::trsm100)
MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL(32'768), NOOP, INPUTLINE(I8085_TAG, I8085_RST75_LINE))
MCFG_IM6402_ADD(IM6402_TAG, 0, 0)
MCFG_IM6402_TRO_CALLBACK(WRITELINE(RS232_TAG, rs232_port_device, write_txd))
IM6402(config, m_uart, 0, 0);
m_uart->tro_callback().set(RS232_TAG, FUNC(rs232_port_device::write_txd));
MCFG_DEVICE_ADD(RS232_TAG, RS232_PORT, default_rs232_devices, nullptr)
MCFG_RS232_RXD_HANDLER(WRITELINE(IM6402_TAG, im6402_device, write_rri))
MCFG_RS232_RXD_HANDLER(WRITELINE(m_uart, im6402_device, write_rri))
MCFG_DEVICE_ADD(m_centronics, CENTRONICS, centronics_devices, "printer")
MCFG_CASSETTE_ADD("cassette")

View File

@ -221,9 +221,9 @@ MACHINE_CONFIG_START(mk14_state::mk14)
MCFG_SOUND_ROUTE(0, "dac8", 1.0, DAC_VREF_POS_INPUT) MCFG_SOUND_ROUTE(0, "dac8", -1.0, DAC_VREF_NEG_INPUT)
/* devices */
MCFG_DEVICE_ADD("ic8", INS8154, 0)
MCFG_INS8154_OUT_A_CB(WRITE8(*this, mk14_state, port_a_w))
MCFG_INS8154_OUT_B_CB(WRITE8("dac8", dac_byte_interface, data_w))
ins8154_device &ic8(INS8154(config, "ic8"));
ic8.out_a().set(FUNC(mk14_state::port_a_w));
ic8.out_b().set("dac8", FUNC(dac_byte_interface::data_w));
MCFG_CASSETTE_ADD( "cassette" )
MACHINE_CONFIG_END

View File

@ -816,11 +816,11 @@ MACHINE_CONFIG_START(vega_state::vega)
m_i8255->out_pb_callback().set(FUNC(vega_state::ppi_pb_w));
m_i8255->out_pc_callback().set(FUNC(vega_state::ppi_pc_w));
MCFG_DEVICE_ADD( "ins8154", INS8154, 0 )
MCFG_INS8154_IN_A_CB(READ8(*this, vega_state, ins8154_pa_r))
MCFG_INS8154_OUT_A_CB(WRITE8(*this, vega_state, ins8154_pa_w))
MCFG_INS8154_IN_B_CB(READ8(*this, vega_state, ins8154_pb_r))
MCFG_INS8154_OUT_B_CB(WRITE8(*this, vega_state, ins8154_pb_w))
INS8154(config, m_ins8154);
m_ins8154->in_a().set(FUNC(vega_state::ins8154_pa_r));
m_ins8154->out_a().set(FUNC(vega_state::ins8154_pa_w));
m_ins8154->in_b().set(FUNC(vega_state::ins8154_pb_r));
m_ins8154->out_b().set(FUNC(vega_state::ins8154_pb_w));
/* video hardware */
MCFG_SCREEN_ADD("screen", RASTER)

View File

@ -1314,10 +1314,10 @@ MACHINE_CONFIG_START(wangpc_state::wangpc)
m_pit->set_clk<2>(500000);
m_pit->out_handler<2>().set(FUNC(wangpc_state::pit2_w));
MCFG_IM6402_ADD(IM6402_TAG, 62500*16, 62500*16)
MCFG_IM6402_TRO_CALLBACK(WRITELINE("wangpckb", wangpc_keyboard_device, write_rxd))
MCFG_IM6402_DR_CALLBACK(WRITELINE(*this, wangpc_state, uart_dr_w))
MCFG_IM6402_TBRE_CALLBACK(WRITELINE(*this, wangpc_state, uart_tbre_w))
IM6402(config, m_uart, 62500*16, 62500*16);
m_uart->tro_callback().set("wangpckb", FUNC(wangpc_keyboard_device::write_rxd));
m_uart->dr_callback().set(FUNC(wangpc_state::uart_dr_w));
m_uart->tbre_callback().set(FUNC(wangpc_state::uart_tbre_w));
MCFG_DEVICE_ADD(SCN2661_TAG, MC2661, 0)
MCFG_MC2661_TXD_HANDLER(WRITELINE(RS232_TAG, rs232_port_device, write_txd))