Skip to content

Commit f7ca797

Browse files
committed
More consistency & address PR feedback
1 parent 5fac700 commit f7ca797

File tree

6 files changed

+59
-72
lines changed

6 files changed

+59
-72
lines changed

src/mame/namco/namcos21.cpp

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ uint16_t namcos21_state::winrun_gpu_color_r()
416416

417417
void namcos21_state::winrun_gpu_color_w(offs_t offset, uint16_t data, uint16_t mem_mask)
418418
{
419-
COMBINE_DATA( &m_winrun_color );
419+
COMBINE_DATA(&m_winrun_color);
420420
}
421421

422422
uint16_t namcos21_state::winrun_gpu_register_r(offs_t offset)
@@ -426,28 +426,28 @@ uint16_t namcos21_state::winrun_gpu_register_r(offs_t offset)
426426

427427
void namcos21_state::winrun_gpu_register_w(offs_t offset, uint16_t data, uint16_t mem_mask)
428428
{
429-
COMBINE_DATA( &m_winrun_gpu_register[offset] );
429+
COMBINE_DATA(&m_winrun_gpu_register[offset]);
430430
m_screen->update_partial(m_screen->vpos());
431431
}
432432

433433
void namcos21_state::winrun_gpu_videoram_w(offs_t offset, uint16_t data)
434434
{
435-
uint8_t color = data>>8;
436-
uint8_t mask = data&0xff;
435+
uint8_t color = data >> 8;
436+
uint8_t mask = data & 0xff;
437437

438438
for (int i=0; i<8; i++)
439439
{
440440
if (BIT(mask, i))
441441
{
442-
m_gpu_videoram[(offset+i)&0x7ffff] = color;
443-
m_gpu_maskram[(offset+i)&0x7ffff] = mask;
442+
m_gpu_videoram[(offset+i) & 0x7ffff] = color;
443+
m_gpu_maskram[(offset+i) & 0x7ffff] = mask;
444444
}
445445
}
446446
}
447447

448448
uint16_t namcos21_state::winrun_gpu_videoram_r(offs_t offset)
449449
{
450-
return (m_gpu_videoram[offset]<<8) | m_gpu_maskram[offset];
450+
return (m_gpu_videoram[offset] << 8) | m_gpu_maskram[offset];
451451
}
452452

