From 204b65fa616a726230eec91f1b57629d3706df5d Mon Sep 17 00:00:00 2001 From: Michael Zapf Date: Sat, 18 Aug 2018 19:18:31 +0200 Subject: [PATCH] ti99: Further devcb3 works (nw). --- src/devices/bus/hexbus/hexbus.cpp | 14 +- src/devices/bus/hexbus/hexbus.h | 7 +- src/devices/bus/hexbus/hx5102.cpp | 2 +- src/devices/bus/ti99/peb/bwg.cpp | 4 +- src/devices/bus/ti99/peb/evpc.cpp | 31 ++- src/devices/bus/ti99/peb/hfdc.cpp | 10 +- src/devices/bus/ti99/peb/spchsyn.cpp | 35 +-- src/devices/bus/ti99/peb/spchsyn.h | 3 +- src/devices/bus/ti99/peb/tn_usbsm.cpp | 4 +- src/devices/machine/mm58274c.h | 1 + src/devices/sound/sn76496.h | 1 + src/devices/sound/tms5220.h | 10 + src/devices/video/v9938.h | 2 + src/mame/drivers/geneve.cpp | 35 +-- src/mame/drivers/ti99_2.cpp | 95 ++++---- src/mame/drivers/ti99_4p.cpp | 22 +- src/mame/drivers/ti99_4x.cpp | 299 +++++++++++++------------- src/mame/drivers/ti99_8.cpp | 110 ++++++---- 18 files changed, 367 insertions(+), 318 deletions(-) diff --git a/src/devices/bus/hexbus/hexbus.cpp b/src/devices/bus/hexbus/hexbus.cpp index 07313a45056..f1719780011 100644 --- a/src/devices/bus/hexbus/hexbus.cpp +++ b/src/devices/bus/hexbus/hexbus.cpp @@ -211,6 +211,14 @@ uint8_t hexbus_device::read(int dir) return value; } +void hexbus_device::configure_slot() +{ + option_reset(); + option_add("hx5102", HX5102); + set_default_option(nullptr); + set_fixed(false); +} + // ------------------------------------------------------------------------ hexbus_chained_device::hexbus_chained_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock): @@ -342,9 +350,3 @@ uint8_t hexbus_chained_device::to_line_state(uint8_t data, bool bav, bool hsk) // ------------------------------------------------------------------------ } } // end namespace bus::hexbus - -void hexbus_conn(device_slot_interface &device) -{ - device.option_add("hx5102", HX5102); -} - diff --git a/src/devices/bus/hexbus/hexbus.h b/src/devices/bus/hexbus/hexbus.h index e6e56ea4b38..fb558d42517 100644 --- a/src/devices/bus/hexbus/hexbus.h +++ b/src/devices/bus/hexbus/hexbus.h @@ -116,6 +116,7 @@ public: // Read and write operations on the bus uint8_t read(int dir); void write(int dir, uint8_t data); + void configure_slot(); protected: void device_start() override; @@ -128,14 +129,8 @@ private: hexbus_chained_device* m_chain_element; }; -#define MCFG_HEXBUS_ADD( _tag ) \ - MCFG_DEVICE_ADD(_tag, HEXBUS, 0) \ - MCFG_DEVICE_SLOT_INTERFACE( hexbus_conn, nullptr, false) - } } // end namespace bus::hexbus -void hexbus_conn(device_slot_interface &device); - DECLARE_DEVICE_TYPE_NS(HEXBUS, bus::hexbus, hexbus_device) #endif // MAME_BUS_HEXBUS_HEXBUS_H diff --git a/src/devices/bus/hexbus/hx5102.cpp b/src/devices/bus/hexbus/hx5102.cpp index b99d06bc87d..4bdb088471a 100644 --- a/src/devices/bus/hexbus/hx5102.cpp +++ b/src/devices/bus/hexbus/hx5102.cpp @@ -675,7 +675,7 @@ MACHINE_CONFIG_START(hx5102_device::device_add_mconfig) MCFG_IBC_HSKLATCH_CALLBACK(WRITELINE(*this, hx5102_device, hsklatch_out)) // Outgoing socket for downstream devices - MCFG_HEXBUS_ADD("hexbus") + HEXBUS(config, "hexbus", 0).configure_slot(); // TMS9995 CPU @ 12.0 MHz TMS9995(config, m_flopcpu, XTAL(12'000'000)); diff --git a/src/devices/bus/ti99/peb/bwg.cpp b/src/devices/bus/ti99/peb/bwg.cpp index bbfd3802dfe..4ef48a51ea0 100644 --- a/src/devices/bus/ti99/peb/bwg.cpp +++ b/src/devices/bus/ti99/peb/bwg.cpp @@ -680,9 +680,7 @@ MACHINE_CONFIG_START(snug_bwg_device::device_add_mconfig) m_wd1773->intrq_wr_callback().set(FUNC(snug_bwg_device::fdc_irq_w)); m_wd1773->drq_wr_callback().set(FUNC(snug_bwg_device::fdc_drq_w)); - MCFG_DEVICE_ADD(CLOCK_TAG, MM58274C, 0) - MCFG_MM58274C_MODE24(1) // 24 hour - MCFG_MM58274C_DAY1(0) // sunday + MM58274C(config, CLOCK_TAG, 0).set_mode_and_day(1, 0); // 24h, sunday MCFG_FLOPPY_DRIVE_ADD("0", bwg_floppies, "525dd", snug_bwg_device::floppy_formats) MCFG_FLOPPY_DRIVE_SOUND(true) diff --git a/src/devices/bus/ti99/peb/evpc.cpp b/src/devices/bus/ti99/peb/evpc.cpp index fa02660a3e5..98b425ba6ef 100644 --- a/src/devices/bus/ti99/peb/evpc.cpp +++ b/src/devices/bus/ti99/peb/evpc.cpp @@ -482,22 +482,31 @@ ioport_constructor snug_enhanced_video_device::device_input_ports() const return INPUT_PORTS_NAME(ti99_evpc); } -MACHINE_CONFIG_START(snug_enhanced_video_device::device_add_mconfig) +void snug_enhanced_video_device::device_add_mconfig(machine_config& config) +{ // video hardware - MCFG_V9938_ADD(TI_VDP_TAG, TI_SCREEN_TAG, 0x20000, XTAL(21'477'272)) /* typical 9938 clock, not verified */ - MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(*this, snug_enhanced_video_device, video_interrupt_in)) - MCFG_V99X8_SCREEN_ADD_NTSC(TI_SCREEN_TAG, TI_VDP_TAG, XTAL(21'477'272)) + V9938(config, m_video, XTAL(21'477'272)); // typical 9938 clock, not verified + m_video->set_vram_size(0x20000); + m_video->int_cb().set(FUNC(snug_enhanced_video_device::video_interrupt_in)); + m_video->set_screen(TI_SCREEN_TAG); + screen_device& screen(SCREEN(config, TI_SCREEN_TAG, SCREEN_TYPE_RASTER)); + screen.set_raw(XTAL(21'477'272), \ + v99x8_device::HTOTAL, \ + 0, \ + v99x8_device::HVISIBLE - 1, \ + v99x8_device::VTOTAL_NTSC * 2, \ + v99x8_device::VERTICAL_ADJUST * 2, \ + v99x8_device::VVISIBLE_NTSC * 2 - 1 - v99x8_device::VERTICAL_ADJUST * 2); + screen.set_screen_update(TI_VDP_TAG, FUNC(v99x8_device::screen_update)); // Sound hardware SPEAKER(config, "sound_out").front_center(); - MCFG_DEVICE_ADD(TI_SOUNDCHIP_TAG, SN94624, 3579545/8) /* 3.579545 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75) - MCFG_SN76496_READY_HANDLER( WRITELINE(*this, snug_enhanced_video_device, ready_line) ) + sn94624_device& soundgen(SN94624(config, TI_SOUNDCHIP_TAG, 3579545/8)); + soundgen.ready_cb().set(FUNC(snug_enhanced_video_device::ready_line)); + soundgen.add_route(ALL_OUTPUTS, "sound_out", 0.75); // Mouse connected to the color bus of the v9938 - TI99_COLORBUS(config, m_colorbus, 0); - m_colorbus->configure_slot(); - -MACHINE_CONFIG_END + TI99_COLORBUS(config, m_colorbus, 0).configure_slot(); +} } } } // end namespace bus::ti99::peb diff --git a/src/devices/bus/ti99/peb/hfdc.cpp b/src/devices/bus/ti99/peb/hfdc.cpp index 1cc4340e162..d48c138834a 100644 --- a/src/devices/bus/ti99/peb/hfdc.cpp +++ b/src/devices/bus/ti99/peb/hfdc.cpp @@ -1067,7 +1067,9 @@ ROM_START( ti99_hfdc ) ROM_END -MACHINE_CONFIG_START(myarc_hfdc_device::device_add_mconfig) +void myarc_hfdc_device::device_add_mconfig(machine_config& config) +{ + device_t *device = nullptr; HDC9234(config, m_hdc9234, 0); m_hdc9234->intrq_cb().set(FUNC(myarc_hfdc_device::intrq_w)); m_hdc9234->dmarq_cb().set(FUNC(myarc_hfdc_device::dmarq_w)); @@ -1090,12 +1092,10 @@ MACHINE_CONFIG_START(myarc_hfdc_device::device_add_mconfig) MCFG_MFM_HARDDISK_CONN_ADD("h2", hfdc_harddisks, nullptr, MFM_BYTE, 2000, 20, MFMHD_GEN_FORMAT) MCFG_MFM_HARDDISK_CONN_ADD("h3", hfdc_harddisks, nullptr, MFM_BYTE, 2000, 20, MFMHD_GEN_FORMAT) - MCFG_DEVICE_ADD(CLOCK_TAG, MM58274C, 0) - MCFG_MM58274C_MODE24(1) // 24 hour - MCFG_MM58274C_DAY1(0) // sunday + MM58274C(config, CLOCK_TAG, 0).set_mode_and_day(1, 0); // 24h, sunday RAM(config, BUFFER).set_default_size("32K").set_default_value(0); -MACHINE_CONFIG_END +} const tiny_rom_entry *myarc_hfdc_device::device_rom_region() const { diff --git a/src/devices/bus/ti99/peb/spchsyn.cpp b/src/devices/bus/ti99/peb/spchsyn.cpp index 86859c7d0c7..1ba1477a690 100644 --- a/src/devices/bus/ti99/peb/spchsyn.cpp +++ b/src/devices/bus/ti99/peb/spchsyn.cpp @@ -46,7 +46,9 @@ namespace bus { namespace ti99 { namespace peb { ti_speech_synthesizer_device::ti_speech_synthesizer_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, TI99_SPEECH, tag, owner, clock), device_ti99_peribox_card_interface(mconfig, *this), - m_vsp(nullptr), m_reading(false), m_sbe(false) + m_vsp(*this, "vsp"), + m_reading(false), + m_sbe(false) { } @@ -130,11 +132,6 @@ WRITE_LINE_MEMBER( ti_speech_synthesizer_device::speech_ready ) void ti_speech_synthesizer_device::device_start() { - m_vsp = subdevice("speechsyn"); - // Need to configure the speech ROM for inverse bit order - speechrom_device* mem = subdevice("vsm"); - mem->set_reverse_bit_order(true); - // We don't need to save m_space because the calling method // combined_rsq_wsq_w only needs the address space formally. save_item(NAME(m_reading)); @@ -164,15 +161,25 @@ ROM_START( ti99_speech ) ROM_LOAD("cd2326a.u2b", 0x4000, 0x4000, CRC(65d00401) SHA1(a367242c2c96cebf0e2bf21862f3f6734b2b3020)) // at location u2, top of stack ROM_END -MACHINE_CONFIG_START(ti_speech_synthesizer_device::device_add_mconfig) - MCFG_DEVICE_ADD("vsm", SPEECHROM, 0) +void ti_speech_synthesizer_device::device_add_mconfig(machine_config& config) +{ + SPEECHROM(config, "vsm", 0).set_reverse_bit_order(true); + SPEAKER(config, "speech_out").front_center(); + CD2501E(config, m_vsp, 640000L); + m_vsp->set_speechrom_tag("vsm"); + m_vsp->ready_cb().set(FUNC(ti_speech_synthesizer_device::speech_ready)); + m_vsp->add_route(ALL_OUTPUTS, "speech_out", 0.50); - SPEAKER(config, "mono").front_center(); - MCFG_DEVICE_ADD("speechsyn", CD2501E, 640000L) - MCFG_TMS52XX_READYQ_HANDLER(WRITELINE(*this, ti_speech_synthesizer_device, speech_ready)) - MCFG_TMS52XX_SPEECHROM("vsm") - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50) -MACHINE_CONFIG_END +/* + // FIXME: Make it work. Guess we need two VSM circuits @16K. + TMS6100(config, "vsm", 640_kHz_XTAL/4); + m_vsp->m0_cb().set("vsm", FUNC(tms6100_device::m0_w)); + m_vsp->m1_cb().set("vsm", FUNC(tms6100_device::m1_w)); + m_vsp->addr_cb().set("vsm", FUNC(tms6100_device::add_w)); + m_vsp->data_cb().set("vsm", FUNC(tms6100_device::data_line_r)); + m_vsp->romclk_cb().set("vsm", FUNC(tms6100_device::clk_w)); +*/ +} const tiny_rom_entry *ti_speech_synthesizer_device::device_rom_region() const { diff --git a/src/devices/bus/ti99/peb/spchsyn.h b/src/devices/bus/ti99/peb/spchsyn.h index 90590f92973..35bf0f680e8 100644 --- a/src/devices/bus/ti99/peb/spchsyn.h +++ b/src/devices/bus/ti99/peb/spchsyn.h @@ -17,6 +17,7 @@ #include "peribox.h" #include "sound/tms5220.h" +#include "machine/tms6100.h" namespace bus { namespace ti99 { namespace peb { @@ -41,7 +42,7 @@ private: DECLARE_WRITE_LINE_MEMBER( speech_ready ); address_space* m_space; - cd2501e_device* m_vsp; + required_device m_vsp; bool m_reading; bool m_sbe; // Signal "Speech block enable" }; diff --git a/src/devices/bus/ti99/peb/tn_usbsm.cpp b/src/devices/bus/ti99/peb/tn_usbsm.cpp index b08ca4effd9..813ced0eb0d 100644 --- a/src/devices/bus/ti99/peb/tn_usbsm.cpp +++ b/src/devices/bus/ti99/peb/tn_usbsm.cpp @@ -367,8 +367,8 @@ INPUT_PORTS_START( tn_usbsm ) INPUT_PORTS_END MACHINE_CONFIG_START(nouspikel_usb_smartmedia_device::device_add_mconfig) - MCFG_DEVICE_ADD("smartmedia", SMARTMEDIA, 0) - MCFG_STRATAFLASH_ADD(STRATA_TAG) + SMARTMEDIA(config, "smartmedia", 0); + STRATAFLASH(config, STRATA_TAG, 0); RAM(config, RAM1_TAG).set_default_size("512K").set_default_value(0); RAM(config, RAM2_TAG).set_default_size("512K").set_default_value(0); MACHINE_CONFIG_END diff --git a/src/devices/machine/mm58274c.h b/src/devices/machine/mm58274c.h index 213b0fa6ab3..cee2df48db9 100644 --- a/src/devices/machine/mm58274c.h +++ b/src/devices/machine/mm58274c.h @@ -14,6 +14,7 @@ public: void set_mode24(int mode) { m_mode24 = mode; } void set_day1(int day) { m_day1 = day; } + void set_mode_and_day(int mode, int day) { m_mode24 = mode; m_day1 = day; } DECLARE_READ8_MEMBER(read); DECLARE_WRITE8_MEMBER(write); diff --git a/src/devices/sound/sn76496.h b/src/devices/sound/sn76496.h index b3d330e0c2c..50ca44a3e1f 100644 --- a/src/devices/sound/sn76496.h +++ b/src/devices/sound/sn76496.h @@ -31,6 +31,7 @@ public: void write(uint8_t data); DECLARE_WRITE8_MEMBER( command_w ) { write(data); } DECLARE_READ_LINE_MEMBER( ready_r ) { return m_ready_state ? 1 : 0; } + auto ready_cb() { return m_ready_handler.bind(); } protected: sn76496_base_device( diff --git a/src/devices/sound/tms5220.h b/src/devices/sound/tms5220.h index cdbf48f2cad..4a61f104f30 100644 --- a/src/devices/sound/tms5220.h +++ b/src/devices/sound/tms5220.h @@ -56,6 +56,10 @@ public: // configuration helpers template devcb_base &set_irq_handler(Object &&cb) { return m_irq_handler.set_callback(std::forward(cb)); } template devcb_base &set_readyq_handler(Object &&cb) { return m_readyq_handler.set_callback(std::forward(cb)); } + + auto irq_cb() { return m_irq_handler.bind(); } + auto ready_cb() { return m_readyq_handler.bind(); } + // old VSM support, remove me! void set_speechrom_tag(const char *_tag) { m_speechrom_tag = _tag; } // new VSM support @@ -65,6 +69,12 @@ public: template devcb_base &set_data_callback(Object &&cb) { return m_data_cb.set_callback(std::forward(cb)); } template devcb_base &set_romclk_callback(Object &&cb) { return m_romclk_cb.set_callback(std::forward(cb)); } + auto m0_cb() { return m_m0_cb.bind(); } + auto m1_cb() { return m_m1_cb.bind(); } + auto addr_cb() { return m_addr_cb.bind(); } + auto data_cb() { return m_data_cb.bind(); } + auto romclk_cb() { return m_romclk_cb.bind(); } + // Control lines - once written to will switch interface into * "true" timing behaviour. // all lines with suffix q are active low! diff --git a/src/devices/video/v9938.h b/src/devices/video/v9938.h index 2b70f6948ac..cdf07dced31 100644 --- a/src/devices/video/v9938.h +++ b/src/devices/video/v9938.h @@ -84,6 +84,8 @@ public: DECLARE_READ8_MEMBER( read ); DECLARE_WRITE8_MEMBER( write ); + auto int_cb() { return m_int_callback.bind(); } + uint8_t vram_r(); uint8_t status_r(); void palette_w(uint8_t data); diff --git a/src/mame/drivers/geneve.cpp b/src/mame/drivers/geneve.cpp index 43c32261f54..82407bb1213 100644 --- a/src/mame/drivers/geneve.cpp +++ b/src/mame/drivers/geneve.cpp @@ -734,9 +734,19 @@ MACHINE_CONFIG_START(geneve_state::geneve_common) m_cpu->dbin_cb().set(FUNC(geneve_state::dbin_line)); // Video hardware - MCFG_V9938_ADD(TI_VDP_TAG, TI_SCREEN_TAG, 0x20000, XTAL(21'477'272)) /* typical 9938 clock, not verified */ - MCFG_V99X8_INTERRUPT_CALLBACK(WRITELINE(*this, geneve_state, set_tms9901_INT2_from_v9938)) - MCFG_V99X8_SCREEN_ADD_NTSC(TI_SCREEN_TAG, TI_VDP_TAG, XTAL(21'477'272)) + v99x8_device& video(V9938(config, TI_VDP_TAG, XTAL(21'477'272))); // typical 9938 clock, not verified + video.set_vram_size(0x20000); + video.int_cb().set(FUNC(geneve_state::set_tms9901_INT2_from_v9938)); + video.set_screen(TI_SCREEN_TAG); + screen_device& screen(SCREEN(config, TI_SCREEN_TAG, SCREEN_TYPE_RASTER)); + screen.set_raw(XTAL(21'477'272), \ + v99x8_device::HTOTAL, \ + 0, \ + v99x8_device::HVISIBLE - 1, \ + v99x8_device::VTOTAL_NTSC * 2, \ + v99x8_device::VERTICAL_ADJUST * 2, \ + v99x8_device::VVISIBLE_NTSC * 2 - 1 - v99x8_device::VERTICAL_ADJUST * 2); + screen.set_screen_update(TI_VDP_TAG, FUNC(v99x8_device::screen_update)); // Main board components TMS9901(config, m_tms9901, 3000000); @@ -753,23 +763,18 @@ MACHINE_CONFIG_START(geneve_state::geneve_common) m_tms9901->intlevel_cb().set(FUNC(geneve_state::tms9901_interrupt)); // Clock - MCFG_DEVICE_ADD(GENEVE_CLOCK_TAG, MM58274C, 0) - MCFG_MM58274C_MODE24(1) // 24 hour - MCFG_MM58274C_DAY1(0) // sunday + MM58274C(config, GENEVE_CLOCK_TAG, 0).set_mode_and_day(1, 0); // 24h, sunday // Sound hardware SPEAKER(config, "sound_out").front_center(); - MCFG_DEVICE_ADD(TI_SOUNDCHIP_TAG, SN76496, 3579545) /* 3.579545 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75) - MCFG_SN76496_READY_HANDLER( WRITELINE(*this, geneve_state, ext_ready) ) + sn76496_device& soundgen(SN76496(config, TI_SOUNDCHIP_TAG, 3579545)); + soundgen.ready_cb().set(FUNC(geneve_state::ext_ready)); + soundgen.add_route(ALL_OUTPUTS, "sound_out", 0.75); // User interface devices - 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(); + GENEVE_KEYBOARD(config, m_keyboard, 0).int_cb().set(FUNC(geneve_state::keyboard_interrupt)); + TI99_JOYPORT(config, m_joyport, 0).configure_slot(false, false); + TI99_COLORBUS(config, m_colorbus, 0).configure_slot(); // PFM expansion AT29C040(config, GENEVE_PFM512_TAG); diff --git a/src/mame/drivers/ti99_2.cpp b/src/mame/drivers/ti99_2.cpp index 73049e63023..1ae9e16b92f 100644 --- a/src/mame/drivers/ti99_2.cpp +++ b/src/mame/drivers/ti99_2.cpp @@ -208,11 +208,11 @@ public: void ti99_224(machine_config &config); void ti99_232(machine_config &config); -private: - DECLARE_MACHINE_START( ti99_224 ); - DECLARE_MACHINE_START( ti99_232 ); - DECLARE_MACHINE_RESET( ti99_2 ); + // Lifecycle + void driver_start() override; + void driver_reset() override; +private: DECLARE_WRITE8_MEMBER(intflag_write); DECLARE_READ8_MEMBER(mem_read); @@ -242,21 +242,14 @@ private: int m_first_ram_page; }; -MACHINE_START_MEMBER(ti99_2_state, ti99_224) +void ti99_2_state::driver_start() { m_rom = memregion(TI992_ROM)->base(); m_ram_start = 0xf000 - m_ram->default_size(); m_first_ram_page = m_ram_start >> 12; } -MACHINE_START_MEMBER(ti99_2_state, ti99_232) -{ - m_rom = memregion(TI992_ROM)->base(); - m_ram_start = 0xf000 - m_ram->default_size(); - m_first_ram_page = m_ram_start >> 12; -} - -MACHINE_RESET_MEMBER(ti99_2_state, ti99_2) +void ti99_2_state::driver_reset() { m_otherbank = false; @@ -416,40 +409,56 @@ WRITE_LINE_MEMBER(ti99_2_state::holda) LOGMASKED(LOG_SIGNALS, "HOLDA: %d\n", state); } -MACHINE_CONFIG_START(ti99_2_state::ti99_224) +void ti99_2_state::ti99_224(machine_config& config) +{ ti99_2(config); // Video hardware - MCFG_DEVICE_ADD( TI992_VDC_TAG, VIDEO99224, XTAL(10'738'635) ) - MCFG_VIDEO992_MEM_ACCESS_CB( READ8( *this, ti99_2_state, mem_read ) ) - MCFG_VIDEO992_HOLD_CB( WRITELINE( *this, ti99_2_state, hold ) ) - MCFG_VIDEO992_INT_CB( WRITELINE( *this, ti99_2_state, interrupt ) ) - 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 + VIDEO99224(config, m_videoctrl, XTAL(10'738'635)); + m_videoctrl->readmem_cb().set(FUNC(ti99_2_state::mem_read)); + m_videoctrl->hold_cb().set(FUNC(ti99_2_state::hold)); + m_videoctrl->int_cb().set(FUNC(ti99_2_state::interrupt)); + + using namespace bus::ti99::internal; + screen_device& screen(SCREEN(config, TI992_SCREEN_TAG, SCREEN_TYPE_RASTER)); + screen.set_raw(XTAL(10'738'635) / 2, \ + video992_device::TOTAL_HORZ, + video992_device::HORZ_DISPLAY_START-12, + video992_device::HORZ_DISPLAY_START + 256 + 12, \ + video992_device::TOTAL_VERT_NTSC, \ + video992_device::VERT_DISPLAY_START_NTSC - 12, \ + video992_device::VERT_DISPLAY_START_NTSC + 192 + 12 ); + screen.set_screen_update(TI992_VDC_TAG, FUNC(video992_device::screen_update)); + + // I/O interface circuit. No banking callback. IO99224(config, m_io992, 0); +} - MCFG_MACHINE_START_OVERRIDE(ti99_2_state, ti99_224 ) -MACHINE_CONFIG_END - -MACHINE_CONFIG_START(ti99_2_state::ti99_232) +void ti99_2_state::ti99_232(machine_config& config) +{ ti99_2(config); // Video hardware - MCFG_DEVICE_ADD( TI992_VDC_TAG, VIDEO99232, XTAL(10'738'635) ) - MCFG_VIDEO992_MEM_ACCESS_CB( READ8( *this, ti99_2_state, mem_read ) ) - MCFG_VIDEO992_HOLD_CB( WRITELINE( *this, ti99_2_state, hold ) ) - MCFG_VIDEO992_INT_CB( WRITELINE( *this, ti99_2_state, interrupt ) ) - MCFG_VIDEO992_SCREEN_ADD( TI992_SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TI992_VDC_TAG, bus::ti99::internal::video992_device, screen_update ) + VIDEO99232(config, m_videoctrl, XTAL(10'738'635)); + m_videoctrl->readmem_cb().set(FUNC(ti99_2_state::mem_read)); + m_videoctrl->hold_cb().set(FUNC(ti99_2_state::hold)); + m_videoctrl->int_cb().set(FUNC(ti99_2_state::interrupt)); + + using namespace bus::ti99::internal; + screen_device& screen(SCREEN(config, TI992_SCREEN_TAG, SCREEN_TYPE_RASTER)); + screen.set_raw(XTAL(10'738'635) / 2, \ + video992_device::TOTAL_HORZ, + video992_device::HORZ_DISPLAY_START-12, + video992_device::HORZ_DISPLAY_START + 256 + 12, \ + video992_device::TOTAL_VERT_NTSC, \ + video992_device::VERT_DISPLAY_START_NTSC - 12, \ + video992_device::VERT_DISPLAY_START_NTSC + 192 + 12 ); + screen.set_screen_update(TI992_VDC_TAG, FUNC(video992_device::screen_update)); // I/O interface circuit - IO99232(config, m_io992, 0); - m_io992->rombank_cb().set(FUNC(ti99_2_state::rombank_set)); + IO99232(config, m_io992, 0).rombank_cb().set(FUNC(ti99_2_state::rombank_set)); +} - MCFG_MACHINE_START_OVERRIDE(ti99_2_state, ti99_232 ) - -MACHINE_CONFIG_END - -MACHINE_CONFIG_START(ti99_2_state::ti99_2) +void ti99_2_state::ti99_2(machine_config& config) +{ // TMS9995, standard variant // Documents state that there is a divider by 2 for the clock rate // Experiments with real consoles proved them wrong. @@ -464,16 +473,14 @@ MACHINE_CONFIG_START(ti99_2_state::ti99_2) // sufficient, not even in the initial design RAM(config, TI992_RAM_TAG).set_default_size("4096").set_default_value(0); - MCFG_MACHINE_RESET_OVERRIDE(ti99_2_state, ti99_2 ) - // Cassette drives // There is no route from the cassette to some audio output, so we don't hear it. - MCFG_CASSETTE_ADD( "cassette" ) + // Cassette drives + CASSETTE(config, "cassette", 0); // Hexbus - MCFG_HEXBUS_ADD( TI_HEXBUS_TAG ) - -MACHINE_CONFIG_END + HEXBUS(config, TI_HEXBUS_TAG, 0).configure_slot(); +} /* ROM loading diff --git a/src/mame/drivers/ti99_4p.cpp b/src/mame/drivers/ti99_4p.cpp index 0cbc81305e8..f52505b58f3 100644 --- a/src/mame/drivers/ti99_4p.cpp +++ b/src/mame/drivers/ti99_4p.cpp @@ -153,6 +153,8 @@ public: { } void ti99_4p_60hz(machine_config &config); + void driver_start() override; + void driver_reset() override; private: DECLARE_WRITE_LINE_MEMBER( ready_line ); @@ -184,8 +186,6 @@ private: DECLARE_WRITE_LINE_MEMBER(cassette_output); DECLARE_WRITE8_MEMBER(tms9901_interrupt); DECLARE_WRITE_LINE_MEMBER(alphaW); - virtual void machine_start() override; - DECLARE_MACHINE_RESET(ti99_4p); DECLARE_WRITE_LINE_MEMBER(video_interrupt_in); @@ -211,7 +211,7 @@ private: DECLARE_READ16_MEMBER( debugger_read ); DECLARE_WRITE16_MEMBER( debugger_write ); void ready_join(); - void set_keyboard_column(int number, int data); + void set_keyboard_column(int number, int data); // Pointer to EPROM uint16_t *m_rom; @@ -947,7 +947,7 @@ WRITE8_MEMBER( ti99_4p_state::external_operation ) /*****************************************************************************/ -void ti99_4p_state::machine_start() +void ti99_4p_state::driver_start() { m_peribox->senila(CLEAR_LINE); m_peribox->senilb(CLEAR_LINE); @@ -995,7 +995,7 @@ WRITE_LINE_MEMBER(ti99_4p_state::video_interrupt_in) /* Reset the machine. */ -MACHINE_RESET_MEMBER(ti99_4p_state,ti99_4p) +void ti99_4p_state::driver_reset() { set_9901_int(12, CLEAR_LINE); @@ -1004,11 +1004,11 @@ MACHINE_RESET_MEMBER(ti99_4p_state,ti99_4p) m_9901_int = 0x03; // INT2* and INT1* set to 1, i.e. inactive } - /* Machine description. */ -MACHINE_CONFIG_START(ti99_4p_state::ti99_4p_60hz) +void ti99_4p_state::ti99_4p_60hz(machine_config& config) +{ /* basic machine hardware */ /* TMS9900 CPU @ 3.0 MHz */ TMS9900(config, m_cpu, 3000000); @@ -1049,15 +1049,13 @@ MACHINE_CONFIG_START(ti99_4p_state::ti99_4p_60hz) // Cassette drives SPEAKER(config, "cass_out").front_center(); - MCFG_CASSETTE_ADD( "cassette" ) + CASSETTE(config, "cassette", 0); WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "cass_out", 0.25); // Joystick port - TI99_JOYPORT(config, m_joyport, 0); - m_joyport->configure_slot(false, false); - -MACHINE_CONFIG_END + TI99_JOYPORT(config, m_joyport, 0).configure_slot(false, false); +} ROM_START(ti99_4p) diff --git a/src/mame/drivers/ti99_4x.cpp b/src/mame/drivers/ti99_4x.cpp index 603303730ad..d4578d41a8a 100644 --- a/src/mame/drivers/ti99_4x.cpp +++ b/src/mame/drivers/ti99_4x.cpp @@ -101,6 +101,7 @@ public: m_alphabug(*this, "ALPHABUG") { } + // Configurations void ti99_4(machine_config &config); void ti99_4_50hz(machine_config &config); void ti99_4ev_60hz(machine_config &config); @@ -111,20 +112,14 @@ public: void ti99_4a(machine_config &config); void ti99_4_60hz(machine_config &config); + // Lifecycle + void driver_start() override; + void driver_reset() override; + // Interrupt triggers DECLARE_INPUT_CHANGED_MEMBER( load_interrupt ); private: - // Machine management - DECLARE_MACHINE_START(ti99_4); - DECLARE_MACHINE_START(ti99_4a); - DECLARE_MACHINE_START(ti99_4qi); - DECLARE_MACHINE_START(ti99_4ev); - - DECLARE_MACHINE_RESET(ti99_4); - DECLARE_MACHINE_RESET(ti99_4a); - DECLARE_MACHINE_RESET(ti99_4ev); - // Processor connections with the main board DECLARE_READ8_MEMBER( cruread ); DECLARE_READ8_MEMBER( interrupt_level ); @@ -206,9 +201,6 @@ private: // Timer for EVPC (provided by the TMS9929A, but EVPC replaces that VDP) emu_timer *m_gromclk_timer; - - // Registering save state - void register_save_state(); }; /* @@ -218,6 +210,7 @@ enum { MODEL_4, MODEL_4A, + MODEL_4EV, MODEL_4QI }; @@ -824,8 +817,19 @@ WRITE_LINE_MEMBER( ti99_4x_state::notconnected ) LOGMASKED(LOG_INTERRUPTS, "Setting a not connected line ... ignored\n"); } -void ti99_4x_state::register_save_state() +/****************************************************************************** + Machine definitions +******************************************************************************/ + +void ti99_4x_state::driver_start() { + m_nready_combined = 0; + logerror("model = %d\n", m_model); + // Removing the TMS9928a requires to add a replacement for the GROMCLK. + // In the real hardware this is a circuit (REPL99x) that fits into the VDP socket + if (m_model == MODEL_4EV) + m_gromclk_timer = timer_alloc(0); + save_item(NAME(m_keyboard_column)); save_item(NAME(m_check_alphalock)); save_item(NAME(m_nready_combined)); @@ -836,31 +840,25 @@ void ti99_4x_state::register_save_state() save_item(NAME(m_int12)); } -/****************************************************************************** - Machine definitions -******************************************************************************/ - -MACHINE_START_MEMBER(ti99_4x_state,ti99_4) -{ - m_nready_combined = 0; - m_model = MODEL_4; - register_save_state(); -} - -MACHINE_RESET_MEMBER(ti99_4x_state,ti99_4) +void ti99_4x_state::driver_reset() { m_cpu->set_ready(ASSERT_LINE); m_cpu->set_hold(CLEAR_LINE); m_int1 = CLEAR_LINE; m_int2 = CLEAR_LINE; m_int12 = CLEAR_LINE; + if (m_model == MODEL_4EV) + m_gromclk_timer->adjust(attotime::zero, 0, attotime::from_hz(XTAL(10'738'635)/24)); } /********************************************************************** TI-99/4 - predecessor of the more popular TI-99/4A ***********************************************************************/ -MACHINE_CONFIG_START(ti99_4x_state::ti99_4) +void ti99_4x_state::ti99_4(machine_config& config) +{ + m_model = MODEL_4; + // CPU TMS9900(config, m_cpu, 3000000); m_cpu->set_addrmap(AS_PROGRAM, &ti99_4x_state::memmap); @@ -871,9 +869,6 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4) m_cpu->clkout_cb().set(FUNC(ti99_4x_state::clock_out)); m_cpu->dbin_cb().set(FUNC(ti99_4x_state::dbin_line)); - MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4 ) - MCFG_MACHINE_RESET_OVERRIDE(ti99_4x_state, ti99_4 ) - // Main board TMS9901(config, m_tms9901, 3000000); m_tms9901->read_cb().set(FUNC(ti99_4x_state::read_by_9901)); @@ -887,8 +882,7 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4) m_tms9901->p_out_cb(9).set(FUNC(ti99_4x_state::cassette_output)); m_tms9901->intlevel_cb().set(FUNC(ti99_4x_state::tms9901_interrupt)); - TI99_DATAMUX(config, m_datamux, 0); - m_datamux->ready_cb().set(FUNC(ti99_4x_state::console_ready_dmux)); + TI99_DATAMUX(config, m_datamux, 0).ready_cb().set(FUNC(ti99_4x_state::console_ready_dmux)); TI99_GROMPORT(config, m_gromport, 0); m_gromport->ready_cb().set(FUNC(ti99_4x_state::console_ready_cart)); @@ -902,7 +896,7 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4) RAM(config, TI99_EXPRAM_TAG).set_default_size("32K").set_default_value(0); // Software list - MCFG_SOFTWARE_LIST_ADD("cart_list_ti99", "ti99_cart") + SOFTWARE_LIST(config, "cart_list_ti99").set_type("ti99_cart", SOFTWARE_LIST_ORIGINAL_SYSTEM); // Input/output port TI99_IOPORT(config, m_ioport, 0); @@ -912,14 +906,14 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4) // Sound hardware SPEAKER(config, "sound_out").front_center(); - MCFG_DEVICE_ADD(TI_SOUNDCHIP_TAG, SN94624, 3579545/8) /* 3.579545 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75) - MCFG_SN76496_READY_HANDLER( WRITELINE(*this, ti99_4x_state, console_ready_sound) ) + sn94624_device& soundgen(SN94624(config, TI_SOUNDCHIP_TAG, 3579545/8)); + soundgen.ready_cb().set(FUNC(ti99_4x_state::console_ready_sound)); + soundgen.add_route(ALL_OUTPUTS, "sound_out", 0.75); // Cassette drives SPEAKER(config, "cass_out").front_center(); - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_ADD( "cassette2" ) + CASSETTE(config, "cassette", 0); + CASSETTE(config, "cassette2", 0); WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "cass_out", 0.25); @@ -940,55 +934,62 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4) TI99_JOYPORT(config, m_joyport, 0); m_joyport->configure_slot(true, true); m_joyport->int_cb().set(FUNC(ti99_4x_state::handset_interrupt_in)); -MACHINE_CONFIG_END +} /* US version: 60 Hz, NTSC */ -MACHINE_CONFIG_START(ti99_4x_state::ti99_4_60hz) +void ti99_4x_state::ti99_4_60hz(machine_config& config) +{ ti99_4(config); - MCFG_DEVICE_ADD( TI_VDP_TAG, TMS9918, XTAL(10'738'635) / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(*this, ti99_4x_state, video_interrupt_in)) - MCFG_TMS9928A_OUT_GROMCLK_CB(WRITELINE(*this, ti99_4x_state, gromclk_in)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( TI_SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TI_VDP_TAG, tms9928a_device, screen_update ) -MACHINE_CONFIG_END + TMS9918(config, m_video, XTAL(10'738'635) / 2); + m_video->out_int_line_callback().set(FUNC(ti99_4x_state::video_interrupt_in)); + m_video->out_gromclk_callback().set(FUNC(ti99_4x_state::gromclk_in)); + m_video->set_vram_size(0x4000); + m_video->set_screen(TI_SCREEN_TAG); + + screen_device& screen(SCREEN(config, TI_SCREEN_TAG, SCREEN_TYPE_RASTER)); + screen.set_raw(XTAL(10'738'635) / 2, \ + tms9928a_device::TOTAL_HORZ, \ + tms9928a_device::HORZ_DISPLAY_START-12, \ + tms9928a_device::HORZ_DISPLAY_START + 256 + 12, \ + tms9928a_device::TOTAL_VERT_NTSC, \ + tms9928a_device::VERT_DISPLAY_START_NTSC - 12, \ + tms9928a_device::VERT_DISPLAY_START_NTSC + 192 + 12 ); + screen.set_screen_update(TI_VDP_TAG, FUNC(tms9928a_device::screen_update)); +} /* European version: 50 Hz, PAL */ -MACHINE_CONFIG_START(ti99_4x_state::ti99_4_50hz) +void ti99_4x_state::ti99_4_50hz(machine_config& config) +{ ti99_4(config); - MCFG_DEVICE_ADD( TI_VDP_TAG, TMS9929, XTAL(10'738'635) / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(*this, ti99_4x_state, video_interrupt_in)) - MCFG_TMS9928A_OUT_GROMCLK_CB(WRITELINE(*this, ti99_4x_state, gromclk_in)) - MCFG_TMS9928A_SCREEN_ADD_PAL( TI_SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TI_VDP_TAG, tms9928a_device, screen_update ) -MACHINE_CONFIG_END + TMS9929(config, m_video, XTAL(10'738'635) / 2); + m_video->out_int_line_callback().set(FUNC(ti99_4x_state::video_interrupt_in)); + m_video->out_gromclk_callback().set(FUNC(ti99_4x_state::gromclk_in)); + m_video->set_vram_size(0x4000); + m_video->set_screen(TI_SCREEN_TAG); + + screen_device& screen(SCREEN(config, TI_SCREEN_TAG, SCREEN_TYPE_RASTER)); + screen.set_raw(XTAL(10'738'635) / 2, \ + tms9928a_device::TOTAL_HORZ, \ + tms9928a_device::HORZ_DISPLAY_START-12, \ + tms9928a_device::HORZ_DISPLAY_START + 256 + 12, \ + tms9928a_device::TOTAL_VERT_PAL, \ + tms9928a_device::VERT_DISPLAY_START_PAL - 12, \ + tms9928a_device::VERT_DISPLAY_START_PAL + 192 + 12 ); + screen.set_screen_update(TI_VDP_TAG, FUNC(tms9928a_device::screen_update)); +} /********************************************************************** TI-99/4A - replaced the 99/4 and became the standard TI-99 console ***********************************************************************/ -MACHINE_START_MEMBER(ti99_4x_state,ti99_4a) +void ti99_4x_state::ti99_4a(machine_config& config) { - m_nready_combined = 0; m_model = MODEL_4A; - register_save_state(); -} -MACHINE_RESET_MEMBER(ti99_4x_state,ti99_4a) -{ - m_cpu->set_ready(ASSERT_LINE); - m_cpu->set_hold(CLEAR_LINE); - m_int1 = CLEAR_LINE; - m_int2 = CLEAR_LINE; - m_int12 = CLEAR_LINE; -} - -MACHINE_CONFIG_START(ti99_4x_state::ti99_4a) // CPU TMS9900(config, m_cpu, 3000000); m_cpu->set_addrmap(AS_PROGRAM, &ti99_4x_state::memmap); @@ -999,9 +1000,6 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4a) m_cpu->clkout_cb().set(FUNC(ti99_4x_state::clock_out)); m_cpu->dbin_cb().set(FUNC(ti99_4x_state::dbin_line)); - MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4a ) - MCFG_MACHINE_RESET_OVERRIDE(ti99_4x_state, ti99_4a ) - // Main board TMS9901(config, m_tms9901, 3000000); m_tms9901->read_cb().set(FUNC(ti99_4x_state::read_by_9901)); @@ -1015,8 +1013,7 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4a) m_tms9901->p_out_cb(9).set(FUNC(ti99_4x_state::cassette_output)); m_tms9901->intlevel_cb().set(FUNC(ti99_4x_state::tms9901_interrupt)); - TI99_DATAMUX(config, m_datamux, 0); - m_datamux->ready_cb().set(FUNC(ti99_4x_state::console_ready_dmux)); + TI99_DATAMUX(config, m_datamux, 0).ready_cb().set(FUNC(ti99_4x_state::console_ready_dmux)); TI99_GROMPORT(config, m_gromport, 0); m_gromport->ready_cb().set(FUNC(ti99_4x_state::console_ready_cart)); @@ -1030,7 +1027,7 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4a) RAM(config, TI99_EXPRAM_TAG).set_default_size("32K").set_default_value(0); // Software list - MCFG_SOFTWARE_LIST_ADD("cart_list_ti99", "ti99_cart") + SOFTWARE_LIST(config, "cart_list_ti99").set_type("ti99_cart", SOFTWARE_LIST_ORIGINAL_SYSTEM); // Input/output port TI99_IOPORT(config, m_ioport, 0); @@ -1040,14 +1037,14 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4a) // Sound hardware SPEAKER(config, "sound_out").front_center(); - MCFG_DEVICE_ADD(TI_SOUNDCHIP_TAG, SN94624, 3579545/8) /* 3.579545 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75) - MCFG_SN76496_READY_HANDLER( WRITELINE(*this, ti99_4x_state, console_ready_sound) ) + sn94624_device& soundgen(SN94624(config, TI_SOUNDCHIP_TAG, 3579545/8)); + soundgen.ready_cb().set(FUNC(ti99_4x_state::console_ready_sound)); + soundgen.add_route(ALL_OUTPUTS, "sound_out", 0.75); // Cassette drives SPEAKER(config, "cass_out").front_center(); - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_ADD( "cassette2" ) + CASSETTE(config, "cassette", 0); + CASSETTE(config, "cassette2", 0); WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "cass_out", 0.25); @@ -1065,36 +1062,54 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4a) grom2.set_region_and_ident(TI99_CONSOLEGROM, 0x4000, 2); // Joystick port - TI99_JOYPORT(config, m_joyport, 0); - m_joyport->configure_slot(true, false); - -MACHINE_CONFIG_END + TI99_JOYPORT(config, m_joyport, 0).configure_slot(true, false); +} /* US version: 60 Hz, NTSC */ -MACHINE_CONFIG_START(ti99_4x_state::ti99_4a_60hz) +void ti99_4x_state::ti99_4a_60hz(machine_config& config) +{ ti99_4a(config); - MCFG_DEVICE_ADD( TI_VDP_TAG, TMS9918A, XTAL(10'738'635) / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(*this, ti99_4x_state, video_interrupt_in)) - MCFG_TMS9928A_OUT_GROMCLK_CB(WRITELINE(*this, ti99_4x_state, gromclk_in)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( TI_SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TI_VDP_TAG, tms9928a_device, screen_update ) -MACHINE_CONFIG_END + TMS9918A(config, m_video, XTAL(10'738'635) / 2); + m_video->out_int_line_callback().set(FUNC(ti99_4x_state::video_interrupt_in)); + m_video->out_gromclk_callback().set(FUNC(ti99_4x_state::gromclk_in)); + m_video->set_vram_size(0x4000); + m_video->set_screen(TI_SCREEN_TAG); + + screen_device& screen(SCREEN(config, TI_SCREEN_TAG, SCREEN_TYPE_RASTER)); + screen.set_raw(XTAL(10'738'635) / 2, \ + tms9928a_device::TOTAL_HORZ, \ + tms9928a_device::HORZ_DISPLAY_START-12, \ + tms9928a_device::HORZ_DISPLAY_START + 256 + 12, \ + tms9928a_device::TOTAL_VERT_NTSC, \ + tms9928a_device::VERT_DISPLAY_START_NTSC - 12, \ + tms9928a_device::VERT_DISPLAY_START_NTSC + 192 + 12 ); + screen.set_screen_update(TI_VDP_TAG, FUNC(tms9928a_device::screen_update)); +} /* European version: 50 Hz, PAL */ -MACHINE_CONFIG_START(ti99_4x_state::ti99_4a_50hz) +void ti99_4x_state::ti99_4a_50hz(machine_config& config) +{ ti99_4a(config); - MCFG_DEVICE_ADD( TI_VDP_TAG, TMS9929A, XTAL(10'738'635) / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(*this, ti99_4x_state, video_interrupt_in)) - MCFG_TMS9928A_OUT_GROMCLK_CB(WRITELINE(*this, ti99_4x_state, gromclk_in)) - MCFG_TMS9928A_SCREEN_ADD_PAL( TI_SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TI_VDP_TAG, tms9928a_device, screen_update ) -MACHINE_CONFIG_END + TMS9929A(config, m_video, XTAL(10'738'635) / 2); + m_video->out_int_line_callback().set(FUNC(ti99_4x_state::video_interrupt_in)); + m_video->out_gromclk_callback().set(FUNC(ti99_4x_state::gromclk_in)); + m_video->set_vram_size(0x4000); + m_video->set_screen(TI_SCREEN_TAG); + + screen_device& screen(SCREEN(config, TI_SCREEN_TAG, SCREEN_TYPE_RASTER)); + screen.set_raw(XTAL(10'738'635) / 2, \ + tms9928a_device::TOTAL_HORZ, \ + tms9928a_device::HORZ_DISPLAY_START-12, \ + tms9928a_device::HORZ_DISPLAY_START + 256 + 12, \ + tms9928a_device::TOTAL_VERT_PAL, \ + tms9928a_device::VERT_DISPLAY_START_PAL - 12, \ + tms9928a_device::VERT_DISPLAY_START_PAL + 192 + 12 ); + screen.set_screen_update(TI_VDP_TAG, FUNC(tms9928a_device::screen_update)); +} /************************************************************************ TI-99/4QI - the final version of the TI-99/4A @@ -1105,31 +1120,31 @@ MACHINE_CONFIG_END those from Atarisoft. *************************************************************************/ -MACHINE_START_MEMBER(ti99_4x_state, ti99_4qi) -{ - m_model = MODEL_4QI; - m_nready_combined = 0; - register_save_state(); -} - -MACHINE_CONFIG_START(ti99_4x_state::ti99_4qi) - ti99_4a(config); - MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4qi ) -MACHINE_CONFIG_END - /* US version: 60 Hz, NTSC There were no European versions. */ -MACHINE_CONFIG_START(ti99_4x_state::ti99_4qi_60hz) - ti99_4qi(config); - MCFG_DEVICE_ADD( TI_VDP_TAG, TMS9918A, XTAL(10'738'635) / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(*this, ti99_4x_state, video_interrupt_in)) - MCFG_TMS9928A_OUT_GROMCLK_CB(WRITELINE(*this, ti99_4x_state, gromclk_in)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( TI_SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TI_VDP_TAG, tms9928a_device, screen_update ) -MACHINE_CONFIG_END +void ti99_4x_state::ti99_4qi_60hz(machine_config& config) +{ + ti99_4a(config); + m_model = MODEL_4QI; + + TMS9918A(config, m_video, XTAL(10'738'635) / 2); + m_video->out_int_line_callback().set(FUNC(ti99_4x_state::video_interrupt_in)); + m_video->out_gromclk_callback().set(FUNC(ti99_4x_state::gromclk_in)); + m_video->set_vram_size(0x4000); + m_video->set_screen(TI_SCREEN_TAG); + + screen_device& screen(SCREEN(config, TI_SCREEN_TAG, SCREEN_TYPE_RASTER)); + screen.set_raw(XTAL(10'738'635) / 2, \ + tms9928a_device::TOTAL_HORZ, \ + tms9928a_device::HORZ_DISPLAY_START-12, \ + tms9928a_device::HORZ_DISPLAY_START + 256 + 12, \ + tms9928a_device::TOTAL_VERT_NTSC, \ + tms9928a_device::VERT_DISPLAY_START_NTSC - 12, \ + tms9928a_device::VERT_DISPLAY_START_NTSC + 192 + 12 ); + screen.set_screen_update(TI_VDP_TAG, FUNC(tms9928a_device::screen_update)); +} /************************************************************************ TI-99/4A with 80-column support. Actually a separate expansion card (EVPC), @@ -1139,27 +1154,10 @@ MACHINE_CONFIG_END which is intended to use the EVPC, does not have an own sound chip. *************************************************************************/ -MACHINE_START_MEMBER(ti99_4x_state, ti99_4ev) +void ti99_4x_state::ti99_4ev_60hz(machine_config& config) { - m_nready_combined = 0; - m_model = MODEL_4A; - // Removing the TMS9928a requires to add a replacement for the GROMCLK. - // In the real hardware this is a circuit (REPL99x) that fits into the VDP socket - m_gromclk_timer = timer_alloc(0); - register_save_state(); -} + m_model = MODEL_4EV; -MACHINE_RESET_MEMBER(ti99_4x_state, ti99_4ev) -{ - m_cpu->set_ready(ASSERT_LINE); - m_cpu->set_hold(CLEAR_LINE); - m_int1 = CLEAR_LINE; - m_int2 = CLEAR_LINE; - m_int12 = CLEAR_LINE; - m_gromclk_timer->adjust(attotime::zero, 0, attotime::from_hz(XTAL(10'738'635)/24)); -} - -MACHINE_CONFIG_START(ti99_4x_state::ti99_4ev_60hz) // CPU TMS9900(config, m_cpu, 3000000); m_cpu->set_addrmap(AS_PROGRAM, &ti99_4x_state::memmap); @@ -1170,9 +1168,6 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4ev_60hz) m_cpu->clkout_cb().set(FUNC(ti99_4x_state::clock_out)); m_cpu->dbin_cb().set(FUNC(ti99_4x_state::dbin_line)); - MCFG_MACHINE_START_OVERRIDE(ti99_4x_state, ti99_4ev ) - MCFG_MACHINE_RESET_OVERRIDE(ti99_4x_state, ti99_4ev ) - // Main board TMS9901(config, m_tms9901, 3000000); m_tms9901->read_cb().set(FUNC(ti99_4x_state::read_by_9901)); @@ -1186,8 +1181,7 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4ev_60hz) m_tms9901->p_out_cb(9).set(FUNC(ti99_4x_state::cassette_output)); m_tms9901->intlevel_cb().set(FUNC(ti99_4x_state::tms9901_interrupt)); - TI99_DATAMUX(config, m_datamux, 0); - m_datamux->ready_cb().set(FUNC(ti99_4x_state::console_ready_dmux)); + TI99_DATAMUX(config, m_datamux, 0).ready_cb().set(FUNC(ti99_4x_state::console_ready_dmux)); TI99_GROMPORT(config, m_gromport, 0); m_gromport->ready_cb().set(FUNC(ti99_4x_state::console_ready_cart)); @@ -1201,11 +1195,10 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4ev_60hz) RAM(config, TI99_EXPRAM_TAG).set_default_size("32K").set_default_value(0); // EVPC connector - 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)); + TI99_EVPCCONN(config, TI99_EVPC_CONN_TAG, 0).vdpint_cb().set(FUNC(ti99_4x_state::video_interrupt_evpc_in)); // Software list - MCFG_SOFTWARE_LIST_ADD("cart_list_ti99", "ti99_cart") + SOFTWARE_LIST(config, "cart_list_ti99").set_type("ti99_cart", SOFTWARE_LIST_ORIGINAL_SYSTEM); // Input/output port TI99_IOPORT(config, m_ioport, 0); @@ -1215,8 +1208,8 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4ev_60hz) // Cassette drives SPEAKER(config, "cass_out").front_center(); - MCFG_CASSETTE_ADD( "cassette" ) - MCFG_CASSETTE_ADD( "cassette2" ) + CASSETTE(config, "cassette", 0); + CASSETTE(config, "cassette2", 0); WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "cass_out", 0.25); @@ -1234,10 +1227,8 @@ MACHINE_CONFIG_START(ti99_4x_state::ti99_4ev_60hz) grom2.set_region_and_ident(TI99_CONSOLEGROM, 0x4000, 2); // Joystick port - TI99_JOYPORT(config, m_joyport, 0); - m_joyport->configure_slot(false, false); - -MACHINE_CONFIG_END + TI99_JOYPORT(config, m_joyport, 0).configure_slot(false, false); +} /***************************************************************************** ROM loading diff --git a/src/mame/drivers/ti99_8.cpp b/src/mame/drivers/ti99_8.cpp index 313a5fd1a17..f4a49328ca5 100644 --- a/src/mame/drivers/ti99_8.cpp +++ b/src/mame/drivers/ti99_8.cpp @@ -238,6 +238,10 @@ public: void ti99_8_60hz(machine_config &config); void ti99_8_50hz(machine_config &config); + // Lifecycle + void driver_start() override; + void driver_reset() override; + private: // Machine management DECLARE_MACHINE_START(ti99_8); @@ -699,11 +703,11 @@ WRITE_LINE_MEMBER( ti99_8_state::dbin_line ) m_mainboard->dbin_in(state); } -MACHINE_START_MEMBER(ti99_8_state,ti99_8) +void ti99_8_state::driver_start() { // Need to configure the speech ROM for inverse bit order - speechrom_device* mem = subdevice(TI998_SPEECHROM_REG); - mem->set_reverse_bit_order(true); +// speechrom_device* mem = subdevice(TI998_SPEECHROM_REG); +// mem->set_reverse_bit_order(true); save_item(NAME(m_keyboard_column)); save_item(NAME(m_ready_old)); @@ -711,13 +715,13 @@ MACHINE_START_MEMBER(ti99_8_state,ti99_8) save_item(NAME(m_int2)); } -MACHINE_RESET_MEMBER(ti99_8_state, ti99_8) +void ti99_8_state::driver_reset() { m_cpu->hold_line(CLEAR_LINE); // Pulling down the line on RESET configures the CPU to insert one wait // state on external memory accesses -// m_cpu->ready_line(ASSERT_LINE); + // m_cpu->ready_line(ASSERT_LINE); // m_gromport->set_grom_base(0x9800, 0xfff1); @@ -728,7 +732,9 @@ MACHINE_RESET_MEMBER(ti99_8_state, ti99_8) console_reset(CLEAR_LINE); } -MACHINE_CONFIG_START(ti99_8_state::ti99_8) +void ti99_8_state::ti99_8(machine_config& config) +{ + using namespace bus::ti99::internal; // basic machine hardware */ // TMS9995-MP9537 CPU @ 10.7 MHz // MP9537 mask: This variant of the TMS9995 does not contain on-chip RAM @@ -739,10 +745,7 @@ MACHINE_CONFIG_START(ti99_8_state::ti99_8) m_cpu->extop_cb().set(FUNC(ti99_8_state::external_operation)); m_cpu->clkout_cb().set(FUNC(ti99_8_state::clock_out)); m_cpu->dbin_cb().set(FUNC(ti99_8_state::dbin_line)); - m_cpu->holda_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::holda_line)); - - MCFG_MACHINE_START_OVERRIDE(ti99_8_state, ti99_8 ) - MCFG_MACHINE_RESET_OVERRIDE(ti99_8_state, ti99_8 ) + m_cpu->holda_cb().set(TI998_MAINBOARD_TAG, FUNC(mainboard8_device::holda_line)); // 9901 configuration TMS9901(config, m_tms9901, XTAL(10'738'635)/4.0); @@ -751,8 +754,8 @@ MACHINE_CONFIG_START(ti99_8_state::ti99_8) m_tms9901->p_out_cb(1).set(FUNC(ti99_8_state::keyC1)); m_tms9901->p_out_cb(2).set(FUNC(ti99_8_state::keyC2)); m_tms9901->p_out_cb(3).set(FUNC(ti99_8_state::keyC3)); - m_tms9901->p_out_cb(4).set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::crus_in)); - m_tms9901->p_out_cb(5).set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::ptgen_in)); + m_tms9901->p_out_cb(4).set(TI998_MAINBOARD_TAG, FUNC(mainboard8_device::crus_in)); + m_tms9901->p_out_cb(5).set(TI998_MAINBOARD_TAG, FUNC(mainboard8_device::ptgen_in)); m_tms9901->p_out_cb(6).set(FUNC(ti99_8_state::cassette_motor)); m_tms9901->p_out_cb(8).set(FUNC(ti99_8_state::audio_gate)); m_tms9901->p_out_cb(9).set(FUNC(ti99_8_state::cassette_output)); @@ -766,7 +769,7 @@ MACHINE_CONFIG_START(ti99_8_state::ti99_8) // Cartridge port TI99_GROMPORT(config, m_gromport, 0); - m_gromport->ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::system_grom_ready)); + m_gromport->ready_cb().set(TI998_MAINBOARD_TAG, FUNC(mainboard8_device::system_grom_ready)); m_gromport->reset_cb().set(FUNC(ti99_8_state::console_reset)); m_gromport->configure_slot(true); @@ -774,36 +777,37 @@ MACHINE_CONFIG_START(ti99_8_state::ti99_8) RAM(config, TI998_SRAM_TAG).set_default_size("2K").set_default_value(0); RAM(config, TI998_DRAM_TAG).set_default_size("64K").set_default_value(0); - /* Software list */ - MCFG_SOFTWARE_LIST_ADD("cart_list_ti99", "ti99_cart") + // Software list + SOFTWARE_LIST(config, "cart_list_ti99").set_type("ti99_cart", SOFTWARE_LIST_ORIGINAL_SYSTEM); // I/O port TI99_IOPORT(config, m_ioport, 0); m_ioport->configure_slot(false); m_ioport->extint_cb().set(FUNC(ti99_8_state::extint)); - m_ioport->ready_cb().set(TI998_MAINBOARD_TAG, FUNC(bus::ti99::internal::mainboard8_device::pbox_ready)); + m_ioport->ready_cb().set(TI998_MAINBOARD_TAG, FUNC(mainboard8_device::pbox_ready)); // Hexbus - MCFG_HEXBUS_ADD( TI_HEXBUS_TAG ) + HEXBUS(config, TI_HEXBUS_TAG, 0).configure_slot(); // Sound hardware SPEAKER(config, "sound_out").front_center(); - MCFG_DEVICE_ADD(TI_SOUNDCHIP_TAG, SN76496, 3579545) /* 3.579545 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75) - MCFG_SN76496_READY_HANDLER(WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, sound_ready)) + sn76496_device& soundgen(SN76496(config, TI_SOUNDCHIP_TAG, 3579545)); + soundgen.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(mainboard8_device::sound_ready)); + soundgen.add_route(ALL_OUTPUTS, "sound_out", 0.75); // Speech hardware // Note: SPEECHROM uses its tag for referencing the region - MCFG_DEVICE_ADD(TI998_SPEECHROM_REG, SPEECHROM, 0) + SPEECHROM(config, TI998_SPEECHROM_REG, 0).set_reverse_bit_order(true); SPEAKER(config, "speech_out").front_center(); - MCFG_DEVICE_ADD(TI998_SPEECHSYN_TAG, CD2501ECD, 640000L) - MCFG_TMS52XX_READYQ_HANDLER(WRITELINE(TI998_MAINBOARD_TAG, bus::ti99::internal::mainboard8_device, speech_ready)) - MCFG_TMS52XX_SPEECHROM(TI998_SPEECHROM_REG) - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "speech_out", 0.50) + + cd2501ecd_device& vsp(CD2501ECD(config, TI998_SPEECHSYN_TAG, 640000L)); + vsp.ready_cb().set(TI998_MAINBOARD_TAG, FUNC(mainboard8_device::speech_ready)); + vsp.set_speechrom_tag(TI998_SPEECHROM_REG); + vsp.add_route(ALL_OUTPUTS, "speech_out", 0.50); // Cassette drive SPEAKER(config, "cass_out").front_center(); - MCFG_CASSETTE_ADD( "cassette" ) + CASSETTE(config, "cassette", 0); WAVE(config, "wave", "cassette").add_route(ALL_OUTPUTS, "cass_out", 0.25); // GROM library @@ -899,36 +903,54 @@ MACHINE_CONFIG_START(ti99_8_state::ti99_8) p3grom2.set_region_and_ident(TI998_GROMLIB3_REG, 0x4000, 2); // Joystick port - TI99_JOYPORT(config, m_joyport, 0); - m_joyport->configure_slot(true, false); - -MACHINE_CONFIG_END + TI99_JOYPORT(config, m_joyport, 0).configure_slot(true, false); +} /* TI-99/8 US version (NTSC, 60 Hz) */ -MACHINE_CONFIG_START(ti99_8_state::ti99_8_60hz) +void ti99_8_state::ti99_8_60hz(machine_config& config) +{ ti99_8(config); // Video hardware - MCFG_DEVICE_ADD( TI_VDP_TAG, TMS9118, XTAL(10'738'635) / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(*this, ti99_8_state, video_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_NTSC( TI_SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TI_VDP_TAG, tms9928a_device, screen_update ) -MACHINE_CONFIG_END + tms9928a_device& video(TMS9118(config, TI_VDP_TAG, XTAL(10'738'635) / 2)); + video.out_int_line_callback().set(FUNC(ti99_8_state::video_interrupt)); + video.set_vram_size(0x4000); + video.set_screen(TI_SCREEN_TAG); + + screen_device& screen(SCREEN(config, TI_SCREEN_TAG, SCREEN_TYPE_RASTER)); + screen.set_raw(XTAL(10'738'635) / 2, \ + tms9928a_device::TOTAL_HORZ, \ + tms9928a_device::HORZ_DISPLAY_START-12, \ + tms9928a_device::HORZ_DISPLAY_START + 256 + 12, \ + tms9928a_device::TOTAL_VERT_NTSC, \ + tms9928a_device::VERT_DISPLAY_START_NTSC - 12, \ + tms9928a_device::VERT_DISPLAY_START_NTSC + 192 + 12 ); + screen.set_screen_update(TI_VDP_TAG, FUNC(tms9928a_device::screen_update)); +} /* TI-99/8 European version (PAL, 50 Hz) */ -MACHINE_CONFIG_START(ti99_8_state::ti99_8_50hz) +void ti99_8_state::ti99_8_50hz(machine_config& config) +{ ti99_8(config); // Video hardware - MCFG_DEVICE_ADD( TI_VDP_TAG, TMS9129, XTAL(10'738'635) / 2 ) - MCFG_TMS9928A_VRAM_SIZE(0x4000) - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(*this, ti99_8_state,video_interrupt)) - MCFG_TMS9928A_SCREEN_ADD_PAL( TI_SCREEN_TAG ) - MCFG_SCREEN_UPDATE_DEVICE( TI_VDP_TAG, tms9928a_device, screen_update ) -MACHINE_CONFIG_END + tms9928a_device& video(TMS9129(config, TI_VDP_TAG, XTAL(10'738'635) / 2)); + video.out_int_line_callback().set(FUNC(ti99_8_state::video_interrupt)); + video.set_vram_size(0x4000); + video.set_screen(TI_SCREEN_TAG); + + screen_device& screen(SCREEN(config, TI_SCREEN_TAG, SCREEN_TYPE_RASTER)); + screen.set_raw(XTAL(10'738'635) / 2, \ + tms9928a_device::TOTAL_HORZ, \ + tms9928a_device::HORZ_DISPLAY_START-12, \ + tms9928a_device::HORZ_DISPLAY_START + 256 + 12, \ + tms9928a_device::TOTAL_VERT_PAL, \ + tms9928a_device::VERT_DISPLAY_START_PAL - 12, \ + tms9928a_device::VERT_DISPLAY_START_PAL + 192 + 12 ); + screen.set_screen_update(TI_VDP_TAG, FUNC(tms9928a_device::screen_update)); +} /* All ROM dumps except the speech ROM have a CRC16 checksum as the final two