diff --git a/src/devices/video/fixfreq.cpp b/src/devices/video/fixfreq.cpp index 607289c92b0..cf4c4bb5517 100644 --- a/src/devices/video/fixfreq.cpp +++ b/src/devices/video/fixfreq.cpp @@ -2,14 +2,14 @@ // copyright-holders:Couriersud /*************************************************************************** - fixfreq.h + fixfreq.h - 2013-2021 Couriersud + 2013-2021 Couriersud - Fixed frequency monochrome monitor emulation + Fixed frequency monochrome monitor emulation - The driver is intended for drivers which provide an analog video signal. - VSYNC and HSYNC levels are used to create the bitmap. + The driver is intended for drivers which provide an analog video signal. + VSYNC and HSYNC levels are used to create the bitmap. ***************************************************************************/ @@ -24,9 +24,9 @@ #include // for quick and dirty debugging -#define VERBOSE 0 #define LOG_GENERAL (1U << 0) +#define VERBOSE 0 #define LOG_OUTPUT_STREAM std::cerr #include "logmacro.h" @@ -73,8 +73,7 @@ enum fixedfreq_tag_id_e SCANLINE_HEIGHT }; -void fixedfreq_monitor_state::update_sync_channel(const time_type &time, - const double newval) +void fixedfreq_monitor_state::update_sync_channel(const time_type &time, double newval) { const time_type delta_time = time - m_last_sync_time; @@ -168,14 +167,13 @@ void fixedfreq_monitor_state::update_bm(const time_type &time) m_last_x = pixels; } -void fixedfreq_monitor_state::update_composite_monochrome(const time_type &time, - const double data) +void fixedfreq_monitor_state::update_composite_monochrome(const time_type &time, double data) { update_bm(time); update_sync_channel(time, data); - //#int colv = (int) ((data - m_desc.m_sync_threshold) * m_desc.m_gain * 255.0); - int colv = (int)((data - 1.5) * m_desc.m_gain * 255.0); + //#int colv = int((data - m_desc.m_sync_threshold) * m_desc.m_gain * 255.0); + int colv = int((data - 1.5) * m_desc.m_gain * 255.0); if (colv > 255) colv = 255; if (colv < 0) @@ -185,12 +183,11 @@ void fixedfreq_monitor_state::update_composite_monochrome(const time_type &time, m_col = 0xff000000 | (colv << 16) | (colv << 8) | colv; } -void fixedfreq_monitor_state::update_red(const time_type &time, - const double data) +void fixedfreq_monitor_state::update_red(const time_type &time, double data) { update_bm(time); - int colv = (int)((data - m_desc.m_sync_threshold) * m_desc.m_gain * 255.0); + int colv = int((data - m_desc.m_sync_threshold) * m_desc.m_gain * 255.0); if (colv > 255) colv = 255; if (colv < 0) @@ -198,13 +195,12 @@ void fixedfreq_monitor_state::update_red(const time_type &time, m_col = (m_col & 0xff00ffff) | (colv << 16); } -void fixedfreq_monitor_state::update_green(const time_type &time, - const double data) +void fixedfreq_monitor_state::update_green(const time_type &time, double data) { update_bm(time); // update_sync_channel(ctime, data); - int colv = (int)((data - m_desc.m_sync_threshold) * m_desc.m_gain * 255.0); + int colv = int((data - m_desc.m_sync_threshold) * m_desc.m_gain * 255.0); if (colv > 255) colv = 255; if (colv < 0) @@ -212,13 +208,12 @@ void fixedfreq_monitor_state::update_green(const time_type &time, m_col = (m_col & 0xffff00ff) | (colv << 8); } -void fixedfreq_monitor_state::update_blue(const time_type &time, - const double data) +void fixedfreq_monitor_state::update_blue(const time_type &time, double data) { update_bm(time); // update_sync_channel(ctime, data); - int colv = (int)((data - m_desc.m_sync_threshold) * m_desc.m_gain * 255.0); + int colv = int((data - m_desc.m_sync_threshold) * m_desc.m_gain * 255.0); if (colv > 255) colv = 255; if (colv < 0) @@ -226,31 +221,35 @@ void fixedfreq_monitor_state::update_blue(const time_type &time, m_col = (m_col & 0xffffff00) | colv; } -void fixedfreq_monitor_state::update_sync(const time_type &time, - const double data) +void fixedfreq_monitor_state::update_sync(const time_type &time, double data) { update_bm(time); update_sync_channel(time, data); } -fixedfreq_device::fixedfreq_device(const machine_config &mconfig, - device_type type, const char *tag, - device_t *owner, uint32_t clock) -: device_t(mconfig, type, tag, owner, clock) -, device_video_interface(mconfig, *this, false) -, m_enable(*this, "ENABLE") -, m_vector(*this, "VECTOR") -, m_scanline_height(1.0) -, m_last_rt(0.0) -, m_monitor() -, m_state(m_monitor, *this) +fixedfreq_device::fixedfreq_device( + const machine_config &mconfig, + device_type type, + const char *tag, + device_t *owner, + uint32_t clock) + : device_t(mconfig, type, tag, owner, clock) + , device_video_interface(mconfig, *this, false) + , m_enable(*this, "ENABLE") + , m_vector(*this, "VECTOR") + , m_scanline_height(1.0) + , m_last_rt(0.0) + , m_monitor() + , m_state(m_monitor, *this) { } -fixedfreq_device::fixedfreq_device(const machine_config &mconfig, - const char *tag, device_t *owner, - uint32_t clock) -: fixedfreq_device(mconfig, FIXFREQ, tag, owner, clock) +fixedfreq_device::fixedfreq_device( + const machine_config &mconfig, + const char *tag, + device_t *owner, + uint32_t clock) + : fixedfreq_device(mconfig, FIXFREQ, tag, owner, clock) { } @@ -272,12 +271,14 @@ void fixedfreq_device::device_config_complete() // It is therefore recommended to use `set_raw` in the mame driver // to specify the window size. if (!screen().refresh_attoseconds()) - screen().set_raw(m_monitor.m_monitor_clock, m_monitor.htotal(), 0, - m_monitor.htotal(), m_monitor.vtotal(), 0, - m_monitor.vtotal()); + { + screen().set_raw( + m_monitor.m_monitor_clock, m_monitor.htotal(), 0, + m_monitor.htotal(), m_monitor.vtotal(), 0, + m_monitor.vtotal()); + } if (!screen().has_screen_update()) - screen().set_screen_update(*this, - FUNC(fixedfreq_device::screen_update)); + screen().set_screen_update(*this, FUNC(fixedfreq_device::screen_update)); LOG("config complete\n"); } @@ -336,20 +337,21 @@ void fixedfreq_device::device_post_load() static uint32_t nom_col(uint32_t col) { - float r = ((col >> 16) & 0xff); - float g = ((col >> 8) & 0xff); - float b = ((col >> 0) & 0xff); + float const r = ((col >> 16) & 0xff); + float const g = ((col >> 8) & 0xff); + float const b = ((col >> 0) & 0xff); - float m = std::max(r, std::max(g, b)); + float const m = std::max(r, std::max(g, b)); if (m == 0.0f) return 0; - return (((uint32_t)m) << 24) | (((uint32_t)(r / m * 255.0f)) << 16) - | (((uint32_t)(g / m * 255.0f)) << 8) - | (((uint32_t)(b / m * 255.0f)) << 0); + return + (uint32_t(m) << 24) | + (uint32_t(r / m * 255.0f) << 16) | + (uint32_t(g / m * 255.0f) << 8) | + (uint32_t(b / m * 255.0f) << 0); } -static void draw_testpat(screen_device &screen, bitmap_rgb32 &bitmap, - const rectangle &cliprect) +static void draw_testpat(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { // Test pattern Grey scale const int stripes = 255; @@ -361,8 +363,7 @@ static void draw_testpat(screen_device &screen, bitmap_rgb32 &bitmap, int l = va.left() + (i * va.width() / stripes); int w = (va.left() + (i + 1) * va.width() / stripes) - l; int v = (255 * i) / stripes; - bitmap.plot_box(l, va.top() + 20, w, va.height() / 2 - 20, - rgb_t(0xff, v, v, v)); + bitmap.plot_box(l, va.top() + 20, w, va.height() / 2 - 20, rgb_t(0xff, v, v, v)); } int l(va.left() + va.width() / 4); @@ -379,9 +380,7 @@ static void draw_testpat(screen_device &screen, bitmap_rgb32 &bitmap, bitmap.plot_box(l, t, w, h, rgb_t(0xff, 0xc3, 0xc3, 0xc3)); // 195 } -uint32_t -fixedfreq_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, - const rectangle &cliprect) +uint32_t fixedfreq_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { // printf("%f\n", machine().time().as_double()); // printf("%d %lu %f %f\n", m_state.m_sig_vsync, m_state.m_fragments.size(), @@ -492,11 +491,11 @@ void fixedfreq_device::vsync_end_cb(double refresh_time, uint32_t field) // reset_origin must be called first. screen().reset_origin( - m_state.m_last_y - - (m_monitor.vsync_width() + m_monitor.vbackporch_width()), - 0); - screen().configure(m_monitor.htotal_scaled(), m_monitor.vtotal(), visarea, - DOUBLE_TO_ATTOSECONDS(refresh_limited)); + m_state.m_last_y - (m_monitor.vsync_width() + m_monitor.vbackporch_width()), + 0); + screen().configure( + m_monitor.htotal_scaled(), m_monitor.vtotal(), visarea, + DOUBLE_TO_ATTOSECONDS(refresh_limited)); } NETDEV_ANALOG_CALLBACK_MEMBER(fixedfreq_device::update_composite_monochrome) diff --git a/src/devices/video/fixfreq.h b/src/devices/video/fixfreq.h index dd0cde5cce6..482016ba97e 100644 --- a/src/devices/video/fixfreq.h +++ b/src/devices/video/fixfreq.h @@ -2,12 +2,12 @@ // copyright-holders:Couriersud /*************************************************************************** - fixfreq.h + fixfreq.h - Fixed frequency monochrome monitor emulation + Fixed frequency monochrome monitor emulation - The driver is intended for drivers which provide an analog video signal. - VSYNC and HSYNC levels are used to create the bitmap. + The driver is intended for drivers which provide an analog video signal. + VSYNC and HSYNC levels are used to create the bitmap. ***************************************************************************/ @@ -20,22 +20,22 @@ struct fixedfreq_monitor_desc { fixedfreq_monitor_desc() - // default to NTSC "704x480@30i" - : m_monitor_clock(13500000) - , m_fieldcount(2) - , m_sync_threshold(0.3) - , m_gain(1.0 / 3.7) - , m_hscale(1) - , m_vsync_threshold(0.600) - , // trigger at 91% of vsync length 1-exp(-0.6) - m_hvisible(704) - , m_hfrontporch(728) - , m_hsync(791) - , m_hbackporch(858) - , m_vvisible(480) - , m_vfrontporch(486) - , m_vsync(492) - , m_vbackporch(525) + // default to NTSC "704x480@30i" + : m_monitor_clock(13500000) + , m_fieldcount(2) + , m_sync_threshold(0.3) + , m_gain(1.0 / 3.7) + , m_hscale(1) + , m_vsync_threshold(0.600) + // trigger at 91% of vsync length 1-exp(-0.6) + , m_hvisible(704) + , m_hfrontporch(728) + , m_hsync(791) + , m_hbackporch(858) + , m_vvisible(480) + , m_vfrontporch(486) + , m_vsync(492) + , m_vbackporch(525) { } @@ -94,13 +94,13 @@ struct fixedfreq_monitor_desc double vsync_filter_timeconst() const noexcept { - return (double)(m_monitor_clock) - / ((double)m_hbackporch * vsync_width()); + return double(m_monitor_clock) + / (double(m_hbackporch) * vsync_width()); } double hsync_filter_timeconst() const noexcept { - return (double)m_monitor_clock / (double)hsync_width(); + return double(m_monitor_clock) / double(hsync_width()); } uint32_t m_monitor_clock; @@ -139,24 +139,23 @@ struct fixedfreq_monitor_state { using time_type = double; - fixedfreq_monitor_state(fixedfreq_monitor_desc &desc, - fixedfreq_monitor_intf &intf) - : m_desc(desc) - , m_intf(intf) - , m_last_sync_val(0) - , m_col(0) - , m_last_x(0) - , m_last_y(0) - , m_last_sync_time(time_type(0)) - , m_line_time(time_type(0)) - , m_last_hsync_time(time_type(0)) - , m_last_vsync_time(time_type(0)) - , m_last_line_duration(time_type(0)) - , m_last_field_time(time_type(0)) - , m_vsync_filter(0) - , m_sig_vsync(0) - , m_sig_composite(0) - , m_sig_field(0) + fixedfreq_monitor_state(fixedfreq_monitor_desc &desc, fixedfreq_monitor_intf &intf) + : m_desc(desc) + , m_intf(intf) + , m_last_sync_val(0) + , m_col(0) + , m_last_x(0) + , m_last_y(0) + , m_last_sync_time(time_type(0)) + , m_line_time(time_type(0)) + , m_last_hsync_time(time_type(0)) + , m_last_vsync_time(time_type(0)) + , m_last_line_duration(time_type(0)) + , m_last_field_time(time_type(0)) + , m_vsync_filter(0) + , m_sig_vsync(0) + , m_sig_composite(0) + , m_sig_field(0) { } @@ -213,14 +212,13 @@ struct fixedfreq_monitor_state m_fragments.clear(); } - void update_sync_channel(const time_type &time, const double newval); + void update_sync_channel(const time_type &time, double newval); void update_bm(const time_type &time); - void - update_composite_monochrome(const time_type &time, const double newval); - void update_red(const time_type &time, const double data); - void update_green(const time_type &time, const double data); - void update_blue(const time_type &time, const double data); - void update_sync(const time_type &time, const double data); + void update_composite_monochrome(const time_type &time, double newval); + void update_red(const time_type &time, double data); + void update_green(const time_type &time, double data); + void update_blue(const time_type &time, double data); + void update_sync(const time_type &time, double data); const fixedfreq_monitor_desc &m_desc; fixedfreq_monitor_intf &m_intf; @@ -257,8 +255,7 @@ public: using time_type = fixedfreq_monitor_state::time_type; // construction/destruction - fixedfreq_device(const machine_config &mconfig, const char *tag, - device_t *owner, uint32_t clock = 0); + fixedfreq_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); // inline configuration helpers fixedfreq_device &set_monitor_clock(uint32_t clock) @@ -286,18 +283,14 @@ public: m_monitor.m_gain = gain; return *this; } - fixedfreq_device & - set_horz_params(int visible, int frontporch, int sync, int backporch) + fixedfreq_device &set_horz_params(int visible, int frontporch, int sync, int backporch) { - m_monitor.set_h_rel(visible, frontporch - visible, sync - frontporch, - backporch - sync); + m_monitor.set_h_rel(visible, frontporch - visible, sync - frontporch, backporch - sync); return *this; } - fixedfreq_device & - set_vert_params(int visible, int frontporch, int sync, int backporch) + fixedfreq_device &set_vert_params(int visible, int frontporch, int sync, int backporch) { - m_monitor.set_v_rel(visible, frontporch - visible, sync - frontporch, - backporch - sync); + m_monitor.set_v_rel(visible, frontporch - visible, sync - frontporch, backporch - sync); return *this; } fixedfreq_device &set_horz_scale(int hscale) @@ -329,8 +322,7 @@ public: return *this; } - virtual uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, - const rectangle &cliprect); + virtual uint32_t screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); NETDEV_ANALOG_CALLBACK_MEMBER(update_composite_monochrome); NETDEV_ANALOG_CALLBACK_MEMBER(update_red); @@ -343,8 +335,12 @@ public: unsigned monitor_val(unsigned param) const; protected: - fixedfreq_device(const machine_config &mconfig, device_type type, - const char *tag, device_t *owner, uint32_t clock); + fixedfreq_device( + const machine_config &mconfig, + device_type type, + const char *tag, + device_t *owner, + uint32_t clock); // device-level overrides virtual void device_config_complete() override; diff --git a/src/mame/apple/maciivx.cpp b/src/mame/apple/maciivx.cpp index 7934114483a..95d57f6fa3f 100644 --- a/src/mame/apple/maciivx.cpp +++ b/src/mame/apple/maciivx.cpp @@ -332,7 +332,7 @@ void maciivx_state::maciiv_base(machine_config &config) VASP(config, m_vasp, C15M); m_vasp->set_maincpu_tag("maincpu"); - m_vasp->set_rom_tag(":bootrom"); + m_vasp->set_rom_tag("bootrom"); m_vasp->hdsel_callback().set(FUNC(maciivx_state::hdsel_w)); MACADB(config, m_macadb, C15M); diff --git a/src/mame/apple/maclc3.cpp b/src/mame/apple/maclc3.cpp index df88a8398f0..639d581e8ef 100644 --- a/src/mame/apple/maclc3.cpp +++ b/src/mame/apple/maclc3.cpp @@ -261,7 +261,7 @@ void macvail_state::maclc3_base(machine_config &config) SONORA(config, m_sonora, C15M); m_sonora->set_maincpu_tag("maincpu"); - m_sonora->set_rom_tag(":bootrom"); + m_sonora->set_rom_tag("bootrom"); MACADB(config, m_macadb, C15M); m_macadb->set_mcu_mode(true); diff --git a/src/mame/capcom/lwings.cpp b/src/mame/capcom/lwings.cpp index 7930fad7267..76504ff51dd 100644 --- a/src/mame/capcom/lwings.cpp +++ b/src/mame/capcom/lwings.cpp @@ -16,7 +16,7 @@ To Do: counter rather than behaving as a memory-mapped black box. - Avengers had a protection chip underneath the sound module. Needs dumping. The protection is extensive: palette data, calculates player movement, - even a hand in the sound. The angle/movement stuff isn't 100% accurate either. + even a hand in the sound. The angle/movement stuff isn't 100% accurate either. - accurate music tempo (audiocpu irq freq) - accurate video timing, raw params