From b4eda1ffb324ff27e3186bbf138316508c87cd00 Mon Sep 17 00:00:00 2001 From: angelosa Date: Thu, 14 Sep 2017 21:53:02 +0200 Subject: pacman.cpp: changed RNG function for alibaba, fixes inp playback [Angelo Salese] smc777.cpp: minor cleanup (nw) --- src/mame/drivers/pacman.cpp | 5 ++++- src/mame/drivers/smc777.cpp | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mame/drivers/pacman.cpp b/src/mame/drivers/pacman.cpp index b1c2bd2924f..21dc50083a0 100644 --- a/src/mame/drivers/pacman.cpp +++ b/src/mame/drivers/pacman.cpp @@ -554,7 +554,10 @@ READ8_MEMBER(pacman_state::alibaba_mystery_1_r) { /* The return value determines what the mystery item is. Each bit corresponds to a question mark */ - return machine().rand() & 0x0f; + // we use z80 R register due of a bug in rand() function (inp desyncing on playback, supposedly caused by emu/ioport.cpp line 498) + // it needs to be changed anyway by testing this device on real HW + //return machine().rand() & 0x0f; + return m_maincpu->state_int(Z80_R) & 0x0f; } diff --git a/src/mame/drivers/smc777.cpp b/src/mame/drivers/smc777.cpp index 052c8b5d3f2..b652ead85a8 100644 --- a/src/mame/drivers/smc777.cpp +++ b/src/mame/drivers/smc777.cpp @@ -515,7 +515,7 @@ WRITE8_MEMBER(smc777_state::system_output_w) { case 0x00: m_raminh_pending_change = ((data & 0x10) >> 4) ^ 1; - m_raminh_prefetch = (uint8_t)(space.device().state().state_int(Z80_R)) & 0x7f; + m_raminh_prefetch = (uint8_t)(m_maincpu->state_int(Z80_R)) & 0x7f; break; case 0x02: printf("Interlace %s\n",data & 0x10 ? "on" : "off"); break; case 0x05: m_beeper->set_state(data & 0x10); break; @@ -571,7 +571,7 @@ READ8_MEMBER(smc777_state::smc777_mem_r) if(m_raminh_prefetch != 0xff) //do the bankswitch AFTER that the prefetch instruction is executed (FIXME: this is an hackish implementation) { - z80_r = (uint8_t)space.device().state().state_int(Z80_R); + z80_r = (uint8_t)m_maincpu->state_int(Z80_R); if(z80_r == ((m_raminh_prefetch+2) & 0x7f)) { -- cgit v1.2.3