From fd4f5150247460fbbeaa556515f2229052c23abe Mon Sep 17 00:00:00 2001 From: 987123879113 <63495610+987123879113@users.noreply.github.com> Date: Tue, 18 Apr 2023 23:49:56 +0900 Subject: namco/namcos10.cpp: More dumps/redumps, new decryption devices, and more I/O emulation. (#11114) * Implemented the basics of the MEM(P3) memory/I/O board. * Added controls for more games. * Marked Pacman BALL as a bad dump. * Marked all games as MACHINE_IMPERFECT_SOUND in anticipation of complaints. * cpu/tlcs900/tmp95c061.cpp: Added basic ADC support (based on TMP95C063). * namco/namcos10_exio.cpp: Added System 10 I/O expander board (EXIO) emulation. * namco/ns10crypt.cpp: Moved per-game decryption setup to client configuration. * Added decryption setups for GAHAHA Ippatsudou, Golgo 13: Juusei no Requiem, Sekai Kaseki Hakken, Pacman BALL, Medal no Tatsujin, Medal no Tatsujin 2 and Sugorotic JAPAN. [Samuel Neves, Peter Wilhelmsen] Systems promoted to working ---------------------------- GAHAHA Ippatsudou (World, GID2 Ver.A) [Samuel Neves, Peter Wilhelmsen, Windy Fairy] GAHAHA Ippatsudou 2 (Japan, GIS1 Ver.A) [Samuel Neves, Peter Wilhelmsen, Windy Fairy] Golgo 13: Juusei no Requiem (Japan, GLT1 VER.A) [Samuel Neves, Peter Wilhelmsen, Windy Fairy] Kotoba no Puzzle Mojipittan (Japan, KPM1 Ver.A) [Brizzo, Smitdogg, The Dumping Union, Windy Fairy] New systems marked not working -------------------------------- Sugorotic JAPAN (STJ1 Ver.C) [Brizzo, Smitdogg, The Dumping Union] Tsukkomi Yousei Gips Nice Tsukkomi (NTK1 Ver.A) [Guru] --- src/devices/cpu/tlcs900/tmp95c061.cpp | 41 ++++++++++++++++++++++++++--------- src/devices/cpu/tlcs900/tmp95c061.h | 4 ++++ 2 files changed, 35 insertions(+), 10 deletions(-) (limited to 'src/devices/cpu/tlcs900') diff --git a/src/devices/cpu/tlcs900/tmp95c061.cpp b/src/devices/cpu/tlcs900/tmp95c061.cpp index d297ba73fcf..3fd8be4fe32 100644 --- a/src/devices/cpu/tlcs900/tmp95c061.cpp +++ b/src/devices/cpu/tlcs900/tmp95c061.cpp @@ -30,6 +30,7 @@ tmp95c061_device::tmp95c061_device(const machine_config &mconfig, const char *ta m_porta_write(*this), m_portb_read(*this), m_portb_write(*this), + m_an_read(*this), m_port_latch{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, m_port_control{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, m_port_function{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, @@ -206,6 +207,7 @@ void tmp95c061_device::device_start() m_porta_write.resolve_safe(); m_portb_read.resolve_safe(0); m_portb_write.resolve_safe(); + m_an_read.resolve_all_safe(0); } void tmp95c061_device::device_reset() @@ -550,15 +552,29 @@ void tmp95c061_device::tlcs900_handle_ad() if ( m_ad_cycles_left <= 0 ) { /* Store A/D converted value */ - switch( m_ad_mode & 0x03 ) + if ( ( m_ad_mode & 0x10 ) == 0 ) { - case 0x00: /* AN0 */ - m_ad_result[0] = 0x3ff; - break; - case 0x01: /* AN1 */ - case 0x02: /* AN2 */ - case 0x03: /* AN3 */ - break; + /* conversion channel fixed */ + m_ad_result[m_ad_mode & 0x03] = m_an_read[m_ad_mode & 0x03](0) & 0x3ff; + } + else + { + /* conversion channel sweep */ + switch( m_ad_mode & 0x03 ) + { + case 0x03: /* AN3 */ + m_ad_result[3] = m_an_read[3](0) & 0x3ff; + [[fallthrough]]; + case 0x02: /* AN2 */ + m_ad_result[2] = m_an_read[2](0) & 0x3ff; + [[fallthrough]]; + case 0x01: /* AN1 */ + m_ad_result[1] = m_an_read[1](0) & 0x3ff; + [[fallthrough]]; + case 0x00: /* AN0 */ + m_ad_result[0] = m_an_read[0](0) & 0x3ff; + break; + } } /* Clear BUSY flag, set END flag */ @@ -1355,10 +1371,15 @@ void tmp95c061_device::ode_w(uint8_t data) uint8_t tmp95c061_device::adreg_r(offs_t offset) { + // ADMOD EOCF is cleared to 0 when reading any ADREG0..3 + m_ad_mode &= ~0x80; + if (BIT(offset, 0)) return m_ad_result[offset >> 1] >> 2; - else - return m_ad_result[offset >> 1] << 6 | 0x3f; + + // Reading data from the upper 8 bits clears INTE0AD IADC + m_int_reg[TMP95C061_INTE0AD] &= ~0x80; + return m_ad_result[offset >> 1] << 6 | 0x3f; } uint8_t tmp95c061_device::admod_r() diff --git a/src/devices/cpu/tlcs900/tmp95c061.h b/src/devices/cpu/tlcs900/tmp95c061.h index 10d8193f6e6..106ca5c57ce 100644 --- a/src/devices/cpu/tlcs900/tmp95c061.h +++ b/src/devices/cpu/tlcs900/tmp95c061.h @@ -33,6 +33,7 @@ public: auto porta_write() { return m_porta_write.bind(); } auto portb_read() { return m_portb_read.bind(); } auto portb_write() { return m_portb_write.bind(); } + template auto an_read() { return m_an_read[Bit].bind(); } protected: virtual void device_config_complete() override; @@ -183,6 +184,9 @@ private: devcb_read8 m_portb_read; devcb_write8 m_portb_write; + // analogue inputs, sampled at 10 bits + devcb_read16::array<4> m_an_read; + // I/O Port Control uint8_t m_port_latch[0xc]; uint8_t m_port_control[0xc]; -- cgit v1.2.3-70-g09d2