From bb9efaff5d69e25c22f8b8023656a7764a72fdf6 Mon Sep 17 00:00:00 2001 From: hap Date: Sat, 8 May 2021 17:09:54 +0200 Subject: [PATCH] gen32: add waitstates on rom access --- src/mame/drivers/mephisto_academy.cpp | 2 +- src/mame/drivers/mephisto_modular.cpp | 48 +++++++++++++++++---------- src/mame/drivers/saitek_risc2500.cpp | 6 ++-- src/mame/drivers/tasc.cpp | 8 ++--- src/mame/video/mmdisplay2.cpp | 10 +++--- src/mame/video/mmdisplay2.h | 4 +-- 6 files changed, 47 insertions(+), 31 deletions(-) diff --git a/src/mame/drivers/mephisto_academy.cpp b/src/mame/drivers/mephisto_academy.cpp index 0fa536152d9..cf7b9495cd5 100644 --- a/src/mame/drivers/mephisto_academy.cpp +++ b/src/mame/drivers/mephisto_academy.cpp @@ -136,7 +136,7 @@ void academy_state::academy(machine_config &config) NVRAM(config, "nvram", nvram_device::DEFAULT_ALL_0); HC259(config, m_outlatch); // SN74HC259N - m_outlatch->parallel_out_cb().set("display:dac", FUNC(dac_byte_interface::write)).rshift(2).mask(0x03); + m_outlatch->parallel_out_cb().set("display:dac", FUNC(speaker_sound_device::level_w)).rshift(2).mask(0x03); MEPHISTO_SENSORS_BOARD(config, "board"); // internal MEPHISTO_DISPLAY_MODULE2(config, "display"); // internal diff --git a/src/mame/drivers/mephisto_modular.cpp b/src/mame/drivers/mephisto_modular.cpp index b192423009f..4d7ae582cc0 100644 --- a/src/mame/drivers/mephisto_modular.cpp +++ b/src/mame/drivers/mephisto_modular.cpp @@ -28,7 +28,8 @@ Portorose 32 Bit: Genius 68030: - M68EC030RP40B, 33.3330MHz XTAL, 6.144MHz XTAL - 256KB ROM (M27C2001) -- 512+256 KB RAM (TC518512PL-10, 8*TC55465P-20) +- 512+256 KB RAM (TC518512PL-10, 8*TC55465P-20), note: chess engine resides in the + 256KB RAM, probably because the EPROM is too slow for this CPU at full speed. Display Modul: - HD44780, 2-line LCD display @@ -42,8 +43,9 @@ Undocumented buttons: - holding CLEAR on boot will clear the battery backed RAM TODO: -- match I/S= diag speed test with real hardware (good test for proper waitstates), - especially gen32 is way too fast when comparing sound pitch +- match I/S= diag speed test with real hardware (good test for proper waitstates) +- gen32 waitstates emulation is preliminary (without it, sound pitch is too high + and lcd write speed too fast) =============================================================================== @@ -103,6 +105,7 @@ public: mmodular_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), + m_rom(*this, "maincpu"), m_nvram(*this, "nvram", 0x2000, ENDIANNESS_BIG), m_board(*this, "board"), m_bav_busy(*this, "bav_busy"), @@ -127,6 +130,7 @@ protected: private: // devices/pointers required_device m_maincpu; + optional_region_ptr m_rom; memory_share_creator m_nvram; required_device m_board; required_device m_bav_busy; @@ -142,6 +146,7 @@ private: void gen32_mem(address_map &map); // I/O handlers + u32 rom_r(offs_t offset); void bavaria_w(u8 data); u8 bavaria1_r(); u8 bavaria2_r(); @@ -171,6 +176,16 @@ void mmodular_state::machine_reset() I/O ******************************************************************************/ +u32 mmodular_state::rom_r(offs_t offset) +{ + // waitstates for gen32 (preliminary) + if (!machine().side_effects_disabled()) + m_maincpu->adjust_icount(-20); + + return m_rom[offset]; +} + + // Bavaria board void mmodular_state::set_sbtype(ioport_value newval) @@ -304,7 +319,7 @@ void mmodular_state::van32_mem(address_map &map) void mmodular_state::gen32_mem(address_map &map) { - map(0x00000000, 0x0003ffff).rom(); + map(0x00000000, 0x0003ffff).r(FUNC(mmodular_state::rom_r)); map(0x40000000, 0x4007ffff).ram(); map(0x80000000, 0x8003ffff).ram(); map(0xc0000000, 0xc0000000).r("board", FUNC(mephisto_board_device::input_r)); @@ -466,7 +481,6 @@ void mmodular_state::gen32(machine_config &config) const attotime irq_period = attotime::from_hz(6.144_MHz_XTAL / 0x4000); // through 4060, 375Hz m_maincpu->set_periodic_int(FUNC(mmodular_state::irq2_line_hold), irq_period); - subdevice("display:hd44780")->set_busy_factor(0.25); // problem with waitstates config.set_default_layout(layout_mephisto_gen32); } @@ -596,23 +610,23 @@ ROM_END ******************************************************************************/ /* YEAR NAME PARENT CMP MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS */ -CONS( 1988, alm32, 0, 0, alm32, alm32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Almeria 32 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1988, alm16, alm32, 0, alm16, alm16, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Almeria 16 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1988, alm32, 0, 0, alm32, alm32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Almeria 32 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1988, alm16, alm32, 0, alm16, alm16, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Almeria 16 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1989, port32, 0, 0, port32, port32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Portorose 32 Bit (v1.04)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1989, port32a, port32, 0, port32, port32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Portorose 32 Bit (v1.03)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1989, port32b, port32, 0, port32, port32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Portorose 32 Bit (v1.01)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1989, port16, port32, 0, port16, port16, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Portorose 16 Bit (v1.01)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1989, port32, 0, 0, port32, port32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Portorose 32 Bit (v1.04)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1989, port32a, port32, 0, port32, port32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Portorose 32 Bit (v1.03)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1989, port32b, port32, 0, port32, port32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Portorose 32 Bit (v1.01)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1989, port16, port32, 0, port16, port16, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Portorose 16 Bit (v1.01)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1990, lyon32, 0, 0, port32, port32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Lyon 32 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1990, lyon16, lyon32, 0, port16, port16, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Lyon 16 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1990, lyon32, 0, 0, port32, port32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Lyon 32 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1990, lyon16, lyon32, 0, port16, port16, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Lyon 16 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1991, van32, 0, 0, van32, port32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Vancouver 32 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1991, van16, van32, 0, van16, port16, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Vancouver 16 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1991, van32, 0, 0, van32, port32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Vancouver 32 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1991, van16, van32, 0, van16, port16, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Vancouver 16 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) CONS( 1993, gen32, 0, 0, gen32, gen32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Genius 68030 (v4.01)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) CONS( 1993, gen32a, gen32, 0, gen32, gen32, mmodular_state, empty_init, "Hegener + Glaser", "Mephisto Genius 68030 (v4.00)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) CONS( 1996, gen32l, gen32, 0, gen32, gen32, mmodular_state, empty_init, "Richard Lang", "Mephisto Genius 68030 (London upgrade)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1996, lond32, 0, 0, van32, port32, mmodular_state, empty_init, "Richard Lang", "Mephisto London 32 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) // for alm32/port32/lyon32/van32 -CONS( 1996, lond16, lond32, 0, van16, port16, mmodular_state, empty_init, "Richard Lang", "Mephisto London 16 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) // for alm16/port16/lyon16/van16 +CONS( 1996, lond32, 0, 0, van32, port32, mmodular_state, empty_init, "Richard Lang", "Mephisto London 32 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // for alm32/port32/lyon32/van32 +CONS( 1996, lond16, lond32, 0, van16, port16, mmodular_state, empty_init, "Richard Lang", "Mephisto London 16 Bit", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // for alm16/port16/lyon16/van16 diff --git a/src/mame/drivers/saitek_risc2500.cpp b/src/mame/drivers/saitek_risc2500.cpp index 0b32abed34c..36afd69a4b6 100644 --- a/src/mame/drivers/saitek_risc2500.cpp +++ b/src/mame/drivers/saitek_risc2500.cpp @@ -500,7 +500,7 @@ ROM_END ******************************************************************************/ // YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS -CONS( 1992, risc2500, 0, 0, risc2500, risc2500, risc2500_state, empty_init, "Saitek / Tasc", "Kasparov RISC 2500 (v1.04)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1992, risc2500a, risc2500, 0, risc2500, risc2500, risc2500_state, empty_init, "Saitek / Tasc", "Kasparov RISC 2500 (v1.03)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1992, risc2500, 0, 0, risc2500, risc2500, risc2500_state, empty_init, "Saitek / Tasc", "Kasparov RISC 2500 (v1.04)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1992, risc2500a, risc2500, 0, risc2500, risc2500, risc2500_state, empty_init, "Saitek / Tasc", "Kasparov RISC 2500 (v1.03)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1995, montreux, 0, 0, montreux, montreux, risc2500_state, empty_init, "Saitek / Tasc", "Mephisto Montreux", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // after Saitek bought Hegener + Glaser +CONS( 1995, montreux, 0, 0, montreux, montreux, risc2500_state, empty_init, "Saitek / Tasc", "Mephisto Montreux", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) // after Saitek bought Hegener + Glaser diff --git a/src/mame/drivers/tasc.cpp b/src/mame/drivers/tasc.cpp index d11edf6c6aa..13a0c1ec7c2 100644 --- a/src/mame/drivers/tasc.cpp +++ b/src/mame/drivers/tasc.cpp @@ -375,7 +375,7 @@ ROM_END ******************************************************************************/ // YEAR NAME PARENT CMP MACHINE INPUT CLASS INIT COMPANY, FULLNAME, FLAGS -CONS( 1995, tascr30, 0, 0, tasc, tasc, tasc_state, empty_init, "Tasc", "ChessSystem R30 (The King 2.50)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1993, tascr30a, tascr30, 0, tasc, tasc, tasc_state, empty_init, "Tasc", "ChessSystem R30 (The King 2.20)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) -CONS( 1993, tascr30b, tascr30, 0, tasc, tasc, tasc_state, empty_init, "Tasc", "ChessSystem R30 (The King 2.23, TM version)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // competed in several chesscomputer tournaments -CONS( 1993, tascr30g, tascr30, 0, tasc, tasc, tasc_state, empty_init, "Tasc", "ChessSystem R30 (Gideon 2.1, prototype)", MACHINE_SUPPORTS_SAVE | MACHINE_CLICKABLE_ARTWORK ) // made in 1993, later released in 2012 +CONS( 1995, tascr30, 0, 0, tasc, tasc, tasc_state, empty_init, "Tasc", "ChessSystem R30 (The King 2.50)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1993, tascr30a, tascr30, 0, tasc, tasc, tasc_state, empty_init, "Tasc", "ChessSystem R30 (The King 2.20)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) +CONS( 1993, tascr30b, tascr30, 0, tasc, tasc, tasc_state, empty_init, "Tasc", "ChessSystem R30 (The King 2.23, TM version)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) // competed in several chesscomputer tournaments +CONS( 1993, tascr30g, tascr30, 0, tasc, tasc, tasc_state, empty_init, "Tasc", "ChessSystem R30 (Gideon 2.1, prototype)", MACHINE_SUPPORTS_SAVE | MACHINE_IMPERFECT_TIMING | MACHINE_CLICKABLE_ARTWORK ) // made in 1993, later released in 2012 diff --git a/src/mame/video/mmdisplay2.cpp b/src/mame/video/mmdisplay2.cpp index 27171a733a4..bc893ac81aa 100644 --- a/src/mame/video/mmdisplay2.cpp +++ b/src/mame/video/mmdisplay2.cpp @@ -35,7 +35,7 @@ mephisto_display2_device::mephisto_display2_device(const machine_config &mconfig void mephisto_display2_device::device_add_mconfig(machine_config &config) { - /* video hardware */ + // video hardware screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_LCD)); screen.set_refresh_hz(60); // arbitrary screen.set_vblank_time(ATTOSECONDS_IN_USEC(2500)); @@ -50,9 +50,11 @@ void mephisto_display2_device::device_add_mconfig(machine_config &config) m_lcd->set_lcd_size(2, 16); m_lcd->set_pixel_update_cb(FUNC(mephisto_display2_device::lcd_pixel_update)); - /* sound hardware */ + // sound hardware (using filtered dac because of aliasing) SPEAKER(config, "speaker").front_center(); - DAC_2BIT_BINARY_WEIGHTED_ONES_COMPLEMENT(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25); + static const double speaker_levels[4] = { 0.0, 1.0, -1.0, 0.0 }; + SPEAKER_SOUND(config, m_dac).add_route(ALL_OUTPUTS, "speaker", 0.25); + m_dac->set_levels(4, speaker_levels); } void mephisto_display2_device::lcd_palette(palette_device &palette) const @@ -105,7 +107,7 @@ void mephisto_display2_device::io_w(u8 data) if (BIT(data, 1) && !BIT(m_ctrl, 1)) m_lcd->write(BIT(data, 0), m_latch); - m_dac->write(data >> 2 & 3); + m_dac->level_w(data >> 2 & 3); m_ctrl = data; } diff --git a/src/mame/video/mmdisplay2.h b/src/mame/video/mmdisplay2.h index 23ea1f56cf3..a8fe68502c6 100644 --- a/src/mame/video/mmdisplay2.h +++ b/src/mame/video/mmdisplay2.h @@ -11,7 +11,7 @@ #pragma once -#include "sound/dac.h" +#include "sound/spkrdev.h" #include "video/hd44780.h" #include "emupal.h" @@ -37,7 +37,7 @@ protected: private: required_device m_lcd; - required_device m_dac; + required_device m_dac; void lcd_palette(palette_device &palette) const; HD44780_PIXEL_UPDATE(lcd_pixel_update);