From 4960e2534cdfe51e7f9fd7ecd8c1a5567037bf50 Mon Sep 17 00:00:00 2001 From: cracyc Date: Sat, 12 Jun 2021 14:13:39 -0500 Subject: fmtowns: fix missing controller return value and cdda status --- src/mame/drivers/fmtowns.cpp | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/mame/drivers/fmtowns.cpp b/src/mame/drivers/fmtowns.cpp index 05441601efe..44a56d2ee43 100644 --- a/src/mame/drivers/fmtowns.cpp +++ b/src/mame/drivers/fmtowns.cpp @@ -939,6 +939,7 @@ uint8_t towns_state::towns_padport_r(offs_t offset) uint8_t extra2; uint32_t state; + offset >>= 1; if(offset == 0) { if((porttype & 0x0f) == 0x01) @@ -960,7 +961,7 @@ uint8_t towns_state::towns_padport_r(offs_t offset) if((extra1 & 0x20) && (m_towns_pad_mask & 0x02)) ret &= ~0x20; } - if((porttype & 0x0f) == 0x04) // 6-button joystick + else if((porttype & 0x0f) == 0x04) // 6-button joystick { extra1 = m_6b_joy1_ex->read(); @@ -992,7 +993,7 @@ uint8_t towns_state::towns_padport_r(offs_t offset) ret &= ~0x01; } } - if((porttype & 0x0f) == 0x02) // mouse + else if((porttype & 0x0f) == 0x02) // mouse { switch(m_towns_mouse_output) { @@ -1025,9 +1026,9 @@ uint8_t towns_state::towns_padport_r(offs_t offset) if(m_towns_pad_mask & 0x10) ret |= 0x40; } - + else ret = 0x7f; } - if(offset == 1) // second joystick port + else if(offset == 1) // second joystick port { if((porttype & 0xf0) == 0x10) { @@ -1048,7 +1049,7 @@ uint8_t towns_state::towns_padport_r(offs_t offset) if((extra2 & 0x20) && (m_towns_pad_mask & 0x08)) ret &= ~0x20; } - if((porttype & 0xf0) == 0x40) // 6-button joystick + else if((porttype & 0xf0) == 0x40) // 6-button joystick { extra2 = m_6b_joy2_ex->read(); @@ -1080,7 +1081,7 @@ uint8_t towns_state::towns_padport_r(offs_t offset) ret &= ~0x01; } } - if((porttype & 0xf0) == 0x20) // mouse + else if((porttype & 0xf0) == 0x20) // mouse { switch(m_towns_mouse_output) { @@ -1113,6 +1114,7 @@ uint8_t towns_state::towns_padport_r(offs_t offset) if(m_towns_pad_mask & 0x20) ret |= 0x40; } + else ret = 0x7f; } return ret; @@ -1788,7 +1790,10 @@ uint8_t towns_state::towns_cdrom_r(offs_t offset) m_towns_cd.extra_status = 0; break; case 0x04: // play cdda - towns_cd_set_status(0x07,0x00,0x00,0x00); + if(m_cdda->audio_ended()) + towns_cd_set_status(0x07,0x00,0x00,0x00); + else + towns_cd_set_status(0x00,0x00,0x03,0x00); m_towns_cd.status &= ~2; m_towns_cd.extra_status = 0; break; @@ -2355,7 +2360,7 @@ void towns_state::towns_io(address_map &map) // CD-ROM map(0x04c0, 0x04cf).rw(FUNC(towns_state::towns_cdrom_r), FUNC(towns_state::towns_cdrom_w)).umask32(0x00ff00ff); // Joystick / Mouse ports - map(0x04d0, 0x04d3).r(FUNC(towns_state::towns_padport_r)).umask32(0x00ff00ff); + map(0x04d0, 0x04d3).r(FUNC(towns_state::towns_padport_r)); map(0x04d6, 0x04d6).w(FUNC(towns_state::towns_pad_mask_w)); // Sound (YM3438 [FM], RF5c68 [PCM]) map(0x04d8, 0x04df).rw("fm", FUNC(ym3438_device::read), FUNC(ym3438_device::write)).umask32(0x00ff00ff); @@ -2426,7 +2431,7 @@ void towns_state::towns16_io(address_map &map) // CD-ROM map(0x04c0, 0x04cf).rw(FUNC(towns_state::towns_cdrom_r), FUNC(towns_state::towns_cdrom_w)).umask16(0x00ff); // Joystick / Mouse ports - map(0x04d0, 0x04d3).r(FUNC(towns_state::towns_padport_r)).umask16(0x00ff); + map(0x04d0, 0x04d3).r(FUNC(towns_state::towns_padport_r)); map(0x04d6, 0x04d6).w(FUNC(towns_state::towns_pad_mask_w)); // Sound (YM3438 [FM], RF5c68 [PCM]) map(0x04d8, 0x04df).rw("fm", FUNC(ym3438_device::read), FUNC(ym3438_device::write)).umask16(0x00ff); -- cgit v1.2.3