mirror of
https://github.com/holub/mame
synced 2025-04-27 10:43:07 +03:00
im6402: devcb2. (nw)
This commit is contained in:
parent
d9128a251d
commit
61c574bf01
@ -41,7 +41,7 @@ inline void im6402_device::set_dr(int state)
|
||||
{
|
||||
m_dr = state;
|
||||
|
||||
m_out_dr_func(state);
|
||||
m_write_dr(state);
|
||||
}
|
||||
|
||||
|
||||
@ -53,7 +53,7 @@ inline void im6402_device::set_tbre(int state)
|
||||
{
|
||||
m_tbre = state;
|
||||
|
||||
m_out_tbre_func(state);
|
||||
m_write_tbre(state);
|
||||
}
|
||||
|
||||
|
||||
@ -65,7 +65,7 @@ inline void im6402_device::set_tre(int state)
|
||||
{
|
||||
m_tre = state;
|
||||
|
||||
m_out_tre_func(state);
|
||||
m_write_tre(state);
|
||||
}
|
||||
|
||||
|
||||
@ -78,39 +78,19 @@ inline void im6402_device::set_tre(int state)
|
||||
// im6402_device - constructor
|
||||
//-------------------------------------------------
|
||||
|
||||
im6402_device::im6402_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
|
||||
: device_t(mconfig, IM6402, "Intersil IM6402", tag, owner, clock, "im6402", __FILE__),
|
||||
device_serial_interface(mconfig, *this),
|
||||
m_rrc_count(0),
|
||||
m_trc_count(0)
|
||||
im6402_device::im6402_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
|
||||
device_t(mconfig, IM6402, "Intersil IM6402", tag, owner, clock, "im6402", __FILE__),
|
||||
device_serial_interface(mconfig, *this),
|
||||
m_write_tro(*this),
|
||||
m_write_dr(*this),
|
||||
m_write_tbre(*this),
|
||||
m_write_tre(*this),
|
||||
m_rrc_count(0),
|
||||
m_trc_count(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_config_complete - perform any
|
||||
// operations now that the configuration is
|
||||
// complete
|
||||
//-------------------------------------------------
|
||||
|
||||
void im6402_device::device_config_complete()
|
||||
{
|
||||
// inherit a copy of the static data
|
||||
const im6402_interface *intf = reinterpret_cast<const im6402_interface *>(static_config());
|
||||
if (intf != NULL)
|
||||
*static_cast<im6402_interface *>(this) = *intf;
|
||||
|
||||
// or initialize to defaults if none provided
|
||||
else
|
||||
{
|
||||
memset(&m_out_tro_cb, 0, sizeof(m_out_tro_cb));
|
||||
memset(&m_out_dr_cb, 0, sizeof(m_out_dr_cb));
|
||||
memset(&m_out_tbre_cb, 0, sizeof(m_out_tbre_cb));
|
||||
memset(&m_out_tre_cb, 0, sizeof(m_out_tre_cb));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
@ -118,10 +98,10 @@ void im6402_device::device_config_complete()
|
||||
void im6402_device::device_start()
|
||||
{
|
||||
// resolve callbacks
|
||||
m_out_tro_func.resolve(m_out_tro_cb, *this);
|
||||
m_out_dr_func.resolve(m_out_dr_cb, *this);
|
||||
m_out_tbre_func.resolve(m_out_tbre_cb, *this);
|
||||
m_out_tre_func.resolve(m_out_tre_cb, *this);
|
||||
m_write_tro.resolve_safe();
|
||||
m_write_dr.resolve_safe();
|
||||
m_write_tbre.resolve_safe();
|
||||
m_write_tre.resolve_safe();
|
||||
|
||||
// create the timers
|
||||
if (m_rrc > 0)
|
||||
@ -163,7 +143,7 @@ void im6402_device::device_reset()
|
||||
receive_register_reset();
|
||||
transmit_register_reset();
|
||||
|
||||
m_out_tro_func(1);
|
||||
m_write_tro(1);
|
||||
|
||||
m_rrc_count = 0;
|
||||
m_trc_count = 0;
|
||||
@ -178,18 +158,24 @@ void im6402_device::device_reset()
|
||||
set_tre(ASSERT_LINE);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
//-------------------------------------------------
|
||||
|
||||
void im6402_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr)
|
||||
{
|
||||
device_serial_interface::device_timer(timer, id, param, ptr);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// tra_callback -
|
||||
//-------------------------------------------------
|
||||
|
||||
void im6402_device::tra_callback()
|
||||
{
|
||||
m_out_tro_func(transmit_register_get_data_bit());
|
||||
m_write_tro(transmit_register_get_data_bit());
|
||||
}
|
||||
|
||||
|
||||
|
@ -49,16 +49,25 @@
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
DEVICE CONFIGURATION MACROS
|
||||
INTERFACE CONFIGURATION MACROS
|
||||
***************************************************************************/
|
||||
|
||||
#define MCFG_IM6402_ADD(_tag, _config) \
|
||||
#define MCFG_IM6402_ADD(_tag, _rrc, _trc) \
|
||||
MCFG_DEVICE_ADD(_tag, IM6402, 0) \
|
||||
MCFG_DEVICE_CONFIG(_config)
|
||||
im6402_device::set_rrc(*device, _rrc); \
|
||||
im6402_device::set_trc(*device, _trc);
|
||||
|
||||
#define MCFG_IM6402_TRO_CALLBACK(_write) \
|
||||
devcb = &im6402_device::set_tro_wr_callback(*device, DEVCB2_##_write);
|
||||
|
||||
#define IM6402_INTERFACE(_name) \
|
||||
const im6402_interface (_name) =
|
||||
#define MCFG_IM6402_DR_CALLBACK(_write) \
|
||||
devcb = &im6402_device::set_dr_wr_callback(*device, DEVCB2_##_write);
|
||||
|
||||
#define MCFG_IM6402_TBRE_CALLBACK(_write) \
|
||||
devcb = &im6402_device::set_tbre_wr_callback(*device, DEVCB2_##_write);
|
||||
|
||||
#define MCFG_IM6402_TRE_CALLBACK(_write) \
|
||||
devcb = &im6402_device::set_tre_wr_callback(*device, DEVCB2_##_write);
|
||||
|
||||
|
||||
|
||||
@ -66,30 +75,22 @@
|
||||
TYPE DEFINITIONS
|
||||
***************************************************************************/
|
||||
|
||||
// ======================> im6402_interface
|
||||
|
||||
struct im6402_interface
|
||||
{
|
||||
int m_rrc;
|
||||
int m_trc;
|
||||
|
||||
devcb_write_line m_out_tro_cb;
|
||||
devcb_write_line m_out_dr_cb;
|
||||
devcb_write_line m_out_tbre_cb;
|
||||
devcb_write_line m_out_tre_cb;
|
||||
};
|
||||
|
||||
|
||||
// ======================> im6402_device
|
||||
|
||||
class im6402_device : public device_t,
|
||||
public device_serial_interface,
|
||||
public im6402_interface
|
||||
public device_serial_interface
|
||||
{
|
||||
public:
|
||||
// construction/destruction
|
||||
im6402_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
|
||||
|
||||
static void set_rrc(device_t &device, int rrc) { downcast<im6402_device &>(device).m_rrc = rrc; }
|
||||
static void set_trc(device_t &device, int trc) { downcast<im6402_device &>(device).m_trc = trc; }
|
||||
template<class _Object> static devcb2_base &set_tro_wr_callback(device_t &device, _Object object) { return downcast<im6402_device &>(device).m_write_tro.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_dr_wr_callback(device_t &device, _Object object) { return downcast<im6402_device &>(device).m_write_dr.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_tbre_wr_callback(device_t &device, _Object object) { return downcast<im6402_device &>(device).m_write_tbre.set_callback(object); }
|
||||
template<class _Object> static devcb2_base &set_tre_wr_callback(device_t &device, _Object object) { return downcast<im6402_device &>(device).m_write_tre.set_callback(object); }
|
||||
|
||||
DECLARE_READ8_MEMBER( read ) { return m_rbr; }
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
|
||||
@ -116,10 +117,9 @@ public:
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_config_complete();
|
||||
virtual void device_start();
|
||||
virtual void device_reset();
|
||||
void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
|
||||
|
||||
// device_serial_interface overrides
|
||||
virtual void tra_callback();
|
||||
@ -132,10 +132,10 @@ private:
|
||||
inline void set_tbre(int state);
|
||||
inline void set_tre(int state);
|
||||
|
||||
devcb_resolved_write_line m_out_tro_func;
|
||||
devcb_resolved_write_line m_out_dr_func;
|
||||
devcb_resolved_write_line m_out_tbre_func;
|
||||
devcb_resolved_write_line m_out_tre_func;
|
||||
devcb2_write_line m_write_tro;
|
||||
devcb2_write_line m_write_dr;
|
||||
devcb2_write_line m_write_tbre;
|
||||
devcb2_write_line m_write_tre;
|
||||
|
||||
// status
|
||||
int m_dr;
|
||||
@ -155,10 +155,12 @@ private:
|
||||
|
||||
// receiver
|
||||
UINT8 m_rbr;
|
||||
int m_rrc;
|
||||
int m_rrc_count;
|
||||
|
||||
// transmitter
|
||||
UINT8 m_tbr;
|
||||
int m_trc;
|
||||
int m_trc_count;
|
||||
};
|
||||
|
||||
|
@ -1192,18 +1192,6 @@ static I8155_INTERFACE( tandy200_8155_intf )
|
||||
DEVCB_DRIVER_LINE_MEMBER(tandy200_state, i8155_to_w) /* timer output */
|
||||
};
|
||||
|
||||
/* IM6402 Interface */
|
||||
|
||||
static IM6402_INTERFACE( uart_intf )
|
||||
{
|
||||
0,
|
||||
0,
|
||||
DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_txd),
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL,
|
||||
DEVCB_NULL
|
||||
};
|
||||
|
||||
/* Machine Drivers */
|
||||
|
||||
void kc85_state::machine_start()
|
||||
@ -1405,8 +1393,8 @@ static MACHINE_CONFIG_START( kc85, kc85_state )
|
||||
MCFG_I8155_ADD(I8155_TAG, XTAL_4_9152MHz/2, kc85_8155_intf)
|
||||
MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, INPUTLINE(I8085_TAG, I8085_RST75_LINE))
|
||||
|
||||
MCFG_IM6402_ADD(IM6402_TAG, uart_intf)
|
||||
|
||||
MCFG_IM6402_ADD(IM6402_TAG, 0, 0)
|
||||
MCFG_IM6402_TRO_CALLBACK(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd))
|
||||
MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL)
|
||||
MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IM6402_TAG, im6402_device, write_rri))
|
||||
|
||||
@ -1451,8 +1439,8 @@ static MACHINE_CONFIG_START( pc8201, pc8201_state )
|
||||
MCFG_I8155_ADD(I8155_TAG, XTAL_4_9152MHz/2, kc85_8155_intf)
|
||||
MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, INPUTLINE(I8085_TAG, I8085_RST75_LINE))
|
||||
|
||||
MCFG_IM6402_ADD(IM6402_TAG, uart_intf)
|
||||
|
||||
MCFG_IM6402_ADD(IM6402_TAG, 0, 0)
|
||||
MCFG_IM6402_TRO_CALLBACK(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd))
|
||||
MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL)
|
||||
MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IM6402_TAG, im6402_device, write_rri))
|
||||
|
||||
@ -1509,8 +1497,8 @@ static MACHINE_CONFIG_START( trsm100, trsm100_state )
|
||||
MCFG_I8155_ADD(I8155_TAG, XTAL_4_9152MHz/2, kc85_8155_intf)
|
||||
MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, INPUTLINE(I8085_TAG, I8085_RST75_LINE))
|
||||
|
||||
MCFG_IM6402_ADD(IM6402_TAG, uart_intf)
|
||||
|
||||
MCFG_IM6402_ADD(IM6402_TAG, 0, 0)
|
||||
MCFG_IM6402_TRO_CALLBACK(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd))
|
||||
MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL)
|
||||
MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IM6402_TAG, im6402_device, write_rri))
|
||||
|
||||
|
@ -916,16 +916,6 @@ WRITE_LINE_MEMBER( wangpc_state::uart_tbre_w )
|
||||
}
|
||||
}
|
||||
|
||||
static IM6402_INTERFACE( uart_intf )
|
||||
{
|
||||
0, // HACK for wangpckb in IM6402 derives clocks from data line
|
||||
62500*16,
|
||||
DEVCB_DEVICE_LINE_MEMBER(WANGPC_KEYBOARD_TAG, wangpc_keyboard_device, write_rxd),
|
||||
DEVCB_DRIVER_LINE_MEMBER(wangpc_state, uart_dr_w),
|
||||
DEVCB_DRIVER_LINE_MEMBER(wangpc_state, uart_tbre_w),
|
||||
DEVCB_NULL
|
||||
};
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// SCN2661_INTERFACE( epci_intf )
|
||||
@ -1170,7 +1160,10 @@ static MACHINE_CONFIG_START( wangpc, wangpc_state )
|
||||
MCFG_PIT8253_CLK2(500000)
|
||||
MCFG_PIT8253_OUT2_HANDLER(WRITELINE(wangpc_state, pit2_w))
|
||||
|
||||
MCFG_IM6402_ADD(IM6402_TAG, uart_intf)
|
||||
MCFG_IM6402_ADD(IM6402_TAG, 0, 62500*16) // HACK for wangpckb in IM6402 derives clocks from data line
|
||||
MCFG_IM6402_TRO_CALLBACK(DEVWRITELINE(WANGPC_KEYBOARD_TAG, wangpc_keyboard_device, write_rxd))
|
||||
MCFG_IM6402_DR_CALLBACK(WRITELINE(wangpc_state, uart_dr_w))
|
||||
MCFG_IM6402_TBRE_CALLBACK(WRITELINE(wangpc_state, uart_tbre_w))
|
||||
MCFG_MC2661_ADD(SCN2661_TAG, 0, epci_intf)
|
||||
MCFG_UPD765A_ADD(UPD765_TAG, false, false)
|
||||
MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", wangpc_floppies, "525dd", wangpc_state::floppy_formats)
|
||||
|
@ -876,16 +876,6 @@ static mc2661_interface wicat_video_uart1_intf =
|
||||
DEVCB_NULL // XSYNC out
|
||||
};
|
||||
|
||||
struct im6402_interface wicat_video_uart_intf =
|
||||
{
|
||||
0, // RRC
|
||||
0, // TRC
|
||||
DEVCB_NULL, //m_out_tro_cb;
|
||||
DEVCB_DRIVER_LINE_MEMBER(wicat_state,kb_data_ready), //m_out_dr_cb;
|
||||
DEVCB_NULL, //m_out_tbre_cb;
|
||||
DEVCB_NULL, //m_out_tre_cb;
|
||||
};
|
||||
|
||||
static mm58274c_interface wicat_rtc_intf =
|
||||
{
|
||||
0, // 12 hour
|
||||
@ -961,7 +951,8 @@ static MACHINE_CONFIG_START( wicat, wicat_state )
|
||||
MCFG_CPU_IO_MAP(wicat_video_io)
|
||||
|
||||
MCFG_AM9517A_ADD("videodma", XTAL_8MHz, wicat_videodma_intf) // clock is a bit of guess
|
||||
MCFG_IM6402_ADD("videouart", wicat_video_uart_intf)
|
||||
MCFG_IM6402_ADD("videouart", 0, 0)
|
||||
MCFG_IM6402_DR_CALLBACK(WRITELINE(wicat_state, kb_data_ready))
|
||||
MCFG_MC2661_ADD("videouart0", XTAL_5_0688MHz, wicat_video_uart0_intf) // the INS2651 looks similar enough to the MC2661...
|
||||
MCFG_MC2661_ADD("videouart1", XTAL_5_0688MHz, wicat_video_uart1_intf)
|
||||
MCFG_X2210_ADD("vsram") // XD2210
|
||||
|
Loading…
Reference in New Issue
Block a user