diff options
Diffstat (limited to 'src/devices/sound/pokey.cpp')
-rw-r--r-- | src/devices/sound/pokey.cpp | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/src/devices/sound/pokey.cpp b/src/devices/sound/pokey.cpp index 7880de562d7..53ad7f26fdf 100644 --- a/src/devices/sound/pokey.cpp +++ b/src/devices/sound/pokey.cpp @@ -507,7 +507,7 @@ void pokey_device::step_keyboard() if (m_IRQEN & IRQ_KEYBD) { /* last interrupt not acknowledged ? */ - if(m_IRQST & IRQ_KEYBD) + if (m_IRQST & IRQ_KEYBD) m_SKSTAT |= SK_KBERR; m_IRQST |= IRQ_KEYBD; if (!m_irq_f.isnull()) @@ -546,18 +546,16 @@ void pokey_device::step_keyboard() void pokey_device::step_pot() { - int pot; - - if( (m_SKCTL & SK_RESET) == 0) + if ((m_SKCTL & SK_RESET) == 0) return; uint8_t upd = 0; m_pot_counter++; - for (pot = 0; pot < 8; pot++) + for (int pot = 0; pot < 8; pot++) { if ((m_POTx[pot]<m_pot_counter) || (m_pot_counter == 228)) { - upd |= (1<<pot); + upd |= (1 << pot); /* latching is emulated in read */ } } @@ -574,14 +572,13 @@ void pokey_device::step_pot() uint32_t pokey_device::step_one_clock(void) { - int ch, clk; - uint32_t sum = 0; - int clock_triggered[3] = {0,0,0}; - int base_clock = (m_AUDCTL & CLK_15KHZ) ? CLK_114 : CLK_28; + int const base_clock = (m_AUDCTL & CLK_15KHZ) ? CLK_114 : CLK_28; - if( (m_SKCTL & SK_RESET) ) + if (m_SKCTL & SK_RESET) { /* Clocks only count if we are not in a reset */ + int clock_triggered[3] = {0,0,0}; + int clk; for (clk = 0; clk < 3; clk++) { m_clock_cnt[clk]++; @@ -625,7 +622,7 @@ uint32_t pokey_device::step_one_clock(void) /* do CHAN2 before CHAN1 because CHAN1 may set borrow! */ if (m_channel[CHAN2].check_borrow()) { - int isJoined = (m_AUDCTL & CH12_JOINED); + bool const isJoined(m_AUDCTL & CH12_JOINED); if (isJoined) m_channel[CHAN1].reset_channel(); m_channel[CHAN2].reset_channel(); @@ -638,7 +635,7 @@ uint32_t pokey_device::step_one_clock(void) if (m_channel[CHAN1].check_borrow()) { - int isJoined = (m_AUDCTL & CH12_JOINED); + bool const isJoined(m_AUDCTL & CH12_JOINED); if (isJoined) m_channel[CHAN2].inc_chan(); else @@ -652,7 +649,7 @@ uint32_t pokey_device::step_one_clock(void) /* do CHAN4 before CHAN3 because CHAN3 may set borrow! */ if (m_channel[CHAN4].check_borrow()) { - int isJoined = (m_AUDCTL & CH34_JOINED); + bool const isJoined(m_AUDCTL & CH34_JOINED); if (isJoined) m_channel[CHAN3].reset_channel(); m_channel[CHAN4].reset_channel(); @@ -668,7 +665,7 @@ uint32_t pokey_device::step_one_clock(void) if (m_channel[CHAN3].check_borrow()) { - int isJoined = (m_AUDCTL & CH34_JOINED); + bool const isJoined(m_AUDCTL & CH34_JOINED); if (isJoined) m_channel[CHAN4].inc_chan(); else @@ -681,7 +678,8 @@ uint32_t pokey_device::step_one_clock(void) m_channel[CHAN1].m_filter_sample = 1; } - for (ch = 0; ch < 4; ch++) + uint32_t sum = 0; + for (int ch = 0; ch < 4; ch++) { sum |= (((((m_channel[ch].m_output ^ m_channel[ch].m_filter_sample) || (m_channel[ch].m_AUDC & VOLUME_ONLY)) ? (m_channel[ch].m_AUDC & VOLUME_MASK) : 0 )) << (ch * 4)); } @@ -793,7 +791,7 @@ READ8_MEMBER( pokey_device::read ) case POT0_C: case POT1_C: case POT2_C: case POT3_C: case POT4_C: case POT5_C: case POT6_C: case POT7_C: pot = offset & 7; - if( m_ALLPOT & (1 << pot) ) + if (m_ALLPOT & (1 << pot)) { /* we have a value measured */ data = m_POTx[pot]; @@ -811,12 +809,12 @@ READ8_MEMBER( pokey_device::read ) * If the 2 least significant bits of SKCTL are 0, the ALLPOTs * are disabled (SKRESET). Thanks to MikeJ for pointing this out. ****************************************************************/ - if( (m_SKCTL & SK_RESET) == 0) + if ((m_SKCTL & SK_RESET) == 0) { data = m_ALLPOT; LOG(("POKEY '%s' ALLPOT internal $%02x (reset)\n", tag(), data)); } - else if( !m_allpot_r_cb.isnull() ) + else if (!m_allpot_r_cb.isnull()) { m_ALLPOT = data = m_allpot_r_cb(offset); LOG(("%s: POKEY '%s' ALLPOT callback $%02x\n", machine().describe_context(), tag(), data)); @@ -833,7 +831,7 @@ READ8_MEMBER( pokey_device::read ) break; case RANDOM_C: - if( m_AUDCTL & POLY9 ) + if (m_AUDCTL & POLY9) { data = m_poly9[m_p9] & 0xff; LOG_RAND(("POKEY '%s' rand9[$%05x]: $%02x\n", tag(), m_p9, data)); @@ -846,7 +844,7 @@ READ8_MEMBER( pokey_device::read ) break; case SERIN_C: - if( !m_serin_r_cb.isnull() ) + if (!m_serin_r_cb.isnull()) m_SERIN = m_serin_r_cb(offset); data = m_SERIN; LOG(("POKEY '%s' SERIN $%02x\n", tag(), data)); @@ -880,7 +878,7 @@ READ8_MEMBER( pokey_device::read ) WRITE8_MEMBER( pokey_device::write ) { - synchronize(SYNC_WRITE, (offset<<8) | data); + synchronize(SYNC_WRITE, (offset << 8) | data); } void pokey_device::write_internal(offs_t offset, uint8_t data) @@ -1145,7 +1143,7 @@ void pokey_device::vol_init() rTot = 0; for (int i=0; i<4; i++) { - rTot += 1.0 / r_chan[(j>>(i*4)) & 0x0f]; + rTot += 1.0 / r_chan[(j >> (i*4)) & 0x0f]; } rTot = 1.0 / rTot; m_voltab[j] = rTot; |