From 36493cc672e996af403540fa02a92e847ca284d3 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Sat, 1 Apr 2023 14:30:48 +1100 Subject: emu/rgbvmx.h: Fixed some corner cases (fixes GitHub #11051). Also changed a pile of comments. --- src/devices/bus/a800/a800_slot.h | 6 +- src/devices/bus/adam/exp.h | 4 +- src/devices/bus/cbm2/exp.h | 6 +- src/devices/bus/chanf/slot.h | 6 +- src/devices/bus/coleco/cartridge/exp.h | 6 +- src/devices/bus/cpc/cpc_rom.h | 2 +- src/devices/bus/plus4/exp.h | 6 +- src/devices/bus/scv/slot.h | 8 +-- src/devices/bus/vic10/exp.h | 6 +- src/devices/bus/vic20/exp.h | 6 +- src/devices/imagedev/bitbngr.h | 3 +- src/devices/imagedev/printer.h | 5 +- src/devices/imagedev/snapquik.h | 7 ++- src/devices/machine/i7220.h | 4 +- src/devices/machine/smartmed.h | 2 +- src/emu/video/rgbvmx.cpp | 2 +- src/emu/video/rgbvmx.h | 102 +++++++++++++++++++-------------- src/mame/acorn/z88_impexp.h | 4 +- src/mame/ausnz/mbee.h | 8 +-- src/mame/ausnz/mbee_m.cpp | 32 +++++------ src/mame/casio/pv1000.cpp | 8 +-- src/mame/commodore/cbm2.cpp | 3 +- src/mame/commodore/cbm_snqk.cpp | 5 +- src/mame/commodore/cbm_snqk.h | 6 ++ src/mame/commodore/vic20.cpp | 13 +++-- src/mame/ddr/kc_m.cpp | 2 +- src/mame/dec/pdp1.h | 20 +++---- src/mame/fujitsu/fmt_icmem.cpp | 16 +++--- src/mame/shared/z80bin.h | 6 ++ 29 files changed, 167 insertions(+), 137 deletions(-) diff --git a/src/devices/bus/a800/a800_slot.h b/src/devices/bus/a800/a800_slot.h index 71fd3545255..8cf79458d46 100644 --- a/src/devices/bus/a800/a800_slot.h +++ b/src/devices/bus/a800/a800_slot.h @@ -102,7 +102,7 @@ public: a800_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~a800_cart_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; @@ -126,11 +126,11 @@ public: protected: a800_cart_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - // device-level overrides + // device_t implementation virtual void device_start() override; private: - device_a800_cart_interface* m_cart; + device_a800_cart_interface *m_cart; int m_type; }; diff --git a/src/devices/bus/adam/exp.h b/src/devices/bus/adam/exp.h index a200474ca65..ea5fae671c2 100644 --- a/src/devices/bus/adam/exp.h +++ b/src/devices/bus/adam/exp.h @@ -50,10 +50,10 @@ public: DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_write_irq(state); } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual bool is_reset_on_load() const noexcept override { return true; } diff --git a/src/devices/bus/cbm2/exp.h b/src/devices/bus/cbm2/exp.h index 5a77de5df3f..d10a7771dcc 100644 --- a/src/devices/bus/cbm2/exp.h +++ b/src/devices/bus/cbm2/exp.h @@ -66,17 +66,17 @@ public: int phi2() { return clock(); } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual bool is_reset_on_load() const noexcept override { return true; } virtual const char *image_interface() const noexcept override { return "cbm2_cart"; } virtual const char *file_extensions() const noexcept override { return "20,40,60"; } - // slot interface overrides + // device_slot_interface implementation virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; device_cbm2_expansion_card_interface *m_card; diff --git a/src/devices/bus/chanf/slot.h b/src/devices/bus/chanf/slot.h index 035d483aa79..fa8bb77520b 100644 --- a/src/devices/bus/chanf/slot.h +++ b/src/devices/bus/chanf/slot.h @@ -77,7 +77,7 @@ public: channelf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~channelf_cart_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override { } @@ -85,7 +85,7 @@ public: virtual const char *image_interface() const noexcept override { return "channelf_cart"; } virtual const char *file_extensions() const noexcept override { return "bin,chf"; } - // slot interface overrides + // device_slot_interface implementation virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; int get_type() { return m_type; } @@ -99,7 +99,7 @@ public: void write_bank(uint8_t data); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; int m_type; diff --git a/src/devices/bus/coleco/cartridge/exp.h b/src/devices/bus/coleco/cartridge/exp.h index 9e51f1ebb1d..2f3e8a0ed11 100644 --- a/src/devices/bus/coleco/cartridge/exp.h +++ b/src/devices/bus/coleco/cartridge/exp.h @@ -68,17 +68,17 @@ public: uint8_t bd_r(offs_t offset, uint8_t data, int _8000, int _a000, int _c000, int _e000); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual bool is_reset_on_load() const noexcept override { return true; } virtual const char *image_interface() const noexcept override { return "coleco_cart"; } virtual const char *file_extensions() const noexcept override { return "rom,col,bin"; } - // slot interface overrides + // device_slot_interface implementation virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; device_colecovision_cartridge_interface *m_card; diff --git a/src/devices/bus/cpc/cpc_rom.h b/src/devices/bus/cpc/cpc_rom.h index a89cd692a50..4503174c895 100644 --- a/src/devices/bus/cpc/cpc_rom.h +++ b/src/devices/bus/cpc/cpc_rom.h @@ -25,7 +25,7 @@ public: cpc_rom_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~cpc_rom_image_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; diff --git a/src/devices/bus/plus4/exp.h b/src/devices/bus/plus4/exp.h index 1af9968899d..bc895af0a18 100644 --- a/src/devices/bus/plus4/exp.h +++ b/src/devices/bus/plus4/exp.h @@ -84,17 +84,17 @@ public: int phi2() { return clock(); } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual bool is_reset_on_load() const noexcept override { return true; } virtual const char *image_interface() const noexcept override { return "plus4_cart"; } virtual const char *file_extensions() const noexcept override { return "rom,bin"; } - // slot interface overrides + // device_slot_interface implementation virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; devcb_write_line m_write_irq; diff --git a/src/devices/bus/scv/slot.h b/src/devices/bus/scv/slot.h index baa1821286f..94ad9c95e47 100644 --- a/src/devices/bus/scv/slot.h +++ b/src/devices/bus/scv/slot.h @@ -79,7 +79,7 @@ public: scv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~scv_cart_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override { } @@ -87,7 +87,7 @@ public: virtual const char *image_interface() const noexcept override { return "scv_cart"; } virtual const char *file_extensions() const noexcept override { return "bin"; } - // slot interface overrides + // device_slot_interface implementation virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; int get_type() { return m_type; } @@ -101,11 +101,11 @@ public: void write_bank(uint8_t data); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; int m_type; - device_scv_cart_interface* m_cart; + device_scv_cart_interface *m_cart; }; diff --git a/src/devices/bus/vic10/exp.h b/src/devices/bus/vic10/exp.h index 961b4305f12..f48f888ff34 100644 --- a/src/devices/bus/vic10/exp.h +++ b/src/devices/bus/vic10/exp.h @@ -83,17 +83,17 @@ public: DECLARE_WRITE_LINE_MEMBER( sp_w ) { m_write_sp(state); } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual bool is_reset_on_load() const noexcept override { return true; } virtual const char *image_interface() const noexcept override { return "vic10_cart"; } virtual const char *file_extensions() const noexcept override { return "80,e0"; } - // slot interface overrides + // device_slot_interface implementation virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; devcb_write_line m_write_irq; diff --git a/src/devices/bus/vic20/exp.h b/src/devices/bus/vic20/exp.h index 202ca79e453..c159c11cfb9 100644 --- a/src/devices/bus/vic20/exp.h +++ b/src/devices/bus/vic20/exp.h @@ -80,18 +80,18 @@ public: DECLARE_WRITE_LINE_MEMBER( res_w ) { m_write_res(state); } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_reset() override; - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual bool is_reset_on_load() const noexcept override { return true; } virtual const char *image_interface() const noexcept override { return "vic1001_cart"; } virtual const char *file_extensions() const noexcept override { return "20,40,60,70,a0,b0,crt"; } - // slot interface overrides + // device_slot_interface implementation virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; devcb_write_line m_write_irq; diff --git a/src/devices/imagedev/bitbngr.h b/src/devices/imagedev/bitbngr.h index 351d41c2e3a..56501d7c7e1 100644 --- a/src/devices/imagedev/bitbngr.h +++ b/src/devices/imagedev/bitbngr.h @@ -19,12 +19,11 @@ public: // construction/destruction bitbanger_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override; virtual void call_unload() override; - // image device virtual bool is_readable() const noexcept override { return true; } virtual bool is_writeable() const noexcept override { return !m_is_readonly; } virtual bool is_creatable() const noexcept override { return !m_is_readonly; } diff --git a/src/devices/imagedev/printer.h b/src/devices/imagedev/printer.h index a4183a3f767..b1b55b00e96 100644 --- a/src/devices/imagedev/printer.h +++ b/src/devices/imagedev/printer.h @@ -29,12 +29,11 @@ public: auto online_callback() { return m_online_cb.bind(); } - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override; virtual void call_unload() override; - // image device virtual bool is_readable() const noexcept override { return false; } virtual bool is_writeable() const noexcept override { return true; } virtual bool is_creatable() const noexcept override { return true; } @@ -52,7 +51,7 @@ public: void output(uint8_t data); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; devcb_write_line m_online_cb; diff --git a/src/devices/imagedev/snapquik.h b/src/devices/imagedev/snapquik.h index 9c090cdf36d..1355eb6579b 100644 --- a/src/devices/imagedev/snapquik.h +++ b/src/devices/imagedev/snapquik.h @@ -13,6 +13,11 @@ #pragma once +#include +#include +#include + + // ======================> snapshot_image_device class snapshot_image_device : public device_t, public device_image_interface @@ -32,7 +37,7 @@ public: void set_interface(const char *interface) { m_interface = interface; } - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual bool is_readable() const noexcept override { return true; } diff --git a/src/devices/machine/i7220.h b/src/devices/machine/i7220.h index eb0068927db..ce47c9991e1 100644 --- a/src/devices/machine/i7220.h +++ b/src/devices/machine/i7220.h @@ -49,7 +49,7 @@ public: void set_data_size(int data_size) { m_data_size = data_size; } - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual bool is_readable() const noexcept override { return true; } @@ -64,7 +64,7 @@ public: void write(offs_t offset, uint8_t data); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_reset() override; diff --git a/src/devices/machine/smartmed.h b/src/devices/machine/smartmed.h index 214f4889eea..48e488d71f7 100644 --- a/src/devices/machine/smartmed.h +++ b/src/devices/machine/smartmed.h @@ -26,7 +26,7 @@ public: // construction/destruction smartmedia_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // image-level overrides + // device_image_interface implementation virtual bool is_creatable() const noexcept override { return false; } virtual bool is_reset_on_load() const noexcept override { return false; } virtual const char *image_interface() const noexcept override { return "sm_memc"; } diff --git a/src/emu/video/rgbvmx.cpp b/src/emu/video/rgbvmx.cpp index 608f7024565..62bd25b3578 100644 --- a/src/emu/video/rgbvmx.cpp +++ b/src/emu/video/rgbvmx.cpp @@ -190,7 +190,7 @@ void rgbaint_t::scale_and_clamp(const rgbaint_t& scale) clamp_to_uint8(); } -void rgbaint_t::scale_imm_and_clamp(const s32 scale) +void rgbaint_t::scale_imm_and_clamp(s32 scale) { mul_imm(scale); sra_imm(8); diff --git a/src/emu/video/rgbvmx.h b/src/emu/video/rgbvmx.h index 05d26cd9e21..dd1946bfa28 100644 --- a/src/emu/video/rgbvmx.h +++ b/src/emu/video/rgbvmx.h @@ -76,7 +76,7 @@ public: } // This function sets all elements to the same val - void set_all(const s32& val) { set(val, val, val, val); } + void set_all(const s32 &val) { set(val, val, val, val); } // This function zeros all elements void zero() { set_all(0); } // This function zeros only the alpha element @@ -100,31 +100,31 @@ public: return result; } - void set_a16(const s32 value) + void set_a16(s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, alpha_perm); } - void set_a(const s32 value) + void set_a(s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, alpha_perm); } - void set_r(const s32 value) + void set_r(s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, red_perm); } - void set_g(const s32 value) + void set_g(s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, green_perm); } - void set_b(const s32 value) + void set_b(s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_perm(m_value, temp, blue_perm); @@ -229,13 +229,13 @@ public: m_value = vec_add(m_value, color2.m_value); } - inline void add_imm(const s32 imm) + inline void add_imm(s32 imm) { const VECS32 temp = { imm, imm, imm, imm }; m_value = vec_add(m_value, temp); } - inline void add_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) + inline void add_imm_rgba(s32 a, s32 r, s32 g, s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -250,13 +250,13 @@ public: m_value = vec_sub(m_value, color2.m_value); } - inline void sub_imm(const s32 imm) + inline void sub_imm(s32 imm) { const VECS32 temp = { imm, imm, imm, imm }; m_value = vec_sub(m_value, temp); } - inline void sub_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) + inline void sub_imm_rgba(s32 a, s32 r, s32 g, s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -271,13 +271,13 @@ public: m_value = vec_sub(color2.m_value, m_value); } - inline void subr_imm(const s32 imm) + inline void subr_imm(s32 imm) { const VECS32 temp = { imm, imm, imm, imm }; m_value = vec_sub(temp, m_value); } - inline void subr_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) + inline void subr_imm_rgba(s32 a, s32 r, s32 g, s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -298,7 +298,7 @@ public: #endif } - inline void mul_imm(const s32 imm) + inline void mul_imm(s32 imm) { const VECU32 value = { u32(imm), u32(imm), u32(imm), u32(imm) }; const VECU32 shift = vec_splat_u32(-16); @@ -310,7 +310,7 @@ public: #endif } - inline void mul_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) + inline void mul_imm_rgba(s32 a, s32 r, s32 g, s32 b) { #ifdef __LITTLE_ENDIAN__ const VECU32 value = { u32(b), u32(g), u32(r), u32(a) }; @@ -332,10 +332,17 @@ public: m_value = vec_and(vec_sl(m_value, VECU32(shift.m_value)), vec_cmpgt(limit, VECU32(shift.m_value))); } - inline void shl_imm(const u8 shift) + inline void shl_imm(u8 shift) { - const VECU32 temp = { shift, shift, shift, shift }; - m_value = vec_sl(m_value, temp); + if (32 > shift) + { + const VECU32 temp = { shift, shift, shift, shift }; + m_value = vec_sl(m_value, temp); + } + else + { + m_value = vec_splat_s32(0); + } } inline void shr(const rgbaint_t& shift) @@ -344,10 +351,17 @@ public: m_value = vec_and(vec_sr(m_value, VECU32(shift.m_value)), vec_cmpgt(limit, VECU32(shift.m_value))); } - inline void shr_imm(const u8 shift) + inline void shr_imm(u8 shift) { - const VECU32 temp = { shift, shift, shift, shift }; - m_value = vec_sr(m_value, temp); + if (32 > shift) + { + const VECU32 temp = { shift, shift, shift, shift }; + m_value = vec_sr(m_value, temp); + } + else + { + m_value = vec_splat_s32(0); + } } inline void sra(const rgbaint_t& shift) @@ -356,8 +370,9 @@ public: m_value = vec_sra(m_value, vec_min(VECU32(shift.m_value), limit)); } - inline void sra_imm(const u8 shift) + inline void sra_imm(u8 shift) { + shift = std::min(shift, 31); const VECU32 temp = { shift, shift, shift, shift }; m_value = vec_sra(m_value, temp); } @@ -367,13 +382,13 @@ public: m_value = vec_or(m_value, color2.m_value); } - inline void or_imm(const s32 value) + inline void or_imm(s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_or(m_value, temp); } - inline void or_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) + inline void or_imm_rgba(s32 a, s32 r, s32 g, s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -393,13 +408,13 @@ public: m_value = vec_andc(m_value, color.m_value); } - inline void and_imm(const s32 value) + inline void and_imm(s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_and(m_value, temp); } - inline void and_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) + inline void and_imm_rgba(s32 a, s32 r, s32 g, s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -414,13 +429,13 @@ public: m_value = vec_xor(m_value, color2.m_value); } - inline void xor_imm(const s32 value) + inline void xor_imm(s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_xor(m_value, temp); } - inline void xor_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) + inline void xor_imm_rgba(s32 a, s32 r, s32 g, s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -430,7 +445,7 @@ public: m_value = vec_xor(m_value, temp); } - inline void clamp_and_clear(const u32 sign) + inline void clamp_and_clear(u32 sign) { const VECS32 vzero = { 0, 0, 0, 0 }; VECS32 vsign = { s32(sign), s32(sign), s32(sign), s32(sign) }; @@ -454,7 +469,7 @@ public: #endif } - inline void sign_extend(const u32 compare, const u32 sign) + inline void sign_extend(u32 compare, u32 sign) { const VECS32 compare_vec = { s32(compare), s32(compare), s32(compare), s32(compare) }; const VECS32 compare_mask = VECS32(vec_cmpeq(vec_and(m_value, compare_vec), compare_vec)); @@ -462,13 +477,13 @@ public: m_value = vec_or(m_value, vec_and(sign_vec, compare_mask)); } - inline void min(const s32 value) + inline void min(s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_min(m_value, temp); } - inline void max(const s32 value) + inline void max(s32 value) { const VECS32 temp = { value, value, value, value }; m_value = vec_max(m_value, temp); @@ -477,7 +492,7 @@ public: void blend(const rgbaint_t& other, u8 factor); void scale_and_clamp(const rgbaint_t& scale); - void scale_imm_and_clamp(const s32 scale); + void scale_imm_and_clamp(s32 scale); void scale_add_and_clamp(const rgbaint_t& scale, const rgbaint_t& other) { @@ -503,13 +518,13 @@ public: m_value = VECS32(vec_cmpeq(m_value, value.m_value)); } - inline void cmpeq_imm(const s32 value) + inline void cmpeq_imm(s32 value) { const VECS32 temp = { value, value, value, value }; m_value = VECS32(vec_cmpeq(m_value, temp)); } - inline void cmpeq_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) + inline void cmpeq_imm_rgba(s32 a, s32 r, s32 g, s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -524,13 +539,13 @@ public: m_value = VECS32(vec_cmpgt(m_value, value.m_value)); } - inline void cmpgt_imm(const s32 value) + inline void cmpgt_imm(s32 value) { const VECS32 temp = { value, value, value, value }; m_value = VECS32(vec_cmpgt(m_value, temp)); } - inline void cmpgt_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) + inline void cmpgt_imm_rgba(s32 a, s32 r, s32 g, s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -545,13 +560,13 @@ public: m_value = VECS32(vec_cmplt(m_value, value.m_value)); } - inline void cmplt_imm(const s32 value) + inline void cmplt_imm(s32 value) { const VECS32 temp = { value, value, value, value }; m_value = VECS32(vec_cmplt(m_value, temp)); } - inline void cmplt_imm_rgba(const s32 a, const s32 r, const s32 g, const s32 b) + inline void cmplt_imm_rgba(s32 a, s32 r, s32 g, s32 b) { #ifdef __LITTLE_ENDIAN__ const VECS32 temp = { b, g, r, a }; @@ -567,7 +582,7 @@ public: return *this; } - inline rgbaint_t& operator+=(const s32 other) + inline rgbaint_t& operator+=(s32 other) { const VECS32 temp = { other, other, other, other }; m_value = vec_add(m_value, temp); @@ -592,7 +607,7 @@ public: return *this; } - inline rgbaint_t& operator*=(const s32 other) + inline rgbaint_t& operator*=(s32 other) { const VECS32 value = { other, other, other, other }; const VECU32 shift = vec_splat_u32(-16); @@ -605,19 +620,20 @@ public: return *this; } - inline rgbaint_t& operator>>=(const s32 shift) + inline rgbaint_t& operator>>=(s32 shift) { + shift = s32(std::min(shift, 31)); const VECU32 temp = { u32(shift), u32(shift), u32(shift), u32(shift) }; m_value = vec_sra(m_value, temp); return *this; } - inline void merge_alpha16(const rgbaint_t& alpha) + inline void merge_alpha16(const rgbaint_t &alpha) { m_value = vec_perm(m_value, alpha.m_value, alpha_perm); } - inline void merge_alpha(const rgbaint_t& alpha) + inline void merge_alpha(const rgbaint_t &alpha) { m_value = vec_perm(m_value, alpha.m_value, alpha_perm); } diff --git a/src/mame/acorn/z88_impexp.h b/src/mame/acorn/z88_impexp.h index 6918e0df69d..5810298c5c3 100644 --- a/src/mame/acorn/z88_impexp.h +++ b/src/mame/acorn/z88_impexp.h @@ -28,12 +28,12 @@ protected: virtual void device_start() override; virtual void device_reset() override; - // device_serial_interface overrides + // device_serial_interface implementation virtual void tra_callback() override; virtual void tra_complete() override; virtual void rcv_complete() override; - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override; diff --git a/src/mame/ausnz/mbee.h b/src/mame/ausnz/mbee.h index d09f79bb029..4322fa61450 100644 --- a/src/mame/ausnz/mbee.h +++ b/src/mame/ausnz/mbee.h @@ -65,10 +65,10 @@ public: , m_bankr(*this, "bankr%d", 0U) , m_bankw(*this, "bankw%d", 0U) , m_pak(*this, "optrom%u", 0U) // "rom" causes issues - { - for (u8 n : m_pak_extended) - m_pak_extended[n] = 0; - } + { + for (u8 n : m_pak_extended) + m_pak_extended[n] = 0; + } void mbee56(machine_config &config); void mbeeppc(machine_config &config); diff --git a/src/mame/ausnz/mbee_m.cpp b/src/mame/ausnz/mbee_m.cpp index 208f1b45ac6..14d618d7648 100644 --- a/src/mame/ausnz/mbee_m.cpp +++ b/src/mame/ausnz/mbee_m.cpp @@ -631,17 +631,15 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_cb) return std::error_condition(); } - uint16_t i, j; - u8 data; - size_t quickload_size = image.length(); if (image.is_filetype("mwb")) { /* mwb files - standard basic files */ - for (i = 0; i < quickload_size; i++) + for (int i = 0; i < quickload_size; i++) { - j = 0x8c0 + i; + int j = 0x8c0 + i; + u8 data; if (image.fread(&data, 1) != 1) { image.message("Unexpected EOF"); @@ -665,14 +663,14 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_cb) else space.write_word(0xa2,0x8517); } - else - if (image.is_filetype("com")) + else if (image.is_filetype("com")) { /* com files - most com files are just machine-language games with a wrapper and don't need cp/m to be present */ - for (i = 0; i < quickload_size; i++) + for (int i = 0; i < quickload_size; i++) { - j = 0x100 + i; + int j = 0x100 + i; + u8 data; if (image.fread(&data, 1) != 1) { image.message("Unexpected EOF"); @@ -691,14 +689,14 @@ QUICKLOAD_LOAD_MEMBER(mbee_state::quickload_cb) if (autorun) m_maincpu->set_pc(0x100); } - else - if (image.is_filetype("bee")) + else if (image.is_filetype("bee")) { /* bee files - machine-language games that start at 0900 */ - for (i = 0; i < quickload_size; i++) + for (int i = 0; i < quickload_size; i++) { - j = 0x900 + i; + int j = 0x900 + i; + u8 data; if (image.fread(&data, 1) != 1) { image.message("Unexpected EOF"); @@ -728,7 +726,7 @@ std::error_condition mbee_state::load_cart(device_image_interface &image, generi if (pak_index > 1) { - // "mbp" roms + // "mbp" ROMs if ((size == 0) || (size > 0x4000)) { osd_printf_error("%s: Unsupported ROM size\n", image.basename()); @@ -740,8 +738,8 @@ std::error_condition mbee_state::load_cart(device_image_interface &image, generi slot->rom_alloc(m_pak_extended[pak_index] ? 0x4000 : 0x2000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); // we alloc the amount for a real rom slot->common_load_rom(slot->get_rom_base(), size, "rom"); - // Validate the rom - logerror ("Rom header = %02X %02X %02X\n", slot->read_rom(0), slot->read_rom(1), slot->read_rom(2)); + // Validate the ROM + logerror("ROM header = %02X %02X %02X\n", slot->read_rom(0), slot->read_rom(1), slot->read_rom(2)); if ((slot->read_rom(0) != 0xc3) || ((slot->read_rom(2) & 0xe0) != 0xc0)) { osd_printf_error("%s: Not a PAK rom\n", image.basename()); @@ -763,7 +761,7 @@ std::error_condition mbee_state::load_cart(device_image_interface &image, generi slot->common_load_rom(slot->get_rom_base(), size, "rom"); // Validate the rom - logerror ("Rom header = %02X %02X %02X\n", slot->read_rom(0), slot->read_rom(1), slot->read_rom(2)); + logerror("ROM header = %02X %02X %02X\n", slot->read_rom(0), slot->read_rom(1), slot->read_rom(2)); if (!image.loaded_through_softlist()) // need to let pascal through without testing { if ((slot->read_rom(0) != 0xc3) || ((slot->read_rom(2) & 0xf0) != 0xe0)) diff --git a/src/mame/casio/pv1000.cpp b/src/mame/casio/pv1000.cpp index ee5fa094a89..71f52c5ee44 100644 --- a/src/mame/casio/pv1000.cpp +++ b/src/mame/casio/pv1000.cpp @@ -320,17 +320,15 @@ DEVICE_IMAGE_LOAD_MEMBER( pv1000_state::cart_load ) uint32_t pv1000_state::screen_update_pv1000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) { - int x, y; - bitmap.fill(m_border_col); // TODO: might be either black or colored by this register - for ( y = 0; y < 24; y++ ) + for (int y = 0; y < 24; y++) { - for ( x = 2; x < 30; x++ ) // left-right most columns are definitely masked by the border color + for (int x = 2; x < 30; x++) // left-right most columns are definitely masked by the border color { uint16_t tile = m_p_videoram[ y * 32 + x ]; - if ( tile < 0xe0 || m_force_pattern ) + if (tile < 0xe0 || m_force_pattern) { tile += ( m_pcg_bank << 8); m_gfxdecode->gfx(0)->opaque(bitmap,cliprect, tile, 0, 0, 0, x*8, y*8 ); diff --git a/src/mame/commodore/cbm2.cpp b/src/mame/commodore/cbm2.cpp index 9ed828e6e0b..a9875db04ff 100644 --- a/src/mame/commodore/cbm2.cpp +++ b/src/mame/commodore/cbm2.cpp @@ -12,6 +12,8 @@ #include "emu.h" +#include "cbm_snqk.h" + #include "bus/cbm2/exp.h" #include "bus/cbm2/user.h" #include "bus/ieee488/ieee488.h" @@ -20,7 +22,6 @@ #include "bus/vcs_ctrl/ctrl.h" #include "cpu/m6502/m6509.h" #include "cpu/i86/i86.h" -#include "cbm_snqk.h" #include "imagedev/snapquik.h" #include "machine/6525tpi.h" #include "machine/ds75160a.h" diff --git a/src/mame/commodore/cbm_snqk.cpp b/src/mame/commodore/cbm_snqk.cpp index 71b32f474ed..b178008ab61 100644 --- a/src/mame/commodore/cbm_snqk.cpp +++ b/src/mame/commodore/cbm_snqk.cpp @@ -31,7 +31,6 @@ std::error_condition general_cbm_loadsnap( device_image_interface &image, addres std::vector data; uint32_t bytesread; uint16_t address = 0; - int i; int snapshot_size = image.length(); @@ -76,14 +75,14 @@ std::error_condition general_cbm_loadsnap( device_image_interface &image, addres if (bytesread != snapshot_size) return image_error::UNSPECIFIED; - for (i = 0; i < snapshot_size; i++) + for (int i = 0; i < snapshot_size; i++) space.write_byte(address + i + offset, data[i]); cbm_sethiaddress(space, address + snapshot_size); return std::error_condition(); } -void cbm_quick_sethiaddress( address_space &space, uint16_t hiaddress ) +void cbm_quick_sethiaddress(address_space &space, uint16_t hiaddress) { space.write_byte(0xae, hiaddress & 0xff); space.write_byte(0x31, hiaddress & 0xff); diff --git a/src/mame/commodore/cbm_snqk.h b/src/mame/commodore/cbm_snqk.h index 3921def18ea..d2573f35391 100644 --- a/src/mame/commodore/cbm_snqk.h +++ b/src/mame/commodore/cbm_snqk.h @@ -11,6 +11,12 @@ #pragma once +#include +#include +#include +#include + + #define CBM_QUICKLOAD_DELAY (attotime::from_seconds(3)) std::error_condition general_cbm_loadsnap( diff --git a/src/mame/commodore/vic20.cpp b/src/mame/commodore/vic20.cpp index fa9c4fe7ef5..a5b5647cb28 100644 --- a/src/mame/commodore/vic20.cpp +++ b/src/mame/commodore/vic20.cpp @@ -10,21 +10,24 @@ */ #include "emu.h" -#include "screen.h" -#include "softlist_dev.h" -#include "speaker.h" + +#include "cbm_snqk.h" + #include "bus/cbmiec/cbmiec.h" #include "bus/pet/cass.h" #include "bus/vcs_ctrl/ctrl.h" #include "bus/vic20/exp.h" #include "bus/vic20/user.h" #include "cpu/m6502/m6510.h" -#include "machine/6522via.h" -#include "cbm_snqk.h" #include "imagedev/snapquik.h" +#include "machine/6522via.h" #include "machine/ram.h" #include "sound/mos6560.h" +#include "screen.h" +#include "softlist_dev.h" +#include "speaker.h" + namespace { diff --git a/src/mame/ddr/kc_m.cpp b/src/mame/ddr/kc_m.cpp index 7a04e766c44..01a5cd7a067 100644 --- a/src/mame/ddr/kc_m.cpp +++ b/src/mame/ddr/kc_m.cpp @@ -42,7 +42,7 @@ QUICKLOAD_LOAD_MEMBER(kc_state::quickload_cb) return image_error::INVALIDLENGTH; std::vector data(size); - image.fread( &data[0], size); + image.fread(&data[0], size); header = (struct kcc_header *) &data[0]; addr = (header->load_address_l & 0x0ff) | ((header->load_address_h & 0x0ff)<<8); diff --git a/src/mame/dec/pdp1.h b/src/mame/dec/pdp1.h index 4b626049307..6959351a7a7 100644 --- a/src/mame/dec/pdp1.h +++ b/src/mame/dec/pdp1.h @@ -188,11 +188,11 @@ public: void iot_rrb(int op2, int nac, int mb, int &io, int ac); protected: - // device-level overrides + // device_t implementation virtual void device_resolve_objects() override; virtual void device_start() override; - // image-level overrides + // device_image_interface implementation virtual const char *file_extensions() const noexcept override { return "tap,rim"; } virtual std::error_condition call_load() override; @@ -234,11 +234,11 @@ public: void iot_ppb(int op2, int nac, int mb, int &io, int ac); protected: - // device-level overrides + // device_t implementation virtual void device_resolve_objects() override; virtual void device_start() override; - // image-level overrides + // device_image_interface implementation virtual bool is_readable() const noexcept override { return false; } virtual bool is_writeable() const noexcept override { return true; } virtual bool is_creatable() const noexcept override { return true; } @@ -277,11 +277,11 @@ public: void iot_tyi(int op2, int nac, int mb, int &io, int ac); protected: - // device-level overrides + // device_t implementation virtual void device_resolve_objects() override; virtual void device_start() override; - // image-level overrides + // device_image_interface implementation virtual bool is_readable() const noexcept override { return false; } virtual bool is_writeable() const noexcept override { return true; } virtual bool is_creatable() const noexcept override { return true; } @@ -335,10 +335,10 @@ public: void iot_dra(int op2, int nac, int mb, int &io, int ac); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; - // image-level overrides + // device_image_interface implementation virtual bool is_readable() const noexcept override { return true; } virtual bool is_writeable() const noexcept override { return true; } virtual bool is_creatable() const noexcept override { return true; } @@ -386,8 +386,8 @@ struct lightpen_t class pdp1_state : public driver_device { public: - pdp1_state(const machine_config &mconfig, device_type type, const char *tag) - : driver_device(mconfig, type, tag), + pdp1_state(const machine_config &mconfig, device_type type, const char *tag) : + driver_device(mconfig, type, tag), m_maincpu(*this, "maincpu"), m_tape_reader(*this, "readt"), m_tape_puncher(*this, "punch"), diff --git a/src/mame/fujitsu/fmt_icmem.cpp b/src/mame/fujitsu/fmt_icmem.cpp index 4cfad33fbfe..be155c2d621 100644 --- a/src/mame/fujitsu/fmt_icmem.cpp +++ b/src/mame/fujitsu/fmt_icmem.cpp @@ -20,14 +20,14 @@ DEFINE_DEVICE_TYPE(FMT_ICMEM, fmt_icmem_device, "fmt_icmem", "FM Towns IC Memory // fmt_icmem_device - constructor //------------------------------------------------- -fmt_icmem_device::fmt_icmem_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) - : device_t(mconfig, FMT_ICMEM, tag, owner, clock), - device_memcard_image_interface(mconfig, *this), - m_writeprotect(*this,"icmem"), - m_change(false), - m_attr_select(false), - m_detect(false), - m_bank(0) +fmt_icmem_device::fmt_icmem_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, FMT_ICMEM, tag, owner, clock), + device_memcard_image_interface(mconfig, *this), + m_writeprotect(*this,"icmem"), + m_change(false), + m_attr_select(false), + m_detect(false), + m_bank(0) { } diff --git a/src/mame/shared/z80bin.h b/src/mame/shared/z80bin.h index 629cb97dda9..9e317e7ade3 100644 --- a/src/mame/shared/z80bin.h +++ b/src/mame/shared/z80bin.h @@ -13,6 +13,12 @@ #pragma once +#include +#include +#include +#include + + class snapshot_image_device; std::error_condition z80bin_load_file(snapshot_image_device &image, address_space &space, uint16_t &exec_addr, uint16_t &start_addr, uint16_t &end_addr); -- cgit v1.2.3