453453
void namcos21_state::winrun_bitmap_draw(bitmap_ind16 &bitmap, const rectangle &cliprect)
@@ -457,18 +457,15 @@ void namcos21_state::winrun_bitmap_draw(bitmap_ind16 &bitmap, const rectangle &c
457457

458458
int const yscroll = -cliprect.top() + (int16_t)m_winrun_gpu_register[0x2/2];
459459
int const xscroll = 0; //m_winrun_gpu_register[0xc/2] >> 7;
460-
int const base = 0x1000 + 0x100 * (m_winrun_color&0xf);
461-
460+
int const base = 0x1000 + 0x100 * (m_winrun_color & 0xf);
462461
for (int sy=cliprect.top(); sy<=cliprect.bottom(); sy++)
463462
{
464463
uint8_t const *const pSource = &videoram[((yscroll+sy) & 0x3ff) * 0x200];
465464
uint16_t *const pDest = &bitmap.pix(sy);
466-
467465
for (int sx=cliprect.left(); sx<=cliprect.right(); sx++)
468466
{
469467
int const pen = pSource[(sx+xscroll) & 0x1ff];
470-
471-
switch( pen )
468+
switch (pen)
472469
{
473470
case 0xff:
474471
break;
@@ -490,12 +487,11 @@ void namcos21_state::winrun_bitmap_draw(bitmap_ind16 &bitmap, const rectangle &c
490487

491488
uint32_t namcos21_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect)
492489
{
493-
bitmap.fill(0xff, cliprect );
490+
bitmap.fill(0xff, cliprect);
494491

495492
m_namcos21_3d->copy_visible_poly_framebuffer(bitmap, cliprect, 0x7fc0, 0x7ffe);
496493
m_namcos21_3d->copy_visible_poly_framebuffer(bitmap, cliprect, 0, 0x7fbf);
497-
498-
winrun_bitmap_draw(bitmap,cliprect);
494+
winrun_bitmap_draw(bitmap, cliprect);
499495

500496
//popmessage("%04x %04x %04x|%04x %04x",m_winrun_gpu_register[0],m_winrun_gpu_register[2/2],m_winrun_gpu_register[4/2],m_winrun_gpu_register[0xa/2],m_winrun_gpu_register[0xc/2]);
501497

@@ -511,10 +507,10 @@ uint32_t namcos21_state::screen_update(screen_device &screen, bitmap_ind16 &bitm
511507

512508
[[maybe_unused]] void namcos21_state::video_enable_w(offs_t offset, uint16_t data, uint16_t mem_mask)
513509
{
514-
COMBINE_DATA( &m_video_enable ); /* 0x40 = enable */
510+
COMBINE_DATA(&m_video_enable); /* 0x40 = enable */
515511

516512
if (m_video_enable!=0 && m_video_enable!=0x40)
517-
logerror( "unexpected video_enable_w=0x%x\n", m_video_enable );
513+
logerror("unexpected video_enable_w=0x%x\n", m_video_enable);
518514
}
519515

520516
/***********************************************************/
@@ -528,9 +524,9 @@ uint16_t namcos21_state::dpram_word_r(offs_t offset)
528524

529525
void namcos21_state::dpram_word_w(offs_t offset, uint16_t data, uint16_t mem_mask)
530526
{
531-
if( ACCESSING_BITS_0_7 )
527+
if (ACCESSING_BITS_0_7)
532528
{
533-
m_dpram[offset] = data&0xff;
529+
m_dpram[offset] = data & 0xff;
534530
}
535531
}
536532

@@ -635,7 +631,6 @@ void namcos21_state::c140_map(address_map &map)
635631
void namcos21_state::configure_c65_namcos21(machine_config &config)
636632
{
637633
NAMCOC65(config, m_c65, 2048000);
638-
639634
m_c65->in_pb_callback().set_ioport("MCUB");
640635
m_c65->in_pc_callback().set_ioport("MCUC");
641636
m_c65->in_ph_callback().set_ioport("MCUH");

src/mame/namco/namcos21_3d.cpp

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ void namcos21_3d_device::device_reset()
3131

3232
void namcos21_3d_device::allocate_poly_framebuffer()
3333
{
34-
unsigned framebuffer_size = m_poly_frame_width*m_poly_frame_height;
34+
unsigned framebuffer_size = m_poly_frame_width * m_poly_frame_height;
3535

3636
if (framebuffer_size == 0)
3737
fatalerror("framebuffer_size == 0\n");
@@ -71,15 +71,12 @@ void namcos21_3d_device::copy_visible_poly_framebuffer(bitmap_ind16 &bitmap, con
7171
uint16_t *const dest = &bitmap.pix(sy);
7272
uint16_t const *const pPen = m_mpPolyFrameBufferPens2.get() + m_poly_frame_width * sy;
7373
uint16_t const *const pZ = m_mpPolyFrameBufferZ2.get() + m_poly_frame_width * sy;
74-
7574
for (int sx = clip.left(); sx <= clip.right(); sx++)
7675
{
7776
int z = pZ[sx];
7877
//if( pZ[sx]!=0x7fff )
7978
if (z >= zlo && z <= zhi)
80-
{
8179
dest[sx] = pPen[sx];
82-
}
8380
}
8481
}
8582
}
@@ -112,7 +109,6 @@ void namcos21_3d_device::renderscanline_flat(const edge *e1, const edge *e2, uns
112109

113110
uint16_t *pDest = m_mpPolyFrameBufferPens.get() + sy * m_poly_frame_width;
114111
uint16_t *pZBuf = m_mpPolyFrameBufferZ.get() + sy * m_poly_frame_width;
115-
116112
for (int x = x0; x < x1; x++)
117113
{
118114
uint16_t zz = (uint16_t)z;
@@ -123,7 +119,7 @@ void namcos21_3d_device::renderscanline_flat(const edge *e1, const edge *e2, uns
123119

124120
if (depthcueenable && zz > 0)
125121
{
126-
const unsigned depth = (zz >> m_zz_shift)*m_zzmult;
122+
const unsigned depth = (zz >> m_zz_shift) * m_zzmult;
127123

128124
if (m_depth_reverse)
129125
pen += depth;
@@ -170,7 +166,6 @@ void namcos21_3d_device::rendertri(const n21_vertex *v0, const n21_vertex *v1, c
170166

171167
e2.x = v0->x;
172168
e2.z = v0->z;
173-
174169
if (ystart < 0)
175170
{
176171
e2.x += dx2dy * -ystart;
@@ -213,9 +208,7 @@ void namcos21_3d_device::rendertri(const n21_vertex *v0, const n21_vertex *v1, c
213208
e1.x += dx1dy;
214209
e1.z += dz1dy;
215210
}
216-
217211
}
218-
219212
}
220213
}
221214

@@ -238,7 +231,7 @@ void namcos21_3d_device::draw_quad(int sx[4], int sy[4], int zcode[4], unsigned
238231
else
239232
{ /* map color code to hardware pen */
240233
unsigned code = color >> 8;
241-
if (code & 0x80)
234+
if (BIT(code, 7))
242235
{
243236
color = 0x2100 | (color & 0xff);
244237
// color = 0x3e00|color;
@@ -248,7 +241,7 @@ void namcos21_3d_device::draw_quad(int sx[4], int sy[4], int zcode[4], unsigned
248241
{
249242
color = 0x3e00 | (color & 0xff);
250243

251-
if ((code & 0x02) == 0)
244+
if (!BIT(code, 1))
252245
color |= 0x100;
253246
}
254247
}

src/mame/namco/namcos21_c67.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -400,10 +400,10 @@ uint16_t namcos21_c67_state::video_enable_r()
400400

401401
void namcos21_c67_state::video_enable_w(offs_t offset, uint16_t data, uint16_t mem_mask)
402402
{
403-
COMBINE_DATA( &m_video_enable ); /* 0x40 = enable */
403+
COMBINE_DATA(&m_video_enable); /* 0x40 = enable */
404404

405405
if (m_video_enable!=0 && m_video_enable!=0x40)
406-
logerror( "unexpected video_enable_w=0x%x\n", m_video_enable );
406+
logerror("unexpected video_enable_w=0x%x\n", m_video_enable);
407407
}
408408

409409
/***********************************************************/
@@ -417,7 +417,7 @@ uint16_t namcos21_c67_state::dpram_word_r(offs_t offset)
417417

418418
void namcos21_c67_state::dpram_word_w(offs_t offset, uint16_t data, uint16_t mem_mask)
419419
{
420-
if( ACCESSING_BITS_0_7 )
420+
if (ACCESSING_BITS_0_7 )
421421
{
422422
m_dpram[offset] = data&0xff;
423423
}

src/mame/namco/namcos21_de.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,10 +249,10 @@ uint16_t namco_de_pcbstack_device::video_enable_r()
249249

250250
void namco_de_pcbstack_device::video_enable_w(offs_t offset, uint16_t data, uint16_t mem_mask)
251251
{
252-
COMBINE_DATA( &m_video_enable ); /* 0x40 = enable */
252+
COMBINE_DATA(&m_video_enable); /* 0x40 = enable */
253253

254254
if (m_video_enable!=0 && m_video_enable!=0x40)
255-
logerror( "unexpected video_enable_w=0x%x\n", m_video_enable);
255+
logerror("unexpected video_enable_w=0x%x\n", m_video_enable);
256256
}
257257

258258
/***********************************************************/
@@ -382,7 +382,7 @@ void namco_de_pcbstack_device::driveyes_slave_map(address_map &map)
382382

383383
void namco_de_pcbstack_device::sound_bankselect_w(uint8_t data)
384384
{
385-
m_audiobank->set_entry(data>>4);
385+
m_audiobank->set_entry(data >> 4);
386386
}
387387

388388
void namco_de_pcbstack_device::sound_reset_w(uint8_t data)

src/mame/namco/namcos21_dsp.cpp

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -62,20 +62,20 @@ void namcos21_dsp_device::device_reset()
6262
m_suspend_timer->adjust(attotime::zero);
6363
}
6464

65-
6665
uint16_t namcos21_dsp_device::winrun_dspcomram_r(offs_t offset)
6766
{
68-
unsigned bank = !BIT(m_winrun_dspcomram_control[0x4/2], 0);
67+
unsigned bank = BIT(~m_winrun_dspcomram_control[0x4/2], 0);
6968
uint16_t *mem = &m_winrun_dspcomram[0x1000 * bank];
7069

7170
return mem[offset];
7271
}
72+
7373
void namcos21_dsp_device::winrun_dspcomram_w(offs_t offset, uint16_t data, uint16_t mem_mask)
7474
{
75-
unsigned bank = !BIT(m_winrun_dspcomram_control[0x4/2], 0);
75+
unsigned bank = BIT(~m_winrun_dspcomram_control[0x4/2], 0);
7676
uint16_t *mem = &m_winrun_dspcomram[0x1000 * bank];
7777

78-
COMBINE_DATA( &mem[offset] );
78+
COMBINE_DATA(&mem[offset]);
7979
}
8080

8181
uint16_t namcos21_dsp_device::winrun_cuskey_r()
@@ -121,7 +121,7 @@ void namcos21_dsp_device::winrun_flush_poly()
121121
zcode[j] = *pSource++;
122122
}
123123

124-
m_renderer->draw_quad(sx, sy, zcode, color&0x7fff);
124+
m_renderer->draw_quad(sx, sy, zcode, color & 0x7fff);
125125
}
126126
else
127127
{
@@ -135,12 +135,12 @@ void namcos21_dsp_device::winrun_flush_poly()
135135
for (int j=0; j<4; j++)
136136
{
137137
uint8_t vi = m_pointram[quad_idx++];
138-
sx[j] = m_poly_frame_width/2 + (int16_t)pSource[vi*3+0];
139-
sy[j] = m_poly_frame_height/2 + (int16_t)pSource[vi*3+1];
140-
zcode[j] = pSource[vi*3+2];
138+
sx[j] = m_poly_frame_width/2 + (int16_t)pSource[vi*3 + 0];
139+
sy[j] = m_poly_frame_height/2 + (int16_t)pSource[vi*3 + 1];
140+
zcode[j] = pSource[vi*3 + 2];
141141
}
142142

143-
m_renderer->draw_quad(sx, sy, zcode, color&0x7fff);
143+
m_renderer->draw_quad(sx, sy, zcode, color & 0x7fff);
144144
} while (!BIT(code, 7)); //Reached end-of-quadlist marker?
145145
}
146146

@@ -158,12 +158,12 @@ void namcos21_dsp_device::winrun_dsp_render_w(uint16_t data)
158158
if (m_winrun_poly_index<WINRUN_MAX_POLY_PARAM)
159159
m_winrun_poly_buf[m_winrun_poly_index++] = data;
160160
else
161-
logerror( "WINRUN_POLY_OVERFLOW\n" );
161+
logerror("WINRUN_POLY_OVERFLOW\n");
162162
}
163163

164164
void namcos21_dsp_device::winrun_dsp_pointrom_addr_w(offs_t offset, uint16_t data)
165165
{
166-
if( offset==0 )
166+
if(offset==0)
167167
{ /* port 8 */
168168
m_winrun_pointrom_addr = data;
169169
}
@@ -195,7 +195,7 @@ uint16_t namcos21_dsp_device::winrun_table_r(offs_t offset)
195195

196196
void namcos21_dsp_device::winrun_dspbios_w(offs_t offset, uint16_t data, uint16_t mem_mask)
197197
{
198-
COMBINE_DATA( &m_winrun_dspbios[offset] );
198+
COMBINE_DATA(&m_winrun_dspbios[offset]);
199199

200200
if (offset==0xfff) // is this the real trigger?
201201
{
@@ -222,7 +222,7 @@ void namcos21_dsp_device::winrun_68k_dspcomram_w(offs_t offset, uint16_t data, u
222222
unsigned bank = BIT(m_winrun_dspcomram_control[0x4/2], 0);
223223
uint16_t *mem = &m_winrun_dspcomram[0x1000*bank];
224224

225-
COMBINE_DATA( &mem[offset] );
225+
COMBINE_DATA(&mem[offset]);
226226
}
227227

228228
uint16_t namcos21_dsp_device::winrun_dspcomram_control_r(offs_t offset)
@@ -232,7 +232,7 @@ uint16_t namcos21_dsp_device::winrun_dspcomram_control_r(offs_t offset)
232232

233233
void namcos21_dsp_device::winrun_dspcomram_control_w(offs_t offset, uint16_t data, uint16_t mem_mask)
234234
{
235-
COMBINE_DATA( &m_winrun_dspcomram_control[offset] );
235+
COMBINE_DATA(&m_winrun_dspcomram_control[offset]);
236236
}
237237

238238

@@ -273,7 +273,7 @@ void namcos21_dsp_device::device_add_mconfig(machine_config &config)
273273

274274
void namcos21_dsp_device::pointram_control_w(offs_t offset, uint16_t data, uint16_t mem_mask)
275275
{
276-
COMBINE_DATA( &m_pointram_control );
276+
COMBINE_DATA(&m_pointram_control);
277277
m_pointram_idx = 0; /* HACK */
278278
}
279279

@@ -287,6 +287,6 @@ void namcos21_dsp_device::pointram_data_w(offs_t offset, uint16_t data, uint16_t
287287
if (ACCESSING_BITS_0_7)
288288
{
289289
m_pointram[m_pointram_idx++] = data;
290-
m_pointram_idx &= (PTRAM_SIZE-1);
290+
m_pointram_idx &= (PTRAM_SIZE - 1);
291291
}
292292
}

0 commit comments

Comments
 (0)