diff options
Diffstat (limited to 'src/mame/drivers/gottlieb.c')
-rw-r--r-- | src/mame/drivers/gottlieb.c | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/src/mame/drivers/gottlieb.c b/src/mame/drivers/gottlieb.c index 29847b232ee..0e494ef1929 100644 --- a/src/mame/drivers/gottlieb.c +++ b/src/mame/drivers/gottlieb.c @@ -483,63 +483,63 @@ TIMER_CALLBACK_MEMBER(gottlieb_state::laserdisc_bit_callback) * *************************************/ -INLINE void audio_end_state(gottlieb_state *state) +inline void gottlieb_state::audio_end_state() { /* this occurs either when the "break in transmission" condition is hit (no zero crossings for 400usec) or when the entire audio buffer is full */ - state->m_laserdisc_status |= 0x08; - state->m_laserdisc_audio_bit_count = 0; - state->m_laserdisc_audio_address = 0; - if (state->m_laserdisc_audio_address != 0) - printf("Got %d bytes\n", state->m_laserdisc_audio_address); + m_laserdisc_status |= 0x08; + m_laserdisc_audio_bit_count = 0; + m_laserdisc_audio_address = 0; + if (m_laserdisc_audio_address != 0) + printf("Got %d bytes\n", m_laserdisc_audio_address); } -static void audio_process_clock(gottlieb_state *state, int logit) +void gottlieb_state::audio_process_clock(int logit) { /* clock the bit through the shift register */ - state->m_laserdisc_audio_bits >>= 1; - if (state->m_laserdisc_zero_seen) - state->m_laserdisc_audio_bits |= 0x80; - state->m_laserdisc_zero_seen = 0; + m_laserdisc_audio_bits >>= 1; + if (m_laserdisc_zero_seen) + m_laserdisc_audio_bits |= 0x80; + m_laserdisc_zero_seen = 0; /* if the buffer ready flag is set, then we are looking for the magic $67 pattern */ - if (state->m_laserdisc_status & 0x08) + if (m_laserdisc_status & 0x08) { - if (state->m_laserdisc_audio_bits == 0x67) + if (m_laserdisc_audio_bits == 0x67) { if (logit) logerror(" -- got 0x67"); - state->m_laserdisc_status &= ~0x08; - state->m_laserdisc_audio_address = 0; + m_laserdisc_status &= ~0x08; + m_laserdisc_audio_address = 0; } } /* otherwise, we keep clocking bytes into the audio buffer */ else { - state->m_laserdisc_audio_bit_count++; + m_laserdisc_audio_bit_count++; /* if we collect 8 bits, add to the buffer */ - if (state->m_laserdisc_audio_bit_count == 8) + if (m_laserdisc_audio_bit_count == 8) { if (logit) - logerror(" -- got new byte %02X", state->m_laserdisc_audio_bits); - state->m_laserdisc_audio_bit_count = 0; - state->m_laserdisc_audio_buffer[state->m_laserdisc_audio_address++] = state->m_laserdisc_audio_bits; + logerror(" -- got new byte %02X", m_laserdisc_audio_bits); + m_laserdisc_audio_bit_count = 0; + m_laserdisc_audio_buffer[m_laserdisc_audio_address++] = m_laserdisc_audio_bits; /* if we collect a full buffer, signal */ - if (state->m_laserdisc_audio_address >= AUDIORAM_SIZE) - audio_end_state(state); + if (m_laserdisc_audio_address >= AUDIORAM_SIZE) + audio_end_state(); } } } -static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime, int logit) +void gottlieb_state::audio_handle_zero_crossing(attotime zerotime, int logit) { /* compute time from last clock */ - attotime deltaclock = zerotime - state->m_laserdisc_last_clock; + attotime deltaclock = zerotime - m_laserdisc_last_clock; if (logit) logerror(" -- zero @ %s (delta=%s)", zerotime.as_string(6), deltaclock.as_string(6)); @@ -548,7 +548,7 @@ static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime, { if (logit) logerror(" -- count as bit"); - state->m_laserdisc_zero_seen++; + m_laserdisc_zero_seen++; return; } @@ -556,8 +556,8 @@ static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime, else if (deltaclock < attotime::from_usec(215)) { if (logit) - logerror(" -- clock, bit=%d", state->m_laserdisc_zero_seen); - state->m_laserdisc_last_clock = zerotime; + logerror(" -- clock, bit=%d", m_laserdisc_zero_seen); + m_laserdisc_last_clock = zerotime; } /* if we are outside of 215usec, we are technically a missing clock @@ -567,7 +567,7 @@ static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime, { if (logit) logerror(" -- skewed clock, correcting"); - state->m_laserdisc_last_clock += attotime::from_usec(200); + m_laserdisc_last_clock += attotime::from_usec(200); } /* we'll count anything more than 275us as an actual missing clock */ @@ -575,11 +575,11 @@ static void audio_handle_zero_crossing(gottlieb_state *state, attotime zerotime, { if (logit) logerror(" -- missing clock"); - state->m_laserdisc_last_clock = zerotime; + m_laserdisc_last_clock = zerotime; } /* we have a clock, process it */ - audio_process_clock(state, logit); + audio_process_clock(logit); } @@ -612,7 +612,7 @@ static void laserdisc_audio_process(device_t *dummy, laserdisc_device &device, i /* if we are past the "break in transmission" time, reset everything */ if ((curtime - state->m_laserdisc_last_clock) > attotime::from_usec(400)) - audio_end_state(state); + state->audio_end_state(); /* if this sample reinforces that the previous one ended a zero crossing, count it */ if ((sample >= 256 && state->m_laserdisc_last_samples[1] >= 0 && state->m_laserdisc_last_samples[0] < 0) || @@ -628,7 +628,7 @@ static void laserdisc_audio_process(device_t *dummy, laserdisc_device &device, i zerotime = curtime + time_per_sample * fractime / 1000; /* determine if this is a clock; if it is, process */ - audio_handle_zero_crossing(state, zerotime, logit); + state->audio_handle_zero_crossing(zerotime, logit); } if (logit) logerror(" \n"); |