From c4c6a68d4b2083ebd5df58b6a38e20ab5e5119be Mon Sep 17 00:00:00 2001 From: Michael Zapf Date: Sat, 18 Aug 2018 01:53:50 +0200 Subject: [PATCH] tms99xx: Various devcb3 updates. (nw) --- src/devices/bus/ti99/gromport/cartridges.cpp | 26 ++- src/devices/bus/ti99/internal/992board.h | 10 +- src/devices/bus/ti99/internal/998board.h | 18 +- src/devices/bus/ti99/internal/evpcconn.h | 7 +- src/devices/bus/ti99/internal/genboard.h | 10 +- src/devices/bus/ti99/peb/ti_rs232.cpp | 175 +++++++------------ src/devices/bus/ti99/peb/ti_rs232.h | 29 +-- src/devices/machine/tmc0430.h | 9 +- src/devices/machine/tms9902.h | 21 --- src/mame/drivers/geneve.cpp | 13 +- src/mame/drivers/jpmmps.cpp | 19 +- src/mame/drivers/jpms80.cpp | 6 +- src/mame/drivers/ti99_2.cpp | 6 +- src/mame/drivers/ti99_4x.cpp | 45 +++-- src/mame/drivers/ti99_8.cpp | 117 ++++++++++--- src/mame/drivers/tm990189.cpp | 10 +- 16 files changed, 273 insertions(+), 248 deletions(-) diff --git a/src/devices/bus/ti99/gromport/cartridges.cpp b/src/devices/bus/ti99/gromport/cartridges.cpp index 41839b3bb1b..8e3d56369bc 100644 --- a/src/devices/bus/ti99/gromport/cartridges.cpp +++ b/src/devices/bus/ti99/gromport/cartridges.cpp @@ -400,11 +400,27 @@ void ti99_cartridge_device::device_config_complete() 5 GROMs that may be contained in a cartridge */ MACHINE_CONFIG_START(ti99_cartridge_device::device_add_mconfig) - MCFG_GROM_ADD( GROM3_TAG, 3, CARTGROM_TAG, 0x0000, WRITELINE(*this, ti99_cartridge_device, ready_line)) - MCFG_GROM_ADD( GROM4_TAG, 4, CARTGROM_TAG, 0x2000, WRITELINE(*this, ti99_cartridge_device, ready_line)) - MCFG_GROM_ADD( GROM5_TAG, 5, CARTGROM_TAG, 0x4000, WRITELINE(*this, ti99_cartridge_device, ready_line)) - MCFG_GROM_ADD( GROM6_TAG, 6, CARTGROM_TAG, 0x6000, WRITELINE(*this, ti99_cartridge_device, ready_line)) - MCFG_GROM_ADD( GROM7_TAG, 7, CARTGROM_TAG, 0x8000, WRITELINE(*this, ti99_cartridge_device, ready_line)) + + tmc0430_device& grom3(TMC0430(config, GROM3_TAG, 0)); + grom3.ready_cb().set(FUNC(ti99_cartridge_device::ready_line)); + grom3.set_region_and_ident(CARTGROM_TAG, 0x0000, 3); + + tmc0430_device& grom4(TMC0430(config, GROM4_TAG, 0)); + grom4.ready_cb().set(FUNC(ti99_cartridge_device::ready_line)); + grom4.set_region_and_ident(CARTGROM_TAG, 0x2000, 4); + + tmc0430_device& grom5(TMC0430(config, GROM5_TAG, 0)); + grom5.ready_cb().set(FUNC(ti99_cartridge_device::ready_line)); + grom5.set_region_and_ident(CARTGROM_TAG, 0x4000, 5); + + tmc0430_device& grom6(TMC0430(config, GROM6_TAG, 0)); + grom6.ready_cb().set(FUNC(ti99_cartridge_device::ready_line)); + grom6.set_region_and_ident(CARTGROM_TAG, 0x6000, 6); + + tmc0430_device& grom7(TMC0430(config, GROM7_TAG, 0)); + grom7.ready_cb().set(FUNC(ti99_cartridge_device::ready_line)); + grom7.set_region_and_ident(CARTGROM_TAG, 0x8000, 7); + MACHINE_CONFIG_END diff --git a/src/devices/bus/ti99/internal/992board.h b/src/devices/bus/ti99/internal/992board.h index 786aed36381..6b0e2ff9143 100644 --- a/src/devices/bus/ti99/internal/992board.h +++ b/src/devices/bus/ti99/internal/992board.h @@ -48,6 +48,11 @@ public: // Video enable DECLARE_WRITE_LINE_MEMBER( videna ); + // Callbacks + auto readmem_cb() { return m_mem_read_cb.bind(); } + auto hold_cb() { return m_hold_cb.bind(); } + auto int_cb() { return m_int_cb.bind(); } + protected: video992_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); int m_beol; @@ -105,8 +110,8 @@ public: DECLARE_READ8_MEMBER( cruread ); DECLARE_WRITE8_MEMBER( cruwrite ); void device_start() override; - template devcb_base &set_rombank_callback(Object &&cb) { return m_set_rom_bank.set_callback(std::forward(cb)); } ioport_constructor device_input_ports() const override; + auto rombank_cb() { return m_set_rom_bank.bind(); } protected: io992_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); @@ -174,9 +179,6 @@ public: #define MCFG_VIDEO992_INT_CB(_devcb) \ downcast(*device).set_int_callback(DEVCB_##_devcb); -#define MCFG_SET_ROMBANK_HANDLER( _devcb ) \ - downcast(*device).set_rombank_callback(DEVCB_##_devcb); - DECLARE_DEVICE_TYPE_NS(VIDEO99224, bus::ti99::internal, video992_24_device) DECLARE_DEVICE_TYPE_NS(VIDEO99232, bus::ti99::internal, video992_32_device) DECLARE_DEVICE_TYPE_NS(IO99224, bus::ti99::internal, io992_24_device) diff --git a/src/devices/bus/ti99/internal/998board.h b/src/devices/bus/ti99/internal/998board.h index e59e80b437e..c0baf6589df 100644 --- a/src/devices/bus/ti99/internal/998board.h +++ b/src/devices/bus/ti99/internal/998board.h @@ -565,9 +565,9 @@ public: DECLARE_WRITE_LINE_MEMBER( holda_line ); - template devcb_base &set_ready_wr_callback(Object &&cb) { return m_ready.set_callback(std::forward(cb)); } - template devcb_base &set_reset_wr_callback(Object &&cb) { return m_console_reset.set_callback(std::forward(cb)); } - template devcb_base &set_hold_wr_callback(Object &&cb) { return m_hold_line.set_callback(std::forward(cb)); } + auto ready_cb() { return m_ready.bind(); } + auto reset_cb() { return m_console_reset.bind(); } + auto hold_cb() { return m_hold_line.bind(); } void set_paddress(int address); @@ -701,18 +701,6 @@ private: } } } // end namespace bus::ti99::internal -#define MCFG_MAINBOARD8_READY_CALLBACK(_write) \ - downcast(*device).set_ready_wr_callback(DEVCB_##_write); - -#define MCFG_MAINBOARD8_RESET_CALLBACK(_write) \ - downcast(*device).set_reset_wr_callback(DEVCB_##_write); - -#define MCFG_MAINBOARD8_HOLD_CALLBACK(_write) \ - downcast(*device).set_hold_wr_callback(DEVCB_##_write); - -#define MCFG_OSO_INT_CALLBACK(_int) \ - downcast(*device).set_int_callback(DEVCB##_int); - DECLARE_DEVICE_TYPE_NS(TI99_MAINBOARD8, bus::ti99::internal, mainboard8_device) DECLARE_DEVICE_TYPE_NS(TI99_VAQUERRO, bus::ti99::internal, vaquerro_device) DECLARE_DEVICE_TYPE_NS(TI99_MOFETTA, bus::ti99::internal, mofetta_device) diff --git a/src/devices/bus/ti99/internal/evpcconn.h b/src/devices/bus/ti99/internal/evpcconn.h index 945c151605c..3aad475d3e7 100644 --- a/src/devices/bus/ti99/internal/evpcconn.h +++ b/src/devices/bus/ti99/internal/evpcconn.h @@ -20,10 +20,9 @@ class evpc_clock_connector : public device_t public: evpc_clock_connector(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template devcb_base &set_vdpint_callback(Object &&cb) { return m_vdpint.set_callback(std::forward(cb)); } - DECLARE_WRITE_LINE_MEMBER( vclock_line ); void device_start() override; + auto vdpint_cb() { return m_vdpint.bind(); } private: // VDPINT line to the CPU @@ -34,8 +33,4 @@ private: DECLARE_DEVICE_TYPE_NS(TI99_EVPCCONN, bus::ti99::internal, evpc_clock_connector) -#define MCFG_ADD_EVPC_CONNECTOR( _tag, _vdpint ) \ - MCFG_DEVICE_ADD(_tag, TI99_EVPCCONN, 0) \ - downcast(*device).set_vdpint_callback(DEVCB_##_vdpint); - #endif // MAME_BUS_TI99_INTERNAL_EVPCCONN_H diff --git a/src/devices/bus/ti99/internal/genboard.h b/src/devices/bus/ti99/internal/genboard.h index e83e81cfc26..875f9f8bd51 100644 --- a/src/devices/bus/ti99/internal/genboard.h +++ b/src/devices/bus/ti99/internal/genboard.h @@ -62,7 +62,7 @@ public: DECLARE_WRITE_LINE_MEMBER( clock_control ); uint8_t get_recent_key(); - template devcb_base &set_int_callback(Object &&cb) { return m_interrupt.set_callback(std::forward(cb)); } + auto int_cb() { return m_interrupt.bind(); } protected: void device_start() override; @@ -107,9 +107,6 @@ private: emu_timer* m_timer; }; -#define MCFG_GENEVE_KBINT_HANDLER( _intcallb ) \ - downcast(*device).set_int_callback(DEVCB_##_intcallb); - /*****************************************************************************/ class geneve_mapper_device : public device_t @@ -138,7 +135,7 @@ public: DECLARE_WRITE_LINE_MEMBER( pfm_select_msb ); DECLARE_WRITE_LINE_MEMBER( pfm_output_enable ); - template devcb_base &set_ready_callback(Object &&cb) { return m_ready.set_callback(std::forward(cb)); } + auto ready_cb() { return m_ready.bind(); } protected: geneve_mapper_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); @@ -307,9 +304,6 @@ private: bool m_turbo; }; -#define MCFG_GENEVE_READY_HANDLER( _intcallb ) \ - downcast(*device).set_ready_callback(DEVCB_##_intcallb); - } } } // end namespace bus::ti99::internal DECLARE_DEVICE_TYPE_NS(GENEVE_KEYBOARD, bus::ti99::internal, geneve_keyboard_device) diff --git a/src/devices/bus/ti99/peb/ti_rs232.cpp b/src/devices/bus/ti99/peb/ti_rs232.cpp index 4863c9f875f..8f2ed3f4c45 100644 --- a/src/devices/bus/ti99/peb/ti_rs232.cpp +++ b/src/devices/bus/ti99/peb/ti_rs232.cpp @@ -133,11 +133,22 @@ namespace bus { namespace ti99 { namespace peb { #define ESC 0x1b +#define UART0 "uart0" +#define UART1 "uart1" + +#define SERDEV0 "serdev0" +#define SERDEV1 "serdev1" +#define PIODEV "piodev" + ti_rs232_pio_device::ti_rs232_pio_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, TI99_RS232, tag, owner, clock), device_ti99_peribox_card_interface(mconfig, *this), m_crulatch(*this, "crulatch"), - m_piodev(nullptr), + m_uart0(*this, UART0), + m_uart1(*this, UART1), + m_serdev0(*this, SERDEV0), + m_serdev1(*this, SERDEV1), + m_piodev(*this, PIODEV), m_dsrrom(nullptr), m_pio_direction_in(false), m_pio_handshakeout(false), @@ -161,7 +172,8 @@ ti_rs232_pio_device::ti_rs232_pio_device(const machine_config &mconfig, const ch ti_rs232_attached_device::ti_rs232_attached_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, TI99_RS232_DEV, tag, owner, clock), - device_image_interface(mconfig, *this) + device_image_interface(mconfig, *this), + m_uart(nullptr) { } @@ -171,55 +183,12 @@ ti_pio_attached_device::ti_pio_attached_device(const machine_config &mconfig, co { } -void ti_rs232_attached_device::device_start() -{ -} - -void ti_pio_attached_device::device_start() -{ -} - -/* - Find the index of the image name. We assume the format - , i.e. the number is the longest string from the right - which can be interpreted as a number. -*/ -int ti_rs232_attached_device::get_index_from_tagname() -{ - const char *mytag = tag(); - int maxlen = strlen(mytag); - int i; - for (i=maxlen-1; i >=0; i--) - if (mytag[i] < 48 || mytag[i] > 57) break; - - return atoi(mytag+i+1); -} - /* Initialize rs232 unit and open image */ image_init_result ti_rs232_attached_device::call_load() { - tms9902_device* tms9902; - - int devnumber = get_index_from_tagname(); - if (devnumber==0) - { - tms9902 = siblingdevice("tms9902_0"); - // Turn on polling - tms9902->set_clock(true); - } - else if (devnumber==1) - { - tms9902 = siblingdevice("tms9902_1"); - // Turn on polling - tms9902->set_clock(true); - } - else - { - LOGMASKED(LOG_WARN, "Could not find device tag number\n"); - return image_init_result::FAIL; - } + m_uart->set_clock(true); // The following line may cause trouble in the init phase // card->incoming_dtr(devnumber, (m_file!=nullptr)? ASSERT_LINE : CLEAR_LINE); @@ -229,21 +198,7 @@ image_init_result ti_rs232_attached_device::call_load() void ti_rs232_attached_device::call_unload() { - tms9902_device* tms9902; - - int devnumber = get_index_from_tagname(); - if (devnumber==0) - { - tms9902 = siblingdevice("tms9902_0"); - // Turn off polling - tms9902->set_clock(false); - } - else if (devnumber==1) - { - tms9902 = siblingdevice("tms9902_1"); - // Turn off polling - tms9902->set_clock(false); - } + m_uart->set_clock(false); } /* @@ -304,12 +259,12 @@ READ8Z_MEMBER(ti_rs232_pio_device::crureadz) } if ((offset & 0x00c0)==0x0040) { - *value = m_uart[0]->cruread(space, offset>>4, 0xff); + *value = m_uart0->cruread(space, offset>>4, 0xff); return; } if ((offset & 0x00c0)==0x0080) { - *value = m_uart[1]->cruread(space, offset>>4, 0xff); + *value = m_uart1->cruread(space, offset>>4, 0xff); return; } } @@ -324,12 +279,12 @@ WRITE8_MEMBER(ti_rs232_pio_device::cruwrite) { if ((offset & 0x00c0)==0x0040) { - m_uart[0]->cruwrite(space, offset>>1, data, 0xff); + m_uart0->cruwrite(space, offset>>1, data, 0xff); return; } if ((offset & 0x00c0)==0x0080) { - m_uart[1]->cruwrite(space, offset>>1, data, 0xff); + m_uart1->cruwrite(space, offset>>1, data, 0xff); return; } @@ -350,8 +305,6 @@ WRITE_LINE_MEMBER(ti_rs232_pio_device::pio_direction_in_w) WRITE_LINE_MEMBER(ti_rs232_pio_device::pio_handshake_out_w) { - device_image_interface *image = dynamic_cast(m_piodev); - m_pio_handshakeout = state; if (m_pio_write && m_pio_writable && (!m_pio_direction_in)) { /* PIO in output mode */ @@ -359,7 +312,7 @@ WRITE_LINE_MEMBER(ti_rs232_pio_device::pio_handshake_out_w) { /* write data strobe */ /* write data and acknowledge */ uint8_t buf = m_pio_out_buffer; - int ret = image->fwrite(&buf, 1); + int ret = m_piodev->fwrite(&buf, 1); if (ret) m_pio_handshakein = 1; } @@ -376,7 +329,7 @@ WRITE_LINE_MEMBER(ti_rs232_pio_device::pio_handshake_out_w) { /* receiver ready */ /* send data and strobe */ uint8_t buf; - if (image->fread(&buf, 1)) + if (m_piodev->fread(&buf, 1)) m_pio_in_buffer = buf; m_pio_handshakein = 0; } @@ -471,8 +424,16 @@ void ti_rs232_pio_device::incoming_dtr(int uartind, line_state value) { LOGMASKED(LOG_LINES, "(RS232/%d) Incoming DTR = %d\n", uartind+1, (value==ASSERT_LINE)? 1:0); - m_uart[uartind]->rcv_cts(value); - m_uart[uartind]->rcv_dsr(value); + if (uartind==0) + { + m_uart0->rcv_cts(value); + m_uart0->rcv_dsr(value); + } + else + { + m_uart1->rcv_cts(value); + m_uart1->rcv_dsr(value); + } } /* @@ -481,9 +442,8 @@ void ti_rs232_pio_device::incoming_dtr(int uartind, line_state value) void ti_rs232_pio_device::transmit_data(int uartind, uint8_t value) { uint8_t buf = value; + ti_rs232_attached_device *serial = (uartind==0)? m_serdev0 : m_serdev1; - device_image_interface *serial; - serial = dynamic_cast(m_serdev[uartind]); if (!serial->exists()) { LOGMASKED(LOG_CONFIG, "(RS232/%d) No serial output attached\n", uartind+1); @@ -710,10 +670,10 @@ uint8_t ti_rs232_pio_device::map_lines_in(int uartind, uint8_t value) */ void ti_rs232_pio_device::receive_data_or_line_state(int uartind) { - device_image_interface *serial; uint8_t buffer; - serial = dynamic_cast(m_serdev[uartind]); + ti_rs232_attached_device *serial = (uartind==0)? m_serdev0 : m_serdev1; + tms9902_device *uart = (uartind==0)? m_uart0 : m_uart1; if (!serial->exists()) { @@ -721,7 +681,7 @@ void ti_rs232_pio_device::receive_data_or_line_state(int uartind) return; } - double baudpoll = m_uart[uartind]->get_baudpoll(); + double baudpoll = uart->get_baudpoll(); // If more than the minimum waiting time since the last data byte has // elapsed, we can get a new value. @@ -758,7 +718,7 @@ void ti_rs232_pio_device::receive_data_or_line_state(int uartind) else { LOGMASKED(LOG_IN, "(RS232/%d) Received: %c <%02x>, pass to UART\n", uartind+1, cbuf, buffer); - m_uart[uartind]->rcv_data(buffer); + uart->rcv_data(buffer); m_time_hold[uartind] = 0.0; } break; @@ -767,7 +727,7 @@ void ti_rs232_pio_device::receive_data_or_line_state(int uartind) { m_recv_mode[uartind] = RECV_MODE_NORMAL; LOGMASKED(LOG_STATE, "(RS232/%d) Received another ESC, passing to UART, leaving ESC mode\n", uartind+1); - m_uart[uartind]->rcv_data(buffer); + uart->rcv_data(buffer); m_time_hold[uartind] = 0.0; } else @@ -791,10 +751,12 @@ void ti_rs232_pio_device::receive_data_or_line_state(int uartind) { // Exception states: BRK, FRMERR, PARERR LOGMASKED(LOG_LINES, "(RS232/%d) Received BRK or ERROR <%02x>\n", uartind+1, buffer); - m_uart[uartind]->rcv_break(((buffer & tms9902_device::BRK)!=0)); + uart->rcv_break(((buffer & tms9902_device::BRK)!=0)); - if (buffer & tms9902_device::FRMERR) m_uart[uartind]->rcv_framing_error(); - if (buffer & tms9902_device::PARERR) m_uart[uartind]->rcv_parity_error(); + if (buffer & tms9902_device::FRMERR) + uart->rcv_framing_error(); + if (buffer & tms9902_device::PARERR) + uart->rcv_parity_error(); } else { @@ -821,11 +783,9 @@ void ti_rs232_pio_device::receive_data_or_line_state(int uartind) void ti_rs232_pio_device::configure_interface(int uartind, int type, int value) { uint8_t bufctrl[4]; - device_image_interface *serial; + ti_rs232_attached_device *serial = (uartind==0)? m_serdev0 : m_serdev1; uint8_t esc = ESC; - serial = dynamic_cast(m_serdev[uartind]); - if (!serial->exists()) { LOGMASKED(LOG_CONFIG, "(RS232/%d) No serial output attached\n", uartind+1); @@ -903,12 +863,10 @@ void ti_rs232_pio_device::set_bit(int uartind, int line, int value) */ void ti_rs232_pio_device::output_exception(int uartind, int param, uint8_t value) { - device_image_interface *serial; + ti_rs232_attached_device *serial = (uartind==0)? m_serdev0 : m_serdev1; uint8_t bufctrl[2]; uint8_t esc = ESC; - serial = dynamic_cast(m_serdev[uartind]); - if (!serial->exists()) { LOGMASKED(LOG_CONFIG, "(RS232/%d) No serial output attached\n", uartind+1); @@ -929,12 +887,10 @@ void ti_rs232_pio_device::output_exception(int uartind, int param, uint8_t value */ void ti_rs232_pio_device::output_line_state(int uartind, int mask, uint8_t value) { - device_image_interface *serial; + ti_rs232_attached_device *serial = (uartind==0)? m_serdev0 : m_serdev1; uint8_t bufctrl[2]; uint8_t esc = ESC; - serial = dynamic_cast(m_serdev[uartind]); - if (!serial->exists()) { LOGMASKED(LOG_CONFIG, "(RS232/%d) No serial output attached\n", uartind+1); @@ -942,6 +898,7 @@ void ti_rs232_pio_device::output_line_state(int uartind, int mask, uint8_t value } // Send ESC to serial bridge + // FIXME: When the socket cannot be set up, MAME crashes here serial->fwrite(&esc, 1); // Length 1 @@ -1026,7 +983,7 @@ void ti_rs232_pio_device::ctrl_callback(int uartind, int offset, uint8_t data) { // We cannot pass the configuration data as they need more than 8 bits. // Could be done by a write16 function as well. - configure_interface(uartind, data, m_uart[uartind]->get_config_value()); + configure_interface(uartind, data, (uartind==0)? m_uart0->get_config_value() : m_uart1->get_config_value()); } else { @@ -1054,14 +1011,11 @@ WRITE8_MEMBER( ti_rs232_pio_device::ctrl1_callback ) void ti_rs232_pio_device::device_start() { m_dsrrom = memregion(TI99_DSRROM)->base(); - m_uart[0] = subdevice("tms9902_0"); - m_uart[1] = subdevice("tms9902_1"); - m_serdev[0] = subdevice("serdev0"); - m_serdev[1] = subdevice("serdev1"); - m_piodev = subdevice("piodev"); + // Prepare the receive buffers m_recvbuf[0] = std::make_unique(512); m_recvbuf[1] = std::make_unique(512); + m_pio_write = true; // required for call_load of pio_attached_device m_pio_writable = false; m_pio_handshakein = false; @@ -1148,19 +1102,22 @@ INPUT_PORTS_START( ti_rs232 ) INPUT_PORTS_END MACHINE_CONFIG_START(ti_rs232_pio_device::device_add_mconfig) - MCFG_DEVICE_ADD("tms9902_0", TMS9902, 3000000) - MCFG_TMS9902_INT_CB(WRITELINE(*this, ti_rs232_pio_device, int0_callback)) /* called when interrupt pin state changes */ - MCFG_TMS9902_RCV_CB(WRITELINE(*this, ti_rs232_pio_device, rcv0_callback)) /* called when a character is received */ - MCFG_TMS9902_XMIT_CB(WRITE8(*this, ti_rs232_pio_device, xmit0_callback)) /* called when a character is transmitted */ - MCFG_TMS9902_CTRL_CB(WRITE8(*this, ti_rs232_pio_device, ctrl0_callback)) - MCFG_DEVICE_ADD("tms9902_1", TMS9902, 3000000) - MCFG_TMS9902_INT_CB(WRITELINE(*this, ti_rs232_pio_device, int1_callback)) /* called when interrupt pin state changes */ - MCFG_TMS9902_RCV_CB(WRITELINE(*this, ti_rs232_pio_device, rcv1_callback)) /* called when a character is received */ - MCFG_TMS9902_XMIT_CB(WRITE8(*this, ti_rs232_pio_device, xmit1_callback)) /* called when a character is transmitted */ - MCFG_TMS9902_CTRL_CB(WRITE8(*this, ti_rs232_pio_device, ctrl1_callback)) - MCFG_DEVICE_ADD("serdev0", TI99_RS232_DEV, 0) - MCFG_DEVICE_ADD("serdev1", TI99_RS232_DEV, 0) - MCFG_DEVICE_ADD("piodev", TI99_PIO_DEV, 0) + TMS9902(config, m_uart0, 3000000); + m_uart0->int_cb().set(FUNC(ti_rs232_pio_device::int0_callback)); + m_uart0->rcv_cb().set(FUNC(ti_rs232_pio_device::rcv0_callback)); + m_uart0->xmit_cb().set(FUNC(ti_rs232_pio_device::xmit0_callback)); + m_uart0->ctrl_cb().set(FUNC(ti_rs232_pio_device::ctrl0_callback)); + TMS9902(config, m_uart1, 3000000); + m_uart1->int_cb().set(FUNC(ti_rs232_pio_device::int1_callback)); + m_uart1->rcv_cb().set(FUNC(ti_rs232_pio_device::rcv1_callback)); + m_uart1->xmit_cb().set(FUNC(ti_rs232_pio_device::xmit1_callback)); + m_uart1->ctrl_cb().set(FUNC(ti_rs232_pio_device::ctrl1_callback)); + TI99_RS232_DEV(config, m_serdev0, 0); + m_serdev0->connect(m_uart0); + TI99_RS232_DEV(config, m_serdev1, 0); + m_serdev1->connect(m_uart1); + + TI99_PIO_DEV(config, m_piodev, 0); LS259(config, m_crulatch); // U12 m_crulatch->q_out_cb<0>().set(FUNC(ti_rs232_pio_device::selected_w)); diff --git a/src/devices/bus/ti99/peb/ti_rs232.h b/src/devices/bus/ti99/peb/ti_rs232.h index 425120b3488..75e6ff582df 100644 --- a/src/devices/bus/ti99/peb/ti_rs232.h +++ b/src/devices/bus/ti99/peb/ti_rs232.h @@ -38,12 +38,12 @@ public: DECLARE_WRITE8_MEMBER(cruwrite) override; protected: - virtual void device_start() override; - virtual void device_reset() override; - virtual void device_stop() override; - virtual const tiny_rom_entry *device_rom_region() const override; - virtual void device_add_mconfig(machine_config &config) override; - virtual ioport_constructor device_input_ports() const override; + void device_start() override; + void device_reset() override; + void device_stop() override; + const tiny_rom_entry *device_rom_region() const override; + void device_add_mconfig(machine_config &config) override; + ioport_constructor device_input_ports() const override; private: DECLARE_WRITE_LINE_MEMBER(int0_callback); @@ -77,15 +77,18 @@ private: void ctrl_callback(int uartind, int type, uint8_t data); required_device m_crulatch; + // Asynchronous receivers/transmitters + required_device m_uart0; + required_device m_uart1; - // UART chips - tms9902_device* m_uart[2]; // Connected images (file or socket connection) that represent the // devices that are connected to the serial adapters - ti_rs232_attached_device* m_serdev[2]; + required_device m_serdev0; + required_device m_serdev1; + // Connected image (file) that represents the device connected to the // parallel interface - ti_pio_attached_device* m_piodev; + required_device m_piodev; uint8_t* m_dsrrom; // Input buffer for each UART. We have to copy the contents of sdlsocket here @@ -138,14 +141,16 @@ public: bool is_reset_on_load() const override { return false; } const char *image_interface() const override { return ""; } const char *file_extensions() const override { return ""; } + void connect(tms9902_device *dev) { m_uart = dev; } protected: - virtual void device_start() override; + void device_start() override { }; image_init_result call_load() override; void call_unload() override; private: int get_index_from_tagname(); + tms9902_device* m_uart; }; /* @@ -166,7 +171,7 @@ public: const char *file_extensions() const override { return ""; } protected: - virtual void device_start() override; + void device_start() override { }; image_init_result call_load() override; void call_unload() override; }; diff --git a/src/devices/machine/tmc0430.h b/src/devices/machine/tmc0430.h index 7cd906570f1..dbbf1757f46 100644 --- a/src/devices/machine/tmc0430.h +++ b/src/devices/machine/tmc0430.h @@ -28,10 +28,8 @@ class tmc0430_device : public device_t public: tmc0430_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template devcb_base &set_ready_wr_callback(Object &&cb) { return m_gromready.set_callback(std::forward(cb)); } - auto ready_cb() { return m_gromready.bind(); } - + void readz(uint8_t *value); void write(uint8_t data); void set_lines(line_state mline, line_state moline, line_state gsq); @@ -103,9 +101,4 @@ private: uint8_t *m_memptr; }; -#define MCFG_GROM_ADD(_tag, _ident, _region, _offset, _ready) \ - MCFG_DEVICE_ADD(_tag, TMC0430, 0) \ - downcast(*device).set_region_and_ident(_region, _offset, _ident); \ - downcast(*device).set_ready_wr_callback(DEVCB_##_ready); - #endif // MAME_MACHINE_TMC0430_H diff --git a/src/devices/machine/tms9902.h b/src/devices/machine/tms9902.h index 0e055253567..1f96e2ffc17 100644 --- a/src/devices/machine/tms9902.h +++ b/src/devices/machine/tms9902.h @@ -50,11 +50,6 @@ public: tms9902_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - template devcb_base &set_int_callback(Object &&cb) { return m_int_cb.set_callback(std::forward(cb)); } - template devcb_base &set_rcv_callback(Object &&cb) { return m_rcv_cb.set_callback(std::forward(cb)); } - template devcb_base &set_xmit_callback(Object &&cb) { return m_xmit_cb.set_callback(std::forward(cb)); } - template devcb_base &set_ctrl_callback(Object &&cb) { return m_ctrl_cb.set_callback(std::forward(cb)); } - // Callbacks auto int_cb() { return m_int_cb.bind(); } auto rcv_cb() { return m_rcv_cb.bind(); } @@ -191,20 +186,4 @@ private: int m_last_config_value; }; -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ - -#define MCFG_TMS9902_INT_CB(cb) \ - downcast(*device).set_int_callback((DEVCB_##cb)); - -#define MCFG_TMS9902_RCV_CB(cb) \ - downcast(*device).set_rcv_callback((DEVCB_##cb)); - -#define MCFG_TMS9902_XMIT_CB(cb) \ - downcast(*device).set_xmit_callback((DEVCB_##cb)); - -#define MCFG_TMS9902_CTRL_CB(cb) \ - downcast(*device).set_ctrl_callback((DEVCB_##cb)); - #endif // MAME_MACHINE_TMS9902_H diff --git a/src/mame/drivers/geneve.cpp b/src/mame/drivers/geneve.cpp index eb71fbe553e..43c32261f54 100644 --- a/src/mame/drivers/geneve.cpp +++ b/src/mame/drivers/geneve.cpp @@ -698,8 +698,8 @@ MACHINE_CONFIG_START(geneve_state::geneve) geneve_common(config); // Mapper - MCFG_DEVICE_ADD(GENEVE_MAPPER_TAG, GENEVE_MAPPER, 0) - MCFG_GENEVE_READY_HANDLER( WRITELINE(*this, geneve_state, mapper_ready) ) + GENEVE_MAPPER(config, m_mapper, 0); + m_mapper->ready_cb().set(FUNC(geneve_state::mapper_ready)); // Peripheral expansion box (Geneve composition) TI99_PERIBOX_GEN(config, m_peribox, 0); @@ -712,8 +712,8 @@ MACHINE_CONFIG_START(geneve_state::genmod) geneve_common(config); // Mapper - MCFG_DEVICE_ADD(GENEVE_MAPPER_TAG, GENMOD_MAPPER, 0) - MCFG_GENEVE_READY_HANDLER( WRITELINE(*this, geneve_state, mapper_ready) ) + GENMOD_MAPPER(config, m_mapper, 0); + m_mapper->ready_cb().set(FUNC(geneve_state::mapper_ready)); // Peripheral expansion box (Geneve composition with Genmod and plugged-in Memex) TI99_PERIBOX_GENMOD(config, m_peribox, 0); @@ -764,11 +764,10 @@ MACHINE_CONFIG_START(geneve_state::geneve_common) MCFG_SN76496_READY_HANDLER( WRITELINE(*this, geneve_state, ext_ready) ) // User interface devices - MCFG_DEVICE_ADD( GENEVE_KEYBOARD_TAG, GENEVE_KEYBOARD, 0 ) - MCFG_GENEVE_KBINT_HANDLER( WRITELINE(*this, geneve_state, keyboard_interrupt) ) + GENEVE_KEYBOARD(config, m_keyboard, 0); + m_keyboard->int_cb().set(FUNC(geneve_state::keyboard_interrupt)); TI99_JOYPORT(config, m_joyport, 0); m_joyport->configure_slot(false, false); - TI99_COLORBUS(config, m_colorbus, 0); m_colorbus->configure_slot(); diff --git a/src/mame/drivers/jpmmps.cpp b/src/mame/drivers/jpmmps.cpp index ceed996aafb..6f7b8e512e4 100644 --- a/src/mame/drivers/jpmmps.cpp +++ b/src/mame/drivers/jpmmps.cpp @@ -132,9 +132,8 @@ #include "j2trail.lh" #include "j2tstplt.lh" - - - +#define UART_IC5 "tms9902_ic5" +#define UART_IC10 "tms9902_ic10" class jpmmps_state : public driver_device @@ -144,7 +143,9 @@ public: : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_psg(*this, "sn"), - m_meters(*this, "meters") + m_meters(*this, "meters"), + m_uart_ic5(*this, UART_IC5), + m_uart_ic10(*this, UART_IC10) { } void jpmmps(machine_config &config); @@ -161,6 +162,8 @@ private: required_device m_maincpu; required_device m_psg; required_device m_meters; + required_device m_uart_ic5; + required_device m_uart_ic10; DECLARE_WRITE8_MEMBER(jpmmps_meters_w); DECLARE_WRITE8_MEMBER(jpmmps_psg_buf_w); @@ -182,7 +185,7 @@ void jpmmps_state::jpmmps_map(address_map &map) void jpmmps_state::jpmmps_io_map(address_map &map) { map.global_mask(0xff); - map(0x0000, 0x001f).rw("tms9902_ic5", FUNC(tms9902_device::cruread), FUNC(tms9902_device::cruwrite)); + map(0x0000, 0x001f).rw(UART_IC5, FUNC(tms9902_device::cruread), FUNC(tms9902_device::cruwrite)); // AM_RANGE(0x0020, 0x0020) // power fail // AM_RANGE(0x0021, 0x0021) // wd timeout @@ -192,7 +195,7 @@ void jpmmps_state::jpmmps_io_map(address_map &map) // AM_RANGE(0x0026, 0x0026) // uart4 int // AM_RANGE(0x0027, 0x0027) // uart2 int - map(0x0040, 0x005f).rw("tms9902_ic10", FUNC(tms9902_device::cruread), FUNC(tms9902_device::cruwrite)); + map(0x0040, 0x005f).rw(UART_IC10, FUNC(tms9902_device::cruread), FUNC(tms9902_device::cruwrite)); map(0x0060, 0x0067).w("mainlatch", FUNC(ls259_device::write_d0)); } @@ -276,8 +279,8 @@ MACHINE_CONFIG_START(jpmmps_state::jpmmps) MCFG_DEVICE_ADD("ppi8255_ic25", I8255, 0) - MCFG_DEVICE_ADD("tms9902_ic10", TMS9902, DUART_CLOCK) // Communication with Reel MCU - MCFG_DEVICE_ADD("tms9902_ic5", TMS9902, DUART_CLOCK) // Communication with Security / Printer + TMS9902(config, m_uart_ic10, DUART_CLOCK); // Communication with Reel MCU + TMS9902(config, m_uart_ic5, DUART_CLOCK); // Communication with Security / Printer SPEAKER(config, "mono").front_center(); diff --git a/src/mame/drivers/jpms80.cpp b/src/mame/drivers/jpms80.cpp index 3cb91b9ce3f..65109f5cfb0 100644 --- a/src/mame/drivers/jpms80.cpp +++ b/src/mame/drivers/jpms80.cpp @@ -52,7 +52,8 @@ class jpms80_state : public driver_device public: jpms80_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), - m_maincpu(*this, "maincpu") + m_maincpu(*this, "maincpu"), + m_duart(*this, "tms9902duart") { } void jpms80(machine_config &config); @@ -73,6 +74,7 @@ private: // devices required_device m_maincpu; + required_device m_duart; }; WRITE_LINE_MEMBER(jpms80_state::int1_enable_w) @@ -158,7 +160,7 @@ MACHINE_CONFIG_START(jpms80_state::jpms80) outlatch10.q_out_cb<2>().set(FUNC(jpms80_state::watchdog_w)); // 52 - Watchdog outlatch10.q_out_cb<3>().set(FUNC(jpms80_state::io_enable_w)); // 53 - I/O Enable - MCFG_DEVICE_ADD("tms9902duart", TMS9902, DUART_CLOCK) + TMS9902(config, m_duart, DUART_CLOCK); MCFG_DEVICE_ADD("aysnd", AY8910, 2000000) MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.0) diff --git a/src/mame/drivers/ti99_2.cpp b/src/mame/drivers/ti99_2.cpp index 67638be5fdd..73049e63023 100644 --- a/src/mame/drivers/ti99_2.cpp +++ b/src/mame/drivers/ti99_2.cpp @@ -426,7 +426,7 @@ MACHINE_CONFIG_START(ti99_2_state::ti99_224) MCFG_VIDEO992_SCREEN_ADD( TI992_SCREEN_TAG ) MCFG_SCREEN_UPDATE_DEVICE( TI992_VDC_TAG, bus::ti99::internal::video992_device, screen_update ) // I/O interface circuit - MCFG_DEVICE_ADD(TI992_IO_TAG, IO99224, 0) + IO99224(config, m_io992, 0); MCFG_MACHINE_START_OVERRIDE(ti99_2_state, ti99_224 ) MACHINE_CONFIG_END @@ -442,8 +442,8 @@ MACHINE_CONFIG_START(ti99_2_state::ti99_232) MCFG_SCREEN_UPDATE_DEVICE( TI992_VDC_TAG, bus::ti99::internal::video992_device, screen_update ) // I/O interface circuit - MCFG_DEVICE_ADD(TI992_IO_TAG, IO99232, 0) - MCFG_SET_ROMBANK_HANDLER(WRITELINE(*this, ti99_2_state, rombank_set) ) + IO99232(config, m_io992, 0); + m_io992->rombank_cb().set(FUNC(ti99_2_state::rombank_set)); MCFG_MACHINE_START_OVERRIDE(ti99_2_state, ti99_232 ) diff --git a/src/mame/drivers/ti99_4x.cpp b/src/mame/drivers/ti99_4x.cpp index 91bad09e4ae..603303730ad 100644 --- a/src/mame/drivers/ti99_4x.cpp +++ b/src/mame/drivers/ti99_4x.cpp @@ -924,9 +924,17 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4) WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "cass_out", 0.25); // GROM devices - MCFG_GROM_ADD( TI99_GROM0_TAG, 0, TI99_CONSOLEGROM, 0x0000, WRITELINE(*this, ti99_4x_state, console_ready_grom)) - MCFG_GROM_ADD( TI99_GROM1_TAG, 1, TI99_CONSOLEGROM, 0x2000, WRITELINE(*this, ti99_4x_state, console_ready_grom)) - MCFG_GROM_ADD( TI99_GROM2_TAG, 2, TI99_CONSOLEGROM, 0x4000, WRITELINE(*this, ti99_4x_state, console_ready_grom)) + tmc0430_device& grom0(TMC0430(config, TI99_GROM0_TAG, 0)); + grom0.ready_cb().set(FUNC(ti99_4x_state::console_ready_grom)); + grom0.set_region_and_ident(TI99_CONSOLEGROM, 0x0000, 0); + + tmc0430_device& grom1(TMC0430(config, TI99_GROM1_TAG, 0)); + grom1.ready_cb().set(FUNC(ti99_4x_state::console_ready_grom)); + grom1.set_region_and_ident(TI99_CONSOLEGROM, 0x2000, 1); + + tmc0430_device& grom2(TMC0430(config, TI99_GROM2_TAG, 0)); + grom2.ready_cb().set(FUNC(ti99_4x_state::console_ready_grom)); + grom2.set_region_and_ident(TI99_CONSOLEGROM, 0x4000, 2); // Joystick port TI99_JOYPORT(config, m_joyport, 0); @@ -1044,9 +1052,17 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4a) WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "cass_out", 0.25); // GROM devices - MCFG_GROM_ADD( TI99_GROM0_TAG, 0, TI99_CONSOLEGROM, 0x0000, WRITELINE(*this, ti99_4x_state, console_ready_grom)) - MCFG_GROM_ADD( TI99_GROM1_TAG, 1, TI99_CONSOLEGROM, 0x2000, WRITELINE(*this, ti99_4x_state, console_ready_grom)) - MCFG_GROM_ADD( TI99_GROM2_TAG, 2, TI99_CONSOLEGROM, 0x4000, WRITELINE(*this, ti99_4x_state, console_ready_grom)) + tmc0430_device& grom0(TMC0430(config, TI99_GROM0_TAG, 0)); + grom0.ready_cb().set(FUNC(ti99_4x_state::console_ready_grom)); + grom0.set_region_and_ident(TI99_CONSOLEGROM, 0x0000, 0); + + tmc0430_device& grom1(TMC0430(config, TI99_GROM1_TAG, 0)); + grom1.ready_cb().set(FUNC(ti99_4x_state::console_ready_grom)); + grom1.set_region_and_ident(TI99_CONSOLEGROM, 0x2000, 1); + + tmc0430_device& grom2(TMC0430(config, TI99_GROM2_TAG, 0)); + grom2.ready_cb().set(FUNC(ti99_4x_state::console_ready_grom)); + grom2.set_region_and_ident(TI99_CONSOLEGROM, 0x4000, 2); // Joystick port TI99_JOYPORT(config, m_joyport, 0); @@ -1185,7 +1201,8 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4ev_60hz) RAM(config, TI99_EXPRAM_TAG).set_default_size("32K").set_default_value(0); // EVPC connector - MCFG_ADD_EVPC_CONNECTOR( TI99_EVPC_CONN_TAG, WRITELINE( *this, ti99_4x_state, video_interrupt_evpc_in ) ) + bus::ti99::internal::evpc_clock_connector& evpcconn(TI99_EVPCCONN(config, TI99_EVPC_CONN_TAG, 0)); + evpcconn.vdpint_cb().set(FUNC(ti99_4x_state::video_interrupt_evpc_in)); // Software list MCFG_SOFTWARE_LIST_ADD("cart_list_ti99", "ti99_cart") @@ -1204,9 +1221,17 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4ev_60hz) WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "cass_out", 0.25); // GROM devices - MCFG_GROM_ADD( TI99_GROM0_TAG, 0, TI99_CONSOLEGROM, 0x0000, WRITELINE(*this, ti99_4x_state, console_ready_grom)) - MCFG_GROM_ADD( TI99_GROM1_TAG, 1, TI99_CONSOLEGROM, 0x2000, WRITELINE(*this, ti99_4x_state, console_ready_grom)) - MCFG_GROM_ADD( TI99_GROM2_TAG, 2, TI99_CONSOLEGROM, 0x4000, WRITELINE(*this, ti99_4x_state, console_ready_grom)) + tmc0430_device& grom0(TMC0430(config, TI99_GROM0_TAG, 0)); + grom0.ready_cb().set(FUNC(ti99_4x_state::console_ready_grom)); + grom0.set_region_and_ident(TI99_CONSOLEGROM, 0x0000, 0); + + tmc0430_device& grom1(TMC0430(config, TI99_GROM1_TAG, 0)); + grom1.ready_cb().set(FUNC(ti99_4x_state::console_ready_grom)); + grom1.set_region_and_ident(TI99_CONSOLEGROM, 0x2000, 1); + + tmc0430_device& grom2(TMC0430(config, TI99_GROM2_TAG, 0)); + grom2.ready_cb().set(FUNC(ti99_4x_state::console_ready_grom)); + grom2.set_region_and_ident(TI99_CONSOLEGROM, 0x4000, 2); // Joystick port TI99_JOYPORT(config, m_joyport, 0); diff --git a/src/mame/drivers/ti99_8.cpp b/src/mame/drivers/ti99_8.cpp index 2fe2f94a34a..313a5fd1a17 100644 --- a/src/mame/drivers/ti99_8.cpp +++ b/src/mame/drivers/ti99_8.cpp @@ -759,10 +759,10 @@ MACHINE_CONFIG_START(ti99_8_state::ti99_8) m_tms9901->intlevel_cb().set(FUNC(ti99_8_state::tms9901_interrupt)); // Mainboard with custom chips - MCFG_DEVICE_ADD(TI998_MAINBOARD_TAG, TI99_MAINBOARD8, 0) - MCFG_MAINBOARD8_READY_CALLBACK(WRITELINE(*this, ti99_8_state, console_ready)) - MCFG_MAINBOARD8_RESET_CALLBACK(WRITELINE(*this, ti99_8_state, console_reset)) - MCFG_MAINBOARD8_HOLD_CALLBACK(WRITELINE(*this, ti99_8_state, cpu_hold)) + TI99_MAINBOARD8(config, m_mainboard, 0); + m_mainboard->ready_cb().set(FUNC(ti99_8_state::console_ready)); + m_mainboard->reset_cb().set(FUNC(ti99_8_state::console_reset)); + m_mainboard->hold_cb().set(FUNC(ti99_8_state::cpu_hold)); // Cartridge port TI99_GROMPORT(config, m_gromport, 0); @@ -807,31 +807,96 @@ MACHINE_CONFIG_START(ti99_8_state::ti99_8) WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "cass_out", 0.25); // GROM library - MCFG_GROM_ADD( TI998_SYSGROM0_TAG, 0, TI998_SYSGROM_REG, 0x0000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, system_grom_ready)) - MCFG_GROM_ADD( TI998_SYSGROM1_TAG, 1, TI998_SYSGROM_REG, 0x2000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, system_grom_ready)) - MCFG_GROM_ADD( TI998_SYSGROM2_TAG, 2, TI998_SYSGROM_REG, 0x4000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, system_grom_ready)) + tmc0430_device& sgrom0(TMC0430(config, TI998_SYSGROM0_TAG, 0)); + sgrom0.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::system_grom_ready)); + sgrom0.set_region_and_ident(TI998_SYSGROM_REG, 0x0000, 0); - MCFG_GROM_ADD( TI998_GLIB10_TAG, 0, TI998_GROMLIB1_REG, 0x0000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, ptts_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB11_TAG, 1, TI998_GROMLIB1_REG, 0x2000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, ptts_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB12_TAG, 2, TI998_GROMLIB1_REG, 0x4000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, ptts_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB13_TAG, 3, TI998_GROMLIB1_REG, 0x6000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, ptts_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB14_TAG, 4, TI998_GROMLIB1_REG, 0x8000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, ptts_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB15_TAG, 5, TI998_GROMLIB1_REG, 0xa000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, ptts_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB16_TAG, 6, TI998_GROMLIB1_REG, 0xc000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, ptts_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB17_TAG, 7, TI998_GROMLIB1_REG, 0xe000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, ptts_grom_ready)) + tmc0430_device& sgrom1(TMC0430(config, TI998_SYSGROM1_TAG, 0)); + sgrom1.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::system_grom_ready)); + sgrom1.set_region_and_ident(TI998_SYSGROM_REG, 0x2000, 1); - MCFG_GROM_ADD( TI998_GLIB20_TAG, 0, TI998_GROMLIB2_REG, 0x0000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, p8_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB21_TAG, 1, TI998_GROMLIB2_REG, 0x2000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, p8_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB22_TAG, 2, TI998_GROMLIB2_REG, 0x4000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, p8_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB23_TAG, 3, TI998_GROMLIB2_REG, 0x6000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, p8_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB24_TAG, 4, TI998_GROMLIB2_REG, 0x8000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, p8_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB25_TAG, 5, TI998_GROMLIB2_REG, 0xa000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, p8_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB26_TAG, 6, TI998_GROMLIB2_REG, 0xc000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, p8_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB27_TAG, 7, TI998_GROMLIB2_REG, 0xe000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, p8_grom_ready)) + tmc0430_device& sgrom2(TMC0430(config, TI998_SYSGROM2_TAG, 0)); + sgrom2.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::system_grom_ready)); + sgrom2.set_region_and_ident(TI998_SYSGROM_REG, 0x4000, 2); - MCFG_GROM_ADD( TI998_GLIB30_TAG, 0, TI998_GROMLIB3_REG, 0x0000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, p3_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB31_TAG, 1, TI998_GROMLIB3_REG, 0x2000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, p3_grom_ready)) - MCFG_GROM_ADD( TI998_GLIB32_TAG, 2, TI998_GROMLIB3_REG, 0x4000, WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, p3_grom_ready)) + + tmc0430_device& tgrom0(TMC0430(config, TI998_GLIB10_TAG, 0)); + tgrom0.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::ptts_grom_ready)); + tgrom0.set_region_and_ident(TI998_GROMLIB1_REG, 0x0000, 0); + + tmc0430_device& tgrom1(TMC0430(config, TI998_GLIB11_TAG, 0)); + tgrom1.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::ptts_grom_ready)); + tgrom1.set_region_and_ident(TI998_GROMLIB1_REG, 0x2000, 1); + + tmc0430_device& tgrom2(TMC0430(config, TI998_GLIB12_TAG, 0)); + tgrom2.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::ptts_grom_ready)); + tgrom2.set_region_and_ident(TI998_GROMLIB1_REG, 0x4000, 2); + + tmc0430_device& tgrom3(TMC0430(config, TI998_GLIB13_TAG, 0)); + tgrom3.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::ptts_grom_ready)); + tgrom3.set_region_and_ident(TI998_GROMLIB1_REG, 0x6000, 3); + + tmc0430_device& tgrom4(TMC0430(config, TI998_GLIB14_TAG, 0)); + tgrom4.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::ptts_grom_ready)); + tgrom4.set_region_and_ident(TI998_GROMLIB1_REG, 0x8000, 4); + + tmc0430_device& tgrom5(TMC0430(config, TI998_GLIB15_TAG, 0)); + tgrom5.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::ptts_grom_ready)); + tgrom5.set_region_and_ident(TI998_GROMLIB1_REG, 0xa000, 5); + + tmc0430_device& tgrom6(TMC0430(config, TI998_GLIB16_TAG, 0)); + tgrom6.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::ptts_grom_ready)); + tgrom6.set_region_and_ident(TI998_GROMLIB1_REG, 0xc000, 6); + + tmc0430_device& tgrom7(TMC0430(config, TI998_GLIB17_TAG, 0)); + tgrom7.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::ptts_grom_ready)); + tgrom7.set_region_and_ident(TI998_GROMLIB1_REG, 0xe000, 7); + + + tmc0430_device& p8grom0(TMC0430(config, TI998_GLIB20_TAG, 0)); + p8grom0.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::p8_grom_ready)); + p8grom0.set_region_and_ident(TI998_GROMLIB2_REG, 0x0000, 0); + + tmc0430_device& p8grom1(TMC0430(config, TI998_GLIB21_TAG, 0)); + p8grom1.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::p8_grom_ready)); + p8grom1.set_region_and_ident(TI998_GROMLIB2_REG, 0x2000, 1); + + tmc0430_device& p8grom2(TMC0430(config, TI998_GLIB22_TAG, 0)); + p8grom2.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::p8_grom_ready)); + p8grom2.set_region_and_ident(TI998_GROMLIB2_REG, 0x4000, 2); + + tmc0430_device& p8grom3(TMC0430(config, TI998_GLIB23_TAG, 0)); + p8grom3.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::p8_grom_ready)); + p8grom3.set_region_and_ident(TI998_GROMLIB2_REG, 0x6000, 3); + + tmc0430_device& p8grom4(TMC0430(config, TI998_GLIB24_TAG, 0)); + p8grom4.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::p8_grom_ready)); + p8grom4.set_region_and_ident(TI998_GROMLIB2_REG, 0x8000, 4); + + tmc0430_device& p8grom5(TMC0430(config, TI998_GLIB25_TAG, 0)); + p8grom5.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::p8_grom_ready)); + p8grom5.set_region_and_ident(TI998_GROMLIB2_REG, 0xa000, 5); + + tmc0430_device& p8grom6(TMC0430(config, TI998_GLIB26_TAG, 0)); + p8grom6.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::p8_grom_ready)); + p8grom6.set_region_and_ident(TI998_GROMLIB2_REG, 0xc000, 6); + + tmc0430_device& p8grom7(TMC0430(config, TI998_GLIB27_TAG, 0)); + p8grom7.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::p8_grom_ready)); + p8grom7.set_region_and_ident(TI998_GROMLIB2_REG, 0xe000, 7); + + + tmc0430_device& p3grom0(TMC0430(config, TI998_GLIB30_TAG, 0)); + p3grom0.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::p3_grom_ready)); + p3grom0.set_region_and_ident(TI998_GROMLIB3_REG, 0x0000, 0); + + tmc0430_device& p3grom1(TMC0430(config, TI998_GLIB31_TAG, 0)); + p3grom1.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::p3_grom_ready)); + p3grom1.set_region_and_ident(TI998_GROMLIB3_REG, 0x2000, 1); + + tmc0430_device& p3grom2(TMC0430(config, TI998_GLIB32_TAG, 0)); + p3grom2.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::p3_grom_ready)); + p3grom2.set_region_and_ident(TI998_GROMLIB3_REG, 0x4000, 2); // Joystick port TI99_JOYPORT(config, m_joyport, 0); diff --git a/src/mame/drivers/tm990189.cpp b/src/mame/drivers/tm990189.cpp index 2378cf81d8b..1c92e836734 100644 --- a/src/mame/drivers/tm990189.cpp +++ b/src/mame/drivers/tm990189.cpp @@ -870,8 +870,9 @@ MACHINE_CONFIG_START(tm990189_state::tm990_189) m_tms9901_sys->p_out_cb(15).set(FUNC(tm990189_state::sys9901_tapewdata_w)); m_tms9901_sys->intlevel_cb().set(FUNC(tm990189_state::sys9901_interrupt_callback)); - MCFG_DEVICE_ADD(m_tms9902, TMS9902, 2000000) // MZ: needs to be fixed once the RS232 support is complete - MCFG_TMS9902_XMIT_CB(WRITE8(*this, tm990189_state, xmit_callback)) /* called when a character is transmitted */ + TMS9902(config, m_tms9902, 2000000); + m_tms9902->xmit_cb().set(FUNC(tm990189_state::xmit_callback)); // called when a character is transmitted + MCFG_DEVICE_ADD("rs232", TM990_189_RS232, 0, m_tms9902) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_timer", tm990189_state, display_callback, attotime::from_hz(30)) // Need to delay the timer, or it will spoil the initial LOAD @@ -931,8 +932,9 @@ MACHINE_CONFIG_START(tm990189_state::tm990_189_v) m_tms9901_sys->p_out_cb(15).set(FUNC(tm990189_state::sys9901_tapewdata_w)); m_tms9901_sys->intlevel_cb().set(FUNC(tm990189_state::sys9901_interrupt_callback)); - MCFG_DEVICE_ADD(m_tms9902, TMS9902, 2000000) // MZ: needs to be fixed once the RS232 support is complete - MCFG_TMS9902_XMIT_CB(WRITE8(*this, tm990189_state, xmit_callback)) /* called when a character is transmitted */ + TMS9902(config, m_tms9902, 2000000); + m_tms9902->xmit_cb().set(FUNC(tm990189_state::xmit_callback)); // called when a character is transmitted + MCFG_DEVICE_ADD("rs232", TM990_189_RS232, 0, m_tms9902) MCFG_TIMER_DRIVER_ADD_PERIODIC("display_timer", tm990189_state, display_callback, attotime::from_hz(30)) MCFG_TIMER_START_DELAY(attotime::from_msec(150))