@@ -318,86 +318,84 @@ void msm5232_device::write(offs_t offset, uint8_t data)
318
318
if (offset > 0x0d )
319
319
return ;
320
320
321
- m_stream->update ();
321
+ m_stream->update ();
322
322
323
323
if (offset < 0x08 ) /* pitch */
324
324
{
325
- int ch = offset& 7 ;
325
+ const int ch = offset & 7 ;
326
326
327
- m_voi[ch].GF = (( data& 0x80 )>> 7 );
327
+ m_voi[ch].GF = BIT ( data, 7 );
328
328
if (ch == 7 )
329
329
gate_update ();
330
330
331
- if (data& 0x80 )
331
+ if (data & 0x80 )
332
332
{
333
- if (data >= 0xd8 )
333
+ if (data >= 0xd8 )
334
334
{
335
335
/* if ((data&0x7f) != 0x5f) logerror("MSM5232: WRONG PITCH CODE = %2x\n",data&0x7f);*/
336
336
m_voi[ch].mode = 1 ; /* noise mode */
337
337
m_voi[ch].eg_sect = 0 ; /* Key On */
338
338
}
339
339
else
340
340
{
341
- if ( m_voi[ch].pitch != (data& 0x7f ) )
341
+ if (m_voi[ch].pitch != (data & 0x7f ))
342
342
{
343
343
int n;
344
- uint16_t pg;
345
344
346
- m_voi[ch].pitch = data& 0x7f ;
345
+ m_voi[ch].pitch = data & 0x7f ;
347
346
348
- pg = MSM5232_ROM[ data& 0x7f ];
347
+ const uint32_t pg = MSM5232_ROM[data & 0x7f ];
349
348
350
349
m_voi[ch].TG_count_period = (pg & 0x1ff ) * m_UpdateStep / 2 ;
351
350
352
- n = (pg>> 9 ) & 7 ; /* n = bit number for 16' output */
351
+ n = (pg >> 9 ) & 7 ; /* n = bit number for 16' output */
353
352
m_voi[ch].TG_out16 = 1 <<n;
354
353
/* for 8' it is bit n-1 (bit 0 if n-1<0) */
355
354
/* for 4' it is bit n-2 (bit 0 if n-2<0) */
356
355
/* for 2' it is bit n-3 (bit 0 if n-3<0) */
357
- n = (n> 0 )? n- 1 : 0 ;
358
- m_voi[ch].TG_out8 = 1 << n;
356
+ n = (n > 0 ) ? (n - 1 ) : 0 ;
357
+ m_voi[ch].TG_out8 = 1 << n;
359
358
360
- n = (n> 0 )? n- 1 : 0 ;
361
- m_voi[ch].TG_out4 = 1 << n;
359
+ n = (n > 0 ) ? (n - 1 ) : 0 ;
360
+ m_voi[ch].TG_out4 = 1 << n;
362
361
363
- n = (n> 0 )? n- 1 : 0 ;
364
- m_voi[ch].TG_out2 = 1 << n;
362
+ n = (n > 0 ) ? (n - 1 ) : 0 ;
363
+ m_voi[ch].TG_out2 = 1 << n;
365
364
}
366
365
m_voi[ch].mode = 0 ; /* tone mode */
367
366
m_voi[ch].eg_sect = 0 ; /* Key On */
368
367
}
369
368
}
370
369
else
371
370
{
372
- if ( !m_voi[ch].eg_arm ) /* arm = 0 */
371
+ if (!m_voi[ch].eg_arm ) /* arm = 0 */
373
372
m_voi[ch].eg_sect = 2 ; /* Key Off -> go to release */
374
- else /* arm = 1 */
373
+ else /* arm = 1 */
375
374
m_voi[ch].eg_sect = 1 ; /* Key Off -> go to decay */
376
375
}
377
376
}
378
377
else
379
378
{
380
- int i;
381
379
switch (offset)
382
380
{
383
381
case 0x08 : /* group1 attack */
384
- for (i= 0 ; i< 4 ; i++)
385
- m_voi[i].ar_rate = m_ar_tbl[data& 0x7 ] * m_external_capacitance[i];
382
+ for (int i = 0 ; i < 4 ; i++)
383
+ m_voi[i].ar_rate = m_ar_tbl[data & 0x7 ] * m_external_capacitance[i];
386
384
break ;
387
385
388
386
case 0x09 : /* group2 attack */
389
- for (i= 0 ; i< 4 ; i++)
390
- m_voi[i+ 4 ].ar_rate = m_ar_tbl[data& 0x7 ] * m_external_capacitance[i+4 ];
387
+ for (int i = 0 ; i < 4 ; i++)
388
+ m_voi[i + 4 ].ar_rate = m_ar_tbl[data & 0x7 ] * m_external_capacitance[i+4 ];
391
389
break ;
392
390
393
391
case 0x0a : /* group1 decay */
394
- for (i= 0 ; i< 4 ; i++)
395
- m_voi[i].dr_rate = m_dr_tbl[data& 0xf ] * m_external_capacitance[i];
392
+ for (int i = 0 ; i < 4 ; i++)
393
+ m_voi[i].dr_rate = m_dr_tbl[data & 0xf ] * m_external_capacitance[i];
396
394
break ;
397
395
398
396
case 0x0b : /* group2 decay */
399
- for (i= 0 ; i< 4 ; i++)
400
- m_voi[i+ 4 ].dr_rate = m_dr_tbl[data& 0xf ] * m_external_capacitance[i+ 4 ];
397
+ for (int i = 0 ; i < 4 ; i++)
398
+ m_voi[i + 4 ].dr_rate = m_dr_tbl[data & 0xf ] * m_external_capacitance[i + 4 ];
401
399
break ;
402
400
403
401
case 0x0c : /* group1 control */
@@ -410,17 +408,17 @@ void msm5232_device::write(offs_t offset, uint8_t data)
410
408
411
409
m_control1 = data;
412
410
413
- for (i= 0 ; i< 4 ; i++)
411
+ for (int i = 0 ; i < 4 ; i++)
414
412
{
415
- if ( (data& 0x10 ) && (m_voi[i].eg_sect == 1 ) )
413
+ if ((data & 0x10 ) && (m_voi[i].eg_sect == 1 ))
416
414
m_voi[i].eg_sect = 0 ;
417
- m_voi[i].eg_arm = data& 0x10 ;
415
+ m_voi[i].eg_arm = data & 0x10 ;
418
416
}
419
417
420
- m_EN_out16[0 ] = (data& 1 ) ? ~0 : 0 ;
421
- m_EN_out8[0 ] = (data& 2 ) ? ~0 : 0 ;
422
- m_EN_out4[0 ] = (data& 4 ) ? ~0 : 0 ;
423
- m_EN_out2[0 ] = (data& 8 ) ? ~0 : 0 ;
418
+ m_EN_out16[0 ] = (data & 1 ) ? ~0 : 0 ;
419
+ m_EN_out8[0 ] = (data & 2 ) ? ~0 : 0 ;
420
+ m_EN_out4[0 ] = (data & 4 ) ? ~0 : 0 ;
421
+ m_EN_out2[0 ] = (data & 8 ) ? ~0 : 0 ;
424
422
425
423
break ;
426
424
@@ -435,11 +433,11 @@ void msm5232_device::write(offs_t offset, uint8_t data)
435
433
m_control2 = data;
436
434
gate_update ();
437
435
438
- for (i= 0 ; i< 4 ; i++)
436
+ for (int i = 0 ; i < 4 ; i++)
439
437
{
440
- if ( (data& 0x10 ) && (m_voi[i+ 4 ].eg_sect == 1 ) )
441
- m_voi[i+ 4 ].eg_sect = 0 ;
442
- m_voi[i+ 4 ].eg_arm = data& 0x10 ;
438
+ if ((data & 0x10 ) && (m_voi[i + 4 ].eg_sect == 1 ))
439
+ m_voi[i + 4 ].eg_sect = 0 ;
440
+ m_voi[i + 4 ].eg_arm = data & 0x10 ;
443
441
}
444
442
445
443
m_EN_out16[1 ] = (data&1 ) ? ~0 :0 ;
0 commit comments