From bfbc03c55933faec5ee7465530b0916a79bc705c Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Mon, 20 Nov 2023 04:45:19 +1100 Subject: Cleaned up some recent changes a little. --- src/devices/bus/bbc/analogue/quinkey.cpp | 2 +- src/devices/bus/bbc/analogue/quinkey.h | 2 +- src/frontend/mame/ui/menu.h | 2 +- src/lib/formats/jvc_dsk.cpp | 2 +- src/mame/dataeast/progolf.cpp | 43 +++++++++++++------------------- src/mame/konami/thunderx.cpp | 32 ++++++++++-------------- src/mame/nasco/suprgolf.cpp | 6 ++--- src/mame/pc/teradrive.cpp | 4 +++ src/mame/sega/fwheel.cpp | 4 +-- src/mame/trs/gime.h | 2 +- 10 files changed, 44 insertions(+), 55 deletions(-) diff --git a/src/devices/bus/bbc/analogue/quinkey.cpp b/src/devices/bus/bbc/analogue/quinkey.cpp index 4d985419f66..b5fee35e7d1 100644 --- a/src/devices/bus/bbc/analogue/quinkey.cpp +++ b/src/devices/bus/bbc/analogue/quinkey.cpp @@ -100,8 +100,8 @@ uint8_t bbc_quinkey_intf_device::ch_r(int channel) device_bbc_quinkey_interface::device_bbc_quinkey_interface(const machine_config &mconfig, device_t &device) : device_interface(device, "bbcquinkey") + , m_slot(dynamic_cast(device.owner())) { - m_slot = dynamic_cast(device.owner()); } diff --git a/src/devices/bus/bbc/analogue/quinkey.h b/src/devices/bus/bbc/analogue/quinkey.h index 2da8f5e31d7..a0a62ca5ef8 100644 --- a/src/devices/bus/bbc/analogue/quinkey.h +++ b/src/devices/bus/bbc/analogue/quinkey.h @@ -83,7 +83,7 @@ public: protected: device_bbc_quinkey_interface(const machine_config &mconfig, device_t &device); - bbc_quinkey_slot_device *m_slot; + bbc_quinkey_slot_device *const m_slot; }; diff --git a/src/frontend/mame/ui/menu.h b/src/frontend/mame/ui/menu.h index c88abdc8cb2..77881a8162c 100644 --- a/src/frontend/mame/ui/menu.h +++ b/src/frontend/mame/ui/menu.h @@ -278,7 +278,7 @@ protected: float maxwidth(origwidth); for (Iter it = begin; it != end; ++it) { - std::string_view const line(*it); + std::string_view const &line(*it); if (!line.empty()) { text_layout layout(*ui().get_font(), text_size * m_last_aspect, text_size, 1.0, justify, wrap); diff --git a/src/lib/formats/jvc_dsk.cpp b/src/lib/formats/jvc_dsk.cpp index a65be9e0942..b6d349ba0d1 100644 --- a/src/lib/formats/jvc_dsk.cpp +++ b/src/lib/formats/jvc_dsk.cpp @@ -179,7 +179,7 @@ int jvc_format::identify(util::random_read &io, uint32_t form_factor, const std: { int header_size, tracks, heads, sectors, sector_size, sector_base_id; if (parse_header(io, header_size, tracks, heads, sectors, sector_size, sector_base_id)) - return header_size ? FIFID_STRUCT | FIFID_SIZE : FIFID_SIZE; + return header_size ? (FIFID_STRUCT | FIFID_SIZE) : FIFID_SIZE; else return 0; } diff --git a/src/mame/dataeast/progolf.cpp b/src/mame/dataeast/progolf.cpp index 62a15630061..8c9d0cabcbe 100644 --- a/src/mame/dataeast/progolf.cpp +++ b/src/mame/dataeast/progolf.cpp @@ -203,7 +203,6 @@ private: void scrollx_lo_w(uint8_t data); void scrollx_hi_w(uint8_t data); void flip_screen_w(uint8_t data); - template uint8_t videoram_r(offs_t offset); void videoram_w(offs_t offset, uint8_t data); void palette_init(palette_device &palette) const; @@ -263,9 +262,9 @@ uint32_t progolf_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma int count = 0; // TODO: rewrite using standard tilemap - for(int x = 0; x < 128; x++) + for (int x = 0; x < 128; x++) { - for(int y = 0; y < 32; y++) + for (int y = 0; y < 32; y++) { int const tile = m_videoram[count]; @@ -281,31 +280,28 @@ uint32_t progolf_state::screen_update(screen_device &screen, bitmap_rgb32 &bitma // framebuffer is 8x8 chars arranged like a bitmap { const int pitch = 32; - for(int y = 0; y < 256; y+= 8) + for (int y = 0; y < 256; y+= 8) { - for(int x = 0; x < 256; x+= 8) + for (int x = 0; x < 256; x+= 8) { - u32 fb_offset = ((y >> 3) + (x >> 3) * pitch) << 3; + const u32 fb_offset = ((y >> 3) + (x >> 3) * pitch) << 3; for (int xi = 0; xi < 8; xi ++) { for (int yi = 0; yi < 8; yi ++) { - int res_x = 256 - x + xi; - int res_y = y + yi; - if(!cliprect.contains(res_x, res_y)) + const int res_x = 256 - x + xi; + const int res_y = y + yi; + if (!cliprect.contains(res_x, res_y)) continue; - u8 pen = 0; - pen |= BIT(m_fbram[fb_offset + (yi | 0x0000)], 7 - xi) << 0; - pen |= BIT(m_fbram[fb_offset + (yi | 0x2000)], 7 - xi) << 1; - pen |= BIT(m_fbram[fb_offset + (yi | 0x4000)], 7 - xi) << 2; - pen &= 7; + const u8 pen = + (BIT(m_fbram[fb_offset + (yi | 0x0000)], 7 - xi) << 0) | + (BIT(m_fbram[fb_offset + (yi | 0x2000)], 7 - xi) << 1) | + (BIT(m_fbram[fb_offset + (yi | 0x4000)], 7 - xi) << 2); - if (!pen) - continue; - - bitmap.pix(res_y, res_x) = m_palette->pen(pen); + if (pen) + bitmap.pix(res_y, res_x) = m_palette->pen(pen); } } } @@ -379,11 +375,6 @@ void progolf_state::flip_screen_w(uint8_t data) logerror("$9600: with data = %02x used\n",data); } -template uint8_t progolf_state::videoram_r(offs_t offset) -{ - return m_videoram[offset | (0x800 * N)]; -} - void progolf_state::videoram_w(offs_t offset, uint8_t data) { m_videoram[offset] = data; @@ -393,14 +384,14 @@ void progolf_state::main_map(address_map &map) { map(0x0000, 0x5fff).ram(); map(0x6000, 0x7fff).rw(FUNC(progolf_state::charram_r), FUNC(progolf_state::charram_w)); - map(0x8000, 0x8fff).w(FUNC(progolf_state::videoram_w)).share("videoram"); + map(0x8000, 0x8fff).ram().w(FUNC(progolf_state::videoram_w)).share("videoram"); map(0x8000, 0x87ff).view(m_video_view0); - m_video_view0[0](0x8000, 0x87ff).r(FUNC(progolf_state::videoram_r<0>)); + m_video_view0[0]; // falls through to RAM read m_video_view0[1](0x8000, 0x87ff).rom().region("gfx1", 0x0000); m_video_view0[2](0x8000, 0x87ff).rom().region("gfx1", 0x1000); m_video_view0[3](0x8000, 0x87ff).rom().region("gfx1", 0x2000); map(0x8800, 0x8fff).view(m_video_view1); - m_video_view1[0](0x8800, 0x8fff).r(FUNC(progolf_state::videoram_r<1>)); + m_video_view1[0]; // falls through to RAM read m_video_view1[1](0x8800, 0x8fff).rom().region("gfx1", 0x0800); m_video_view1[2](0x8800, 0x8fff).rom().region("gfx1", 0x1800); m_video_view1[3](0x8800, 0x8fff).rom().region("gfx1", 0x2800); diff --git a/src/mame/konami/thunderx.cpp b/src/mame/konami/thunderx.cpp index 02036b6ae84..7c4ec1360c5 100644 --- a/src/mame/konami/thunderx.cpp +++ b/src/mame/konami/thunderx.cpp @@ -365,33 +365,29 @@ this is the data written to internal ram on startup: void thunderx_state::run_collisions( int s0, int e0, int s1, int e1, int cm, int hm ) { - for (uint8_t* p0 = &m_pmcram[s0]; p0 < &m_pmcram[e0]; p0 += 5) + for (uint8_t *p0 = &m_pmcram[s0]; p0 < &m_pmcram[e0]; p0 += 5) { - int l0, r0, b0, t0; - // check valid if (!(p0[0] & cm)) continue; // get area - l0 = p0[3] - p0[1]; - r0 = p0[3] + p0[1]; - t0 = p0[4] - p0[2]; - b0 = p0[4] + p0[2]; + const int l0 = p0[3] - p0[1]; + const int r0 = p0[3] + p0[1]; + const int t0 = p0[4] - p0[2]; + const int b0 = p0[4] + p0[2]; - for (uint8_t* p1 = &m_pmcram[s1]; p1 < &m_pmcram[e1]; p1 += 5) + for (uint8_t *p1 = &m_pmcram[s1]; p1 < &m_pmcram[e1]; p1 += 5) { - int l1,r1,b1,t1; - // check valid if (!(p1[0] & hm)) continue; // get area - l1 = p1[3] - p1[1]; - r1 = p1[3] + p1[1]; - t1 = p1[4] - p1[2]; - b1 = p1[4] + p1[2]; + const int l1 = p1[3] - p1[1]; + const int r1 = p1[3] + p1[1]; + const int t1 = p1[4] - p1[2]; + const int b1 = p1[4] + p1[2]; // overlap check if (l1 >= r0) continue; @@ -412,8 +408,6 @@ void thunderx_state::run_collisions( int s0, int e0, int s1, int e1, int cm, int void thunderx_state::calculate_collisions() { - int s0, s1; - // the data at 0x00 to 0x06 defines the operation // // 0x00 : word : last byte of set 0 @@ -433,14 +427,14 @@ void thunderx_state::calculate_collisions() // hit mask is 40 to set bit on object 0 and object 1 // hit mask is 20 to set bit on object 1 only - const int e0 = (m_pmcram[0]<<8) | m_pmcram[1]; + const int e0 = (m_pmcram[0] << 8) | m_pmcram[1]; const int e1 = m_pmcram[2]; + int s0, s1; if (m_pmcram[5] < 16) { // US Thunder Cross uses this form - s0 = m_pmcram[5]; - s0 = (s0 << 8) + m_pmcram[6]; + s0 = (m_pmcram[5] << 8) + m_pmcram[6]; s1 = m_pmcram[7]; } else diff --git a/src/mame/nasco/suprgolf.cpp b/src/mame/nasco/suprgolf.cpp index 449673a03bd..cd28a469310 100644 --- a/src/mame/nasco/suprgolf.cpp +++ b/src/mame/nasco/suprgolf.cpp @@ -417,15 +417,15 @@ INPUT_PORTS_END // 0 -> 1 clocks NMI, 1 -> 0 pushes data to the ADPCM if available from the bus. void suprgolf_state::adpcm_int(int state) { - if (!state && m_adpcm_available_data) + if(!state && m_adpcm_available_data) { m_msm->data_w(m_adpcm_data >> 4); m_adpcm_data <<= 4; - m_adpcm_available_data --; + m_adpcm_available_data--; return; } - if (state && m_adpcm_available_data == 0 && m_adpcm_nmi_enable) + if(state && m_adpcm_available_data == 0 && m_adpcm_nmi_enable) m_maincpu->pulse_input_line(INPUT_LINE_NMI, attotime::zero); } diff --git a/src/mame/pc/teradrive.cpp b/src/mame/pc/teradrive.cpp index 3adb9a995d7..56809da637e 100644 --- a/src/mame/pc/teradrive.cpp +++ b/src/mame/pc/teradrive.cpp @@ -23,6 +23,8 @@ TODO: #include "bus/pc_kbd/pc_kbdc.h" #include "softlist_dev.h" +namespace { + class teradrive_state : public driver_device { public: @@ -143,5 +145,7 @@ ROM_START( teradrive ) ROM_LOAD( "tera_tmss.bin", 0x0000, 0x1000, CRC(424a9d11) SHA1(1c470a9a8d0b211c5feea1c1c2376aa1f7934b16) ) ROM_END +} // anonymous namespace + COMP( 1991, teradrive, 0, 0, teradrive, 0, teradrive_state, empty_init, "Sega / International Business Machines", "TeraDrive (Japan)", MACHINE_NOT_WORKING ) diff --git a/src/mame/sega/fwheel.cpp b/src/mame/sega/fwheel.cpp index a37bd6a4771..fc2c79c7e63 100644 --- a/src/mame/sega/fwheel.cpp +++ b/src/mame/sega/fwheel.cpp @@ -196,8 +196,8 @@ void fwheel_state::fwheel(machine_config &config) SPEAKER(config, "mono").front_center(); SCREEN(config, m_screen, SCREEN_TYPE_RASTER); - m_screen->set_raw(XTAL(10'738'000) / 2, \ - sega315_5124_device::WIDTH , sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH - 2, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH + 256 + 10, \ + m_screen->set_raw(XTAL(10'738'000) / 2, + sega315_5124_device::WIDTH , sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH - 2, sega315_5124_device::LBORDER_START + sega315_5124_device::LBORDER_WIDTH + 256 + 10, sega315_5124_device::HEIGHT_NTSC, sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT, sega315_5124_device::TBORDER_START + sega315_5124_device::NTSC_224_TBORDER_HEIGHT + 224); m_screen->set_refresh_hz(XTAL(10'738'000) / 2 / (sega315_5124_device::WIDTH * sega315_5124_device::HEIGHT_NTSC)); m_screen->set_screen_update(m_vdp, FUNC(sega315_5246_device::screen_update)); diff --git a/src/mame/trs/gime.h b/src/mame/trs/gime.h index bebe6480a42..ed255d28f56 100644 --- a/src/mame/trs/gime.h +++ b/src/mame/trs/gime.h @@ -14,9 +14,9 @@ #pragma once -#include "video/mc6847.h" #include "machine/6883sam.h" #include "machine/ram.h" +#include "video/mc6847.h" //************************************************************************** -- cgit v1.2.3