hh_tms1k: improve h2hhockey timing (nw)

This commit is contained in:
hap 2019-02-18 00:37:16 +01:00
parent 365039e3a9
commit 76bfae9ffb
3 changed files with 30 additions and 13 deletions

View File

@ -972,7 +972,7 @@ void ccx_state::prepare_display()
WRITE8_MEMBER(ccx_state::ppi_porta_w)
{
// d7: enable beeper on falling edge (555 monostable)
if (m_beeper && ~data & m_7seg_data & 0x80)
if (~data & m_7seg_data & 0x80 && !m_beeper_off->enabled())
{
m_beeper->set_state(1);
m_beeper_off->adjust(attotime::from_msec(80)); // duration is approximate

View File

@ -143,7 +143,6 @@
- finish bshipb SN76477 sound
- improve elecbowl driver
- is alphie(patent) the same as the final version?
- h2hhockey R9 timing is wrong: passing seems too slow, and in-game clock too fast
***************************************************************************/
@ -1494,7 +1493,8 @@ public:
required_device<timer_device> m_cap_empty_timer;
TIMER_DEVICE_CALLBACK_MEMBER(cap_empty_callback);
bool m_cap;
bool m_cap_state;
attotime m_cap_charge;
void prepare_display();
DECLARE_WRITE16_MEMBER(write_r);
@ -1511,7 +1511,7 @@ protected:
TIMER_DEVICE_CALLBACK_MEMBER(h2hhockey_state::cap_empty_callback)
{
if (~m_r & 0x200)
m_cap = false;
m_cap_state = false;
}
void h2hhockey_state::prepare_display()
@ -1534,10 +1534,24 @@ WRITE16_MEMBER(h2hhockey_state::write_r)
m_speaker->level_w(data >> 8 & 1);
// R9: K8 and 15uF cap to V- (used as timer)
if (data & 0x200)
m_cap = true;
else if (m_r & 0x200) // falling edge
m_cap_empty_timer->adjust(attotime::from_msec(28)); // not accurate
// rising edge, remember the time
if (data & ~m_r & 0x200)
{
m_cap_state = true;
m_cap_charge = machine().time();
}
// falling edge, determine how long K8 should stay up
if (~data & m_r & 0x200)
{
const attotime full = attotime::from_usec(1300); // approx. charge time
const int factor = 27; // approx. factor for charge/discharge to logic 0
attotime charge = machine().time() - m_cap_charge;
if (charge > full)
charge = full;
m_cap_empty_timer->adjust(charge * factor);
}
// R0-R7: led select
m_r = data;
@ -1554,7 +1568,7 @@ WRITE16_MEMBER(h2hhockey_state::write_o)
READ8_MEMBER(h2hhockey_state::read_k)
{
// K1-K4: multiplexed inputs, K8: R9 and capacitor
return (read_inputs(4) & 7) | (m_cap ? 8 : 0);
return (read_inputs(4) & 7) | (m_cap_state ? 8 : 0);
}
// config
@ -1590,8 +1604,11 @@ void h2hhockey_state::machine_start()
hh_tms1k_state::machine_start();
// zerofill/register for savestates
m_cap = false;
save_item(NAME(m_cap));
m_cap_state = false;
m_cap_charge = attotime::zero;
save_item(NAME(m_cap_state));
save_item(NAME(m_cap_charge));
}
void h2hhockey_state::h2hhockey(machine_config &config)

View File

@ -33,8 +33,8 @@
class k28_state : public driver_device
{
public:
k28_state(const machine_config &mconfig, device_type type, const char *tag)
: driver_device(mconfig, type, tag),
k28_state(const machine_config &mconfig, device_type type, const char *tag) :
driver_device(mconfig, type, tag),
m_maincpu(*this, "maincpu"),
m_tms6100(*this, "tms6100"),
m_speech(*this, "speech"),