From f36e9e33fe5f07d7c6797257a645effe3299137d Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Wed, 28 Nov 2018 01:39:58 +1100 Subject: (nw) adjust some stuff (uniform spacing, standardised logging, capitalised template parameters, etc.) --- src/devices/bus/amiga/zorro/a2065.cpp | 11 ++-- src/devices/cpu/mips/mips1.cpp | 2 +- src/devices/cpu/mips/mips1.h | 2 +- src/devices/machine/mb87030.cpp | 2 +- src/devices/video/catseye.cpp | 102 +++++++++++++++++----------------- src/devices/video/catseye.h | 60 ++++++++++---------- src/devices/video/nereid.cpp | 2 +- src/mame/drivers/jaguar.cpp | 3 +- src/mame/drivers/m52.cpp | 32 +++++------ src/mame/drivers/ncd17c.cpp | 41 ++++++-------- src/mame/machine/c117.cpp | 14 ++--- src/mame/machine/c117.h | 12 ++-- src/mame/video/m52.cpp | 10 ++-- 13 files changed, 136 insertions(+), 157 deletions(-) diff --git a/src/devices/bus/amiga/zorro/a2065.cpp b/src/devices/bus/amiga/zorro/a2065.cpp index cfe687817c1..9eb0d835db2 100644 --- a/src/devices/bus/amiga/zorro/a2065.cpp +++ b/src/devices/bus/amiga/zorro/a2065.cpp @@ -17,6 +17,7 @@ //************************************************************************** #define VERBOSE 1 +#include "logmacro.h" //************************************************************************** @@ -76,11 +77,8 @@ void a2065_device::device_start() void a2065_device::autoconfig_base_address(offs_t address) { - if (VERBOSE) - logerror("%s('%s'): autoconfig_base_address received: 0x%06x\n", shortname(), basetag(), address); - - if (VERBOSE) - logerror("-> installing a2065\n"); + LOG("%s('%s'): autoconfig_base_address received: 0x%06x\n", shortname(), basetag(), address); + LOG("-> installing a2065\n"); // stop responding to default autoconfig m_slot->m_space->unmap_readwrite(0xe80000, 0xe8007f); @@ -106,8 +104,7 @@ void a2065_device::autoconfig_base_address(offs_t address) WRITE_LINE_MEMBER( a2065_device::cfgin_w ) { - if (VERBOSE) - logerror("%s('%s'): configin_w (%d)\n", shortname(), basetag(), state); + LOG("%s('%s'): configin_w (%d)\n", shortname(), basetag(), state); if (state == 0) { diff --git a/src/devices/cpu/mips/mips1.cpp b/src/devices/cpu/mips/mips1.cpp index 57c0c151d55..b2988470a94 100644 --- a/src/devices/cpu/mips/mips1.cpp +++ b/src/devices/cpu/mips/mips1.cpp @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders:Aaron Giles, Patrick Mackinlay /* * MIPS-I emulation, including R2000[A], R3000[A] and IDT R30xx devices. The diff --git a/src/devices/cpu/mips/mips1.h b/src/devices/cpu/mips/mips1.h index 608cbb8463b..3319fcdefe2 100644 --- a/src/devices/cpu/mips/mips1.h +++ b/src/devices/cpu/mips/mips1.h @@ -1,5 +1,5 @@ // license:BSD-3-Clause -// copyright-holders:Aaron Giles +// copyright-holders:Aaron Giles, Patrick Mackinlay #ifndef MAME_CPU_MIPS_MIPS1_H #define MAME_CPU_MIPS_MIPS1_H diff --git a/src/devices/machine/mb87030.cpp b/src/devices/machine/mb87030.cpp index 7606578dfbb..cd0b4f2beae 100644 --- a/src/devices/machine/mb87030.cpp +++ b/src/devices/machine/mb87030.cpp @@ -427,7 +427,7 @@ void mb87030_device::step(bool timeout) scsi_set_ctrl(0, S_ACK); break; - } + } } void mb87030_device::device_start() diff --git a/src/devices/video/catseye.cpp b/src/devices/video/catseye.cpp index d94fa1a9420..0423b88fb8f 100644 --- a/src/devices/video/catseye.cpp +++ b/src/devices/video/catseye.cpp @@ -78,7 +78,7 @@ void catseye_device::device_reset() { LOG("%s\n", __func__); - for(int i = 0; i < 2; i++) { + for (int i = 0; i < 2; i++) { m_read_enable[i] = 0; m_write_enable[i] = 0; m_fb_enable[i] = 0; @@ -197,16 +197,16 @@ void catseye_device::execute_rule(const bool src, const int rule, bool &dst) con } } -template +template void catseye_device::window_move() { - if (!m_fb_enable[idx]) + if (!m_fb_enable[Idx]) return; LOGMASKED(LOG_WMOVE, "%s%d: %3ux%3u -> %3ux%3u / %3ux%3u planemode %04x wrr %04x, trr %04x m_trrctl %04x acntr %04x\n", - __func__, idx, m_wmsourcex, m_wmsourcey, m_wmdestx, m_wmdesty, m_wmwidth, m_wmheight, m_planemode[idx], - m_wrr[idx], m_trr[idx], m_trrctl[idx], m_acntrl); + __func__, Idx, m_wmsourcex, m_wmsourcey, m_wmdestx, m_wmdesty, m_wmwidth, m_wmheight, m_planemode[Idx], + m_wrr[Idx], m_trr[Idx], m_trrctl[Idx], m_acntrl); int line, endline, lineincr; @@ -252,30 +252,30 @@ void catseye_device::window_move() bool dst = false; - if (m_trrctl[idx] & 0x0100) { - bool bit = m_patterns[idx][(m_plane << 4) | (dy & 0xf)] & (1 << (dx & 0xf)); - switch (m_trr[idx] >> 8) { + if (m_trrctl[Idx] & 0x0100) { + bool bit = m_patterns[Idx][(m_plane << 4) | (dy & 0xf)] & (1 << (dx & 0xf)); + switch (m_trr[Idx] >> 8) { case 0xf0: dst = bit; break; default: - logerror("%s: unknown trr %02x\n", __func__, m_trr[idx] >> 8); + logerror("%s: unknown trr %02x\n", __func__, m_trr[Idx] >> 8); break; } } else { - bool const src = get_vram_pixel_plane(sx, sy); - dst = get_vram_pixel(dx, dy); - execute_rule(src, m_wrr[idx] & 0x0f, dst); + bool const src = get_vram_pixel_plane(sx, sy); + dst = get_vram_pixel(dx, dy); + execute_rule(src, m_wrr[Idx] & 0x0f, dst); } - modify_vram(dx, dy, dst); + modify_vram(dx, dy, dst); } } } -template +template void catseye_device::draw_pixel(int x, int y, int color) { if ((m_misc & CATSEYE_MISC_ENABLE_CLIP) && @@ -286,16 +286,16 @@ void catseye_device::draw_pixel(int x, int y, int color) return; bool src = color & m_plane_mask_l; - bool dst = get_vram_pixel(x, y); - execute_rule(src, (m_prr[idx] >> 8) & 0x0f, dst); - modify_vram(x, y, dst); + bool dst = get_vram_pixel(x, y); + execute_rule(src, (m_prr[Idx] >> 8) & 0x0f, dst); + modify_vram(x, y, dst); m_status |= CATSEYE_STATUS_UNCLIPPED; } -template +template void catseye_device::draw_line() { - const int color = m_color[idx] >> 8; + const int color = m_color[Idx] >> 8; int x1 = m_wmsourcex; int y1 = m_wmsourcey; int x2 = m_wmdestx; @@ -304,7 +304,7 @@ void catseye_device::draw_line() bool c1; LOGMASKED(LOG_WMOVE, "%s%d %dx%d -> %dx%d, color %d\n", - __func__, idx, m_wmsourcex, m_wmsourcey, m_wmdestx, m_wmdesty, color); + __func__, Idx, m_wmsourcex, m_wmsourcey, m_wmdestx, m_wmdesty, color); c1 = false; incy = 1; @@ -359,7 +359,7 @@ void catseye_device::draw_line() if (c1) { do { - draw_pixel(y, x, color); + draw_pixel(y, x, color); if (e > 0) { y += incy; @@ -371,7 +371,7 @@ void catseye_device::draw_line() } while (x <= x2); } else { do { - draw_pixel(x, y, color); + draw_pixel(x, y, color); if (e > 0) { y += incy; e += diago; @@ -384,53 +384,53 @@ void catseye_device::draw_line() } -template +template void catseye_device::trigger_wm() { - if (!m_fb_enable[idx]) + if (!m_fb_enable[Idx]) return; - if ((m_vb[idx] & CATSEYE_VB_VECTOR) && (m_rugsc == 0x10)) - draw_line(); + if ((m_vb[Idx] & CATSEYE_VB_VECTOR) && (m_rugsc == 0x10)) + draw_line(); else if (m_rugsc == 0x90) - window_move(); + window_move(); else - logerror("%s: unsupported rugcmd: %04x vb %04x\n", __func__, m_rugsc, m_vb[idx]); + logerror("%s: unsupported rugcmd: %04x vb %04x\n", __func__, m_rugsc, m_vb[Idx]); } -template +template u16 catseye_device::vram_r_bit(offs_t offset) { u16 ret = 0; offset &= ~0x7; - for(int i = 0; i < 16; i++) - ret |= get_vram_offset_plane(offset * 2 + 15 - i) ? (1 << i) : 0; + for (int i = 0; i < 16; i++) + ret |= get_vram_offset_plane(offset * 2 + 15 - i) ? (1 << i) : 0; return ret; } -template +template u16 catseye_device::vram_r_word(offs_t offset, u16 mem_mask) { u16 ret = 0; if (mem_mask & m_plane_mask_l) - ret |= get_vram_offset(offset * 2 + 1); + ret |= get_vram_offset(offset * 2 + 1); if (mem_mask & m_plane_mask_h) - ret |= get_vram_offset(offset * 2) << 8; + ret |= get_vram_offset(offset * 2) << 8; return ret; } -template +template u16 catseye_device::vram_r(offs_t offset, u16 mem_mask) { if (m_acntrl & 0x100) - return vram_r_bit(offset); + return vram_r_bit(offset); else - return vram_r_word(offset, mem_mask); + return vram_r_word(offset, mem_mask); } READ16_MEMBER(catseye_device::vram_r) @@ -446,7 +446,7 @@ READ16_MEMBER(catseye_device::vram_r) return ret; } -template +template void catseye_device::vram_w_bit(offs_t offset, u16 data, u16 mem_mask) { offset &= ~0x7; @@ -458,37 +458,37 @@ void catseye_device::vram_w_bit(offs_t offset, u16 data, u16 mem_mask) if (!(mem_mask & bit)) continue; - bool dst = get_vram_offset(offset * 2 + 15 - i); - execute_rule(data & bit, (m_prr[idx] >> 8) & 0x0f, dst); - modify_vram_offset(offset * 2 + 15 - i, dst); + bool dst = get_vram_offset(offset * 2 + 15 - i); + execute_rule(data & bit, (m_prr[Idx] >> 8) & 0x0f, dst); + modify_vram_offset(offset * 2 + 15 - i, dst); } } -template +template void catseye_device::vram_w_word(offs_t offset, u16 data, u16 mem_mask) { if (mem_mask & m_plane_mask_l) { const bool src = data & m_plane_mask_l; - bool dst = get_vram_offset(offset * 2 + 1); - execute_rule(src, (m_prr[idx] >> 8) & 0x0f, dst); - modify_vram_offset(offset * 2 + 1, dst); + bool dst = get_vram_offset(offset * 2 + 1); + execute_rule(src, (m_prr[Idx] >> 8) & 0x0f, dst); + modify_vram_offset(offset * 2 + 1, dst); } if (mem_mask & m_plane_mask_h) { const bool src = data & m_plane_mask_h; - bool dst = get_vram_offset(offset * 2); - execute_rule(src, (m_prr[idx] >> 8) & 0x0f, dst); - modify_vram_offset(offset * 2, dst); + bool dst = get_vram_offset(offset * 2); + execute_rule(src, (m_prr[Idx] >> 8) & 0x0f, dst); + modify_vram_offset(offset * 2, dst); } } -template +template void catseye_device::vram_w(offs_t offset, u16 data, u16 mem_mask) { if (m_acntrl & 0x100) - vram_w_bit(offset, data, mem_mask); + vram_w_bit(offset, data, mem_mask); else - vram_w_word(offset, data, mem_mask); + vram_w_word(offset, data, mem_mask); } WRITE16_MEMBER(catseye_device::vram_w) diff --git a/src/devices/video/catseye.h b/src/devices/video/catseye.h index 257ae13f3ee..63f7604a892 100644 --- a/src/devices/video/catseye.h +++ b/src/devices/video/catseye.h @@ -52,16 +52,16 @@ protected: void execute_rule(const bool src, const int rule, bool &dst) const; void update_int(); - template void window_move(); - template void draw_line(); - template void trigger_wm(); - template void draw_pixel(int x, int y, int color); - template void vram_w(offs_t offset, u16 data, u16 mem_mask); - template void vram_w_bit(offs_t offset, u16 data, u16 mem_mask); - template void vram_w_word(offs_t offset, u16 data, u16 mem_mask); - template u16 vram_r(offs_t offset, u16 mem_mask); - template u16 vram_r_bit(offs_t offset); - template u16 vram_r_word(offs_t offset, u16 mem_mask); + template void window_move(); + template void draw_line(); + template void trigger_wm(); + template void draw_pixel(int x, int y, int color); + template void vram_w(offs_t offset, u16 data, u16 mem_mask); + template void vram_w_bit(offs_t offset, u16 data, u16 mem_mask); + template void vram_w_word(offs_t offset, u16 data, u16 mem_mask); + template u16 vram_r(offs_t offset, u16 mem_mask); + template u16 vram_r_bit(offs_t offset); + template u16 vram_r_word(offs_t offset, u16 mem_mask); int get_plane_from_idx(const int idx) const { if (idx == VRAM_VIDEO_PLANE) { @@ -77,55 +77,55 @@ protected: } } - template + template void modify_vram(int x, int y, bool state) { m_changed = true; m_status |= CATSEYE_STATUS_UNCLIPPED; const int offset = y * m_fb_width + x; if (state) - m_vram[idx][offset] |= m_plane_mask_l; + m_vram[Idx][offset] |= m_plane_mask_l; else - m_vram[idx][offset] &= ~m_plane_mask_l; + m_vram[Idx][offset] &= ~m_plane_mask_l; } - template + template void modify_vram_offset(int offset, bool state) { m_changed = true; m_status |= CATSEYE_STATUS_UNCLIPPED; if (state) - m_vram[idx][offset] |= m_plane_mask_l; + m_vram[Idx][offset] |= m_plane_mask_l; else - m_vram[idx][offset] &= ~m_plane_mask_l; + m_vram[Idx][offset] &= ~m_plane_mask_l; } - template + template u8 get_vram_offset_plane(int offset) const { - const int plane = (m_planemode[idx] >> 8) & 0x0f; - if (!m_planemode[idx]) - return m_vram[idx][offset] & m_plane_mask_l; + const int plane = (m_planemode[Idx] >> 8) & 0x0f; + if (!m_planemode[Idx]) + return m_vram[Idx][offset] & m_plane_mask_l; else if (plane < 8) - return m_vram[idx][offset] & (1 << plane); + return m_vram[Idx][offset] & (1 << plane); else - return m_vram[idx][offset] & (1 << (plane-8)); + return m_vram[Idx][offset] & (1 << (plane-8)); } - template + template u8 get_vram_offset(int offset) const { - return m_vram[idx][offset] & m_plane_mask_l; + return m_vram[Idx][offset] & m_plane_mask_l; } - template + template bool get_vram_pixel(int x, int y) const { - return m_vram[get_plane_from_idx(idx)][y * m_fb_width + x] & m_plane_mask_l; + return m_vram[get_plane_from_idx(Idx)][y * m_fb_width + x] & m_plane_mask_l; } - template + template bool get_vram_pixel_plane(int x, int y) const { - const int plane = (m_planemode[idx] >> 8) & 0x0f; + const int plane = (m_planemode[Idx] >> 8) & 0x0f; const int offset = y * m_fb_width + x; - if (!(m_planemode[idx] & (1 << 12))) - return m_vram[idx][offset] & m_plane_mask_l; + if (!(m_planemode[Idx] & (1 << 12))) + return m_vram[Idx][offset] & m_plane_mask_l; else if (plane < 8) return m_vram[0][offset] & (1 << plane); else diff --git a/src/devices/video/nereid.cpp b/src/devices/video/nereid.cpp index 55f5a9f9284..44d1aa42616 100644 --- a/src/devices/video/nereid.cpp +++ b/src/devices/video/nereid.cpp @@ -39,7 +39,7 @@ void nereid_device::device_start() void nereid_device::device_reset() { - for(int i = 0; i < palette_entries(); i++) + for (int i = 0; i < palette_entries(); i++) set_pen_color(i, rgb_t(0, 0, 0)); m_index = 0; m_plane_mask = 0; diff --git a/src/mame/drivers/jaguar.cpp b/src/mame/drivers/jaguar.cpp index 52fd4fe71bf..8fcfb2723fc 100644 --- a/src/mame/drivers/jaguar.cpp +++ b/src/mame/drivers/jaguar.cpp @@ -1841,8 +1841,7 @@ INPUT_PORTS_END MACHINE_CONFIG_START(jaguar_state::cojagr3k) /* basic machine hardware */ - R3041(config, m_maincpu, R3000_CLOCK); - downcast(*m_maincpu).set_endianness(ENDIANNESS_BIG); + R3041(config, m_maincpu, R3000_CLOCK).set_endianness(ENDIANNESS_BIG); m_maincpu->set_addrmap(AS_PROGRAM, &jaguar_state::r3000_map); MCFG_DEVICE_ADD("gpu", JAGUARGPU, COJAG_CLOCK/2) diff --git a/src/mame/drivers/m52.cpp b/src/mame/drivers/m52.cpp index 60250437104..0fc60b08365 100644 --- a/src/mame/drivers/m52.cpp +++ b/src/mame/drivers/m52.cpp @@ -300,10 +300,10 @@ INPUT_PORTS_END /************************************* -* -* Graphics layouts -* -*************************************/ + * + * Graphics layouts + * + *************************************/ static const gfx_layout charlayout = { @@ -384,10 +384,10 @@ GFXDECODE_END /************************************* -* -* Machine drivers -* -*************************************/ + * + * Machine drivers + * + *************************************/ void m52_state::machine_reset() { @@ -443,10 +443,10 @@ MACHINE_CONFIG_END /************************************* -* -* ROM definitions -* -*************************************/ + * + * ROM definitions + * + *************************************/ ROM_START(mpatrol) ROM_REGION(0x10000, "maincpu", 0) @@ -624,10 +624,10 @@ ROM_END /************************************* -* -* Game drivers -* -*************************************/ + * + * Game drivers + * + *************************************/ GAME(1982, mpatrol, 0, m52, mpatrol, m52_state, empty_init, ROT0, "Irem", "Moon Patrol", MACHINE_SUPPORTS_SAVE) GAME(1982, mpatrolw, mpatrol, m52, mpatrolw, m52_state, empty_init, ROT0, "Irem (Williams license)", "Moon Patrol (Williams)", MACHINE_SUPPORTS_SAVE) // USA diff --git a/src/mame/drivers/ncd17c.cpp b/src/mame/drivers/ncd17c.cpp index 0dd1fc60aa8..4e57ffaefb0 100644 --- a/src/mame/drivers/ncd17c.cpp +++ b/src/mame/drivers/ncd17c.cpp @@ -47,8 +47,8 @@ class ncd_020_state : public driver_device { public: - ncd_020_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + ncd_020_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_mcu(*this, "mcu"), m_screen(*this, "screen"), @@ -60,8 +60,13 @@ public: } void ncd_17c(machine_config &config); - void ncd_17c_map(address_map &map); void ncd_19(machine_config &config); + +protected: + virtual void machine_reset() override; + +private: + void ncd_17c_map(address_map &map); void ncd_19_map(address_map &map); void ncd_mcu_map(address_map &map); @@ -83,9 +88,6 @@ public: DECLARE_READ8_MEMBER(mcu_ports_r); DECLARE_WRITE8_MEMBER(mcu_ports_w); -private: - virtual void machine_reset() override; - required_device m_maincpu; required_device m_mcu; required_device m_screen; @@ -159,27 +161,18 @@ uint32_t ncd_020_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma uint32_t ncd_020_state::screen_update_19(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { - uint32_t *scanline; - int x, y; - uint8_t pixels; - static const uint32_t palette[2] = { 0, 0xffffff }; - uint8_t *vram = (uint8_t *)m_vram.target(); + static constexpr uint32_t palette[2] = { 0, 0xffffff }; + uint8_t const *const vram = (uint8_t *)m_vram.target(); - for (y = 0; y < 1024; y++) + for (int y = 0; y < 1024; y++) { - scanline = &bitmap.pix32(y); - for (x = 0; x < 1024/8; x++) + uint32_t *scanline = &bitmap.pix32(y); + for (int x = 0; x < 1024/8; x++) { - pixels = vram[(y * (2048/8)) + (BYTE4_XOR_BE(x))]; - - *scanline++ = palette[(pixels>>7)&1]; - *scanline++ = palette[(pixels>>6)&1]; - *scanline++ = palette[(pixels>>5)&1]; - *scanline++ = palette[(pixels>>4)&1]; - *scanline++ = palette[(pixels>>3)&1]; - *scanline++ = palette[(pixels>>2)&1]; - *scanline++ = palette[(pixels>>1)&1]; - *scanline++ = palette[(pixels&1)]; + uint8_t const pixels = vram[(y * (2048/8)) + (BYTE4_XOR_BE(x))]; + + for (int b = 0; b < 8; b++) + *scanline++ = palette[BIT(pixels, 7 - b)]; } } diff --git a/src/mame/machine/c117.cpp b/src/mame/machine/c117.cpp index 51c61357b5a..d8af377d751 100644 --- a/src/mame/machine/c117.cpp +++ b/src/mame/machine/c117.cpp @@ -38,8 +38,7 @@ namco_c117_device::namco_c117_device(const machine_config &mconfig, const char * device_memory_interface(mconfig, *this), m_subres_cb(*this), m_program_config("program", ENDIANNESS_BIG, 8, 23), - m_maincpu_tag(nullptr), - m_subcpu_tag(nullptr), + m_cpuexec{ { *this, finder_base::DUMMY_TAG }, { *this, finder_base::DUMMY_TAG } }, m_watchdog(*this, "watchdog") { } @@ -61,13 +60,8 @@ void namco_c117_device::device_start() m_program = &space(AS_PROGRAM); - cpu_device *maincpu = siblingdevice(m_maincpu_tag); - cpu_device *subcpu = siblingdevice(m_subcpu_tag); - - m_cpuexec[0] = maincpu; - m_cpuexec[1] = subcpu; - m_cpucache[0] = maincpu->space(AS_PROGRAM).cache<0, 0, ENDIANNESS_BIG>(); - m_cpucache[1] = subcpu->space(AS_PROGRAM).cache<0, 0, ENDIANNESS_BIG>(); + m_cpucache[0] = m_cpuexec[0]->space(AS_PROGRAM).cache<0, 0, ENDIANNESS_BIG>(); + m_cpucache[1] = m_cpuexec[1]->space(AS_PROGRAM).cache<0, 0, ENDIANNESS_BIG>(); memset(&m_offsets, 0, sizeof(m_offsets)); m_subres = m_wdog = 0; @@ -198,7 +192,7 @@ void namco_c117_device::register_w(int whichcpu, offs_t offset, uint8_t data) unknown_reg = true; } if (unknown_reg) - logerror("'%s' writing to unknown CUS117 register %04X = %02X\n", (whichcpu ? m_subcpu_tag : m_maincpu_tag), offset, data); + logerror("'%s' writing to unknown CUS117 register %04X = %02X\n", m_cpuexec[whichcpu].finder_tag(), offset, data); } void namco_c117_device::bankswitch(int whichcpu, int whichbank, int a0, uint8_t data) diff --git a/src/mame/machine/c117.h b/src/mame/machine/c117.h index 790c76b9900..46f45d1a7ef 100644 --- a/src/mame/machine/c117.h +++ b/src/mame/machine/c117.h @@ -22,10 +22,10 @@ public: namco_c117_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); // configuration - void set_cpu_tags(const char *maintag, const char *subtag) + template void set_cpu_tags(T &&maintag, U &&subtag) { - m_maincpu_tag = maintag; - m_subcpu_tag = subtag; + m_cpuexec[0].set_tag(std::forward(maintag)); + m_cpuexec[1].set_tag(std::forward(subtag)); } auto subres_cb() { return m_subres_cb.bind(); } @@ -66,13 +66,9 @@ private: address_space * m_program; // cpu interfaces - device_execute_interface * m_cpuexec[2]; + required_device m_cpuexec[2]; memory_access_cache<0, 0, ENDIANNESS_BIG> *m_cpucache[2]; - // configuration - const char * m_maincpu_tag; - const char * m_subcpu_tag; - required_device m_watchdog; }; diff --git a/src/mame/video/m52.cpp b/src/mame/video/m52.cpp index 1c5dfb92072..340af4093fc 100644 --- a/src/mame/video/m52.cpp +++ b/src/mame/video/m52.cpp @@ -21,15 +21,15 @@ void m52_state::init_palette() { - const int resistances_3[3] = { 1000, 470, 220 }; - const int resistances_2[2] = { 470, 220 }; + constexpr int resistances_3[3] = { 1000, 470, 220 }; + constexpr int resistances_2[2] = { 470, 220 }; double weights_r[3], weights_g[3], weights_b[3], scale; /* compute palette information for characters/backgrounds */ scale = compute_resistor_weights(0, 255, -1.0, - 3, resistances_3, weights_r, 0, 0, - 3, resistances_3, weights_g, 0, 0, - 2, resistances_2, weights_b, 0, 0); + 3, resistances_3, weights_r, 0, 0, + 3, resistances_3, weights_g, 0, 0, + 2, resistances_2, weights_b, 0, 0); /* character palette */ const uint8_t *char_pal = memregion("tx_pal")->base(); -- cgit v1.2.3