pacman.cpp: changed RNG function for alibaba, fixes inp playback [Angelo Salese]

smc777.cpp: minor cleanup (nw)
This commit is contained in:
angelosa 2017-09-14 21:53:02 +02:00
parent 227ae7045d
commit b4eda1ffb3
2 changed files with 6 additions and 3 deletions

View File

@ -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;
}

View File

@ -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))
{