diff options
author | smf- <smf-@users.noreply.github.com> | 2014-02-15 19:50:54 +0000 |
---|---|---|
committer | smf- <smf-@users.noreply.github.com> | 2014-02-15 19:50:54 +0000 |
commit | f468c60ea7397a56a118c67c758282c06edb568b (patch) | |
tree | 24200174832bf814751103b902429c480d37ed97 /src/mess | |
parent | 292d16c120d717c732d440eed7096119e99929e2 (diff) |
Converted i8251 to DEVCB2 [smf]
Diffstat (limited to 'src/mess')
58 files changed, 455 insertions, 895 deletions
diff --git a/src/mess/drivers/alphatro.c b/src/mess/drivers/alphatro.c index 9ab1691af3b..312bd67792c 100644 --- a/src/mess/drivers/alphatro.c +++ b/src/mess/drivers/alphatro.c @@ -128,8 +128,12 @@ void alphatro_state::device_timer(emu_timer &timer, device_timer_id id, int para m_timer_bit ^= 0x80; break; case TIMER_SERIAL: - m_usart->transmit_clock(); - m_usart->receive_clock(); + /// TODO: double timer frequency for correct duty cycle + m_usart->write_txc(1); + m_usart->write_rxc(1); + + m_usart->write_txc(0); + m_usart->write_rxc(0); break; case TIMER_ALPHATRO_BEEP_OFF: m_beep->set_state(0); @@ -373,7 +377,7 @@ void alphatro_state::machine_reset() m_cass_state = 1; m_cass_data[0] = 0; m_cass_data[1] = 0; - m_usart->write_rx(0); + m_usart->write_rxd(0); m_cass_data[3] = 0; m_beep->set_state(0); m_beep->set_frequency(950); /* piezo-device needs to be measured */ @@ -410,16 +414,6 @@ static MC6845_INTERFACE( alphatro_crtc6845_interface ) NULL }; -static const i8251_interface alphatro_usart_interface = -{ - DEVCB_DRIVER_LINE_MEMBER(alphatro_state,txdata_callback), //txd_cb - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - TIMER_DEVICE_CALLBACK_MEMBER(alphatro_state::alphatro_c) { m_cass_data[3]++; @@ -439,7 +433,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(alphatro_state::alphatro_p) if (cass_ws != m_cass_data[0]) { m_cass_data[0] = cass_ws; - m_usart->write_rx((m_cass_data[1] < 12) ? 1 : 0); + m_usart->write_rxd((m_cass_data[1] < 12) ? 1 : 0); m_cass_data[1] = 0; } } @@ -480,7 +474,8 @@ static MACHINE_CONFIG_START( alphatro, alphatro_state ) /* Devices */ MCFG_MC6845_ADD("crtc", MC6845, "screen", XTAL_12_288MHz / 8, alphatro_crtc6845_interface) // clk unknown - MCFG_I8251_ADD("usart", alphatro_usart_interface) + MCFG_DEVICE_ADD("usart", I8251, 0) + MCFG_I8251_TXD_HANDLER(WRITELINE(alphatro_state,txdata_callback)) MCFG_CASSETTE_ADD("cassette", alphatro_cassette_interface) MCFG_TIMER_DRIVER_ADD_PERIODIC("alphatro_c", alphatro_state, alphatro_c, attotime::from_hz(4800)) diff --git a/src/mess/drivers/b2m.c b/src/mess/drivers/b2m.c index d3b0c1f2087..9b6785b1423 100644 --- a/src/mess/drivers/b2m.c +++ b/src/mess/drivers/b2m.c @@ -214,7 +214,7 @@ static MACHINE_CONFIG_START( b2m, b2m_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) /* uart */ - MCFG_I8251_ADD("uart", default_i8251_interface) + MCFG_DEVICE_ADD("uart", I8251, 0) MCFG_FD1793x_ADD("fd1793", XTAL_8MHz / 8) diff --git a/src/mess/drivers/bw2.c b/src/mess/drivers/bw2.c index 59a09bea8db..1bbf1220d22 100644 --- a/src/mess/drivers/bw2.c +++ b/src/mess/drivers/bw2.c @@ -516,8 +516,8 @@ static I8255A_INTERFACE( ppi_intf ) WRITE_LINE_MEMBER( bw2_state::pit_out0_w ) { - m_uart->transmit_clock(); - m_uart->receive_clock(); + m_uart->write_txc(state); + m_uart->write_rxc(state); } WRITE_LINE_MEMBER( bw2_state::mtron_w ) @@ -549,23 +549,6 @@ static const struct pit8253_interface pit_intf = } }; - -//------------------------------------------------- -// i8251_interface usart_intf -//------------------------------------------------- - -static const i8251_interface usart_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_rts), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - - //------------------------------------------------- // floppy_format_type floppy_formats //------------------------------------------------- @@ -665,16 +648,20 @@ static MACHINE_CONFIG_START( bw2, bw2_state ) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - MCFG_I8251_ADD(I8251_TAG, usart_intf) + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) + MCFG_WD2797x_ADD(WD2797_TAG, XTAL_16MHz/16) MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG":0", bw2_floppies, "35dd", bw2_state::floppy_formats) MCFG_FLOPPY_DRIVE_ADD(WD2797_TAG":1", bw2_floppies, NULL, bw2_state::floppy_formats) MCFG_BW2_EXPANSION_SLOT_ADD(BW2_EXPANSION_SLOT_TAG, XTAL_16MHz, bw2_expansion_cards, NULL) - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rx)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) - // software list MCFG_SOFTWARE_LIST_ADD("flop_list","bw2") diff --git a/src/mess/drivers/cgc7900.c b/src/mess/drivers/cgc7900.c index 3460b005e0c..86709a521fa 100644 --- a/src/mess/drivers/cgc7900.c +++ b/src/mess/drivers/cgc7900.c @@ -342,36 +342,6 @@ INPUT_PORTS_END ***************************************************************************/ /*------------------------------------------------- - i8251_interface rs232_intf --------------------------------------------------*/ - -static const i8251_interface rs232_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - -/*------------------------------------------------- - i8251_interface rs449_intf --------------------------------------------------*/ - -static const i8251_interface rs449_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - -/*------------------------------------------------- ay8910_interface ay8910_intf -------------------------------------------------*/ @@ -434,8 +404,11 @@ static MACHINE_CONFIG_START( cgc7900, cgc7900_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) /* devices */ - MCFG_I8251_ADD(INS8251_0_TAG, rs232_intf) - MCFG_I8251_ADD(INS8251_1_TAG, rs449_intf) + MCFG_DEVICE_ADD(INS8251_0_TAG, I8251, 0) + // rs232 + + MCFG_DEVICE_ADD(INS8251_1_TAG, I8251, 0) + // rs449 MACHINE_CONFIG_END /*************************************************************************** diff --git a/src/mess/drivers/compis.c b/src/mess/drivers/compis.c index 64d32a10b7c..6343e2cecdc 100644 --- a/src/mess/drivers/compis.c +++ b/src/mess/drivers/compis.c @@ -505,8 +505,8 @@ WRITE_LINE_MEMBER( compis_state::tmr1_w ) WRITE_LINE_MEMBER( compis_state::tmr2_w ) { - m_uart->rxc_w(state); - m_uart->txc_w(state); + m_uart->write_rxc(state); + m_uart->write_txc(state); } @@ -540,22 +540,6 @@ static const struct pit8253_interface pit_intf = //------------------------------------------------- -// i8251_interface usart_intf -//------------------------------------------------- - -static const i8251_interface usart_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(COMPIS_KEYBOARD_TAG, compis_keyboard_device, si_w), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_DEVICE_LINE_MEMBER(I80130_TAG, i80130_device, ir2_w), - DEVCB_NULL, //DEVCB_DEVICE_LINE_MEMBER(I80186_TAG, i80186_cpu_device, int1_w), - DEVCB_NULL, - DEVCB_NULL -}; - - -//------------------------------------------------- // I8255A_INTERFACE( ppi_intf ) //------------------------------------------------- @@ -769,7 +753,15 @@ static MACHINE_CONFIG_START( compis, compis_state ) MCFG_I80130_BAUD_CALLBACK(DEVWRITELINE(DEVICE_SELF, compis_state, tmr2_w)) MCFG_PIT8253_ADD(I8253_TAG, pit_intf ) MCFG_I8255_ADD(I8255_TAG, ppi_intf ) - MCFG_I8251_ADD(I8251A_TAG, usart_intf) + + MCFG_DEVICE_ADD(I8251A_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(COMPIS_KEYBOARD_TAG, compis_keyboard_device, si_w)) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE(I80130_TAG, i80130_device, ir2_w)) + //MCFG_I8251_TXRDY_HANDLER(DEVWRITELINE(I80186_TAG, i80186_cpu_device, int1_w)) + + MCFG_DEVICE_ADD(COMPIS_KEYBOARD_TAG, COMPIS_KEYBOARD, 0) + MCFG_COMPIS_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_rxd)) + MCFG_I8274_ADD(I8274_TAG, XTAL_16MHz/4, mpsc_intf) MCFG_MM58274C_ADD(MM58174A_TAG, rtc_intf) MCFG_CASSETTE_ADD(CASSETTE_TAG, compis_cassette_interface) @@ -798,9 +790,6 @@ static MACHINE_CONFIG_START( compis, compis_state ) MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE(I80130_TAG, i80130_device, ir5_w)) MCFG_ISBX_SLOT_MDRQT_CALLBACK(DEVWRITELINE(I80186_TAG, i80186_cpu_device, drq1_w)) - MCFG_DEVICE_ADD(COMPIS_KEYBOARD_TAG, COMPIS_KEYBOARD, 0) - MCFG_COMPIS_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_rx)) - // software lists MCFG_SOFTWARE_LIST_ADD("flop_list", "compis") diff --git a/src/mess/drivers/einstein.c b/src/mess/drivers/einstein.c index c5458ced3ed..cebd0d00074 100644 --- a/src/mess/drivers/einstein.c +++ b/src/mess/drivers/einstein.c @@ -271,12 +271,12 @@ TIMER_DEVICE_CALLBACK_MEMBER(einstein_state::einstein_ctc_trigger_callback) WRITE_LINE_MEMBER(einstein_state::einstein_serial_transmit_clock) { - m_uart->transmit_clock(); + m_uart->write_txc(state); } WRITE_LINE_MEMBER(einstein_state::einstein_serial_receive_clock) { - m_uart->receive_clock(); + m_uart->write_rxc(state); } @@ -784,7 +784,7 @@ static MACHINE_CONFIG_START( einstein, einstein_state ) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") /* uart */ - MCFG_I8251_ADD(IC_I060, default_i8251_interface) + MCFG_DEVICE_ADD(IC_I060, I8251, 0) MCFG_WD1770x_ADD(IC_I042, XTAL_X002) diff --git a/src/mess/drivers/elwro800.c b/src/mess/drivers/elwro800.c index 895527fc41c..e60e5349c1e 100644 --- a/src/mess/drivers/elwro800.c +++ b/src/mess/drivers/elwro800.c @@ -592,7 +592,7 @@ static MACHINE_CONFIG_START( elwro800, elwro800_state ) MCFG_DEVICE_ADD("cent_data_in", INPUT_BUFFER, 0) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - MCFG_I8251_ADD("i8251", default_i8251_interface) + MCFG_DEVICE_ADD("i8251", I8251, 0) /* sound hardware */ MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mess/drivers/fk1.c b/src/mess/drivers/fk1.c index bcd43483081..45f0d5f29d5 100644 --- a/src/mess/drivers/fk1.c +++ b/src/mess/drivers/fk1.c @@ -475,8 +475,9 @@ static MACHINE_CONFIG_START( fk1, fk1_state ) MCFG_I8255_ADD( "ppi8255_1", fk1_ppi8255_interface_1 ) MCFG_I8255_ADD( "ppi8255_2", fk1_ppi8255_interface_2 ) MCFG_I8255_ADD( "ppi8255_3", fk1_ppi8255_interface_3 ) + /* uart */ - MCFG_I8251_ADD("uart", default_i8251_interface) + MCFG_DEVICE_ADD("uart", I8251, 0) /* internal ram */ MCFG_RAM_ADD(RAM_TAG) diff --git a/src/mess/drivers/h8.c b/src/mess/drivers/h8.c index 84f3f3c6797..08c1795aa3b 100644 --- a/src/mess/drivers/h8.c +++ b/src/mess/drivers/h8.c @@ -218,7 +218,7 @@ void h8_state::machine_reset() m_cass_state = 1; m_cass_data[0] = 0; m_cass_data[1] = 0; - m_uart->write_rx(0); + m_uart->write_rxd(0); m_cass_data[3] = 0; m_ff_b = 1; } @@ -266,21 +266,15 @@ WRITE_LINE_MEMBER( h8_state::txdata_callback ) m_cass_state = state; } -static const i8251_interface uart_intf = -{ - DEVCB_DRIVER_LINE_MEMBER(h8_state,txdata_callback), //txd_cb - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - TIMER_DEVICE_CALLBACK_MEMBER(h8_state::h8_c) { - m_uart->receive_clock(); - m_uart->transmit_clock(); + /// TODO: double timer rate to get correct duty cycle + m_uart->write_rxc(1); + m_uart->write_txc(1); + + m_uart->write_rxc(0); + m_uart->write_rxc(0); + m_cass_data[3]++; if (m_cass_state) @@ -298,7 +292,7 @@ TIMER_DEVICE_CALLBACK_MEMBER(h8_state::h8_p) if (cass_ws != m_cass_data[0]) { m_cass_data[0] = cass_ws; - m_uart->write_rx((m_cass_data[1] < 12) ? 1 : 0); + m_uart->write_rxd((m_cass_data[1] < 12) ? 1 : 0); m_cass_data[1] = 0; } } @@ -332,7 +326,9 @@ static MACHINE_CONFIG_START( h8, h8_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) /* Devices */ - MCFG_I8251_ADD("uart", uart_intf) + MCFG_DEVICE_ADD("uart", I8251, 0) + MCFG_I8251_TXD_HANDLER(WRITELINE(h8_state,txdata_callback)) + MCFG_CASSETTE_ADD("cassette", h8_cassette_interface) MCFG_TIMER_DRIVER_ADD_PERIODIC("h8_c", h8_state, h8_c, attotime::from_hz(4800)) MCFG_TIMER_DRIVER_ADD_PERIODIC("h8_p", h8_state, h8_p, attotime::from_hz(40000)) diff --git a/src/mess/drivers/horizon.c b/src/mess/drivers/horizon.c index db962d87271..194c850d3fa 100644 --- a/src/mess/drivers/horizon.c +++ b/src/mess/drivers/horizon.c @@ -96,38 +96,6 @@ INPUT_PORTS_END // DEVICE CONFIGURATION //************************************************************************** -//------------------------------------------------- -// i8251_interface usart_l_intf -//------------------------------------------------- - -static const i8251_interface usart_l_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, rs232_port_device, write_rts), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - - -//------------------------------------------------- -// i8251_interface usart_r_intf -//------------------------------------------------- - -static const i8251_interface usart_r_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, rs232_port_device, write_rts), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - - static DEVICE_INPUT_DEFAULTS_START( terminal ) DEVICE_INPUT_DEFAULTS( "TERM_TXBAUD", 0xff, 0x06 ) // 9600 DEVICE_INPUT_DEFAULTS( "TERM_RXBAUD", 0xff, 0x06 ) // 9600 @@ -197,17 +165,24 @@ static MACHINE_CONFIG_START( horizon, horizon_state ) MCFG_CPU_IO_MAP(horizon_io) // devices - MCFG_I8251_ADD(I8251_L_TAG, usart_l_intf) - MCFG_I8251_ADD(I8251_R_TAG, usart_r_intf) + MCFG_DEVICE_ADD(I8251_L_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "serial_terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_L_TAG, i8251_device, write_rx)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_L_TAG, i8251_device, write_rx)) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_L_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_L_TAG, i8251_device, write_dsr)) MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("serial_terminal", terminal) + MCFG_DEVICE_ADD(I8251_R_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_R_TAG, i8251_device, write_rx)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_R_TAG, i8251_device, write_rx)) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_R_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_R_TAG, i8251_device, write_dsr)) // S-100 MCFG_S100_BUS_ADD(s100_intf) diff --git a/src/mess/drivers/imsai.c b/src/mess/drivers/imsai.c index 9a40bac2bd3..5224567fed2 100644 --- a/src/mess/drivers/imsai.c +++ b/src/mess/drivers/imsai.c @@ -99,17 +99,6 @@ static GENERIC_TERMINAL_INTERFACE( terminal_intf ) DEVCB_DRIVER_MEMBER(imsai_state, kbd_put) }; -static const i8251_interface uart_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - static const struct pit8253_interface pit_intf = { { @@ -148,7 +137,7 @@ static MACHINE_CONFIG_START( imsai, imsai_state ) MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf) /* Devices */ - MCFG_I8251_ADD("uart", uart_intf) + MCFG_DEVICE_ADD("uart", I8251, 0) MCFG_PIT8253_ADD( "pit", pit_intf) MACHINE_CONFIG_END diff --git a/src/mess/drivers/irisha.c b/src/mess/drivers/irisha.c index bee8a371072..49091b97ce3 100644 --- a/src/mess/drivers/irisha.c +++ b/src/mess/drivers/irisha.c @@ -434,7 +434,7 @@ static MACHINE_CONFIG_START( irisha, irisha_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) /* Devices */ - MCFG_I8251_ADD("uart", default_i8251_interface) + MCFG_DEVICE_ADD("uart", I8251, 0) MCFG_PIT8253_ADD( "pit8253", irisha_pit8253_intf ) MCFG_I8255_ADD( "ppi8255", irisha_ppi8255_interface ) MCFG_PIC8259_ADD( "pic8259", WRITELINE(irisha_state,irisha_pic_set_int_line), VCC, NULL ) diff --git a/src/mess/drivers/isbc.c b/src/mess/drivers/isbc.c index f574c11aad9..d4c62d0d0fa 100644 --- a/src/mess/drivers/isbc.c +++ b/src/mess/drivers/isbc.c @@ -166,8 +166,8 @@ static const struct pit8253_interface isbc86_pit_config = WRITE_LINE_MEMBER( isbc_state::isbc86_tmr2_w ) { - m_uart8251->rxc_w(state); - m_uart8251->txc_w(state); + m_uart8251->write_rxc(state); + m_uart8251->write_txc(state); } static const i8255_interface isbc86_ppi_interface = @@ -180,17 +180,6 @@ static const i8255_interface isbc86_ppi_interface = DEVCB_NULL }; -static const i8251_interface isbc86_uart8251_interface = -{ - DEVCB_DEVICE_LINE_MEMBER("rs232", rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER("rs232", rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER("rs232", rs232_port_device, write_rts), - DEVCB_DEVICE_LINE_MEMBER("pic_0", pic8259_device, ir6_w), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - READ8_MEMBER( isbc_state::get_slave_ack ) { if (offset == 7) @@ -287,11 +276,16 @@ static MACHINE_CONFIG_START( isbc86, isbc_state ) MCFG_PIC8259_ADD("pic_0", INPUTLINE(":maincpu", 0), VCC, NULL) MCFG_PIT8253_ADD("pit", isbc86_pit_config) MCFG_I8255A_ADD("ppi", isbc86_ppi_interface) - MCFG_I8251_ADD("uart8251", isbc86_uart8251_interface) + + MCFG_DEVICE_ADD("uart8251", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic_0", pic8259_device, ir6_w)) /* video hardware */ MCFG_RS232_PORT_ADD("rs232", default_rs232_devices, "serial_terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_rx)) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_rxd)) MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_cts)) MCFG_RS232_DSR_HANDLER(DEVWRITELINE("uart8251", i8251_device, write_dsr)) MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("serial_terminal", isbc86_terminal) @@ -335,6 +329,12 @@ static MACHINE_CONFIG_START( isbc286, isbc_state ) MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart8274", z80dart_device, dcda_w)) MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart8274", z80dart_device, ctsa_w)) + MCFG_RS232_PORT_ADD("rs232b", default_rs232_devices, "serial_terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart8274", z80dart_device, rxb_w)) + MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart8274", z80dart_device, dcdb_w)) + MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart8274", z80dart_device, ctsb_w)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("serial_terminal", isbc286_terminal) + MCFG_ISBX_SLOT_ADD("sbx1", 0, isbx_cards, NULL) MCFG_ISBX_SLOT_MINTR0_CALLBACK(DEVWRITELINE("pic_1", pic8259_device, ir3_w)) MCFG_ISBX_SLOT_MINTR1_CALLBACK(DEVWRITELINE("pic_1", pic8259_device, ir4_w)) @@ -344,13 +344,6 @@ static MACHINE_CONFIG_START( isbc286, isbc_state ) MCFG_ISBC_215_ADD("isbc_215g", 0x100, "maincpu") MCFG_ISBC_215_IRQ(DEVWRITELINE("pic_0", pic8259_device, ir5_w)) - - /* video hardware */ - MCFG_RS232_PORT_ADD("rs232b", default_rs232_devices, "serial_terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("uart8274", z80dart_device, rxb_w)) - MCFG_RS232_DCD_HANDLER(DEVWRITELINE("uart8274", z80dart_device, dcdb_w)) - MCFG_RS232_CTS_HANDLER(DEVWRITELINE("uart8274", z80dart_device, ctsb_w)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("serial_terminal", isbc286_terminal) MACHINE_CONFIG_END static MACHINE_CONFIG_DERIVED( isbc2861, isbc286 ) diff --git a/src/mess/drivers/jade.c b/src/mess/drivers/jade.c index d6d7d230f7a..0975f070389 100644 --- a/src/mess/drivers/jade.c +++ b/src/mess/drivers/jade.c @@ -85,17 +85,6 @@ static GENERIC_TERMINAL_INTERFACE( terminal_intf ) DEVCB_DRIVER_MEMBER(jade_state, kbd_put) }; -static const i8251_interface uart_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - void jade_state::machine_reset() { m_term_data = 0; @@ -111,7 +100,7 @@ static MACHINE_CONFIG_START( jade, jade_state ) MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf) /* Devices */ - MCFG_I8251_ADD("uart", uart_intf) + MCFG_DEVICE_ADD("uart", I8251, 0) MACHINE_CONFIG_END /* ROM definition */ diff --git a/src/mess/drivers/kyocera.c b/src/mess/drivers/kyocera.c index fc565ef3efa..846e835e8af 100644 --- a/src/mess/drivers/kyocera.c +++ b/src/mess/drivers/kyocera.c @@ -1203,19 +1203,6 @@ static IM6402_INTERFACE( uart_intf ) DEVCB_NULL }; -/* I8251 Interface */ - -static const i8251_interface tandy200_uart_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_rts), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - /* Machine Drivers */ void kc85_state::machine_start() @@ -1416,6 +1403,7 @@ static MACHINE_CONFIG_START( kc85, kc85_state ) /* devices */ 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_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) @@ -1461,8 +1449,11 @@ static MACHINE_CONFIG_START( pc8201, pc8201_state ) /* devices */ 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_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IM6402_TAG, im6402_device, write_rx)) MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_printers, "image") MCFG_CENTRONICS_BUSY_HANDLER(WRITELINE(kc85_state, write_centronics_busy)) @@ -1516,8 +1507,12 @@ static MACHINE_CONFIG_START( trsm100, trsm100_state ) /* devices */ 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_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(IM6402_TAG, im6402_device, write_rx)) + MCFG_CENTRONICS_ADD(CENTRONICS_TAG, centronics_printers, "image") MCFG_CASSETTE_ADD("cassette", kc85_cassette_interface) // MCFG_MC14412_ADD(MC14412_TAG, XTAL_1MHz) @@ -1566,10 +1561,14 @@ static MACHINE_CONFIG_START( tandy200, tandy200_state ) /* devices */ MCFG_I8155_ADD(I8155_TAG, XTAL_4_9152MHz/2, tandy200_8155_intf) MCFG_RP5C01_ADD(RP5C01A_TAG, XTAL_32_768kHz, tandy200_rtc_intf) - MCFG_I8251_ADD(I8251_TAG, /*XTAL_4_9152MHz/2,*/ tandy200_uart_intf) + + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) /*XTAL_4_9152MHz/2,*/ + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rx)) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) // MCFG_MC14412_ADD(MC14412_TAG, XTAL_1MHz) diff --git a/src/mess/drivers/m20.c b/src/mess/drivers/m20.c index 8eb6a720608..6db9d1331bf 100644 --- a/src/mess/drivers/m20.c +++ b/src/mess/drivers/m20.c @@ -262,14 +262,14 @@ WRITE_LINE_MEMBER( m20_state::pic_irq_line_w ) WRITE_LINE_MEMBER( m20_state::tty_clock_tick_w ) { - m_ttyi8251->transmit_clock(); - m_ttyi8251->receive_clock(); + m_ttyi8251->write_txc(state); + m_ttyi8251->write_rxc(state); } WRITE_LINE_MEMBER( m20_state::kbd_clock_tick_w ) { - m_kbdi8251->transmit_clock(); - m_kbdi8251->receive_clock(); + m_kbdi8251->write_txc(state); + m_kbdi8251->write_rxc(state); } WRITE_LINE_MEMBER( m20_state::timer_tick_w ) @@ -866,28 +866,6 @@ void m20_state::fdc_intrq_w(bool state) m_i8259->ir0_w(state); } -static const i8251_interface kbd_i8251_intf = -{ - DEVCB_DRIVER_LINE_MEMBER(m20_state, kbd_tx), - DEVCB_NULL, // dtr - DEVCB_NULL, // rts - DEVCB_DRIVER_LINE_MEMBER(m20_state, kbd_rxrdy_int), // rx ready - DEVCB_NULL, // tx ready - DEVCB_NULL, // tx empty - DEVCB_NULL // syndet -}; - -static const i8251_interface tty_i8251_intf = -{ - DEVCB_NULL, // txd out - DEVCB_NULL, // dtr - DEVCB_NULL, // rts - DEVCB_NULL, // rx ready - DEVCB_NULL, // tx ready - DEVCB_NULL, // tx empty - DEVCB_NULL // syndet -}; - static unsigned char kbxlat[] = { 0x00, '\\', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', @@ -987,8 +965,13 @@ static MACHINE_CONFIG_START( m20, m20_state ) MCFG_FLOPPY_DRIVE_ADD("fd1797:1", m20_floppies, "5dd", m20_state::floppy_formats) MCFG_MC6845_ADD("crtc", MC6845, "screen", PIXEL_CLOCK/8, mc6845_intf) /* hand tuned to get ~50 fps */ MCFG_I8255A_ADD("ppi8255", ppi_interface) - MCFG_I8251_ADD("i8251_1", kbd_i8251_intf) - MCFG_I8251_ADD("i8251_2", tty_i8251_intf) + + MCFG_DEVICE_ADD("i8251_1", I8251, 0) + MCFG_I8251_TXD_HANDLER(WRITELINE(m20_state, kbd_tx)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(m20_state, kbd_rxrdy_int)) + + MCFG_DEVICE_ADD("i8251_2", I8251, 0) + MCFG_PIT8253_ADD("pit8253", pit8253_intf) MCFG_PIC8259_ADD("i8259", WRITELINE(m20_state, pic_irq_line_w), VCC, NULL) diff --git a/src/mess/drivers/mbc200.c b/src/mess/drivers/mbc200.c index 0b594b3065c..53d54f0664b 100644 --- a/src/mess/drivers/mbc200.c +++ b/src/mess/drivers/mbc200.c @@ -277,8 +277,8 @@ static MACHINE_CONFIG_START( mbc200, mbc200_state ) MCFG_MC6845_ADD("crtc", H46505, "screen", XTAL_8MHz / 4, mbc200_crtc) // HD46505SP MCFG_I8255_ADD("ppi8255_1", mbc200_ppi8255_interface_1) // i8255AC-5 MCFG_I8255_ADD("ppi8255_2", mbc200_ppi8255_interface_2) // i8255AC-5 - MCFG_I8251_ADD("i8251_1", default_i8251_interface) // INS8251N - MCFG_I8251_ADD("i8251_2", default_i8251_interface) // INS8251A + MCFG_DEVICE_ADD("i8251_1", I8251, 0) // INS8251N + MCFG_DEVICE_ADD("i8251_2", I8251, 0) // INS8251A MCFG_MB8876_ADD("fdc",mbc200_mb8876_interface) // MB8876A MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(mbc200_floppy_interface) MACHINE_CONFIG_END diff --git a/src/mess/drivers/mbc55x.c b/src/mess/drivers/mbc55x.c index e7d8caaa0ce..61c527bd8fd 100644 --- a/src/mess/drivers/mbc55x.c +++ b/src/mess/drivers/mbc55x.c @@ -257,7 +257,9 @@ static MACHINE_CONFIG_START( mbc55x, mbc55x_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS,MONO_TAG, 0.75) /* Devices */ - MCFG_I8251_ADD(I8251A_KB_TAG,mbc55x_i8251a_interface) + MCFG_DEVICE_ADD(I8251A_KB_TAG, I8251, 0) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE(PIC8259_TAG, pic8259_device, ir3_w)) + MCFG_PIT8253_ADD( PIT8253_TAG, mbc55x_pit8253_config ) MCFG_PIC8259_ADD( PIC8259_TAG, INPUTLINE(MAINCPU_TAG, INPUT_LINE_IRQ0), VCC, NULL ) MCFG_I8255_ADD( PPI8255_TAG, mbc55x_ppi8255_interface ) diff --git a/src/mess/drivers/mc1502.c b/src/mess/drivers/mc1502.c index 87e18c51b59..58b69aa747b 100644 --- a/src/mess/drivers/mc1502.c +++ b/src/mess/drivers/mc1502.c @@ -201,18 +201,6 @@ I8255_INTERFACE( mc1502_ppi8255_interface_2 ) DEVCB_DRIVER_MEMBER(mc1502_state,mc1502_kppi_portc_w) }; -const i8251_interface mc1502_i8251_interface = -{ - /* XXX RxD data are accessible via PPI port C, bit 7 */ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_DEVICE_LINE_MEMBER("pic8259", pic8259_device, ir7_w), /* default handler does nothing */ - DEVCB_DEVICE_LINE_MEMBER("pic8259", pic8259_device, ir7_w), - DEVCB_NULL, - DEVCB_DRIVER_LINE_MEMBER(mc1502_state, mc1502_i8251_syndet) -}; - WRITE_LINE_MEMBER(mc1502_state::mc1502_i8251_syndet) { if (!BIT(m_ppi_portc,3)) @@ -221,8 +209,8 @@ WRITE_LINE_MEMBER(mc1502_state::mc1502_i8251_syndet) WRITE_LINE_MEMBER(mc1502_state::mc1502_pit8253_out1_changed) { - machine().device<i8251_device>("upd8251")->txc_w(state); - machine().device<i8251_device>("upd8251")->rxc_w(state); + machine().device<i8251_device>("upd8251")->write_txc(state); + machine().device<i8251_device>("upd8251")->write_rxc(state); } WRITE_LINE_MEMBER(mc1502_state::mc1502_pit8253_out2_changed) @@ -342,7 +330,12 @@ static MACHINE_CONFIG_START( mc1502, mc1502_state ) MCFG_I8255_ADD( "ppi8255n1", mc1502_ppi8255_interface_1 ) MCFG_I8255_ADD( "ppi8255n2", mc1502_ppi8255_interface_2 ) - MCFG_I8251_ADD( "upd8251", mc1502_i8251_interface ) + MCFG_DEVICE_ADD( "upd8251", I8251, 0) + /* XXX RxD data are accessible via PPI port C, bit 7 */ + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) /* default handler does nothing */ + MCFG_I8251_TXRDY_HANDLER(DEVWRITELINE("pic8259", pic8259_device, ir7_w)) + MCFG_I8251_SYNDET_HANDLER(WRITELINE(mc1502_state, mc1502_i8251_syndet)) + MCFG_SERIAL_ADD( "irps", mc1502_serial ) MCFG_ISA8_BUS_ADD("isa", ":maincpu", mc1502_isabus_intf) diff --git a/src/mess/drivers/nc.c b/src/mess/drivers/nc.c index 1c0e68255a9..8c9d6e08496 100644 --- a/src/mess/drivers/nc.c +++ b/src/mess/drivers/nc.c @@ -699,8 +699,12 @@ TIMER_CALLBACK_MEMBER(nc_state::nc_serial_timer_callback) { i8251_device *uart = machine().device<i8251_device>("uart"); - uart->transmit_clock(); - uart->receive_clock(); + /// TODO: double timer rate to provide correct duty cycle + uart->write_txc(1); + uart->write_rxc(1); + + uart->write_txc(0); + uart->write_rxc(0); } WRITE8_MEMBER(nc_state::nc_uart_control_w) @@ -805,18 +809,6 @@ static RP5C01_INTERFACE( rtc_intf ) DEVCB_DRIVER_LINE_MEMBER(nc_state,nc100_tc8521_alarm_callback) }; -static const i8251_interface nc100_uart_interface = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_DRIVER_LINE_MEMBER(nc_state,nc100_rxrdy_callback), - DEVCB_DRIVER_LINE_MEMBER(nc_state,nc100_txrdy_callback), - DEVCB_NULL, - DEVCB_NULL -}; - - WRITE_LINE_MEMBER(nc_state::write_nc100_centronics_ack) { m_centronics_ack = state; @@ -1140,18 +1132,6 @@ WRITE_LINE_MEMBER(nc_state::nc200_rxrdy_callback) nc200_refresh_uart_interrupt(); } -static const i8251_interface nc200_uart_interface= -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_DRIVER_LINE_MEMBER(nc_state,nc200_rxrdy_callback), - DEVCB_DRIVER_LINE_MEMBER(nc_state,nc200_txrdy_callback), - DEVCB_NULL, - DEVCB_NULL -}; - - void nc_state::nc200_fdc_interrupt(bool state) { #if 0 @@ -1490,7 +1470,9 @@ static MACHINE_CONFIG_START( nc100, nc_state ) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") /* uart */ - MCFG_I8251_ADD("uart", nc100_uart_interface) + MCFG_DEVICE_ADD("uart", I8251, 0) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(nc_state,nc100_rxrdy_callback)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(nc_state,nc100_txrdy_callback)) /* rtc */ MCFG_RP5C01_ADD("rtc", XTAL_32_768kHz, rtc_intf) @@ -1540,8 +1522,9 @@ static MACHINE_CONFIG_DERIVED( nc200, nc100 ) MCFG_CENTRONICS_ACK_HANDLER(WRITELINE(nc_state, write_nc200_centronics_ack)) /* uart */ - MCFG_DEVICE_REMOVE("uart") - MCFG_I8251_ADD("uart", nc200_uart_interface) + MCFG_DEVICE_MODIFY("uart") + MCFG_I8251_RXRDY_HANDLER(WRITELINE(nc_state,nc200_rxrdy_callback)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(nc_state,nc200_txrdy_callback)) /* no rtc */ MCFG_DEVICE_REMOVE("rtc") diff --git a/src/mess/drivers/pc6001.c b/src/mess/drivers/pc6001.c index abf2a8a201a..226a1aa0e93 100644 --- a/src/mess/drivers/pc6001.c +++ b/src/mess/drivers/pc6001.c @@ -1918,18 +1918,6 @@ static I8255_INTERFACE( pc6001_ppi8255_interface ) DEVCB_DRIVER_MEMBER(pc6001_state,pc6001_8255_portc_w) }; -static const i8251_interface pc6001_usart_interface= -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - - static const ay8910_interface pc6001_ay_interface = { AY8910_LEGACY_OUTPUT, @@ -2343,7 +2331,7 @@ static MACHINE_CONFIG_START( pc6001, pc6001_state ) MCFG_I8255_ADD( "ppi8255", pc6001_ppi8255_interface ) /* uart */ - MCFG_I8251_ADD("uart", pc6001_usart_interface) + MCFG_DEVICE_ADD("uart", I8251, 0) MCFG_CARTSLOT_ADD("cart") MCFG_CARTSLOT_EXTENSION_LIST("bin") diff --git a/src/mess/drivers/pc8001.c b/src/mess/drivers/pc8001.c index db8bb5f389a..7aac44c954c 100644 --- a/src/mess/drivers/pc8001.c +++ b/src/mess/drivers/pc8001.c @@ -411,19 +411,6 @@ static UPD3301_INTERFACE( pc8001_upd3301_intf ) DEVCB_NULL }; -/* 8251 Interface */ - -static const i8251_interface uart_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - /* 8255 Interface */ static I8255A_INTERFACE( ppi_intf ) @@ -567,7 +554,8 @@ static MACHINE_CONFIG_START( pc8001, pc8001_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) /* devices */ - MCFG_I8251_ADD(I8251_TAG, uart_intf) + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8255A_ADD(I8255A_TAG, ppi_intf) MCFG_I8257_ADD(I8257_TAG, 4000000, dmac_intf) MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) @@ -606,7 +594,8 @@ static MACHINE_CONFIG_START( pc8001mk2, pc8001mk2_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) /* devices */ - MCFG_I8251_ADD(I8251_TAG, uart_intf) + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8255A_ADD(I8255A_TAG, ppi_intf) MCFG_I8257_ADD(I8257_TAG, 4000000, dmac_intf) MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) diff --git a/src/mess/drivers/pc8401a.c b/src/mess/drivers/pc8401a.c index ea005ab6892..15799c5ff12 100644 --- a/src/mess/drivers/pc8401a.c +++ b/src/mess/drivers/pc8401a.c @@ -569,19 +569,6 @@ static I8255A_INTERFACE( ppi_intf ) DEVCB_DRIVER_MEMBER(pc8401a_state, ppi_pc_w) }; -/* I8251 Interface */ - -static const i8251_interface uart_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_rts), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - /* Machine Drivers */ static MACHINE_CONFIG_START( pc8401a, pc8401a_state ) @@ -596,10 +583,14 @@ static MACHINE_CONFIG_START( pc8401a, pc8401a_state ) /* devices */ MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) MCFG_I8255A_ADD(I8255A_TAG, ppi_intf) - MCFG_I8251_ADD(I8251_TAG, uart_intf) + + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rx)) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) /* video hardware */ @@ -633,8 +624,15 @@ static MACHINE_CONFIG_START( pc8500, pc8500_state ) /* devices */ MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) MCFG_I8255A_ADD(I8255A_TAG, ppi_intf) - MCFG_I8251_ADD(I8251_TAG, uart_intf) + + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) /* video hardware */ MCFG_FRAGMENT_ADD(pc8500_video) diff --git a/src/mess/drivers/pc8801.c b/src/mess/drivers/pc8801.c index 38ab765c68c..4b2100337d7 100644 --- a/src/mess/drivers/pc8801.c +++ b/src/mess/drivers/pc8801.c @@ -2615,17 +2615,6 @@ WRITE_LINE_MEMBER( pc8801_state::rxrdy_w ) // ... } -static const i8251_interface uart_intf = -{ - DEVCB_DRIVER_LINE_MEMBER(pc8801_state,txdata_callback), //txd_cb - DEVCB_NULL, - DEVCB_DRIVER_LINE_MEMBER(pc8801_state,rxrdy_w), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - static const cassette_interface pc8801_cassette_interface = { cassette_default_formats, @@ -2663,7 +2652,9 @@ static MACHINE_CONFIG_START( pc8801, pc8801_state ) MCFG_CASSETTE_ADD("cassette", pc8801_cassette_interface) MCFG_SOFTWARE_LIST_ADD("tape_list","pc8801_cass") - MCFG_I8251_ADD(I8251_TAG, uart_intf) + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(WRITELINE(pc8801_state, txdata_callback)) + MCFG_I8251_RTS_HANDLER(WRITELINE(pc8801_state, rxrdy_w)) MCFG_FLOPPY_DRIVE_ADD("upd765:0", pc88_floppies, "525hd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD("upd765:1", pc88_floppies, "525hd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/pc9801.c b/src/mess/drivers/pc9801.c index 3feecbad542..81b280878fb 100644 --- a/src/mess/drivers/pc9801.c +++ b/src/mess/drivers/pc9801.c @@ -3410,17 +3410,6 @@ void pc9801_state::pc9801rs_fdc_drq(bool state) printf("DRQ %02x %d\n",m_fdc_ctrl,state); } -static const i8251_interface pc9801_uart_interface = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - UINT32 pc9801_state::pc9801_286_a20(bool state) { return (state ? 0xffffff : 0x0fffff); @@ -3714,7 +3703,7 @@ static MACHINE_CONFIG_START( pc9801, pc9801_state ) MCFG_FRAGMENT_ADD(pc9801_cbus) MCFG_FRAGMENT_ADD(pc9801_sasi) MCFG_UPD1990A_ADD(UPD1990A_TAG, XTAL_32_768kHz, NULL, NULL) - MCFG_I8251_ADD(UPD8251_TAG, pc9801_uart_interface) + MCFG_DEVICE_ADD(UPD8251_TAG, I8251, 0) MCFG_UPD765A_ADD("upd765_2hd", false, true) MCFG_UPD765A_ADD("upd765_2dd", false, true) @@ -3782,7 +3771,7 @@ static MACHINE_CONFIG_START( pc9801rs, pc9801_state ) MCFG_FRAGMENT_ADD(pc9801_mouse) MCFG_FRAGMENT_ADD(pc9801_ide) MCFG_UPD1990A_ADD("upd1990a", XTAL_32_768kHz, NULL, NULL) - MCFG_I8251_ADD(UPD8251_TAG, pc9801_uart_interface) + MCFG_DEVICE_ADD(UPD8251_TAG, I8251, 0) MCFG_UPD765A_ADD("upd765_2hd", false, true) //"upd765_2dd" @@ -3860,7 +3849,7 @@ static MACHINE_CONFIG_START( pc9821, pc9801_state ) MCFG_FRAGMENT_ADD(pc9801_mouse) MCFG_FRAGMENT_ADD(pc9801_ide) MCFG_UPD1990A_ADD("upd1990a", XTAL_32_768kHz, NULL, NULL) - MCFG_I8251_ADD(UPD8251_TAG, pc9801_uart_interface) + MCFG_DEVICE_ADD(UPD8251_TAG, I8251, 0) MCFG_UPD765A_ADD("upd765_2hd", false, true) //"upd765_2dd" diff --git a/src/mess/drivers/pk8020.c b/src/mess/drivers/pk8020.c index f7d06771e9b..ec78259b03f 100644 --- a/src/mess/drivers/pk8020.c +++ b/src/mess/drivers/pk8020.c @@ -225,8 +225,8 @@ static MACHINE_CONFIG_START( pk8020, pk8020_state ) MCFG_I8255_ADD( "ppi8255_3", pk8020_ppi8255_interface_3 ) MCFG_PIT8253_ADD( "pit8253", pk8020_pit8253_intf ) MCFG_PIC8259_ADD( "pic8259", WRITELINE(pk8020_state,pk8020_pic_set_int_line), VCC, NULL ) - MCFG_I8251_ADD( "rs232", default_i8251_interface) - MCFG_I8251_ADD( "lan", default_i8251_interface) + MCFG_DEVICE_ADD( "rs232", I8251, 0) + MCFG_DEVICE_ADD( "lan", I8251, 0) MCFG_FD1793_ADD( "wd1793", pk8020_wd17xx_interface ) diff --git a/src/mess/drivers/pmd85.c b/src/mess/drivers/pmd85.c index 80b180021b4..cabbbfe72b7 100644 --- a/src/mess/drivers/pmd85.c +++ b/src/mess/drivers/pmd85.c @@ -542,17 +542,6 @@ static const cassette_interface pmd85_cassette_interface = NULL }; -const i8251_interface pmd85_i8251_interface = -{ - DEVCB_DRIVER_LINE_MEMBER(pmd85_state, write_cas_tx), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - /* machine definition */ static MACHINE_CONFIG_START( pmd85, pmd85_state ) @@ -585,7 +574,8 @@ static MACHINE_CONFIG_START( pmd85, pmd85_state ) MCFG_CASSETTE_ADD( "cassette", pmd85_cassette_interface ) /* uart */ - MCFG_I8251_ADD("uart", pmd85_i8251_interface) + MCFG_DEVICE_ADD("uart", I8251, 0) + MCFG_I8251_TXD_HANDLER(WRITELINE(pmd85_state, write_cas_tx)) /* internal ram */ MCFG_RAM_ADD(RAM_TAG) diff --git a/src/mess/drivers/poly88.c b/src/mess/drivers/poly88.c index fddd46846d1..bae385646a0 100644 --- a/src/mess/drivers/poly88.c +++ b/src/mess/drivers/poly88.c @@ -196,7 +196,9 @@ static MACHINE_CONFIG_START( poly88, poly88_state ) MCFG_CASSETTE_ADD( "cassette", poly88_cassette_interface ) /* uart */ - MCFG_I8251_ADD("uart", poly88_usart_interface) + MCFG_DEVICE_ADD("uart", I8251, 0) + MCFG_I8251_TXD_HANDLER(WRITELINE(poly88_state,write_cas_tx)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(poly88_state,poly88_usart_rxready)) /* snapshot */ MCFG_SNAPSHOT_ADD("snapshot", poly88_state, poly88, "img", 0) diff --git a/src/mess/drivers/pp01.c b/src/mess/drivers/pp01.c index 52e5c61da5f..8881f292f64 100644 --- a/src/mess/drivers/pp01.c +++ b/src/mess/drivers/pp01.c @@ -218,7 +218,9 @@ static MACHINE_CONFIG_START( pp01, pp01_state ) //MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25) /* Devices */ - MCFG_I8251_ADD("uart", pp01_uart_intf) + MCFG_DEVICE_ADD("uart", I8251, 0) + // when rts and dtr are both high, the uart is being used for cassette operations + MCFG_PIT8253_ADD( "pit8253", pp01_pit8253_intf ) MCFG_I8255A_ADD( "ppi8255", pp01_ppi8255_interface ) diff --git a/src/mess/drivers/px8.c b/src/mess/drivers/px8.c index 4a5e4b15a91..10b65a6c522 100644 --- a/src/mess/drivers/px8.c +++ b/src/mess/drivers/px8.c @@ -723,21 +723,6 @@ GFXDECODE_END ***************************************************************************/ /*------------------------------------------------- - i8251_interface i8251_intf --------------------------------------------------*/ - -static const i8251_interface i8251_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - -/*------------------------------------------------- cassette_interface px8_cassette_interface -------------------------------------------------*/ @@ -823,7 +808,8 @@ static MACHINE_CONFIG_START( px8, px8_state ) MCFG_CARTSLOT_EXTENSION_LIST("bin,rom") /* devices */ - MCFG_I8251_ADD(I8251_TAG, i8251_intf) + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_CASSETTE_ADD("cassette", px8_cassette_interface) /* internal ram */ diff --git a/src/mess/drivers/rainbow.c b/src/mess/drivers/rainbow.c index 9e423403288..623b94b0895 100644 --- a/src/mess/drivers/rainbow.c +++ b/src/mess/drivers/rainbow.c @@ -178,6 +178,8 @@ W17 pulls J1 serial port pin 1 to GND when set (chassis to logical GND). #include "rainbow.lh" // BEZEL - LAYOUT with LEDs for diag 1-7, keyboard 8-11 and floppy 20-23 +#define LK201_TAG "lk201" + class rainbow_state : public driver_device { public: @@ -1031,8 +1033,12 @@ WRITE_LINE_MEMBER(rainbow_state::kbd_txready_w) TIMER_DEVICE_CALLBACK_MEMBER(rainbow_state::keyboard_tick) { - m_kbd8251->transmit_clock(); - m_kbd8251->receive_clock(); + /// TODO: double clock speed to get correct duty cycle + m_kbd8251->write_txc(1); + m_kbd8251->write_rxc(1); + + m_kbd8251->write_txc(0); + m_kbd8251->write_rxc(0); if (MOTOR_DISABLE_counter) MOTOR_DISABLE_counter--; @@ -1105,17 +1111,6 @@ static const floppy_interface floppy_intf = NULL }; -static const i8251_interface i8251_intf = -{ - DEVCB_DRIVER_LINE_MEMBER(rainbow_state, kbd_tx), // txd out - DEVCB_NULL, // dtr - DEVCB_NULL, // rts - DEVCB_DRIVER_LINE_MEMBER(rainbow_state, kbd_rxready_w), - DEVCB_DRIVER_LINE_MEMBER(rainbow_state, kbd_txready_w), - DEVCB_NULL, // tx empty - DEVCB_NULL // syndet -}; - static MACHINE_CONFIG_START( rainbow, rainbow_state ) MCFG_DEFAULT_LAYOUT(layout_rainbow) @@ -1145,11 +1140,15 @@ static MACHINE_CONFIG_START( rainbow, rainbow_state ) MCFG_LEGACY_FLOPPY_4_DRIVES_ADD(floppy_intf) MCFG_SOFTWARE_LIST_ADD("flop_list","rainbow") - MCFG_I8251_ADD("kbdser", i8251_intf) - MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", rainbow_state, keyboard_tick, attotime::from_hz(4800*16)) // 8251 is set to /16 on the clock input + MCFG_DEVICE_ADD("kbdser", I8251, 0) + MCFG_I8251_TXD_HANDLER(WRITELINE(rainbow_state, kbd_tx)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(rainbow_state, kbd_rxready_w)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(rainbow_state, kbd_txready_w)) - MCFG_LK201_ADD() - MCFG_LK201_SET_TX_CALLBACK(DEVWRITELINE("kbdser", i8251_device, write_rx)) + MCFG_DEVICE_ADD(LK201_TAG, LK201, 0) + MCFG_LK201_TX_HANDLER(DEVWRITELINE("kbdser", i8251_device, write_rxd)) + + MCFG_TIMER_DRIVER_ADD_PERIODIC("keyboard", rainbow_state, keyboard_tick, attotime::from_hz(4800*16)) // 8251 is set to /16 on the clock input MCFG_NVRAM_ADD_0FILL("nvram") MACHINE_CONFIG_END diff --git a/src/mess/drivers/sage2.c b/src/mess/drivers/sage2.c index 772468a2ba1..12b25dcccf9 100644 --- a/src/mess/drivers/sage2.c +++ b/src/mess/drivers/sage2.c @@ -414,20 +414,14 @@ static const struct pit8253_interface pit0_intf = WRITE_LINE_MEMBER( sage2_state::br1_w ) { - if (state) - { - m_usart0->transmit_clock(); - m_usart0->receive_clock(); - } + m_usart0->write_txc(state); + m_usart0->write_rxc(state); } WRITE_LINE_MEMBER( sage2_state::br2_w ) { - if (state) - { - m_usart1->transmit_clock(); - m_usart1->receive_clock(); - } + m_usart1->write_txc(state); + m_usart1->write_rxc(state); } static const struct pit8253_interface pit1_intf = @@ -449,39 +443,6 @@ static const struct pit8253_interface pit1_intf = } }; - -//------------------------------------------------- -// i8251_interface usart0_intf -//------------------------------------------------- - -static const i8251_interface usart0_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, rs232_port_device, write_rts), - DEVCB_CPU_INPUT_LINE(M68000_TAG, M68K_IRQ_5), - DEVCB_DEVICE_LINE_MEMBER(I8259_TAG, pic8259_device, ir2_w), - DEVCB_NULL, - DEVCB_NULL -}; - - -//------------------------------------------------- -// i8251_interface usart1_intf -//------------------------------------------------- - -static const i8251_interface usart1_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, rs232_port_device, write_rts), - DEVCB_DEVICE_LINE_MEMBER(I8259_TAG, pic8259_device, ir1_w), - DEVCB_DEVICE_LINE_MEMBER(I8259_TAG, pic8259_device, ir3_w), - DEVCB_NULL, - DEVCB_NULL -}; - - //------------------------------------------------- // upd765_interface fdc_intf //------------------------------------------------- @@ -557,8 +518,30 @@ static MACHINE_CONFIG_START( sage2, sage2_state ) MCFG_I8255A_ADD(I8255A_1_TAG, ppi1_intf) MCFG_PIT8253_ADD(I8253_0_TAG, pit0_intf) MCFG_PIT8253_ADD(I8253_1_TAG, pit1_intf) - MCFG_I8251_ADD(I8251_0_TAG, usart0_intf) - MCFG_I8251_ADD(I8251_1_TAG, usart1_intf) + + MCFG_DEVICE_ADD(I8251_0_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE(M68000_TAG, m68000_base_device, write_irq5)) + MCFG_I8251_TXRDY_HANDLER(DEVWRITELINE(I8259_TAG, pic8259_device, ir2_w)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "serial_terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_0_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_0_TAG, i8251_device, write_dsr)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("serial_terminal", terminal) + + MCFG_DEVICE_ADD(I8251_1_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(DEVWRITELINE(I8259_TAG, pic8259_device, ir1_w)) + MCFG_I8251_TXRDY_HANDLER(DEVWRITELINE(I8259_TAG, pic8259_device, ir3_w)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_1_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_1_TAG, i8251_device, write_dsr)) + MCFG_UPD765A_ADD(UPD765_TAG, false, false) MCFG_CENTRONICS_ADD("centronics", centronics_printers, "image") @@ -574,15 +557,6 @@ static MACHINE_CONFIG_START( sage2, sage2_state ) MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":1", sage2_floppies, "525qd", floppy_image_device::default_floppy_formats) MCFG_IEEE488_BUS_ADD() - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, "serial_terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_0_TAG, i8251_device, write_rx)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_0_TAG, i8251_device, write_dsr)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("serial_terminal", terminal) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_1_TAG, i8251_device, write_rx)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_1_TAG, i8251_device, write_dsr)) - // internal ram MCFG_RAM_ADD(RAM_TAG) MCFG_RAM_DEFAULT_SIZE("512K") diff --git a/src/mess/drivers/sbrain.c b/src/mess/drivers/sbrain.c index 52d0e36148e..44e43e7b177 100644 --- a/src/mess/drivers/sbrain.c +++ b/src/mess/drivers/sbrain.c @@ -269,28 +269,6 @@ static I8255_INTERFACE( ppi_intf ) DEVCB_DRIVER_MEMBER(sbrain_state, ppi_pc_w), // Port C write }; -static const i8251_interface u0_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - -static const i8251_interface u1_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - MACHINE_RESET_MEMBER( sbrain_state, sbrain ) { m_beep->set_frequency(800); @@ -364,8 +342,11 @@ static MACHINE_CONFIG_START( sbrain, sbrain_state ) /* Devices */ MCFG_I8255_ADD("ppi", ppi_intf) - MCFG_I8251_ADD("uart0", u0_intf) - MCFG_I8251_ADD("uart1", u1_intf) + + MCFG_DEVICE_ADD("uart0", I8251, 0) + + MCFG_DEVICE_ADD("uart1", I8251, 0) + MCFG_COM8116_ADD("brg", XTAL_5_0688MHz, NULL, WRITELINE(sbrain_state, fr_w), WRITELINE(sbrain_state, ft_w)) MCFG_FD1791x_ADD("fdc", XTAL_16MHz / 16) MCFG_FLOPPY_DRIVE_ADD("fdc:0", sbrain_floppies, "525dd", floppy_image_device::default_floppy_formats) diff --git a/src/mess/drivers/sdk86.c b/src/mess/drivers/sdk86.c index e8a5c9d40ed..a09b0fd1c34 100644 --- a/src/mess/drivers/sdk86.c +++ b/src/mess/drivers/sdk86.c @@ -131,20 +131,13 @@ READ8_MEMBER( sdk86_state::kbd_r ) TIMER_DEVICE_CALLBACK_MEMBER( sdk86_state::serial_tick ) { - m_usart->receive_clock(); - m_usart->transmit_clock(); -} + /// TODO: double timer frequency to get correct duty cycle + m_usart->write_rxc(1); + m_usart->write_txc(1); -static const i8251_interface usart_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_dtr), - DEVCB_NULL, // connected to CTS - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; + m_usart->write_rxc(0); + m_usart->write_txc(0); +} static I8279_INTERFACE( sdk86_intf ) { @@ -176,15 +169,20 @@ static MACHINE_CONFIG_START( sdk86, sdk86_state ) MCFG_DEFAULT_LAYOUT(layout_sdk86) /* Devices */ - MCFG_I8251_ADD(I8251_TAG, usart_intf) - MCFG_I8279_ADD("i8279", 2500000, sdk86_intf) // based on divider + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_cts)) MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "serial_terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rx)) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("serial_terminal", terminal) + MCFG_TIMER_DRIVER_ADD_PERIODIC("serial", sdk86_state, serial_tick, attotime::from_hz(307200)) + + MCFG_I8279_ADD("i8279", 2500000, sdk86_intf) // based on divider + MACHINE_CONFIG_END /* ROM definition */ diff --git a/src/mess/drivers/sg1000.c b/src/mess/drivers/sg1000.c index 5dba367127d..9d5d209af21 100644 --- a/src/mess/drivers/sg1000.c +++ b/src/mess/drivers/sg1000.c @@ -650,21 +650,6 @@ static I8255_INTERFACE( sf7000_ppi_intf ) DEVCB_DRIVER_MEMBER(sf7000_state, ppi_pc_w) // Port C write }; -//------------------------------------------------- -// i8251_interface usart_intf -//------------------------------------------------- - -static const i8251_interface usart_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_rts), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - /*------------------------------------------------- upd765_interface sf7000_upd765_interface -------------------------------------------------*/ @@ -881,7 +866,16 @@ static MACHINE_CONFIG_START( sf7000, sf7000_state ) /* devices */ MCFG_I8255_ADD(UPD9255_0_TAG, sc3000_ppi_intf) MCFG_I8255_ADD(UPD9255_1_TAG, sf7000_ppi_intf) - MCFG_I8251_ADD(UPD8251_TAG, usart_intf) + + MCFG_DEVICE_ADD(UPD8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(UPD8251_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(UPD8251_TAG, i8251_device, write_dsr)) + MCFG_UPD765A_ADD(UPD765_TAG, false, false) MCFG_FLOPPY_DRIVE_ADD(UPD765_TAG ":0", sf7000_floppies, "3ssdd", sf7000_state::floppy_formats) @@ -891,10 +885,6 @@ static MACHINE_CONFIG_START( sf7000, sf7000_state ) MCFG_CASSETTE_ADD("cassette", sc3000_cassette_interface) - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(UPD8251_TAG, i8251_device, write_rx)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(UPD8251_TAG, i8251_device, write_dsr)) - /* software lists */ MCFG_SOFTWARE_LIST_ADD("flop_list","sf7000") diff --git a/src/mess/drivers/sm1800.c b/src/mess/drivers/sm1800.c index 45b30e8dc75..e2bfdd0a520 100644 --- a/src/mess/drivers/sm1800.c +++ b/src/mess/drivers/sm1800.c @@ -190,7 +190,7 @@ static MACHINE_CONFIG_START( sm1800, sm1800_state ) /* Devices */ MCFG_I8255_ADD ("i8255", sm1800_ppi8255_interface ) MCFG_I8275_ADD ("i8275", sm1800_i8275_interface) - MCFG_I8251_ADD("i8251", default_i8251_interface) + MCFG_DEVICE_ADD("i8251", I8251, 0) MACHINE_CONFIG_END /* ROM definition */ diff --git a/src/mess/drivers/softbox.c b/src/mess/drivers/softbox.c index b45d3c145e5..68e18f1aa82 100644 --- a/src/mess/drivers/softbox.c +++ b/src/mess/drivers/softbox.c @@ -173,22 +173,6 @@ INPUT_PORTS_END //************************************************************************** //------------------------------------------------- -// i8251_interface usart_intf -//------------------------------------------------- - -static const i8251_interface usart_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_rts), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - - -//------------------------------------------------- // I8255A_INTERFACE( ppi0_intf ) //------------------------------------------------- @@ -412,21 +396,27 @@ static MACHINE_CONFIG_START( softbox, softbox_state ) MCFG_CPU_IO_MAP(softbox_io) // devices - MCFG_I8251_ADD(I8251_TAG, usart_intf) + MCFG_DEVICE_ADD(I8251_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "serial_terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("serial_terminal", terminal) + MCFG_I8255A_ADD(I8255_0_TAG, ppi0_intf) MCFG_I8255A_ADD(I8255_1_TAG, ppi1_intf) - MCFG_COM8116_ADD(COM8116_TAG, XTAL_5_0688MHz, NULL, DEVWRITELINE(I8251_TAG, i8251_device, rxc_w), DEVWRITELINE(I8251_TAG, i8251_device, txc_w)) + + MCFG_COM8116_ADD(COM8116_TAG, XTAL_5_0688MHz, NULL, DEVWRITELINE(I8251_TAG, i8251_device, write_rxc), DEVWRITELINE(I8251_TAG, i8251_device, write_txc)) + MCFG_CBM_IEEE488_ADD("c8050") MCFG_HARDDISK_ADD("harddisk1") MCFG_HARDDISK_ADD("harddisk2") MCFG_HARDDISK_ADD("harddisk3") MCFG_HARDDISK_ADD("harddisk4") - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, "serial_terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_rx)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_TAG, i8251_device, write_dsr)) - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("serial_terminal", terminal) - MCFG_IMI7000_BUS_ADD("imi5000h", NULL, NULL, NULL) // software lists diff --git a/src/mess/drivers/tandy2k.c b/src/mess/drivers/tandy2k.c index d447b32e80a..11462a6866e 100644 --- a/src/mess/drivers/tandy2k.c +++ b/src/mess/drivers/tandy2k.c @@ -407,17 +407,6 @@ WRITE_LINE_MEMBER( tandy2k_state::txrdy_w ) m_pic0->ir2_w(m_rxrdy || m_txrdy); } -static const i8251_interface usart_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_rts), - DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, rxrdy_w), - DEVCB_DRIVER_LINE_MEMBER(tandy2k_state, txrdy_w), - DEVCB_NULL, - DEVCB_NULL -}; - // Intel 8253 Interface WRITE_LINE_MEMBER( tandy2k_state::outspkr_w ) @@ -428,10 +417,10 @@ WRITE_LINE_MEMBER( tandy2k_state::outspkr_w ) WRITE_LINE_MEMBER( tandy2k_state::intbrclk_w ) { - if (!m_extclk && state) + if (!m_extclk) { - m_uart->transmit_clock(); - m_uart->receive_clock(); + m_uart->write_txc(state); + m_uart->write_rxc(state); } } @@ -707,7 +696,18 @@ static MACHINE_CONFIG_START( tandy2k, tandy2k_state ) // devices MCFG_I8255A_ADD(I8255A_TAG, ppi_intf) - MCFG_I8251_ADD(I8251A_TAG, usart_intf) + + MCFG_DEVICE_ADD(I8251A_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(tandy2k_state, rxrdy_w)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(tandy2k_state, txrdy_w)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_dsr)) + MCFG_PIT8253_ADD(I8253_TAG, pit_intf) MCFG_PIC8259_ADD(I8259A_0_TAG, DEVWRITELINE(I80186_TAG, i80186_cpu_device, int0_w), VCC, NULL) MCFG_PIC8259_ADD(I8259A_1_TAG, DEVWRITELINE(I80186_TAG, i80186_cpu_device, int1_w), VCC, NULL) @@ -724,10 +724,6 @@ static MACHINE_CONFIG_START( tandy2k, tandy2k_state ) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", CENTRONICS_TAG) - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_rx)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251A_TAG, i8251_device, write_dsr)) - MCFG_TANDY2K_KEYBOARD_ADD(WRITELINE(tandy2k_state, kbdclk_w), WRITELINE(tandy2k_state, kbddat_w)) // software lists diff --git a/src/mess/drivers/tim100.c b/src/mess/drivers/tim100.c index 4349137b5e0..c5b9a89fe08 100644 --- a/src/mess/drivers/tim100.c +++ b/src/mess/drivers/tim100.c @@ -136,8 +136,8 @@ static MACHINE_CONFIG_START( tim100, tim100_state ) MCFG_PALETTE_LENGTH(3) - MCFG_I8251_ADD("uart_u17", default_i8251_interface) - MCFG_I8251_ADD("uart_u18", default_i8251_interface) + MCFG_DEVICE_ADD("uart_u17", I8251, 0) + MCFG_DEVICE_ADD("uart_u18", I8251, 0) MACHINE_CONFIG_END /* ROM definition */ diff --git a/src/mess/drivers/tsispch.c b/src/mess/drivers/tsispch.c index 8539249ac4e..bed4b2ea49c 100644 --- a/src/mess/drivers/tsispch.c +++ b/src/mess/drivers/tsispch.c @@ -164,18 +164,6 @@ WRITE_LINE_MEMBER(tsispch_state::i8251_txrdy_int) machine().device<pic8259_device>("pic8259")->ir3_w(state); } -// (todo: proper hookup, currently using hack w/i8251_receive_character()) -const i8251_interface i8251_config = -{ - DEVCB_NULL, // out txd, serial - DEVCB_NULL, // out dtr - DEVCB_NULL, // out rts - DEVCB_DRIVER_LINE_MEMBER(tsispch_state,i8251_rxrdy_int), // out rxrdy - DEVCB_DRIVER_LINE_MEMBER(tsispch_state,i8251_txrdy_int), // out txrdy - DEVCB_DRIVER_LINE_MEMBER(tsispch_state,i8251_txempty_int), // out txempty - DEVCB_NULL // out syndet -}; - WRITE8_MEMBER( tsispch_state::i8251_rxd ) { i8251_device *uart = machine().device<i8251_device>("i8251a_u15"); @@ -434,7 +422,11 @@ static MACHINE_CONFIG_START( prose2k, tsispch_state ) MCFG_PIC8259_ADD("pic8259", WRITELINE(tsispch_state,pic8259_set_int_line), VCC, NULL) /* uarts */ - MCFG_I8251_ADD("i8251a_u15", i8251_config) + MCFG_DEVICE_ADD("i8251a_u15", I8251, 0) + // (todo: proper hookup, currently using hack w/i8251_receive_character()) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(tsispch_state, i8251_rxrdy_int)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(tsispch_state, i8251_txrdy_int)) + MCFG_I8251_TXEMPTY_HANDLER(WRITELINE(tsispch_state, i8251_txempty_int)) /* sound hardware */ //MCFG_SPEAKER_STANDARD_MONO("mono") diff --git a/src/mess/drivers/unior.c b/src/mess/drivers/unior.c index 2902eac52a0..8a056273aad 100644 --- a/src/mess/drivers/unior.c +++ b/src/mess/drivers/unior.c @@ -465,7 +465,7 @@ static MACHINE_CONFIG_START( unior, unior_state ) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) /* Devices */ - MCFG_I8251_ADD("uart", default_i8251_interface) + MCFG_DEVICE_ADD("uart", I8251, 0) MCFG_PIT8253_ADD( "pit", pit_intf ) MCFG_I8255_ADD( "ppi0", ppi0_intf ) MCFG_I8255_ADD( "ppi1", ppi1_intf ) diff --git a/src/mess/drivers/v1050.c b/src/mess/drivers/v1050.c index 41c897e7c3d..87c2c908097 100644 --- a/src/mess/drivers/v1050.c +++ b/src/mess/drivers/v1050.c @@ -933,8 +933,12 @@ static I8255A_INTERFACE( rtc_ppi_intf ) TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::kb_8251_tick) { - m_uart_kb->transmit_clock(); - m_uart_kb->receive_clock(); + /// TODO: double timer frequency for correct duty cycle + m_uart_kb->write_txc(1); + m_uart_kb->write_rxc(1); + + m_uart_kb->write_txc(0); + m_uart_kb->write_rxc(0); } WRITE_LINE_MEMBER( v1050_state::kb_rxrdy_w ) @@ -942,23 +946,16 @@ WRITE_LINE_MEMBER( v1050_state::kb_rxrdy_w ) set_interrupt(INT_KEYBOARD, state); } -static const i8251_interface kb_8251_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(V1050_KEYBOARD_TAG, v1050_keyboard_device, si_w), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_DRIVER_LINE_MEMBER(v1050_state, kb_rxrdy_w), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - // Serial 8251A Interface TIMER_DEVICE_CALLBACK_MEMBER(v1050_state::sio_8251_tick) { - m_uart_sio->transmit_clock(); - m_uart_sio->receive_clock(); + /// TODO: double timer frequency for correct duty cycle + m_uart_sio->write_txc(1); + m_uart_sio->write_rxc(1); + + m_uart_sio->write_txc(0); + m_uart_sio->write_rxc(0); } WRITE_LINE_MEMBER( v1050_state::sio_rxrdy_w ) @@ -975,17 +972,6 @@ WRITE_LINE_MEMBER( v1050_state::sio_txrdy_w ) set_interrupt(INT_RS_232, m_rxrdy || m_txrdy); } -static const i8251_interface sio_8251_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_rts), - DEVCB_DRIVER_LINE_MEMBER(v1050_state, sio_rxrdy_w), - DEVCB_DRIVER_LINE_MEMBER(v1050_state, sio_txrdy_w), - DEVCB_NULL, - DEVCB_NULL -}; - // MB8877 Interface void v1050_state::update_fdc() @@ -1145,8 +1131,26 @@ static MACHINE_CONFIG_START( v1050, v1050_state ) MCFG_I8255A_ADD(I8255A_MISC_TAG, misc_ppi_intf) MCFG_I8255A_ADD(I8255A_RTC_TAG, rtc_ppi_intf) MCFG_I8255A_ADD(I8255A_M6502_TAG, m6502_ppi_intf) - MCFG_I8251_ADD(I8251A_KB_TAG, /*XTAL_16MHz/8,*/ kb_8251_intf) - MCFG_I8251_ADD(I8251A_SIO_TAG, /*XTAL_16MHz/8,*/ sio_8251_intf) + + MCFG_DEVICE_ADD(I8251A_KB_TAG, I8251, 0/*XTAL_16MHz/8,*/) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(V1050_KEYBOARD_TAG, v1050_keyboard_device, si_w)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(v1050_state, kb_rxrdy_w)) + + // keyboard + MCFG_DEVICE_ADD(V1050_KEYBOARD_TAG, V1050_KEYBOARD, 0) + MCFG_V1050_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE(I8251A_KB_TAG, i8251_device, write_rxd)) + + MCFG_DEVICE_ADD(I8251A_SIO_TAG, I8251, 0/*XTAL_16MHz/8,*/) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(v1050_state, sio_rxrdy_w)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(v1050_state, sio_txrdy_w)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251A_SIO_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251A_SIO_TAG, i8251_device, write_dsr)) + MCFG_MB8877x_ADD(MB8877_TAG, XTAL_16MHz/16) MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":0", v1050_floppies, "525qd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD(MB8877_TAG":1", v1050_floppies, "525qd", floppy_image_device::default_floppy_formats) @@ -1155,10 +1159,6 @@ static MACHINE_CONFIG_START( v1050, v1050_state ) MCFG_TIMER_DRIVER_ADD_PERIODIC(TIMER_KB_TAG, v1050_state, kb_8251_tick, attotime::from_hz((double)XTAL_16MHz/4/13/8)) MCFG_TIMER_DRIVER_ADD(TIMER_SIO_TAG, v1050_state, sio_8251_tick) - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251A_SIO_TAG, i8251_device, write_rx)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251A_SIO_TAG, i8251_device, write_dsr)) - // SASI bus MCFG_SCSIBUS_ADD(SASIBUS_TAG) MCFG_SCSIDEV_ADD(SASIBUS_TAG ":harddisk0", S1410, SCSI_ID_0) @@ -1168,10 +1168,6 @@ static MACHINE_CONFIG_START( v1050, v1050_state ) MCFG_TIMER_DRIVER_ADD(TIMER_ACK_TAG, v1050_state, sasi_ack_tick) MCFG_TIMER_DRIVER_ADD(TIMER_RST_TAG, v1050_state, sasi_rst_tick) - // keyboard - MCFG_DEVICE_ADD(V1050_KEYBOARD_TAG, V1050_KEYBOARD, 0) - MCFG_V1050_KEYBOARD_OUT_TX_HANDLER(DEVWRITELINE(I8251A_KB_TAG, i8251_device, write_rx)) - // software lists MCFG_SOFTWARE_LIST_ADD("flop_list", "v1050_flop") MCFG_SOFTWARE_LIST_ADD("hdd_list", "v1050_hdd") diff --git a/src/mess/drivers/vixen.c b/src/mess/drivers/vixen.c index 059945a6bd7..0f2bc527855 100644 --- a/src/mess/drivers/vixen.c +++ b/src/mess/drivers/vixen.c @@ -633,10 +633,10 @@ WRITE8_MEMBER( vixen_state::io_i8155_pc_w ) WRITE_LINE_MEMBER( vixen_state::io_i8155_to_w ) { - if (m_int_clk && !state) + if (m_int_clk) { - m_usart->transmit_clock(); - m_usart->receive_clock(); + m_usart->write_txc(state); + m_usart->write_rxc(state); } } @@ -668,18 +668,6 @@ WRITE_LINE_MEMBER( vixen_state::txrdy_w ) update_interrupt(); } -static const i8251_interface usart_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_rts), - DEVCB_DRIVER_LINE_MEMBER(vixen_state, rxrdy_w), - DEVCB_DRIVER_LINE_MEMBER(vixen_state, txrdy_w), - DEVCB_NULL, - DEVCB_NULL -}; - - //------------------------------------------------- // IEEE488_INTERFACE( ieee488_intf ) //------------------------------------------------- @@ -809,7 +797,18 @@ static MACHINE_CONFIG_START( vixen, vixen_state ) // devices MCFG_I8155_ADD(P8155H_TAG, XTAL_23_9616MHz/6, i8155_intf) MCFG_I8155_ADD(P8155H_IO_TAG, XTAL_23_9616MHz/6, io_i8155_intf) - MCFG_I8251_ADD(P8251A_TAG, usart_intf) + + MCFG_DEVICE_ADD(P8251A_TAG, I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(vixen_state, rxrdy_w)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(vixen_state, txrdy_w)) + + MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(P8251A_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(P8251A_TAG, i8251_device, write_dsr)) + MCFG_FD1797x_ADD(FDC1797_TAG, XTAL_23_9616MHz/24) MCFG_FLOPPY_DRIVE_ADD(FDC1797_TAG":0", vixen_floppies, "525dd", floppy_image_device::default_floppy_formats) MCFG_FLOPPY_DRIVE_ADD(FDC1797_TAG":1", vixen_floppies, "525dd", floppy_image_device::default_floppy_formats) @@ -817,10 +816,6 @@ static MACHINE_CONFIG_START( vixen, vixen_state ) MCFG_IEEE488_SRQ_CALLBACK(WRITELINE(vixen_state, srq_w)) MCFG_IEEE488_ATN_CALLBACK(WRITELINE(vixen_state, atn_w)) - MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(P8251A_TAG, i8251_device, write_rx)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(P8251A_TAG, i8251_device, write_dsr)) - /* software lists */ MCFG_SOFTWARE_LIST_ADD("disk_list", "vixen") diff --git a/src/mess/drivers/vk100.c b/src/mess/drivers/vk100.c index bc5eedee9ee..f9f6d486805 100644 --- a/src/mess/drivers/vk100.c +++ b/src/mess/drivers/vk100.c @@ -1009,18 +1009,6 @@ static MC6845_INTERFACE( mc6845_intf ) NULL }; -static const i8251_interface i8251_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_rts), - //DEVCB_DRIVER_LINE_MEMBER(vk100_state, i8251_rts), // out_rts_cb - DEVCB_DRIVER_LINE_MEMBER(vk100_state, i8251_rxrdy_int), // out_rxrdy_cb - DEVCB_DRIVER_LINE_MEMBER(vk100_state, i8251_txrdy_int), // out_txrdy_cb - DEVCB_NULL, // out_txempty_cb - DEVCB_NULL // out_syndet_cb -}; - static MACHINE_CONFIG_START( vk100, vk100_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu", I8085A, XTAL_5_0688MHz) @@ -1035,13 +1023,18 @@ static MACHINE_CONFIG_START( vk100, vk100_state ) MCFG_MC6845_ADD( "crtc", H46505, "screen", XTAL_45_6192Mhz/3/12, mc6845_intf) /* i8251 uart */ - MCFG_I8251_ADD("i8251", i8251_intf) + MCFG_DEVICE_ADD("i8251", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) + MCFG_I8251_RXRDY_HANDLER(WRITELINE(vk100_state, i8251_rxrdy_int)) + MCFG_I8251_TXRDY_HANDLER(WRITELINE(vk100_state, i8251_txrdy_int)) MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rx)) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxd)) MCFG_RS232_DSR_HANDLER(DEVWRITELINE("i8251", i8251_device, write_dsr)) - MCFG_COM8116_ADD(COM5016T_TAG, XTAL_5_0688MHz, NULL, DEVWRITELINE("i8251", i8251_device, rxc_w), DEVWRITELINE("i8251", i8251_device, txc_w)) + MCFG_COM8116_ADD(COM5016T_TAG, XTAL_5_0688MHz, NULL, DEVWRITELINE("i8251", i8251_device, write_rxc), DEVWRITELINE("i8251", i8251_device, write_txc)) MCFG_DEFAULT_LAYOUT( layout_vk100 ) diff --git a/src/mess/drivers/votrpss.c b/src/mess/drivers/votrpss.c index a14d96e54af..c756ee1827b 100644 --- a/src/mess/drivers/votrpss.c +++ b/src/mess/drivers/votrpss.c @@ -192,20 +192,6 @@ IRQ_CALLBACK_MEMBER( votrpss_state::irq_ack ) return 0x38; } -static const i8251_interface uart_intf = -{ - //DEVCB_DEVICE_LINE_MEMBER("rs232", serial_port_device, tx), - //DEVCB_DEVICE_LINE_MEMBER("rs232", rs232_port_device, write_dtr), - //DEVCB_DEVICE_LINE_MEMBER("rs232", rs232_port_device, write_rts), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - static const struct pit8253_interface pit_intf = { { @@ -304,8 +290,12 @@ static GENERIC_TERMINAL_INTERFACE( terminal_intf ) TIMER_DEVICE_CALLBACK_MEMBER( votrpss_state::serial_tick ) { - m_uart->receive_clock(); - m_uart->transmit_clock(); + /// TODO: double timer frequency for correct duty cycle + m_uart->write_rxc(1); + m_uart->write_txc(1); + + m_uart->write_rxc(0); + m_uart->write_txc(0); } /****************************************************************************** @@ -331,7 +321,12 @@ static MACHINE_CONFIG_START( votrpss, votrpss_state ) /* Devices */ MCFG_GENERIC_TERMINAL_ADD(TERMINAL_TAG, terminal_intf) - MCFG_I8251_ADD("uart", uart_intf) + + MCFG_DEVICE_ADD("uart", I8251, 0) + //MCFG_I8251_TXD_HANDLER(DEVWRITELINE("rs232", serial_port_device, tx)) + //MCFG_I8251_DTR_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_dtr)) + //MCFG_I8251_RTS_HANDLER(DEVWRITELINE("rs232", rs232_port_device, write_rts)) + MCFG_PIT8253_ADD( "pit", pit_intf) MCFG_I8255_ADD("ppi", ppi_intf) MCFG_TIMER_DRIVER_ADD_PERIODIC("irq_timer", votrpss_state, irq_timer, attotime::from_msec(10)) diff --git a/src/mess/drivers/vt100.c b/src/mess/drivers/vt100.c index 22424112ba3..5e2a467e506 100644 --- a/src/mess/drivers/vt100.c +++ b/src/mess/drivers/vt100.c @@ -405,17 +405,6 @@ static GFXDECODE_START( vt100 ) GFXDECODE_ENTRY( "chargen", 0x0000, vt100_charlayout, 0, 1 ) GFXDECODE_END -static const i8251_interface i8251_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_TAG, rs232_port_device, write_rts), - DEVCB_NULL, // out_rxrdy_cb - DEVCB_NULL, // out_txrdy_cb - DEVCB_NULL, // out_txempty_cb - DEVCB_NULL // out_syndet_cb -}; - static MACHINE_CONFIG_START( vt100, vt100_state ) /* basic machine hardware */ MCFG_CPU_ADD("maincpu",I8080, XTAL_24_8832MHz / 9) @@ -440,13 +429,16 @@ static MACHINE_CONFIG_START( vt100, vt100_state ) MCFG_VT100_VIDEO_ADD("vt100_video", vt100_video_interface) - MCFG_I8251_ADD("i8251", i8251_intf) + MCFG_DEVICE_ADD("i8251", I8251, 0) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_TAG, rs232_port_device, write_rts)) MCFG_RS232_PORT_ADD(RS232_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rx)) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE("i8251", i8251_device, write_rxd)) MCFG_RS232_DSR_HANDLER(DEVWRITELINE("i8251", i8251_device, write_dsr)) - MCFG_COM8116_ADD(COM5016T_TAG, XTAL_5_0688MHz, NULL, DEVWRITELINE("i8251", i8251_device, rxc_w), DEVWRITELINE("i8251", i8251_device, txc_w)) + MCFG_COM8116_ADD(COM5016T_TAG, XTAL_5_0688MHz, NULL, DEVWRITELINE("i8251", i8251_device, write_rxc), DEVWRITELINE("i8251", i8251_device, write_txc)) /* audio hardware */ diff --git a/src/mess/drivers/xor100.c b/src/mess/drivers/xor100.c index e96f460bcfb..8bae8409133 100644 --- a/src/mess/drivers/xor100.c +++ b/src/mess/drivers/xor100.c @@ -361,42 +361,16 @@ INPUT_PORTS_END WRITE_LINE_MEMBER( xor100_state::com5016_fr_w ) { - m_uart_a->transmit_clock(); - m_uart_a->receive_clock(); + m_uart_a->write_txc(state); + m_uart_a->write_rxc(state); } WRITE_LINE_MEMBER( xor100_state::com5016_ft_w ) { - m_uart_b->transmit_clock(); - m_uart_b->receive_clock(); + m_uart_b->write_txc(state); + m_uart_b->write_rxc(state); } -/* Printer 8251A Interface */ - -static const i8251_interface printer_8251_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_A_TAG, rs232_port_device, write_rts), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - -/* Terminal 8251A Interface */ - -static const i8251_interface terminal_8251_intf = -{ - DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, rs232_port_device, write_txd), - DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, rs232_port_device, write_dtr), - DEVCB_DEVICE_LINE_MEMBER(RS232_B_TAG, rs232_port_device, write_rts), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - /* Printer 8255A Interface */ WRITE_LINE_MEMBER( xor100_state::write_centronics_busy ) @@ -573,8 +547,25 @@ static MACHINE_CONFIG_START( xor100, xor100_state ) MCFG_CPU_IO_MAP(xor100_io) /* devices */ - MCFG_I8251_ADD(I8251_A_TAG, /*XTAL_8MHz/2,*/ printer_8251_intf) - MCFG_I8251_ADD(I8251_B_TAG, /*XTAL_8MHz/2,*/ terminal_8251_intf) + MCFG_DEVICE_ADD(I8251_A_TAG, I8251, 0/*XTAL_8MHz/2,*/) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_A_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_A_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_A_TAG, i8251_device, write_dsr)) + + MCFG_DEVICE_ADD(I8251_B_TAG, I8251, 0/*XTAL_8MHz/2,*/) + MCFG_I8251_TXD_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_txd)) + MCFG_I8251_DTR_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_dtr)) + MCFG_I8251_RTS_HANDLER(DEVWRITELINE(RS232_B_TAG, rs232_port_device, write_rts)) + + MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, "serial_terminal") + MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_B_TAG, i8251_device, write_rxd)) + MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_B_TAG, i8251_device, write_dsr)) + MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("serial_terminal", terminal) + MCFG_I8255A_ADD(I8255A_TAG, printer_8255_intf) MCFG_Z80CTC_ADD(Z80CTC_TAG, XTAL_8MHz/2, ctc_intf) MCFG_COM8116_ADD(COM5016_TAG, XTAL_5_0688MHz, NULL, WRITELINE(xor100_state, com5016_fr_w), WRITELINE(xor100_state, com5016_ft_w)) @@ -591,16 +582,6 @@ static MACHINE_CONFIG_START( xor100, xor100_state ) MCFG_CENTRONICS_OUTPUT_LATCH_ADD("cent_data_out", "centronics") - MCFG_RS232_PORT_ADD(RS232_A_TAG, default_rs232_devices, NULL) - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_A_TAG, i8251_device, write_rx)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_A_TAG, i8251_device, write_dsr)) - - MCFG_RS232_PORT_ADD(RS232_B_TAG, default_rs232_devices, "serial_terminal") - MCFG_RS232_RXD_HANDLER(DEVWRITELINE(I8251_B_TAG, i8251_device, write_rx)) - MCFG_RS232_DSR_HANDLER(DEVWRITELINE(I8251_B_TAG, i8251_device, write_dsr)) - - MCFG_DEVICE_CARD_DEVICE_INPUT_DEFAULTS("serial_terminal", terminal) - // S-100 MCFG_S100_BUS_ADD(s100_intf) MCFG_S100_SLOT_ADD("s100_1", xor100_s100_cards, NULL) diff --git a/src/mess/drivers/zorba.c b/src/mess/drivers/zorba.c index 29f6feafeb8..15810763e5d 100644 --- a/src/mess/drivers/zorba.c +++ b/src/mess/drivers/zorba.c @@ -228,42 +228,6 @@ static SLOT_INTERFACE_START( zorba_floppies ) SLOT_INTERFACE( "525dd", FLOPPY_525_DD ) SLOT_INTERFACE_END -// COM port -static const i8251_interface u0_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - -// printer port -static const i8251_interface u1_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - -// keyboard -static const i8251_interface u2_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - WRITE8_MEMBER( zorba_state::pia0_porta_w ) { m_beep->set_state(BIT(data, 7)); @@ -421,9 +385,15 @@ static MACHINE_CONFIG_START( zorba, zorba_state ) /* Devices */ MCFG_Z80DMA_ADD("dma", XTAL_24MHz/6, dma_intf) - MCFG_I8251_ADD("uart0", u0_intf) - MCFG_I8251_ADD("uart1", u1_intf) - MCFG_I8251_ADD("uart2", u2_intf) + + MCFG_DEVICE_ADD("uart0", I8251, 0) + // COM port + + MCFG_DEVICE_ADD("uart1", I8251, 0) + // printer port + + MCFG_DEVICE_ADD("uart2", I8251, 0) + // keyboard // port A - disk select etc, beeper // port B - parallel interface diff --git a/src/mess/includes/mbc55x.h b/src/mess/includes/mbc55x.h index 82e056097c8..2437733a438 100644 --- a/src/mess/includes/mbc55x.h +++ b/src/mess/includes/mbc55x.h @@ -89,16 +89,17 @@ class mbc55x_state : public driver_device public: mbc55x_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maincpu(*this, MAINCPU_TAG), - m_crtc(*this, VID_MC6845_NAME), - m_kb_uart(*this, I8251A_KB_TAG), - m_pit(*this, PIT8253_TAG), - m_ppi(*this, PPI8255_TAG), - m_pic(*this, PIC8259_TAG), - m_fdc(*this, FDC_TAG), - m_speaker(*this, "speaker"), - m_ram(*this, RAM_TAG) - { } + m_maincpu(*this, MAINCPU_TAG), + m_crtc(*this, VID_MC6845_NAME), + m_kb_uart(*this, I8251A_KB_TAG), + m_pit(*this, PIT8253_TAG), + m_ppi(*this, PPI8255_TAG), + m_pic(*this, PIC8259_TAG), + m_fdc(*this, FDC_TAG), + m_speaker(*this, "speaker"), + m_ram(*this, RAM_TAG) + { + } required_device<cpu_device> m_maincpu; required_device<mc6845_device> m_crtc; @@ -173,8 +174,6 @@ extern const unsigned char mbc55x_palette[SCREEN_NO_COLOURS][3]; extern const struct pit8253_interface mbc55x_pit8253_config; extern const i8255_interface mbc55x_ppi8255_interface; -extern const i8251_interface mbc55x_i8251a_interface; -extern const i8251_interface mbc55x_i8251b_interface; /* Memory controller */ diff --git a/src/mess/includes/poly88.h b/src/mess/includes/poly88.h index 67d28095b4f..d891fd1505e 100644 --- a/src/mess/includes/poly88.h +++ b/src/mess/includes/poly88.h @@ -80,9 +80,4 @@ protected: int m_cas_tx; }; - -/*----------- defined in machine/poly88.c -----------*/ -extern const i8251_interface poly88_usart_interface; - - #endif /* POLY88_H_ */ diff --git a/src/mess/includes/pp01.h b/src/mess/includes/pp01.h index 2e03705ae75..193a42544f8 100644 --- a/src/mess/includes/pp01.h +++ b/src/mess/includes/pp01.h @@ -63,7 +63,6 @@ public: /*----------- defined in machine/pp01.c -----------*/ -extern const i8251_interface pp01_uart_intf; extern const struct pit8253_interface pp01_pit8253_intf; extern const i8255_interface pp01_ppi8255_interface; diff --git a/src/mess/machine/dec_lk201.c b/src/mess/machine/dec_lk201.c index 336c4774a04..14d815d10ad 100644 --- a/src/mess/machine/dec_lk201.c +++ b/src/mess/machine/dec_lk201.c @@ -429,7 +429,6 @@ ioport_constructor lk201_device::device_input_ports() const lk201_device::lk201_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, LK201, "DEC LK201 keyboard", tag, owner, clock, "lk201", __FILE__), device_serial_interface(mconfig, *this), - m_tx_write(*this), m_maincpu(*this, LK201_CPU_TAG), m_speaker(*this, LK201_SPK_TAG), m_kbd0(*this, "KBD0"), @@ -449,7 +448,8 @@ lk201_device::lk201_device(const machine_config &mconfig, const char *tag, devic m_kbd14(*this, "KBD14"), m_kbd15(*this, "KBD15"), m_kbd16(*this, "KBD16"), - m_kbd17(*this, "KBD17") + m_kbd17(*this, "KBD17"), + m_tx_handler(*this) { } @@ -459,7 +459,7 @@ lk201_device::lk201_device(const machine_config &mconfig, const char *tag, devic void lk201_device::device_start() { - m_tx_write.resolve_safe(); + m_tx_handler.resolve_safe(); } @@ -505,8 +505,7 @@ void lk201_device::tra_complete() void lk201_device::tra_callback() { - int bit = transmit_register_send_bit(); - m_tx_write(bit); + m_tx_handler(transmit_register_send_bit()); } void lk201_device::input_callback(UINT8 state) diff --git a/src/mess/machine/dec_lk201.h b/src/mess/machine/dec_lk201.h index adb4b5f517f..6db0958dee8 100644 --- a/src/mess/machine/dec_lk201.h +++ b/src/mess/machine/dec_lk201.h @@ -10,8 +10,6 @@ // MACROS / CONSTANTS //************************************************************************** -#define LK201_TAG "lk201" - #define LK_CMD_LEDS_ON 0x13 /* light LEDs - 1st param: led bitmask */ #define LK_CMD_LEDS_OFF 0x11 /* turn off LEDs */ @@ -30,17 +28,8 @@ // INTERFACE CONFIGURATION MACROS //************************************************************************** -#define MCFG_LK201_ADD() \ - MCFG_DEVICE_ADD(LK201_TAG, LK201, 0) - -#define MCFG_LK201_REPLACE() \ - MCFG_DEVICE_REPLACE(LK201_TAG, LK201, 0) - -#define MCFG_LK201_REMOVE() \ - MCFG_DEVICE_REMOVE(LK201_TAG) - -#define MCFG_LK201_SET_TX_CALLBACK(_cb) \ - devcb = &lk201_device::set_tx_cb(*device, DEVCB2_##_cb); +#define MCFG_LK201_TX_HANDLER(_cb) \ + devcb = &lk201_device::set_tx_handler(*device, DEVCB2_##_cb); //************************************************************************** // TYPE DEFINITIONS @@ -63,9 +52,7 @@ public: DECLARE_READ8_MEMBER( spi_r ); DECLARE_WRITE8_MEMBER( spi_w ); - template<class _Object> static devcb2_base &set_tx_cb(device_t &device, _Object wr) { return downcast<lk201_device &>(device).m_tx_write.set_callback(wr); } - - devcb2_write_line m_tx_write; + template<class _Object> static devcb2_base &set_tx_handler(device_t &device, _Object wr) { return downcast<lk201_device &>(device).m_tx_handler.set_callback(wr); } protected: // device-level overrides @@ -119,6 +106,8 @@ private: void send_port(address_space &space, UINT8 offset, UINT8 data); void update_interrupts(); + + devcb2_write_line m_tx_handler; }; // device type definition diff --git a/src/mess/machine/isa_ibm_mfc.c b/src/mess/machine/isa_ibm_mfc.c index 6d8b41f001a..848b708374d 100644 --- a/src/mess/machine/isa_ibm_mfc.c +++ b/src/mess/machine/isa_ibm_mfc.c @@ -297,21 +297,13 @@ static const struct pit8253_interface d8253_intf = void isa8_ibm_mfc_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) { - m_d71051->transmit_clock(); - m_d71051->receive_clock(); -} - -static const i8251_interface d71051_intf = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; + /// TODO: double timer frequency to get correct duty cycle + m_d71051->write_txc(1); + m_d71051->write_rxc(1); + m_d71051->write_txc(0); + m_d71051->write_rxc(0); +} //------------------------------------------------- // YM-2164 @@ -335,7 +327,9 @@ static MACHINE_CONFIG_FRAGMENT( ibm_mfc ) MCFG_I8255_ADD("d71055c_0", d71055c_0_intf) MCFG_I8255_ADD("d71055c_1", d71055c_1_intf) - MCFG_I8251_ADD("d71051", d71051_intf) + + MCFG_DEVICE_ADD("d71051", I8251, 0) + MCFG_PIT8253_ADD("d8253", d8253_intf) MCFG_SPEAKER_STANDARD_STEREO("ymleft", "ymright") diff --git a/src/mess/machine/mbc55x.c b/src/mess/machine/mbc55x.c index 26bf6989307..a0623f6d38f 100644 --- a/src/mess/machine/mbc55x.c +++ b/src/mess/machine/mbc55x.c @@ -159,8 +159,8 @@ WRITE8_MEMBER(mbc55x_state::mbcpit8253_w) WRITE_LINE_MEMBER( mbc55x_state::pit8253_t2 ) { - m_kb_uart->transmit_clock(); - m_kb_uart->receive_clock(); + m_kb_uart->write_txc(state); + m_kb_uart->write_txc(state); } /* Video ram page register */ @@ -280,19 +280,6 @@ TIMER_CALLBACK_MEMBER(mbc55x_state::keyscan_callback) scan_keyboard(); } -/* i8251 serial */ - -const i8251_interface mbc55x_i8251a_interface = -{ - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL, - DEVCB_DEVICE_LINE_MEMBER(PIC8259_TAG, pic8259_device, ir3_w), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - READ8_MEMBER(mbc55x_state::mbc55x_kb_usart_r) { UINT8 result = 0; @@ -300,14 +287,15 @@ READ8_MEMBER(mbc55x_state::mbc55x_kb_usart_r) switch (offset) { - case 0 : //logerror("%s read kb_uart\n",machine().describe_context()); - result = m_kb_uart->data_r(space,0); break; - - case 1 : result = m_kb_uart->status_r(space,0); - - if (m_keyboard.key_special & KEY_BIT_CTRL) // Parity error used to flag control down - result |= I8251_STATUS_PARITY_ERROR; - break; + case 0: //logerror("%s read kb_uart\n",machine().describe_context()); + result = m_kb_uart->data_r(space,0); + break; + + case 1: + result = m_kb_uart->status_r(space,0); + if (m_keyboard.key_special & KEY_BIT_CTRL) // Parity error used to flag control down + result |= i8251_device::I8251_STATUS_PARITY_ERROR; + break; } return result; diff --git a/src/mess/machine/pmd85.c b/src/mess/machine/pmd85.c index a4e237a2121..898a3640ca8 100644 --- a/src/mess/machine/pmd85.c +++ b/src/mess/machine/pmd85.c @@ -795,12 +795,13 @@ TIMER_CALLBACK_MEMBER(pmd85_state::pmd85_cassette_timer_callback) { data = (!m_previous_level && current_level) ? 1 : 0; - m_uart->write_rx(data); - m_uart->receive_clock(); + m_uart->write_rxd(data); m_clk_level_tape = 1; } } + + m_uart->write_rxc(m_clk_level_tape); return; case PMD85_2: case PMD85_2A: @@ -819,19 +820,16 @@ TIMER_CALLBACK_MEMBER(pmd85_state::pmd85_cassette_timer_callback) data ^= m_clk_level_tape; m_cassette->output(data&0x01 ? 1 : -1); - if (!m_clk_level_tape) - m_uart->transmit_clock(); - m_clk_level_tape = m_clk_level_tape ? 0 : 1; + m_uart->write_txc(m_clk_level_tape); return; } m_clk_level_tape = 1; - if (!m_clk_level) - m_uart->transmit_clock(); m_clk_level = m_clk_level ? 0 : 1; + m_uart->write_txc(m_clk_level); } } diff --git a/src/mess/machine/poly88.c b/src/mess/machine/poly88.c index 234d822512b..01b8a498d64 100644 --- a/src/mess/machine/poly88.c +++ b/src/mess/machine/poly88.c @@ -171,25 +171,26 @@ TIMER_CALLBACK_MEMBER(poly88_state::poly88_cassette_timer_callback) /* tape reading */ if (m_cassette->get_state()&CASSETTE_PLAY) { - if (m_clk_level_tape) - { - m_previous_level = (m_cassette->input() > 0.038) ? 1 : 0; - m_clk_level_tape = 0; - } - else - { - current_level = (m_cassette->input() > 0.038) ? 1 : 0; - - if (m_previous_level!=current_level) - { - data = (!m_previous_level && current_level) ? 1 : 0; + if (m_clk_level_tape) + { + m_previous_level = (m_cassette->input() > 0.038) ? 1 : 0; + m_clk_level_tape = 0; + } + else + { + current_level = (m_cassette->input() > 0.038) ? 1 : 0; + + if (m_previous_level!=current_level) + { + data = (!m_previous_level && current_level) ? 1 : 0; //data = current_level; - m_uart->write_rx(data); - m_uart->receive_clock(); + m_uart->write_rxd(data); - m_clk_level_tape = 1; - } - } + m_clk_level_tape = 1; + } + } + + m_uart->write_rxc(m_clk_level_tape); } /* tape writing */ @@ -199,19 +200,16 @@ TIMER_CALLBACK_MEMBER(poly88_state::poly88_cassette_timer_callback) data ^= m_clk_level_tape; m_cassette->output(data&0x01 ? 1 : -1); - if (!m_clk_level_tape) - m_uart->transmit_clock(); - m_clk_level_tape = m_clk_level_tape ? 0 : 1; + m_uart->write_txc(m_clk_level_tape); return; } m_clk_level_tape = 1; - if (!m_clk_level) - m_uart->transmit_clock(); m_clk_level = m_clk_level ? 0 : 1; + m_uart->write_txc(m_clk_level); // } } @@ -245,17 +243,6 @@ WRITE_LINE_MEMBER(poly88_state::poly88_usart_rxready) //execute().set_input_line(0, HOLD_LINE); } -const i8251_interface poly88_usart_interface= -{ - DEVCB_DRIVER_LINE_MEMBER(poly88_state,write_cas_tx), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_DRIVER_LINE_MEMBER(poly88_state,poly88_usart_rxready), - DEVCB_NULL, - DEVCB_NULL, - DEVCB_NULL -}; - READ8_MEMBER(poly88_state::poly88_keyboard_r) { UINT8 retVal = m_last_code; diff --git a/src/mess/machine/pp01.c b/src/mess/machine/pp01.c index 78a8911394c..5f92dda8da7 100644 --- a/src/mess/machine/pp01.c +++ b/src/mess/machine/pp01.c @@ -228,15 +228,3 @@ I8255A_INTERFACE( pp01_ppi8255_interface ) DEVCB_DRIVER_MEMBER(pp01_state,pp01_8255_portc_r), DEVCB_DRIVER_MEMBER(pp01_state,pp01_8255_portc_w) }; - -// when rts and dtr are both high, the uart is being used for cassette operations -const i8251_interface pp01_uart_intf = -{ - DEVCB_NULL, // out txd - DEVCB_NULL, // out dtr - DEVCB_NULL, // out rts - DEVCB_NULL, // out rxrdy - DEVCB_NULL, // out txrdy - DEVCB_NULL, // out txempty - DEVCB_NULL // out syndet -}; |