From b3e50dfa6a2035bda05ac52219968b0887fa8501 Mon Sep 17 00:00:00 2001 From: Vas Crabb Date: Tue, 4 Apr 2023 16:40:41 +1000 Subject: Small fixes and cleanup: * emu/devfind.h: Allow range-based for loops on memory share finders. * emu/emucore.h: Choose correct emu_fatalerror constructor when format string is an rvalue. * osborne/osborne1.cpp: Allocate main RAM as a flat share, and use a view to switch in atttribute RAM. * Reduced scope of some variables and edited some copy/pasted comments. --- src/devices/bus/aquarius/slot.h | 6 +- src/devices/bus/astrocde/slot.h | 8 +- src/devices/bus/coco/cococart.h | 4 +- src/devices/bus/ekara/slot.h | 6 +- src/devices/bus/gba/gba_slot.h | 6 +- src/devices/bus/intv/slot.h | 4 +- src/devices/bus/jakks_gamekey/slot.h | 8 +- src/devices/bus/m5/slot.h | 8 +- src/devices/bus/mc10/mc10_cart.cpp | 4 +- src/devices/bus/mc10/mc10_cart.h | 17 ++--- src/devices/bus/megadrive/md_slot.h | 18 +++-- src/devices/bus/mononcol/slot.h | 4 +- src/devices/bus/mtx/exp.h | 6 +- src/devices/bus/nabupc/adapter.h | 8 +- src/devices/bus/nes/nes_slot.h | 6 +- src/devices/bus/odyssey2/slot.h | 6 +- src/devices/bus/pce/pce_slot.h | 6 +- src/devices/bus/ql/rom.h | 6 +- src/devices/bus/saturn/sat_slot.h | 6 +- src/devices/bus/sega8/sega8_slot.h | 8 +- src/devices/bus/snes/snes_slot.h | 6 +- src/devices/bus/vectrex/slot.h | 8 +- src/devices/bus/vidbrain/exp.h | 6 +- src/devices/imagedev/avivideo.h | 4 +- src/devices/imagedev/microdrv.h | 4 +- src/devices/imagedev/picture.h | 4 +- src/devices/machine/ds6417.h | 6 +- src/emu/devfind.h | 55 ++++++++++++++ src/emu/emucore.h | 8 +- src/mame/mchester/ssem.cpp | 21 ++---- src/mame/memotech/mtx_m.cpp | 8 +- src/mame/microkey/primo_m.cpp | 2 +- src/mame/mit/tx0.cpp | 16 ++-- src/mame/mits/altair.cpp | 6 +- src/mame/motorola/mekd2.cpp | 4 +- src/mame/nascom/nascom1.cpp | 11 ++- src/mame/neogeo/ng_memcard.cpp | 14 ++-- src/mame/neogeo/ng_memcard.h | 4 +- src/mame/netronics/elf.cpp | 2 +- src/mame/nichibutsu/myvision.cpp | 20 ++--- src/mame/nintendo/n64.cpp | 2 +- src/mame/osborne/osborne1.cpp | 93 ++++++++++-------------- src/mame/pc/ibmpcjr.cpp | 4 +- src/mame/pce/tourvis.cpp | 13 ++-- src/mame/pitronics/beta.cpp | 2 +- src/mame/psion/psion_pack.h | 4 +- src/mame/psion/psion_ssd.h | 4 +- src/mame/robotron/z1013.cpp | 19 ++--- src/mame/roland/roland_cm32p.cpp | 16 ++-- src/mame/roland/roland_r8.cpp | 12 +-- src/mame/sega/sega_beena.cpp | 2 +- src/mame/sfrj/galaxy.cpp | 2 +- src/mame/sharp/pce220.cpp | 7 +- src/mame/sharp/pce220_ser.cpp | 12 +++ src/mame/sharp/pce220_ser.h | 35 ++++----- src/mame/sharp/wizard.cpp | 2 +- src/mame/sinclair/spec_snqk.cpp | 29 ++++---- src/mame/sinclair/timex.cpp | 2 +- src/mame/skeleton/c2color.cpp | 2 +- src/mame/skeleton/cd2650.cpp | 2 +- src/mame/skeleton/cosmicos.cpp | 6 +- src/mame/skeleton/digiblast.cpp | 2 +- src/mame/skeleton/easy_karaoke.cpp | 2 +- src/mame/skeleton/i7000.cpp | 16 ++-- src/mame/skeleton/squale.cpp | 2 +- src/mame/snk/ngp.cpp | 2 +- src/mame/sony/pockstat.cpp | 2 +- src/mame/sony/psxcd.h | 2 + src/mame/sony/smc777.cpp | 6 +- src/mame/svi/svi318.cpp | 2 +- src/mame/ta/alphatro.cpp | 2 +- src/mame/tatung/einstein.cpp | 8 +- src/mame/telercas/tmc1800.cpp | 8 +- src/mame/thomson/thomson_m.cpp | 53 +++++++------- src/mame/ti/avigo.cpp | 2 +- src/mame/ti/snspell.cpp | 2 +- src/mame/tiger/gamecom.h | 17 +++-- src/mame/tiger/gamecom_m.cpp | 6 +- src/mame/tiger/k28m2.cpp | 4 +- src/mame/trs/coco_vhd.h | 2 +- src/mame/trs/trs80_m.cpp | 18 ++--- src/mame/trs/trs80m3_m.cpp | 12 +-- src/mame/tvgames/elan_eu3a05.cpp | 4 +- src/mame/tvgames/generalplus_gpl16250_mobigo.cpp | 4 +- src/mame/tvgames/generalplus_gpl16250_nand.cpp | 2 +- src/mame/tvgames/generalplus_gpl16250_spi.cpp | 2 +- src/mame/tvgames/generalplus_gpl32612.cpp | 2 +- src/mame/tvgames/hyperscan_card.h | 3 +- src/mame/tvgames/magiceyes_pollux_vr3520f.cpp | 2 +- src/mame/tvgames/pubint_storyreader.cpp | 2 +- src/mame/tvgames/spg110.cpp | 2 +- src/mame/tvgames/spg2xx_ican.cpp | 4 +- src/mame/tvgames/spg2xx_smarttv.cpp | 4 +- src/mame/tvgames/spg2xx_telestory.cpp | 4 +- src/mame/tvgames/spg2xx_tvgogo.cpp | 4 +- src/mame/tvgames/spg2xx_vii.cpp | 4 +- src/mame/ussr/lviv.h | 2 +- 97 files changed, 437 insertions(+), 402 deletions(-) diff --git a/src/devices/bus/aquarius/slot.h b/src/devices/bus/aquarius/slot.h index 6a8abad1492..aae1d082bc9 100644 --- a/src/devices/bus/aquarius/slot.h +++ b/src/devices/bus/aquarius/slot.h @@ -44,14 +44,14 @@ public: auto irq_handler() { return m_irq_handler.bind(); } auto nmi_handler() { return m_nmi_handler.bind(); } - // 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 "aquarius_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; // reading and writing @@ -66,7 +66,7 @@ public: DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_nmi_handler(state); } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; device_aquarius_cartridge_interface *m_cart; diff --git a/src/devices/bus/astrocde/slot.h b/src/devices/bus/astrocde/slot.h index 10c1362c993..b7670b63eda 100644 --- a/src/devices/bus/astrocde/slot.h +++ b/src/devices/bus/astrocde/slot.h @@ -66,7 +66,7 @@ public: astrocade_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~astrocade_cart_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override {} @@ -74,7 +74,7 @@ public: virtual const char *image_interface() const noexcept override { return "astrocde_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; } @@ -83,11 +83,11 @@ public: uint8_t read_rom(offs_t offset); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; int m_type; - device_astrocade_cart_interface* m_cart; + device_astrocade_cart_interface *m_cart; }; // device type definition diff --git a/src/devices/bus/coco/cococart.h b/src/devices/bus/coco/cococart.h index 2b81319d0d3..867b309fca8 100644 --- a/src/devices/bus/coco/cococart.h +++ b/src/devices/bus/coco/cococart.h @@ -67,10 +67,10 @@ public: auto nmi_callback() { return m_nmi_callback.bind(); } auto halt_callback() { return m_halt_callback.bind(); } - // 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/ekara/slot.h b/src/devices/bus/ekara/slot.h index f766e35a49f..e0cccf808bd 100644 --- a/src/devices/bus/ekara/slot.h +++ b/src/devices/bus/ekara/slot.h @@ -80,7 +80,7 @@ public: virtual ~ekara_cart_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override {} @@ -88,7 +88,7 @@ public: virtual const char *image_interface() const noexcept override { return "ekara_cart"; } virtual const char *file_extensions() const noexcept override { return "bin,u1"; } - // 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; } @@ -114,7 +114,7 @@ public: bool has_cart() { return m_cart ? true : false; } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; int m_type; diff --git a/src/devices/bus/gba/gba_slot.h b/src/devices/bus/gba/gba_slot.h index 45cea852b82..5977a5b7b39 100644 --- a/src/devices/bus/gba/gba_slot.h +++ b/src/devices/bus/gba/gba_slot.h @@ -97,7 +97,7 @@ public: gba_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~gba_cart_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; @@ -105,7 +105,7 @@ public: virtual const char *image_interface() const noexcept override { return "gba_cart"; } virtual const char *file_extensions() const noexcept override { return "gba,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; } @@ -125,7 +125,7 @@ public: virtual void write_mapper(offs_t offset, uint32_t data) { if (m_cart) m_cart->write_mapper(offset, data); } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; int m_type; diff --git a/src/devices/bus/intv/slot.h b/src/devices/bus/intv/slot.h index 526996fd969..bf8f34bc77a 100644 --- a/src/devices/bus/intv/slot.h +++ b/src/devices/bus/intv/slot.h @@ -111,7 +111,7 @@ public: intv_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~intv_cart_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override {} @@ -119,7 +119,7 @@ public: virtual const char *image_interface() const noexcept override { return "intv_cart"; } virtual const char *file_extensions() const noexcept override { return "bin,int,rom,itv"; } - // 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; } diff --git a/src/devices/bus/jakks_gamekey/slot.h b/src/devices/bus/jakks_gamekey/slot.h index 7949b339802..305a099b70b 100644 --- a/src/devices/bus/jakks_gamekey/slot.h +++ b/src/devices/bus/jakks_gamekey/slot.h @@ -68,7 +68,7 @@ public: virtual ~jakks_gamekey_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override { } @@ -76,7 +76,7 @@ public: virtual const char *image_interface() const noexcept override { return "jakks_gamekey"; } virtual const char *file_extensions() const noexcept override { return "bin,u1"; } - // 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; } @@ -92,11 +92,11 @@ public: bool has_cart() { return m_cart ? true : false; } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; int m_type; - device_jakks_gamekey_interface* m_cart; + device_jakks_gamekey_interface *m_cart; }; // device type definition diff --git a/src/devices/bus/m5/slot.h b/src/devices/bus/m5/slot.h index 6a19ab83b53..36a9658ffc6 100644 --- a/src/devices/bus/m5/slot.h +++ b/src/devices/bus/m5/slot.h @@ -79,7 +79,7 @@ public: m5_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~m5_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 "m5_cart"; } virtual const char *file_extensions() const noexcept override { return "bin,rom"; } - // 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; } @@ -100,11 +100,11 @@ public: void write_ram(offs_t offset, uint8_t data); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; int m_type; - device_m5_cart_interface* m_cart; + device_m5_cart_interface *m_cart; }; diff --git a/src/devices/bus/mc10/mc10_cart.cpp b/src/devices/bus/mc10/mc10_cart.cpp index d02314cdf93..9e9026c503b 100644 --- a/src/devices/bus/mc10/mc10_cart.cpp +++ b/src/devices/bus/mc10/mc10_cart.cpp @@ -60,8 +60,8 @@ mc10cart_slot_device::mc10cart_slot_device(const machine_config &mconfig, const device_single_card_slot_interface(mconfig, *this), device_cartrom_image_interface(mconfig, *this), m_nmi_callback(*this), - m_cart(nullptr), - m_memspace(*this, finder_base::DUMMY_TAG, -1) + m_memspace(*this, finder_base::DUMMY_TAG, -1), + m_cart(nullptr) { } diff --git a/src/devices/bus/mc10/mc10_cart.h b/src/devices/bus/mc10/mc10_cart.h index 8bfe283a6f5..dd9e4b8235b 100644 --- a/src/devices/bus/mc10/mc10_cart.h +++ b/src/devices/bus/mc10/mc10_cart.h @@ -49,10 +49,7 @@ public: // address map manipulations address_space &memspace() const { return *m_memspace; } - // device-level overrides - 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; } @@ -63,16 +60,18 @@ public: void set_nmi_line(int state); devcb_write_line m_nmi_callback; - // slot interface overrides + // device_slot_interface implementation virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; -private: +protected: + // device_t implementation + virtual void device_start() override; + required_address_space m_memspace; + +private: // cartridge device_mc10cart_interface *m_cart; - -protected: - required_address_space m_memspace; }; // device type definition diff --git a/src/devices/bus/megadrive/md_slot.h b/src/devices/bus/megadrive/md_slot.h index 3918de51d50..86a031db9ed 100644 --- a/src/devices/bus/megadrive/md_slot.h +++ b/src/devices/bus/megadrive/md_slot.h @@ -27,7 +27,7 @@ enum // Cart + NVRAM SEGA_SRAM, SEGA_FRAM, HARDBALL95, /* Hardball 95 uses different sram start address */ - XINQIG, /* Xin Qigai Wangzi uses different sram start address and has no valid header */ + XINQIG, /* Xin Qigai Wangzi uses different sram start address and has no valid header */ BEGGARP, /* Beggar Prince uses different sram start address + bankswitch tricks */ WUKONG, /* Legend of Wukong uses different sram start address + bankswitch trick for last 128K of ROM */ STARODYS, /* Star Odyssey */ @@ -35,7 +35,7 @@ enum // EEPROM SEGA_EEPROM, /* Wonder Boy V / Evander Holyfield's Boxing / Greatest Heavyweights of the Ring / Sports Talk Baseball / Megaman */ NBA_JAM, /* NBA Jam */ - NBA_JAM_ALT, /* NBA Jam */ + NBA_JAM_ALT, /* NBA Jam */ NBA_JAM_TE, /* NBA Jam TE / NFL Quarterback Club */ NFL_QB_96, /* NFL Quarterback Club '96 */ C_SLAM, /* College Slam / Frank Thomas Big Hurt Baseball */ @@ -156,13 +156,13 @@ public: // construction/destruction virtual ~base_md_cart_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; virtual bool is_reset_on_load() const noexcept override { return true; } - // 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; } @@ -188,7 +188,7 @@ public: virtual int read_test() { if (m_cart) return m_cart->read_test(); else return 0; } // used by Virtua Racing test -// TODO: this only needs to be public because megasvp copies rom into memory region, so we need to rework that code... +// TODO: this only needs to be public because megasvp copies ROM into memory region, so we need to rework that code... //private: int m_type; @@ -197,7 +197,7 @@ public: protected: base_md_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; }; @@ -218,6 +218,8 @@ public: } md_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // device_image_interface implementation virtual const char *image_interface() const noexcept override { return "megadriv_cart"; } virtual const char *file_extensions() const noexcept override { return "smd,bin,md,gen"; } }; @@ -238,6 +240,8 @@ public: set_fixed(false); } pico_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // device_image_interface implementation virtual const char *image_interface() const noexcept override { return "pico_cart"; } virtual const char *file_extensions() const noexcept override { return "bin,md"; } }; @@ -258,6 +262,8 @@ public: set_fixed(false); } copera_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // device_image_interface implementation virtual const char *image_interface() const noexcept override { return "copera_cart"; } virtual const char *file_extensions() const noexcept override { return "bin,md"; } }; diff --git a/src/devices/bus/mononcol/slot.h b/src/devices/bus/mononcol/slot.h index 9e8567dbcf2..bac80451532 100644 --- a/src/devices/bus/mononcol/slot.h +++ b/src/devices/bus/mononcol/slot.h @@ -57,7 +57,7 @@ public: virtual char const *image_interface() const noexcept override { return "monon_color_cart"; } virtual char const *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; uint8_t read() @@ -84,7 +84,7 @@ public: protected: mononcol_cartslot_device(machine_config const &mconfig, device_type type, char const *tag, device_t *owner, u32 clock); - // device-level overrides + // device_t implementation virtual void device_start() override ATTR_COLD; device_mononcol_cart_interface *m_cart; diff --git a/src/devices/bus/mtx/exp.h b/src/devices/bus/mtx/exp.h index f99181c2927..62f0c33fbff 100644 --- a/src/devices/bus/mtx/exp.h +++ b/src/devices/bus/mtx/exp.h @@ -56,17 +56,17 @@ public: virtual void bankswitch(uint8_t data); 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 "mtx_cart"; } virtual const char *file_extensions() const noexcept override { return "bin,rom"; } - // slot interface overrides + // device_slot_interface implementation virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; private: diff --git a/src/devices/bus/nabupc/adapter.h b/src/devices/bus/nabupc/adapter.h index 6dbf4bdfb96..e311532b89d 100644 --- a/src/devices/bus/nabupc/adapter.h +++ b/src/devices/bus/nabupc/adapter.h @@ -34,7 +34,7 @@ public: // constructor/destructor network_adapter(machine_config const &mconfig, char const *tag, device_t *owner, u32 clock); - // image-level overrides + // device_image_interface implementation virtual bool is_readable() const noexcept override { return true; } virtual bool is_writeable() const noexcept override { return false; } virtual bool is_creatable() const noexcept override { return false; } @@ -45,15 +45,15 @@ public: virtual const char *image_brief_type_name() const noexcept override { return "hcca"; } virtual std::error_condition call_load() override; - virtual DECLARE_WRITE_LINE_MEMBER(input_txd) override; + protected: - // device overrides + // device_t implementation virtual ioport_constructor device_input_ports() const override; virtual void device_start() override; virtual void device_reset() override; - // device_buffered_serial_interface overrides + // device_buffered_serial_interface implementation virtual void tra_callback() override; private: diff --git a/src/devices/bus/nes/nes_slot.h b/src/devices/bus/nes/nes_slot.h index f9ed0b16494..3a49c942ab9 100644 --- a/src/devices/bus/nes/nes_slot.h +++ b/src/devices/bus/nes/nes_slot.h @@ -398,7 +398,7 @@ public: nes_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~nes_cart_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; @@ -407,7 +407,7 @@ public: virtual const char *file_extensions() const noexcept override { return "nes,unf,unif"; } virtual u32 unhashed_header_length() const noexcept override { return 16; } - // slot interface overrides + // device_slot_interface implementation virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; // reading and writing @@ -438,7 +438,7 @@ public: int m_pcb_id; protected: - // device-level overrides + // device_t implementation virtual void device_start() override; const char * get_default_card_ines(get_default_card_software_hook &hook, const uint8_t *ROM, uint32_t len) const; diff --git a/src/devices/bus/odyssey2/slot.h b/src/devices/bus/odyssey2/slot.h index f0c2f3db666..48bece68d9e 100644 --- a/src/devices/bus/odyssey2/slot.h +++ b/src/devices/bus/odyssey2/slot.h @@ -112,7 +112,7 @@ public: o2_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0); virtual ~o2_cart_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override { } @@ -120,7 +120,7 @@ public: virtual const char *image_interface() const noexcept override { return "odyssey_cart"; } virtual const char *file_extensions() const noexcept override { return "bin,rom"; } - // 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; } @@ -140,7 +140,7 @@ public: void write_p2(u8 data) { if (m_cart) m_cart->write_p2(data); } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; int m_type; diff --git a/src/devices/bus/pce/pce_slot.h b/src/devices/bus/pce/pce_slot.h index a702c2f4f7d..648d138ac0d 100644 --- a/src/devices/bus/pce/pce_slot.h +++ b/src/devices/bus/pce/pce_slot.h @@ -80,7 +80,7 @@ public: pce_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~pce_cart_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; @@ -88,7 +88,7 @@ public: virtual const char *image_interface() const noexcept override { return m_interface; } virtual const char *file_extensions() const noexcept override { return "pce,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,7 +101,7 @@ public: void write_cart(offs_t offset, uint8_t data); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; const char *m_interface; diff --git a/src/devices/bus/ql/rom.h b/src/devices/bus/ql/rom.h index 6e8cb6765e8..ec56cbcaccc 100644 --- a/src/devices/bus/ql/rom.h +++ b/src/devices/bus/ql/rom.h @@ -91,18 +91,18 @@ public: DECLARE_WRITE_LINE_MEMBER( romoeh_w ) { if (m_card) m_card->romoeh_w(state); } 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 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 "ql_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; device_ql_rom_cartridge_card_interface *m_card; diff --git a/src/devices/bus/saturn/sat_slot.h b/src/devices/bus/saturn/sat_slot.h index 1776501a038..fcf721c47e2 100644 --- a/src/devices/bus/saturn/sat_slot.h +++ b/src/devices/bus/saturn/sat_slot.h @@ -79,7 +79,7 @@ public: sat_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~sat_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 "sat_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_cart_type(); @@ -102,7 +102,7 @@ public: virtual void write_ext_bram(offs_t offset, uint32_t data, uint32_t mem_mask = ~0); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; private: diff --git a/src/devices/bus/sega8/sega8_slot.h b/src/devices/bus/sega8/sega8_slot.h index d29f268bda0..a1293ca2a2e 100644 --- a/src/devices/bus/sega8/sega8_slot.h +++ b/src/devices/bus/sega8/sega8_slot.h @@ -116,7 +116,7 @@ public: sega8_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~sega8_cart_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; @@ -124,7 +124,7 @@ public: virtual const char *image_interface() const noexcept override { return "sms_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; } @@ -152,12 +152,12 @@ public: protected: sega8_cart_slot_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock, bool is_card = false); - // device-level overrides + // device_t implementation virtual void device_start() override; int m_type; bool const m_is_card; - device_sega8_cart_interface* m_cart; + device_sega8_cart_interface *m_cart; }; // ======================> sega8_card_slot_device diff --git a/src/devices/bus/snes/snes_slot.h b/src/devices/bus/snes/snes_slot.h index 10c750960ae..3bde7ffc8e7 100644 --- a/src/devices/bus/snes/snes_slot.h +++ b/src/devices/bus/snes/snes_slot.h @@ -177,13 +177,13 @@ public: void set_scanlines(int scanlines) { m_scanlines = scanlines; } void set_address(offs_t address) { m_address = address; } - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; virtual bool is_reset_on_load() const noexcept override { return true; } - // slot interface overrides + // device_slot_interface implementation virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override; void get_cart_type_addon(const uint8_t *ROM, uint32_t len, int &type, int &addon) const; @@ -236,7 +236,7 @@ public: protected: base_sns_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: diff --git a/src/devices/bus/vectrex/slot.h b/src/devices/bus/vectrex/slot.h index b90d3903777..e7216f3a0fe 100644 --- a/src/devices/bus/vectrex/slot.h +++ b/src/devices/bus/vectrex/slot.h @@ -67,7 +67,7 @@ public: vectrex_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~vectrex_cart_slot_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override { } @@ -75,7 +75,7 @@ public: virtual const char *image_interface() const noexcept override { return "vectrex_cart"; } virtual const char *file_extensions() const noexcept override { return "bin,gam,vec"; } - // 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; } @@ -87,11 +87,11 @@ public: void write_bank(uint8_t data); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; int m_type, m_vec3d; - device_vectrex_cart_interface* m_cart; + device_vectrex_cart_interface *m_cart; }; diff --git a/src/devices/bus/vidbrain/exp.h b/src/devices/bus/vidbrain/exp.h index 8cbaad2e274..0e9f4418839 100644 --- a/src/devices/bus/vidbrain/exp.h +++ b/src/devices/bus/vidbrain/exp.h @@ -116,17 +116,17 @@ public: DECLARE_WRITE_LINE_MEMBER( extres_w ) { m_write_extres(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 "vidbrain_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; devcb_write_line m_write_extres; diff --git a/src/devices/imagedev/avivideo.h b/src/devices/imagedev/avivideo.h index d03396f8b52..a39d6b40d84 100644 --- a/src/devices/imagedev/avivideo.h +++ b/src/devices/imagedev/avivideo.h @@ -29,7 +29,7 @@ public: avivideo_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~avivideo_image_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; @@ -44,7 +44,7 @@ public: bitmap_argb32 &get_frame() { return *m_frame; } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_reset() override; diff --git a/src/devices/imagedev/microdrv.h b/src/devices/imagedev/microdrv.h index efa55c8968f..62c7b717ce6 100644 --- a/src/devices/imagedev/microdrv.h +++ b/src/devices/imagedev/microdrv.h @@ -39,7 +39,7 @@ public: auto comms_out_wr_callback() { return m_write_comms_out.bind(); } - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; @@ -58,7 +58,7 @@ public: DECLARE_READ_LINE_MEMBER ( data2_r ); protected: - // device-level overrides + // device_t implementation virtual void device_start() override; TIMER_CALLBACK_MEMBER(bit_timer); diff --git a/src/devices/imagedev/picture.h b/src/devices/imagedev/picture.h index 2e88a4b4de5..ac7d439dec8 100644 --- a/src/devices/imagedev/picture.h +++ b/src/devices/imagedev/picture.h @@ -29,7 +29,7 @@ public: picture_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0); virtual ~picture_image_device(); - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; @@ -44,7 +44,7 @@ public: const bitmap_argb32 &get_bitmap() { return m_picture; } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; private: diff --git a/src/devices/machine/ds6417.h b/src/devices/machine/ds6417.h index beccdbe3c60..007f2072784 100644 --- a/src/devices/machine/ds6417.h +++ b/src/devices/machine/ds6417.h @@ -3,8 +3,8 @@ // Only known to be used by the Tandy VIS -#ifndef MAME_MACHINE_DS6417_H_ -#define MAME_MACHINE_DS6417_H_ +#ifndef MAME_MACHINE_DS6417_H +#define MAME_MACHINE_DS6417_H #pragma once @@ -60,4 +60,4 @@ private: DECLARE_DEVICE_TYPE(DS6417, ds6417_device) -#endif /* MAME_MACHINE_DS6417_H_ */ +#endif // MAME_MACHINE_DS6417_H diff --git a/src/emu/devfind.h b/src/emu/devfind.h index c8884d9582f..6e8b078bc56 100644 --- a/src/emu/devfind.h +++ b/src/emu/devfind.h @@ -1186,6 +1186,33 @@ public: /// been found. size_t bytes() const { return m_bytes; } + /// \brief Get iterator to first element + /// + /// Returns an iterator to the first element of the memory share. + /// \return Iterator to first element. + PointerType *begin() const { return this->m_target; } + + /// \brief Get iterator beyond last element + /// + /// Returns an iterator one past the last element of the memory + /// share. + /// \return Iterator one past last element. + PointerType *end() const { return this->m_target + length(); } + + /// \brief Get constant iterator to first element + /// + /// Returns a constant iterator to the first element of the memory + /// share. + /// \return Constant iterator to first element. + PointerType const *cbegin() const { return this->m_target; } + + /// \brief Get constant iterator beyond last element + /// + /// Returns a constant iterator one past the last element of the + /// memory share. + /// \return Constant iterator one past last element. + PointerType const *cend() const { return this->m_target + length(); } + private: /// \brief Find memory share base pointer /// @@ -1312,6 +1339,34 @@ public: /// \return Memory share width in bytes. u8 bytewidth() const { return m_target->bytewidth(); } + /// \brief Get iterator to first element + /// + /// Returns an iterator to the first element of the memory share. + /// Must not be called before creation is attempted. + /// \return Iterator to first element. + PointerType *begin() const { return target(); } + + /// \brief Get iterator beyond last element + /// + /// Returns an iterator one past the last element of the memory + /// share. Must not be called before creation is attempted. + /// \return Iterator one past last element. + PointerType *end() const { return target() + length(); } + + /// \brief Get constant iterator to first element + /// + /// Returns a constant iterator to the first element of the memory + /// share. Must not be called before creation is attempted. + /// \return Constant iterator to first element. + PointerType const *cbegin() const { return target(); } + + /// \brief Get constant iterator beyond last element + /// + /// Returns a constant iterator one past the last element of the + /// memory share. Must not be called before creation is attempted. + /// \return Constant iterator one past last element. + PointerType const *cend() const { return target() + length(); } + protected: virtual bool findit(validity_checker *valid) override; virtual void end_configuration() override; diff --git a/src/emu/emucore.h b/src/emu/emucore.h index 24942975a29..d87ea5ca3af 100644 --- a/src/emu/emucore.h +++ b/src/emu/emucore.h @@ -232,13 +232,13 @@ public: emu_fatalerror(int _exitcode, util::format_argument_pack const &args); template - emu_fatalerror(Format const &fmt, Params &&... args) - : emu_fatalerror(static_cast const &>(util::make_format_argument_pack(fmt, std::forward(args)...))) + emu_fatalerror(Format &&fmt, Params &&... args) + : emu_fatalerror(static_cast const &>(util::make_format_argument_pack(std::forward(fmt), std::forward(args)...))) { } template - emu_fatalerror(int _exitcode, Format const &fmt, Params &&... args) - : emu_fatalerror(_exitcode, static_cast const &>(util::make_format_argument_pack(fmt, std::forward(args)...))) + emu_fatalerror(int _exitcode, Format &&fmt, Params &&... args) + : emu_fatalerror(_exitcode, static_cast const &>(util::make_format_argument_pack(std::forward(fmt), std::forward(args)...))) { } diff --git a/src/mame/mchester/ssem.cpp b/src/mame/mchester/ssem.cpp index 0e5272eb6f2..02d2e55b561 100644 --- a/src/mame/mchester/ssem.cpp +++ b/src/mame/mchester/ssem.cpp @@ -615,26 +615,19 @@ QUICKLOAD_LOAD_MEMBER(ssem_state::quickload_cb) if (buffer == "num") word = unsigned_value; - else - if (buffer == "jmp") + else if (buffer == "jmp") word = 0x00000000 | unsigned_value ; - else - if (buffer == "jrp") + else if (buffer == "jrp") word = 0x00040000 | unsigned_value; - else - if (buffer == "ldn") + else if (buffer == "ldn") word = 0x00020000 | unsigned_value; - else - if (buffer == "sto") + else if (buffer == "sto") word = 0x00060000 | unsigned_value; - else - if (buffer == "sub") + else if (buffer == "sub") word = 0x00010000 | unsigned_value; - else - if (buffer == "cmp") + else if (buffer == "cmp") word = 0x00030000 | unsigned_value; - else - if (buffer == "stp") + else if (buffer == "stp") word = 0x00070000 | unsigned_value; else logerror("Unknown opcode (%s) in line %d\n",buffer,i+2); diff --git a/src/mame/memotech/mtx_m.cpp b/src/mame/memotech/mtx_m.cpp index 76c7b6f0a0f..b2b4ad02ce9 100644 --- a/src/mame/memotech/mtx_m.cpp +++ b/src/mame/memotech/mtx_m.cpp @@ -418,7 +418,7 @@ DEVICE_IMAGE_LOAD_MEMBER( mtx_state::extrom_load ) ***************************************************************************/ // this only works for some of the files, nothing which tries to load -// more data from tape. todo: tapes which autorun after loading +// more data from tape. TODO: tapes which autorun after loading SNAPSHOT_LOAD_MEMBER(mtx_state::snapshot_cb) { uint64_t length = image.length(); @@ -486,7 +486,7 @@ SNAPSHOT_LOAD_MEMBER(mtx_state::snapshot_cb) QUICKLOAD_LOAD_MEMBER(mtx_state::quickload_cb) { - uint64_t length = image.length(); + uint64_t const length = image.length(); if (length < 4) { @@ -507,8 +507,8 @@ QUICKLOAD_LOAD_MEMBER(mtx_state::quickload_cb) return image_error::UNSPECIFIED; } - uint16_t code_base = pick_integer_le(data.get(), 0, 2); - uint16_t code_length = pick_integer_le(data.get(), 2, 2); + uint16_t const code_base = pick_integer_le(data.get(), 0, 2); + uint16_t const code_length = pick_integer_le(data.get(), 2, 2); if (length < code_length) { diff --git a/src/mame/microkey/primo_m.cpp b/src/mame/microkey/primo_m.cpp index 8fb72d18e8d..daaf76a7390 100644 --- a/src/mame/microkey/primo_m.cpp +++ b/src/mame/microkey/primo_m.cpp @@ -322,7 +322,7 @@ void primo_state::setup_pp(uint8_t* quickload_data, uint32_t quickload_size) QUICKLOAD_LOAD_MEMBER(primo_state::quickload_cb) { - size_t quickload_size = image.length(); + size_t const quickload_size = image.length(); std::vector quickload_data(quickload_size); if (image.fread(&quickload_data[0], quickload_size) != quickload_size) diff --git a/src/mame/mit/tx0.cpp b/src/mame/mit/tx0.cpp index 06e8ccf17bf..1f47a14a4af 100644 --- a/src/mame/mit/tx0.cpp +++ b/src/mame/mit/tx0.cpp @@ -366,7 +366,7 @@ public: // construction/destruction tx0_readtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // 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; @@ -374,7 +374,7 @@ public: virtual const char *image_interface() const noexcept override { return "tx0_ptp"; } protected: - // device-level overrides + // device_t implementation virtual void device_start() override { } private: @@ -395,7 +395,7 @@ public: // construction/destruction tx0_punchtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // 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; @@ -403,7 +403,7 @@ public: virtual void call_unload() override; protected: - // device-level overrides + // device_t implementation virtual void device_start() override { } private: @@ -426,7 +426,7 @@ public: // construction/destruction tx0_printer_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_readable() const noexcept override { return false; } virtual bool is_writeable() const noexcept override { return true; } virtual bool is_creatable() const noexcept override { return true; } @@ -440,7 +440,7 @@ public: virtual void call_unload() override; protected: - // device-level overrides + // device_t implementation virtual void device_start() override { } private: @@ -462,14 +462,14 @@ public: // construction/destruction tx0_magtape_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - // image-level overrides + // device_image_interface implementation virtual const char *file_extensions() const noexcept override { return "tap"; } virtual std::error_condition call_load() override; virtual void call_unload() override; protected: - // device-level overrides + // device_t implementation virtual void device_start() override; private: diff --git a/src/mame/mits/altair.cpp b/src/mame/mits/altair.cpp index 65c5e417720..3761f88d65d 100644 --- a/src/mame/mits/altair.cpp +++ b/src/mame/mits/altair.cpp @@ -96,12 +96,10 @@ INPUT_PORTS_END QUICKLOAD_LOAD_MEMBER(altair_state::quickload_cb) { - int quick_length; - int read_; - quick_length = image.length(); + int const quick_length = image.length(); if (quick_length >= 0xfd00) return image_error::INVALIDLENGTH; - read_ = image.fread(m_ram, quick_length); + int const read_ = image.fread(m_ram, quick_length); if (read_ != quick_length) return image_error::UNSPECIFIED; diff --git a/src/mame/motorola/mekd2.cpp b/src/mame/motorola/mekd2.cpp index c9cfbb95bd4..e3074cd9b14 100644 --- a/src/mame/motorola/mekd2.cpp +++ b/src/mame/motorola/mekd2.cpp @@ -301,8 +301,8 @@ QUICKLOAD_LOAD_MEMBER(mekd2_state::quickload_cb) uint16_t addr, size; uint8_t ident, *RAM = memregion("maincpu")->base(); - image.fread(buff, sizeof (buff)); - if (memcmp(buff, magic, sizeof (buff))) + image.fread(buff, sizeof(buff)); + if (memcmp(buff, magic, sizeof(buff))) { logerror("mekd2 rom load: magic '%s' not found\n", magic); return image_error::INVALIDIMAGE; diff --git a/src/mame/nascom/nascom1.cpp b/src/mame/nascom/nascom1.cpp index da1e3f3a200..46582e92b45 100644 --- a/src/mame/nascom/nascom1.cpp +++ b/src/mame/nascom/nascom1.cpp @@ -363,9 +363,9 @@ SNAPSHOT_LOAD_MEMBER(nascom_state::snapshot_cb) std::error_condition nascom2_state::load_cart(device_image_interface &image, generic_slot_device *slot, int slot_id) { - // loading directly from file if (!image.loaded_through_softlist()) { + // loading directly from file if (slot->length() > 0x1000) { osd_printf_error("%s: Unsupported file size\n", image.basename()); @@ -386,13 +386,12 @@ std::error_condition nascom2_state::load_cart(device_image_interface &image, gen break; } } - - // loading from software list. this supports multiple regions to load to else { - uint8_t *region_b000 = image.get_software_region("b000"); - uint8_t *region_c000 = image.get_software_region("c000"); - uint8_t *region_d000 = image.get_software_region("d000"); + // loading from software list. this supports multiple regions to load to + uint8_t *const region_b000 = image.get_software_region("b000"); + uint8_t *const region_c000 = image.get_software_region("c000"); + uint8_t *const region_d000 = image.get_software_region("d000"); if (region_b000 != nullptr) { diff --git a/src/mame/neogeo/ng_memcard.cpp b/src/mame/neogeo/ng_memcard.cpp index 861ccd8adf6..77b63b9d666 100644 --- a/src/mame/neogeo/ng_memcard.cpp +++ b/src/mame/neogeo/ng_memcard.cpp @@ -2,17 +2,15 @@ // copyright-holders:Miodrag Milanovic /********************************************************************* - ng_memcard.c - NEOGEO Memory card functions. *********************************************************************/ #include "emu.h" -#include "emuopts.h" - #include "ng_memcard.h" +#include "emuopts.h" + // device type definition DEFINE_DEVICE_TYPE(NG_MEMCARD, ng_memcard_device, "ng_memcard", "NeoGeo Memory Card") @@ -44,12 +42,12 @@ void ng_memcard_device::device_start() std::error_condition ng_memcard_device::call_load() { - if(length() != 0x800) + if (length() != 0x800) return image_error::INVALIDLENGTH; fseek(0, SEEK_SET); size_t ret = fread(m_memcard_data, 0x800); - if(ret != 0x800) + if (ret != 0x800) return image_error::UNSPECIFIED; return std::error_condition(); @@ -65,8 +63,8 @@ std::error_condition ng_memcard_device::call_create(int format_type, util::optio { memset(m_memcard_data, 0, 0x800); - size_t ret = fwrite(m_memcard_data, 0x800); - if(ret != 0x800) + size_t const ret = fwrite(m_memcard_data, 0x800); + if (ret != 0x800) return image_error::UNSPECIFIED; return std::error_condition(); diff --git a/src/mame/neogeo/ng_memcard.h b/src/mame/neogeo/ng_memcard.h index 77cafd221e1..6f7dd43023f 100644 --- a/src/mame/neogeo/ng_memcard.h +++ b/src/mame/neogeo/ng_memcard.h @@ -2,8 +2,6 @@ // copyright-holders:Miodrag Milanovic /********************************************************************* - ng_memcard.h - NEOGEO Memory card functions. *********************************************************************/ @@ -38,7 +36,7 @@ public: bool present() { return is_loaded(); } protected: - // device-level overrides + // device_t implementation virtual void device_start() override; private: diff --git a/src/mame/netronics/elf.cpp b/src/mame/netronics/elf.cpp index 0b70008c0d6..0f61fb29b66 100644 --- a/src/mame/netronics/elf.cpp +++ b/src/mame/netronics/elf.cpp @@ -223,7 +223,7 @@ void elf2_state::machine_start() QUICKLOAD_LOAD_MEMBER(elf2_state::quickload_cb) { - int size = image.length(); + int const size = image.length(); if (size > m_ram->size()) { diff --git a/src/mame/nichibutsu/myvision.cpp b/src/mame/nichibutsu/myvision.cpp index c05a73ba8e8..cdf979d01f3 100644 --- a/src/mame/nichibutsu/myvision.cpp +++ b/src/mame/nichibutsu/myvision.cpp @@ -156,7 +156,7 @@ void myvision_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER( myvision_state::cart_load ) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); if (size != 0x4000 && size != 0x6000) { @@ -173,27 +173,19 @@ DEVICE_IMAGE_LOAD_MEMBER( myvision_state::cart_load ) uint8_t myvision_state::ay_port_a_r() { - uint8_t data = 0xFF; + uint8_t data = 0xff; - if ( ! ( m_column & 0x80 ) ) - { + if (!(m_column & 0x80)) data &= m_io_row0->read(); - } - if ( ! ( m_column & 0x40 ) ) - { + if (!(m_column & 0x40)) data &= m_io_row1->read(); - } - if ( ! ( m_column & 0x20 ) ) - { + if (!(m_column & 0x20)) data &= m_io_row2->read(); - } - if ( ! ( m_column & 0x10 ) ) - { + if (!(m_column & 0x10)) data &= m_io_row3->read(); - } return data; } diff --git a/src/mame/nintendo/n64.cpp b/src/mame/nintendo/n64.cpp index ab619db63a4..353e2d4b0c7 100644 --- a/src/mame/nintendo/n64.cpp +++ b/src/mame/nintendo/n64.cpp @@ -357,7 +357,7 @@ DEVICE_IMAGE_LOAD_MEMBER(n64_mess_state::cart_load) logerror("cart length = %d\n", length); device_image_interface *battery_image = dynamic_cast(m_rcp_periphs->m_nvram_image); - if(battery_image) + if (battery_image) { //printf("Loading\n"); uint8_t data[0x30800]; diff --git a/src/mame/osborne/osborne1.cpp b/src/mame/osborne/osborne1.cpp index 69f3f3f0972..e49ee6dcdbe 100644 --- a/src/mame/osborne/osborne1.cpp +++ b/src/mame/osborne/osborne1.cpp @@ -116,6 +116,8 @@ TODO: #include "speaker.h" #include "tilemap.h" +#include + namespace { @@ -128,7 +130,8 @@ public: osborne1_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag), m_rom_view(*this, "bank_0000"), - m_vram(*this, "vram", 0x2000, ENDIANNESS_LITTLE), + m_main_ram(*this, "mainram"), + m_attr_ram(*this, "attrram"), m_screen(*this, "screen"), m_maincpu(*this, "maincpu"), m_pia0(*this, "pia_0"), @@ -143,7 +146,7 @@ public: m_keyb_row(*this, { "ROW0", "ROW1", "ROW3", "ROW4", "ROW5", "ROW2", "ROW6", "ROW7" }), m_btn_reset(*this, "RESET"), m_cnf(*this, "CNF"), - m_bank_fxxx(*this, "bank_fxxx"), + m_vram_view(*this, "bank_fxxx"), m_p_chargen(*this, "chargen"), m_video_timer(nullptr), m_tilemap(nullptr), @@ -169,6 +172,7 @@ protected: u8 bank2_peripherals_r(offs_t offset); void bank2_peripherals_w(offs_t offset, u8 data); void videoram_w(offs_t offset, u8 data); + void attrram_w(offs_t offset, u8 data); u8 opcode_r(offs_t offset); void bankswitch_w(offs_t offset, u8 data); DECLARE_WRITE_LINE_MEMBER(irqack_w); @@ -179,7 +183,8 @@ protected: template void draw_rows(uint16_t col, bitmap_ind16 &bitmap, const rectangle &cliprect); memory_view m_rom_view; - memory_share_creator m_vram; + required_shared_ptr m_main_ram; + required_shared_ptr m_attr_ram; required_device m_screen; required_device m_maincpu; required_device m_pia0; @@ -205,7 +210,6 @@ private: TILE_GET_INFO_MEMBER(get_tile_info); bool set_rom_mode(u8 value); - bool set_bit_9(u8 value); void update_irq(); void update_acia_rxc_txc(); @@ -225,7 +229,7 @@ private: required_ioport m_cnf; // pieces of memory - required_memory_bank m_bank_fxxx; + memory_view m_vram_view; required_region_ptr m_p_chargen; // configuration (reloaded on reset) @@ -237,7 +241,6 @@ private: u8 m_ub4a_q; u8 m_ub6a_q; u8 m_rom_mode; - u8 m_bit_9; // onboard video state u8 m_scroll_x; @@ -368,13 +371,15 @@ void osborne1sp_state::bank2_peripherals_w(offs_t offset, u8 data) } void osborne1_state::videoram_w(offs_t offset, u8 data) +{ + m_main_ram[0xf000 | offset] = data; + m_tilemap->mark_tile_dirty(offset); +} + +void osborne1_state::attrram_w(offs_t offset, u8 data) { // Attribute RAM is only one bit wide - low seven bits are discarded and read back high - if (m_bit_9) - data |= 0x7f; - else - m_tilemap->mark_tile_dirty(offset); - reinterpret_cast(m_bank_fxxx->base())[offset] = data; + m_attr_ram[offset] = data | 0x7f; } u8 osborne1_state::opcode_r(offs_t offset) @@ -411,10 +416,10 @@ void osborne1_state::bankswitch_w(offs_t offset, u8 data) m_maincpu->set_input_line(INPUT_LINE_NMI, CLEAR_LINE); break; case 0x02: - set_bit_9(1); + m_vram_view.select(0); break; case 0x03: - set_bit_9(0); + m_vram_view.disable(); break; } } @@ -535,8 +540,6 @@ INPUT_CHANGED_MEMBER( osborne1_state::reset_key ) void osborne1_state::machine_start() { - m_bank_fxxx->configure_entries(0, 2, &m_vram[0], 0x1000); - m_video_timer = timer_alloc(FUNC(osborne1_state::video_callback), this); m_tilemap = &machine().tilemap().create( *m_gfxdecode, @@ -554,7 +557,6 @@ void osborne1_state::machine_start() save_item(NAME(m_ub4a_q)); save_item(NAME(m_ub6a_q)); save_item(NAME(m_rom_mode)); - save_item(NAME(m_bit_9)); save_item(NAME(m_scroll_x)); save_item(NAME(m_scroll_y)); @@ -593,9 +595,8 @@ void osborne1_state::machine_reset() // Initialise memory configuration m_rom_mode = 0; - m_bit_9 = 1; set_rom_mode(1); - set_bit_9(0); + m_vram_view.disable(); // Reset serial state m_acia_irq_state = 0; @@ -603,8 +604,8 @@ void osborne1_state::machine_reset() update_acia_rxc_txc(); // The low bits of attribute RAM are not physically present and hence always read high - for (unsigned i = 0; i < 0x1000; i++) - m_vram[0x1000 + i] |= 0x7f; + for (u8 &b : m_attr_ram) + b |= 0x7f; } void osborne1_state::video_start() @@ -639,25 +640,22 @@ inline void osborne1_state::draw_rows(uint16_t col, bitmap_ind16 &bitmap, const m_scroll_y = m_pia1->b_output() & 0x1f; // Draw a line of the display - u8 const ra(y % 10); - uint16_t *p(&bitmap.pix(y)); - uint16_t const row(((m_scroll_y + (y / 10)) << 7) & 0x0f80); + u8 const ra = y % 10; + uint16_t *p = &bitmap.pix(y); + uint16_t const row = ((m_scroll_y + (y / 10)) << 7) & 0x0f80; for (uint16_t x = 0; Width > x; ++x) { - uint16_t const offs(row | ((col + x) & 0x7f)); - u8 const chr(m_vram[offs]); - u8 const clr((m_vram[0x1000 + offs] & 0x80) ? 2 : 1); + uint16_t const offs = row | ((col + x) & 0x7f); + u8 const chr = m_main_ram[0xf000 | offs]; + u8 const clr = BIT(m_attr_ram[offs], 7) ? 2 : 1; - u8 const gfx(((chr & 0x80) && (ra == 9)) ? 0xff : m_p_chargen[(ra << 7) | (chr & 0x7f)]); + bool const underline = BIT(chr, 7) && (ra == 9); + u8 const gfx = underline ? 0xff : m_p_chargen[(ra << 7) | (chr & 0x7f)]; // Display a scanline of a character for (unsigned b = 0; 8 > b; ++b) - { - uint16_t const pixel(BIT(gfx, 7 - b) ? clr : 0); - for (unsigned i = 0; Scale > i; ++i) - *p++ = pixel; - } + p = std::fill_n(p, Scale, BIT(gfx, 7 - b) ? clr : 0); } } } @@ -700,8 +698,8 @@ uint32_t osborne1sp_state::screen_update(screen_device &screen, bitmap_ind16 &bi TIMER_CALLBACK_MEMBER(osborne1_state::video_callback) { - int const y(m_screen->vpos()); - u8 const ra(y % 10); + int const y = m_screen->vpos(); + u8 const ra = y % 10; // The beeper is gated so it's active four out of every ten scanlines m_beep_state = (ra & 0x04) ? 1 : 0; @@ -721,7 +719,7 @@ TIMER_CALLBACK_MEMBER(osborne1_state::acia_rxc_txc_callback) TILE_GET_INFO_MEMBER(osborne1_state::get_tile_info) { // The gfxdecode and tilemap aren't actually used for drawing, they just look nice in the graphics viewer - tileinfo.set(0, m_vram[tile_index] & 0x7f, 0, 0); + tileinfo.set(0, m_main_ram[0xf000 | tile_index] & 0x7f, 0, 0); } @@ -742,20 +740,6 @@ bool osborne1_state::set_rom_mode(u8 value) } } -bool osborne1_state::set_bit_9(u8 value) -{ - if (value != m_bit_9) - { - m_bit_9 = value; - m_bank_fxxx->set_entry(m_bit_9); - return true; - } - else - { - return false; - } -} - void osborne1_state::update_irq() { if (m_pia0->irq_a_state()) @@ -786,8 +770,8 @@ MC6845_UPDATE_ROW(osborne1nv_state::crtc_update_row) for (u8 x = 0; x < x_count; ++x) { uint16_t const offset = base | ((ma + x) & 0x7f); - u8 const chr = m_vram[offset]; - u8 const clr = BIT(m_vram[0x1000 | offset], 7) ? 2 : 1; + u8 const chr = m_main_ram[0xf000 | offset]; + u8 const clr = BIT(m_attr_ram[offset], 7) ? 2 : 1; u8 const gfx = ((chr & 0x80) && (ra == 9)) ? 0xff : m_p_nuevo[(ra << 7) | (chr & 0x7f)]; @@ -803,12 +787,15 @@ MC6845_ON_UPDATE_ADDR_CHANGED(osborne1nv_state::crtc_update_addr_changed) void osborne1_state::osborne1_mem(address_map &map) { - map(0x0000, 0xefff).ram(); - map(0xf000, 0xffff).bankr(m_bank_fxxx).w(FUNC(osborne1_state::videoram_w)); + map(0x0000, 0xffff).ram().share(m_main_ram); + map(0xf000, 0xffff).w(FUNC(osborne1_state::videoram_w)); map(0x0000, 0x3fff).view(m_rom_view); m_rom_view[0](0x0000, 0x0fff).mirror(0x1000).rom().region("maincpu", 0).unmapw(); m_rom_view[0](0x2000, 0x2fff).mirror(0x1000).rw(FUNC(osborne1_state::bank2_peripherals_r), FUNC(osborne1_state::bank2_peripherals_w)); + + map(0xf000, 0xffff).view(m_vram_view); + m_vram_view[0](0xf000, 0xffff).ram().w(FUNC(osborne1_state::attrram_w)).share(m_attr_ram); } void osborne1sp_state::osborne1sp_mem(address_map &map) diff --git a/src/mame/pc/ibmpcjr.cpp b/src/mame/pc/ibmpcjr.cpp index e57502b4698..0fe13eca861 100644 --- a/src/mame/pc/ibmpcjr.cpp +++ b/src/mame/pc/ibmpcjr.cpp @@ -468,9 +468,9 @@ std::error_condition pcjr_state::load_cart(device_image_interface &image, generi osd_printf_error("%s: Invalid header size\n", image.basename()); return image_error::INVALIDIMAGE; } - if (size - header_size == 0xa000) + if ((size - header_size) == 0xa000) { - // alloc 64K for the imagic carts, so to handle the necessary mirroring + // alloc 64K for the imagic carts, so as to handle the necessary mirroring size += 0x6000; imagic_hack = true; } diff --git a/src/mame/pce/tourvis.cpp b/src/mame/pce/tourvis.cpp index aa59086ce77..a8c587e777c 100644 --- a/src/mame/pce/tourvis.cpp +++ b/src/mame/pce/tourvis.cpp @@ -223,22 +223,21 @@ private: uint32_t m_rom_size = 0; }; -DEVICE_IMAGE_LOAD_MEMBER( tourvision_state::cart_load ) +DEVICE_IMAGE_LOAD_MEMBER(tourvision_state::cart_load) { m_rom_size = m_cart->common_get_size("rom"); m_cart->rom_alloc(m_rom_size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), m_rom_size, "rom"); - uint8_t* rgn = memregion("maincpu")->base(); - uint8_t* base = m_cart->get_rom_base(); + uint8_t *rgn = memregion("maincpu")->base(); + uint8_t *base = m_cart->get_rom_base(); if (m_rom_size == 0x0c0000) { memcpy(rgn+0x000000, base+0x000000, 0x0c0000 ); memcpy(rgn+0x0c0000, base+0x080000, 0x040000 ); } - else - if (m_rom_size == 0x060000) + else if (m_rom_size == 0x060000) { memcpy(rgn+0x000000, base+0x000000, 0x040000 ); memcpy(rgn+0x040000, base+0x000000, 0x040000 ); @@ -249,8 +248,8 @@ DEVICE_IMAGE_LOAD_MEMBER( tourvision_state::cart_load ) } else { - for (int i=0;i<0x100000;i+=m_rom_size) - memcpy(rgn+i, base+0x000000, m_rom_size ); + for (int i=0; i<0x100000; i+=m_rom_size) + memcpy(rgn+i, base+0x000000, m_rom_size); } #if 0 diff --git a/src/mame/pitronics/beta.cpp b/src/mame/pitronics/beta.cpp index 3412df75fcc..470b3ad8a4a 100644 --- a/src/mame/pitronics/beta.cpp +++ b/src/mame/pitronics/beta.cpp @@ -296,7 +296,7 @@ void beta_state::riot_pb_w(uint8_t data) DEVICE_IMAGE_LOAD_MEMBER(beta_state::load_beta_eprom) { - uint32_t size = m_eprom->common_get_size("rom"); + uint32_t const size = m_eprom->common_get_size("rom"); if (size != 0x800) { diff --git a/src/mame/psion/psion_pack.h b/src/mame/psion/psion_pack.h index 0f63de1c146..37d29f8df12 100644 --- a/src/mame/psion/psion_pack.h +++ b/src/mame/psion/psion_pack.h @@ -26,7 +26,7 @@ public: datapack_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~datapack_device(); - // 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 *create_args) override; @@ -48,7 +48,7 @@ protected: // internal helper void update(); - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_config_complete() override; diff --git a/src/mame/psion/psion_ssd.h b/src/mame/psion/psion_ssd.h index d1def9f2508..dc23f248458 100644 --- a/src/mame/psion/psion_ssd.h +++ b/src/mame/psion/psion_ssd.h @@ -33,14 +33,14 @@ public: void data_w(uint16_t data); protected: - // device-level overrides + // device_t implementation virtual void device_resolve_objects() override; virtual void device_config_complete() override; virtual void device_start() override; virtual void device_reset() override; virtual void device_add_mconfig(machine_config &config) override; - // image-level overrides + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; diff --git a/src/mame/robotron/z1013.cpp b/src/mame/robotron/z1013.cpp index bd37a8c9448..7d26d2b78e3 100644 --- a/src/mame/robotron/z1013.cpp +++ b/src/mame/robotron/z1013.cpp @@ -405,32 +405,27 @@ SNAPSHOT_LOAD_MEMBER(z1013_state::snapshot_cb) */ std::vector data(image.length()); - uint16_t startaddr,endaddr,runaddr; - image.fread(&data[0], image.length()); - startaddr = data[0] + data[1]*256; - endaddr = data[2] + data[3]*256; - runaddr = data[4] + data[5]*256; + uint16_t const startaddr = data[0] + data[1]*256; + uint16_t const endaddr = data[2] + data[3]*256; + uint16_t const runaddr = data[4] + data[5]*256; - if ((data[13]==data[14]) && (data[14]==data[15])) - { } - else + if ((data[13] != data[14]) || (data[14] != data[15])) { osd_printf_error("%s: Not a Z1013 image\n", image.basename()); image.message(" Not a Z1013 image"); return image_error::INVALIDIMAGE; } - memcpy (m_maincpu->space(AS_PROGRAM).get_read_ptr(startaddr), - &data[0x20], endaddr - startaddr + 1); + memcpy(m_maincpu->space(AS_PROGRAM).get_read_ptr(startaddr), &data[0x20], endaddr - startaddr + 1); if (runaddr) m_maincpu->set_state_int(Z80_PC, runaddr); else { - osd_printf_error("%s: Loaded but cannot run\n", image.basename()); - image.message(" Loaded but cannot run"); + osd_printf_error("%s: Loaded but cannot run due to zero entry point\n", image.basename()); + image.message(" Loaded but cannot run due to zero entry point"); } return std::error_condition(); diff --git a/src/mame/roland/roland_cm32p.cpp b/src/mame/roland/roland_cm32p.cpp index 8d216229fdb..8886397ad80 100644 --- a/src/mame/roland/roland_cm32p.cpp +++ b/src/mame/roland/roland_cm32p.cpp @@ -426,7 +426,7 @@ void cm32p_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER(cm32p_state::card_load) { - uint32_t size = pcmcard->common_get_size("rom"); + uint32_t const size = pcmcard->common_get_size("rom"); if (size > 0x080000) { osd_printf_error("%s: Invalid size: Only up to 512K is supported\n", image.basename()); @@ -435,7 +435,7 @@ DEVICE_IMAGE_LOAD_MEMBER(cm32p_state::card_load) pcmcard->rom_alloc(0x080000, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); // cards are up to 512K pcmcard->common_load_rom(pcmcard->get_rom_base(), size, "rom"); - u8* base = pcmcard->get_rom_base(); + u8 *base = pcmcard->get_rom_base(); if (size < 0x080000) { uint32_t mirror = (1 << (31 - count_leading_zeros_32(size))); @@ -445,8 +445,8 @@ DEVICE_IMAGE_LOAD_MEMBER(cm32p_state::card_load) memcpy(base + ofs, base, mirror); } - u8* src = static_cast(memregion("pcmorg")->base()); - u8* dst = static_cast(memregion("pcm")->base()); + u8 *src = reinterpret_cast(memregion("pcmorg")->base()); + u8 *dst = reinterpret_cast(memregion("pcm")->base()); memcpy(&src[0x080000], base, 0x080000); // descramble PCM card ROM descramble_rom_external(&dst[0x080000], &src[0x080000]); @@ -457,10 +457,10 @@ DEVICE_IMAGE_LOAD_MEMBER(cm32p_state::card_load) DEVICE_IMAGE_UNLOAD_MEMBER(cm32p_state::card_unload) { - u8* src = static_cast(memregion("pcmorg")->base()); - u8* dst = static_cast(memregion("pcm")->base()); - memset(&src[0x080000], 0xFF, 0x080000); - memset(&dst[0x080000], 0xFF, 0x080000); + u8 *src = reinterpret_cast(memregion("pcmorg")->base()); + u8 *dst = reinterpret_cast(memregion("pcm")->base()); + memset(&src[0x080000], 0xff, 0x080000); + memset(&dst[0x080000], 0xff, 0x080000); pcmard_loaded = false; } diff --git a/src/mame/roland/roland_r8.cpp b/src/mame/roland/roland_r8.cpp index edb0cbf4eca..a8bff5e555d 100644 --- a/src/mame/roland/roland_r8.cpp +++ b/src/mame/roland/roland_r8.cpp @@ -188,7 +188,7 @@ private: std::error_condition roland_r8_base_state::pcmrom_load(generic_slot_device *pcmcard, int card_id, device_image_interface &image) { - uint32_t size = pcmcard->common_get_size("rom"); + uint32_t const size = pcmcard->common_get_size("rom"); if (size > PCMCARD_SIZE) { osd_printf_error("%s: Invalid size: Only up to 512K is supported\n", image.basename()); @@ -197,7 +197,7 @@ std::error_condition roland_r8_base_state::pcmrom_load(generic_slot_device *pcmc pcmcard->rom_alloc(PCMCARD_SIZE, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); pcmcard->common_load_rom(pcmcard->get_rom_base(), size, "rom"); - u8* base = pcmcard->get_rom_base(); + u8 *base = pcmcard->get_rom_base(); if (size < PCMCARD_SIZE) { uint32_t mirror = (1 << (31 - count_leading_zeros_32(size))); @@ -208,8 +208,8 @@ std::error_condition roland_r8_base_state::pcmrom_load(generic_slot_device *pcmc } offs_t pcm_addr = PCMCARD_OFFSETS[card_id]; - u8 *src = static_cast(memregion("pcmorg")->base()); - u8 *dst = static_cast(memregion("pcm")->base()); + u8 *src = reinterpret_cast(memregion("pcmorg")->base()); + u8 *dst = reinterpret_cast(memregion("pcm")->base()); memcpy(&src[pcm_addr], base, PCMCARD_SIZE); // descramble PCM card ROM descramble_rom_external(&dst[pcm_addr], &src[pcm_addr]); @@ -220,8 +220,8 @@ std::error_condition roland_r8_base_state::pcmrom_load(generic_slot_device *pcmc void roland_r8_base_state::pcmrom_unload(int card_id) { - u8 *src = static_cast(memregion("pcmorg")->base()); - u8 *dst = static_cast(memregion("pcm")->base()); + u8 *src = reinterpret_cast(memregion("pcmorg")->base()); + u8 *dst = reinterpret_cast(memregion("pcm")->base()); offs_t pcm_addr = PCMCARD_OFFSETS[card_id]; memset(&src[pcm_addr], 0xff, PCMCARD_SIZE); memset(&dst[pcm_addr], 0xff, PCMCARD_SIZE); diff --git a/src/mame/sega/sega_beena.cpp b/src/mame/sega/sega_beena.cpp index 928d81a0b04..f026c24bcec 100644 --- a/src/mame/sega/sega_beena.cpp +++ b/src/mame/sega/sega_beena.cpp @@ -149,7 +149,7 @@ void sega_beena_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER(sega_beena_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); diff --git a/src/mame/sfrj/galaxy.cpp b/src/mame/sfrj/galaxy.cpp index 116e761db1b..ebba787844b 100644 --- a/src/mame/sfrj/galaxy.cpp +++ b/src/mame/sfrj/galaxy.cpp @@ -196,7 +196,7 @@ void galaxy_state::setup_snapshot(const uint8_t * data, uint32_t size) SNAPSHOT_LOAD_MEMBER(galaxy_state::snapshot_cb) { - uint32_t snapshot_size = image.length(); + uint32_t const snapshot_size = image.length(); switch (snapshot_size) { case GALAXY_SNAPSHOT_V1_SIZE: diff --git a/src/mame/sharp/pce220.cpp b/src/mame/sharp/pce220.cpp index 7d925240456..3320ea24d2d 100644 --- a/src/mame/sharp/pce220.cpp +++ b/src/mame/sharp/pce220.cpp @@ -23,15 +23,18 @@ ****************************************************************************/ #include "emu.h" + +#include "pce220_ser.h" + #include "cpu/z80/z80.h" #include "machine/input_merger.h" #include "machine/nvram.h" -#include "pce220_ser.h" #include "machine/ram.h" #include "machine/timer.h" #include "sound/beep.h" #include "video/hd61202.h" #include "video/sed1520.h" + #include "emupal.h" #include "screen.h" #include "speaker.h" @@ -53,7 +56,7 @@ public: , m_beep(*this, "beeper") , m_lcdc(*this, "hd61202") , m_input_merger(*this, "input_merger") - , m_serial(*this, PCE220SERIAL_TAG) + , m_serial(*this, "serial") , m_keyboard(*this, "LINE%u", 0) , m_io_on(*this, "ON") , m_battery(*this, "BATTERY") diff --git a/src/mame/sharp/pce220_ser.cpp b/src/mame/sharp/pce220_ser.cpp index 9c5646076b9..2047f855094 100644 --- a/src/mame/sharp/pce220_ser.cpp +++ b/src/mame/sharp/pce220_ser.cpp @@ -46,6 +46,18 @@ DEFINE_DEVICE_TYPE(PCE220SERIAL, pce220_serial_device, "pce220_serial", "Sharp P pce220_serial_device::pce220_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : device_t(mconfig, PCE220SERIAL, tag, owner, clock) , device_image_interface(mconfig, *this) + , m_send_timer(nullptr) + , m_receive_timer(nullptr) + , m_state(0) + , m_bytes_count(0) + , m_current_byte(0) + , m_enabled(0) + , m_busy(0) + , m_dout(0) + , m_xout(0) + , m_xin(0) + , m_din(0) + , m_ack(0) { } diff --git a/src/mame/sharp/pce220_ser.h b/src/mame/sharp/pce220_ser.h index fd4afbbf4e7..c37ce465c75 100644 --- a/src/mame/sharp/pce220_ser.h +++ b/src/mame/sharp/pce220_ser.h @@ -28,7 +28,7 @@ public: pce220_serial_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~pce220_serial_device(); - // 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; @@ -56,7 +56,7 @@ protected: int calc_parity(uint8_t data); int get_next_state(); - // device-level overrides + // device_t implementation virtual void device_start() override; virtual void device_reset() override; @@ -65,27 +65,22 @@ protected: private: // internal device state - emu_timer* m_send_timer = nullptr; // timer for send data - emu_timer* m_receive_timer = nullptr; // timer for receive data - uint8_t m_state = 0; // transfer status - uint32_t m_bytes_count = 0; // number of bytes transferred - uint8_t m_current_byte = 0; // byte in transfer - uint8_t m_enabled = 0; // enable/disable - - uint8_t m_busy = 0; // CTS - uint8_t m_dout = 0; // DTR - uint8_t m_xout = 0; // TXD - uint8_t m_xin = 0; // RXD - uint8_t m_din = 0; // DSR - uint8_t m_ack = 0; // RTS + emu_timer* m_send_timer; // timer for send data + emu_timer* m_receive_timer; // timer for receive data + uint8_t m_state; // transfer status + uint32_t m_bytes_count; // number of bytes transferred + uint8_t m_current_byte; // byte in transfer + uint8_t m_enabled; // enable/disable + + uint8_t m_busy; // CTS + uint8_t m_dout; // DTR + uint8_t m_xout; // TXD + uint8_t m_xin; // RXD + uint8_t m_din; // DSR + uint8_t m_ack; // RTS }; // device type definition DECLARE_DEVICE_TYPE(PCE220SERIAL, pce220_serial_device) -/*************************************************************************** - DEVICE CONFIGURATION MACROS -***************************************************************************/ -#define PCE220SERIAL_TAG "serial" - #endif // MAME_SHARP_PCE220_SER_H diff --git a/src/mame/sharp/wizard.cpp b/src/mame/sharp/wizard.cpp index 8dd38639153..b9ee42a22c3 100644 --- a/src/mame/sharp/wizard.cpp +++ b/src/mame/sharp/wizard.cpp @@ -116,7 +116,7 @@ void wizard_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER(wizard_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); diff --git a/src/mame/sinclair/spec_snqk.cpp b/src/mame/sinclair/spec_snqk.cpp index 9c68812a204..0afa480e850 100644 --- a/src/mame/sinclair/spec_snqk.cpp +++ b/src/mame/sinclair/spec_snqk.cpp @@ -28,16 +28,21 @@ ***************************************************************************/ #include "emu.h" -#include "ui/uimain.h" -#include "cpu/z80/z80.h" -#include "spectrum.h" +#include "spec_snqk.h" + +#include "specpls3.h" #include "spec128.h" +#include "spectrum.h" #include "timex.h" -#include "specpls3.h" + +#include "cpu/z80/z80.h" #include "sound/ay8910.h" -#include "spec_snqk.h" + +#include "ui/uimain.h" + #include "corestr.h" + #define EXEC_NA "N/A" //------------------------------------------------- @@ -2476,10 +2481,9 @@ QUICKLOAD_LOAD_MEMBER(spectrum_state::quickload_cb) *******************************************************************/ void spectrum_state::setup_scr(uint8_t *quickdata, uint32_t quicksize) { - int i; address_space &space = m_maincpu->space(AS_PROGRAM); - for (i = 0; i < quicksize; i++) + for (int i = 0; i < quicksize; i++) space.write_byte(i + BASE_RAM, quickdata[i]); log_quickload(quicksize == SCR_SIZE ? "SCREEN$" : "SCREEN$ (Mono)", BASE_RAM, quicksize, 0, EXEC_NA); @@ -2513,19 +2517,16 @@ void spectrum_state::setup_scr(uint8_t *quickdata, uint32_t quicksize) *******************************************************************/ void spectrum_state::setup_raw(uint8_t *quickdata, uint32_t quicksize) { - int i; - uint8_t data; - uint16_t start, len; address_space &space = m_maincpu->space(AS_PROGRAM); - start = (quickdata[RAW_OFFSET + 4] << 8) | quickdata[RAW_OFFSET + 3]; - len = (quickdata[RAW_OFFSET + 2] << 8) | quickdata[RAW_OFFSET + 1]; + uint16_t const start = (quickdata[RAW_OFFSET + 4] << 8) | quickdata[RAW_OFFSET + 3]; + uint16_t const len = (quickdata[RAW_OFFSET + 2] << 8) | quickdata[RAW_OFFSET + 1]; - for (i = 0; i < len; i++) + for (int i = 0; i < len; i++) space.write_byte(i + start, quickdata[i + RAW_HDR]); // Set border color - data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. + uint8_t const data = (space.read_byte(0x5c48) >> 3) & 0x07; // Get the current border color from BORDCR system variable. m_port_fe_data = (m_port_fe_data & 0xf8) | data; border_update(data); logerror("Border color:%02X\n", data); diff --git a/src/mame/sinclair/timex.cpp b/src/mame/sinclair/timex.cpp index c0670efb38d..9311736c347 100644 --- a/src/mame/sinclair/timex.cpp +++ b/src/mame/sinclair/timex.cpp @@ -600,7 +600,6 @@ DEVICE_IMAGE_LOAD_MEMBER( ts2068_state::cart_load ) if (!image.loaded_through_softlist()) { - int chunks_in_file = 0; std::vector header; header.resize(9); @@ -616,6 +615,7 @@ DEVICE_IMAGE_LOAD_MEMBER( ts2068_state::cart_load ) // check header image.fread(&header[0], 9); + int chunks_in_file = 0; for (int i = 0; i < 8; i++) if (header[i + 1] & 0x02) chunks_in_file++; diff --git a/src/mame/skeleton/c2color.cpp b/src/mame/skeleton/c2color.cpp index 684356e941d..75a5033b466 100644 --- a/src/mame/skeleton/c2color.cpp +++ b/src/mame/skeleton/c2color.cpp @@ -100,7 +100,7 @@ void c2_color_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER(c2_color_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); diff --git a/src/mame/skeleton/cd2650.cpp b/src/mame/skeleton/cd2650.cpp index 62fbbee2563..20dd03d30e5 100644 --- a/src/mame/skeleton/cd2650.cpp +++ b/src/mame/skeleton/cd2650.cpp @@ -259,7 +259,7 @@ QUICKLOAD_LOAD_MEMBER(cd2650_state::quickload_cb) int i; std::error_condition result = image_error::UNSPECIFIED; - int quick_length = image.length(); + int const quick_length = image.length(); if (quick_length < 0x1500) { result = image_error::INVALIDLENGTH; diff --git a/src/mame/skeleton/cosmicos.cpp b/src/mame/skeleton/cosmicos.cpp index cf66198a6d9..1b9a6fcf686 100644 --- a/src/mame/skeleton/cosmicos.cpp +++ b/src/mame/skeleton/cosmicos.cpp @@ -497,10 +497,10 @@ void cosmicos_state::machine_reset() QUICKLOAD_LOAD_MEMBER(cosmicos_state::quickload_cb) { - uint8_t *ptr = m_rom->base(); - int size = image.length(); + int const size = image.length(); + uint8_t *const ptr = m_rom->base(); - /* load image to RAM */ + // load image to RAM image.fread(ptr, size); return std::error_condition(); diff --git a/src/mame/skeleton/digiblast.cpp b/src/mame/skeleton/digiblast.cpp index 0fccebc5682..a609286addf 100644 --- a/src/mame/skeleton/digiblast.cpp +++ b/src/mame/skeleton/digiblast.cpp @@ -69,7 +69,7 @@ void digiblast_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER(digiblast_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); m_cart->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); diff --git a/src/mame/skeleton/easy_karaoke.cpp b/src/mame/skeleton/easy_karaoke.cpp index 89f9bc4e7e5..b2bc9632275 100644 --- a/src/mame/skeleton/easy_karaoke.cpp +++ b/src/mame/skeleton/easy_karaoke.cpp @@ -123,7 +123,7 @@ void easy_karaoke_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER(easy_karaoke_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); diff --git a/src/mame/skeleton/i7000.cpp b/src/mame/skeleton/i7000.cpp index a642bea9dc8..761833628ed 100644 --- a/src/mame/skeleton/i7000.cpp +++ b/src/mame/skeleton/i7000.cpp @@ -283,7 +283,7 @@ void i7000_state::i7000_io(address_map &map) DEVICE_IMAGE_LOAD_MEMBER(i7000_state::card_load) { - uint32_t size = m_card->common_get_size("rom"); + uint32_t const size = m_card->common_get_size("rom"); m_card->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_BIG); m_card->common_load_rom(m_card->get_rom_base(), size, "rom"); @@ -293,15 +293,15 @@ DEVICE_IMAGE_LOAD_MEMBER(i7000_state::card_load) static const gfx_layout i7000_charlayout = { - 8, 8, /* 8 x 8 characters */ - 256, /* 256 characters */ - 1, /* 1 bits per pixel */ - { 0 }, /* no bitplanes */ - /* x offsets */ + 8, 8, // 8 x 8 characters + 256, // 256 characters + 1, // 1 bits per pixel + { 0 }, // no bitplanes + // x offsets { 0, 1, 2, 3, 4, 5, 6, 7 }, - /* y offsets */ + // y offsets { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8 }, - 8*8 /* every char takes 8 bytes */ + 8*8 // every char takes 8 bytes }; static GFXDECODE_START( gfx_i7000 ) diff --git a/src/mame/skeleton/squale.cpp b/src/mame/skeleton/squale.cpp index d091a4411f2..41427436fc0 100644 --- a/src/mame/skeleton/squale.cpp +++ b/src/mame/skeleton/squale.cpp @@ -629,7 +629,7 @@ WRITE_LINE_MEMBER( squale_state::pia_u72_cb2_w ) DEVICE_IMAGE_LOAD_MEMBER( squale_state::cart_load ) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); if ( ! size || size > 0x10000) { diff --git a/src/mame/snk/ngp.cpp b/src/mame/snk/ngp.cpp index 440123956bb..641e3ec66c8 100644 --- a/src/mame/snk/ngp.cpp +++ b/src/mame/snk/ngp.cpp @@ -755,7 +755,7 @@ DEVICE_IMAGE_LOAD_MEMBER(ngp_state::load_ngp_cart) { uint32_t size = m_cart->common_get_size("rom"); - if (size != 0x8000 && size != 0x80000 && size != 0x100000 && size != 0x200000 && size != 0x400000) + if (size != 0x8000 && size != 0x8'0000 && size != 0x10'0000 && size != 0x20'0000 && size != 0x40'0000) { osd_printf_error("Unsupported cartridge size\n"); return image_error::INVALIDLENGTH; diff --git a/src/mame/sony/pockstat.cpp b/src/mame/sony/pockstat.cpp index 21dd8bf6e1c..d64118381a0 100644 --- a/src/mame/sony/pockstat.cpp +++ b/src/mame/sony/pockstat.cpp @@ -965,7 +965,7 @@ DEVICE_IMAGE_LOAD_MEMBER(pockstat_state::flash_load) { static const char *gme_id = "123-456-STD"; char cart_id[0xf40]; - uint32_t size = image.length(); + uint32_t const size = image.length(); if (size != 0x20f40) return image_error::INVALIDLENGTH; diff --git a/src/mame/sony/psxcd.h b/src/mame/sony/psxcd.h index 10d6e335f5a..74348e088f8 100644 --- a/src/mame/sony/psxcd.h +++ b/src/mame/sony/psxcd.h @@ -24,6 +24,8 @@ public: // configuration helpers auto irq_handler() { return m_irq_handler.bind(); } + + // device_image_interface implementation virtual std::error_condition call_load() override; virtual void call_unload() override; diff --git a/src/mame/sony/smc777.cpp b/src/mame/sony/smc777.cpp index 29567ce87a0..26800ec42dd 100644 --- a/src/mame/sony/smc777.cpp +++ b/src/mame/sony/smc777.cpp @@ -20,17 +20,19 @@ **************************************************************************************/ #include "emu.h" + #include "cpu/z80/z80.h" #include "imagedev/floppy.h" +#include "imagedev/snapquik.h" #include "machine/timer.h" #include "machine/wd_fdc.h" +#include "softlist_dev.h" #include "sound/beep.h" #include "sound/sn76496.h" #include "video/mc6845.h" + #include "emupal.h" #include "screen.h" -#include "softlist_dev.h" -#include "imagedev/snapquik.h" #include "speaker.h" diff --git a/src/mame/svi/svi318.cpp b/src/mame/svi/svi318.cpp index fb37a14da08..5aa6c4000f0 100644 --- a/src/mame/svi/svi318.cpp +++ b/src/mame/svi/svi318.cpp @@ -503,7 +503,7 @@ WRITE_LINE_MEMBER( svi3x8_state::ctrl1_w ) DEVICE_IMAGE_LOAD_MEMBER( svi3x8_state::cart_load ) { - uint32_t size = m_cart_rom->common_get_size("rom"); + uint32_t const size = m_cart_rom->common_get_size("rom"); m_cart_rom->rom_alloc(size, GENERIC_ROM8_WIDTH, ENDIANNESS_LITTLE); m_cart_rom->common_load_rom(m_cart_rom->get_rom_base(), size, "rom"); diff --git a/src/mame/ta/alphatro.cpp b/src/mame/ta/alphatro.cpp index d74844460ee..f4eaeab0379 100644 --- a/src/mame/ta/alphatro.cpp +++ b/src/mame/ta/alphatro.cpp @@ -698,7 +698,7 @@ void alphatro_state::machine_reset() std::error_condition alphatro_state::load_cart(device_image_interface &image, generic_slot_device *slot) { - uint32_t size = slot->common_get_size("rom"); + uint32_t const size = slot->common_get_size("rom"); if ((size != 0x4000) && (size != 0x2000)) { diff --git a/src/mame/tatung/einstein.cpp b/src/mame/tatung/einstein.cpp index 376414162e8..f3b21393801 100644 --- a/src/mame/tatung/einstein.cpp +++ b/src/mame/tatung/einstein.cpp @@ -845,12 +845,12 @@ QUICKLOAD_LOAD_MEMBER(einstein_state::quickload_cb) if (image.length() >= 0xfd00) return image_error::INVALIDLENGTH; - /* disable rom */ + // disable ROM m_rom_enabled = 0; m_bank1->set_entry(m_rom_enabled); - /* load image */ - uint16_t quickload_size = image.length(); + // load image + uint16_t const quickload_size = image.length(); for (uint16_t i = 0; i < quickload_size; i++) { uint8_t data; @@ -860,7 +860,7 @@ QUICKLOAD_LOAD_MEMBER(einstein_state::quickload_cb) prog_space.write_byte(i + 0x100, data); } - /* start program */ + // start program m_maincpu->set_pc(0x100); return std::error_condition(); diff --git a/src/mame/telercas/tmc1800.cpp b/src/mame/telercas/tmc1800.cpp index d8104715d32..390e809a4fa 100644 --- a/src/mame/telercas/tmc1800.cpp +++ b/src/mame/telercas/tmc1800.cpp @@ -766,15 +766,15 @@ void nano_state::machine_reset() QUICKLOAD_LOAD_MEMBER(tmc1800_base_state::quickload_cb) { - uint8_t *ptr = m_rom->base(); - int size = image.length(); + int const size = image.length(); - if (size > m_ram->size()) + if (size > m_ram->size()) // FIXME: comparing size to RAM size, but loading to ROM - seems incorrect { return image_error::INVALIDLENGTH; } - image.fread( ptr, size); + uint8_t *const ptr = m_rom->base(); + image.fread(ptr, size); return std::error_condition(); } diff --git a/src/mame/thomson/thomson_m.cpp b/src/mame/thomson/thomson_m.cpp index 05d41c2f9c3..d6bddf0f8a2 100644 --- a/src/mame/thomson/thomson_m.cpp +++ b/src/mame/thomson/thomson_m.cpp @@ -242,24 +242,20 @@ void thomson_state::thom_irq_reset() DEVICE_IMAGE_LOAD_MEMBER( thomson_state::to7_cartridge ) { - int i,j; - uint8_t* pos = &m_cart_rom[0]; offs_t size; - char name[129]; - if (!image.loaded_through_softlist()) size = image.length(); else size = image.get_software_region_length("rom"); - /* get size & number of 16-KB banks */ - if ( size <= 0x04000 ) + // get size & number of 16-KB banks + if (size <= 0x04000) m_thom_cart_nb_banks = 1; - else if ( size == 0x08000 ) + else if (size == 0x08000) m_thom_cart_nb_banks = 2; - else if ( size == 0x0c000 ) + else if (size == 0x0c000) m_thom_cart_nb_banks = 3; - else if ( size == 0x10000 ) + else if (size == 0x10000) m_thom_cart_nb_banks = 4; else { @@ -267,9 +263,10 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state::to7_cartridge ) return image_error::INVALIDLENGTH; } + uint8_t *const pos = &m_cart_rom[0]; if (!image.loaded_through_softlist()) { - if ( image.fread( pos, size ) != size ) + if (image.fread(pos, size) != size) { osd_printf_error("%s: Read error\n", image.basename()); return image_error::UNSPECIFIED; @@ -280,14 +277,16 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state::to7_cartridge ) memcpy(pos, image.get_software_region("rom"), size); } - /* extract name */ - for ( i = 0; i < size && pos[i] != ' '; i++ ); - for ( i++, j = 0; i + j < size && j < 128 && pos[i+j] >= 0x20; j++) + // extract name + int i,j; + char name[129]; + for (i = 0; i < size && pos[i] != ' '; i++); + for (i++, j = 0; i + j < size && j < 128 && pos[i+j] >= 0x20; j++) name[j] = pos[i+j]; name[j] = 0; - /* sanitize name */ - for ( i = 0; name[i]; i++) + // sanitize name + for (i = 0; name[i]; i++) { if ( name[i] < ' ' || name[i] >= 127 ) name[i] = '?'; @@ -1067,24 +1066,22 @@ void mo5_state::mo5_gatearray_w(offs_t offset, uint8_t data) DEVICE_IMAGE_LOAD_MEMBER( thomson_state::mo5_cartridge ) { - uint8_t* pos = &m_cart_rom[0]; uint64_t size, i; int j; - char name[129]; if (!image.loaded_through_softlist()) size = image.length(); else size = image.get_software_region_length("rom"); - /* get size & number of 16-KB banks */ - if ( size > 32 && size <= 0x04000 ) + // get size & number of 16-KB banks + if (size > 32 && size <= 0x04000) m_thom_cart_nb_banks = 1; - else if ( size == 0x08000 ) + else if (size == 0x08000) m_thom_cart_nb_banks = 2; - else if ( size == 0x0c000 ) + else if (size == 0x0c000) m_thom_cart_nb_banks = 3; - else if ( size == 0x10000 ) + else if (size == 0x10000) m_thom_cart_nb_banks = 4; else { @@ -1092,9 +1089,10 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state::mo5_cartridge ) return image_error::INVALIDLENGTH; } + uint8_t *const pos = &m_cart_rom[0]; if (!image.loaded_through_softlist()) { - if ( image.fread(pos, size ) != size ) + if (image.fread(pos, size) != size) { osd_printf_error("Read error\n"); return image_error::UNSPECIFIED; @@ -1105,14 +1103,15 @@ DEVICE_IMAGE_LOAD_MEMBER( thomson_state::mo5_cartridge ) memcpy(pos, image.get_software_region("rom"), size); } - /* extract name */ + // extract name i = size - 32; - while ( i < size && !pos[i] ) i++; - for ( j = 0; i < size && pos[i] >= 0x20; j++, i++) + char name[129]; + while (i < size && !pos[i]) i++; + for (j = 0; i < size && pos[i] >= 0x20; j++, i++) name[j] = pos[i]; name[j] = 0; - /* sanitize name */ + // sanitize name for ( j = 0; name[j]; j++) { if ( name[j] < ' ' || name[j] >= 127 ) name[j] = '?'; diff --git a/src/mame/ti/avigo.cpp b/src/mame/ti/avigo.cpp index b65a862c6af..d4eca8713d2 100644 --- a/src/mame/ti/avigo.cpp +++ b/src/mame/ti/avigo.cpp @@ -697,7 +697,7 @@ QUICKLOAD_LOAD_MEMBER(avigo_state::quickload_cb) int app_page; // german and spanish language are 4 pages bigger than other - if ( strcmp( systemname, "avigo_de" ) == 0 || strcmp( systemname, "avigo_es" ) == 0 ) + if (strcmp( systemname, "avigo_de" ) == 0 || strcmp( systemname, "avigo_es" ) == 0) first_app_page += 4; // search the first empty page diff --git a/src/mame/ti/snspell.cpp b/src/mame/ti/snspell.cpp index ce33f514c81..94dd63a21ec 100644 --- a/src/mame/ti/snspell.cpp +++ b/src/mame/ti/snspell.cpp @@ -364,7 +364,7 @@ void snspell_state::power_off() DEVICE_IMAGE_LOAD_MEMBER(snspell_state::cart_load) { - u32 size = m_cart->common_get_size("rom"); + u32 const size = m_cart->common_get_size("rom"); if (size > m_cart_max_size) { diff --git a/src/mame/tiger/gamecom.h b/src/mame/tiger/gamecom.h index edb5bacc019..d9d2c85571a 100644 --- a/src/mame/tiger/gamecom.h +++ b/src/mame/tiger/gamecom.h @@ -237,8 +237,11 @@ public: void init_gamecom(); -private: +protected: + virtual void machine_reset() override; + virtual void video_start() override; +private: uint8_t gamecom_internal_r(offs_t offset); uint8_t gamecom_pio_r(offs_t offset); void gamecom_internal_w(offs_t offset, uint8_t data); @@ -256,6 +259,11 @@ private: uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); void gamecom_mem_map(address_map &map); + void gamecom_set_mmu(uint8_t mmu, uint8_t data); + void handle_stylus_press(int column); + void recompute_lcd_params(); + void handle_input_press(uint16_t mux_data); + uint8_t *m_p_ram = nullptr; uint8_t *m_cart_ptr = nullptr; uint8_t m_lcdc_reg = 0U; @@ -275,13 +283,8 @@ private: GAMECOM_TIMER m_timer[2]; gamecom_sound_t m_sound; bitmap_ind16 m_bitmap; - void gamecom_set_mmu(uint8_t mmu, uint8_t data); - void handle_stylus_press(int column); - void recompute_lcd_params(); - void handle_input_press(uint16_t mux_data); + std::error_condition common_load(device_image_interface &image, generic_slot_device *slot); - virtual void machine_reset() override; - virtual void video_start() override; required_shared_ptr m_p_videoram; required_shared_ptr m_p_nvram; required_device m_maincpu; diff --git a/src/mame/tiger/gamecom_m.cpp b/src/mame/tiger/gamecom_m.cpp index 095d2306b98..08e05c420a0 100644 --- a/src/mame/tiger/gamecom_m.cpp +++ b/src/mame/tiger/gamecom_m.cpp @@ -623,11 +623,11 @@ void gamecom_state::init_gamecom() std::error_condition gamecom_state::common_load(device_image_interface &image, generic_slot_device *slot) { - uint32_t size = slot->common_get_size("rom"); + uint32_t const size = slot->common_get_size("rom"); uint32_t load_offset = 0; - if (size != 0x008000 && size != 0x040000 && size != 0x080000 - && size != 0x100000 && size != 0x1c0000 && size != 0x200000) + if (size != 0x00'8000 && size != 0x04'0000 && size != 0x08'0000 + && size != 0x10'0000 && size != 0x1c'0000 && size != 0x20'0000) { osd_printf_error("%s: Unsupported cartridge size\n", image.basename()); return image_error::INVALIDLENGTH; diff --git a/src/mame/tiger/k28m2.cpp b/src/mame/tiger/k28m2.cpp index fb4f0ab4839..e7858e10acc 100644 --- a/src/mame/tiger/k28m2.cpp +++ b/src/mame/tiger/k28m2.cpp @@ -120,7 +120,7 @@ void k28m2_state::power_off() DEVICE_IMAGE_LOAD_MEMBER(k28m2_state::cart_load) { - u32 size = m_cart->common_get_size("rom"); + u32 const size = m_cart->common_get_size("rom"); if (size > 0x4000) { @@ -128,7 +128,7 @@ DEVICE_IMAGE_LOAD_MEMBER(k28m2_state::cart_load) return image_error::INVALIDLENGTH; } - u8 *base = memregion("tms6100")->base() + 0x8000; + u8 *const base = memregion("tms6100")->base() + 0x8000; m_cart->common_load_rom(base, size, "rom"); return std::error_condition(); diff --git a/src/mame/trs/coco_vhd.h b/src/mame/trs/coco_vhd.h index 89ce2cb7bb5..405477ae222 100644 --- a/src/mame/trs/coco_vhd.h +++ b/src/mame/trs/coco_vhd.h @@ -33,7 +33,7 @@ public: coco_vhd_image_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); virtual ~coco_vhd_image_device(); - // 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/mame/trs/trs80_m.cpp b/src/mame/trs/trs80_m.cpp index 9371a232055..fbc52ca0524 100644 --- a/src/mame/trs/trs80_m.cpp +++ b/src/mame/trs/trs80_m.cpp @@ -386,16 +386,16 @@ QUICKLOAD_LOAD_MEMBER(trs80_state::quickload_cb) while (!image.image_feof()) { - image.fread( &type, 1); - image.fread( &length, 1); + image.fread(&type, 1); + image.fread(&length, 1); switch (type) { - case CMD_TYPE_OBJECT_CODE: // 01 - block of data + case CMD_TYPE_OBJECT_CODE: // 01 - block of data { length -= 2; u16 block_length = length ? length : 256; - image.fread( &addr, 2); + image.fread(&addr, 2); u16 address = (addr[1] << 8) | addr[0]; if (LOG) logerror("/CMD object code block: address %04x length %u\n", address, block_length); ptr = program.get_write_ptr(address); @@ -408,9 +408,9 @@ QUICKLOAD_LOAD_MEMBER(trs80_state::quickload_cb) } break; - case CMD_TYPE_TRANSFER_ADDRESS: // 02 - go address + case CMD_TYPE_TRANSFER_ADDRESS: // 02 - go address { - image.fread( &addr, 2); + image.fread(&addr, 2); u16 address = (addr[1] << 8) | addr[0]; if (LOG) logerror("/CMD transfer address %04x\n", address); m_maincpu->set_state_int(Z80_PC, address); @@ -418,17 +418,17 @@ QUICKLOAD_LOAD_MEMBER(trs80_state::quickload_cb) return std::error_condition(); case CMD_TYPE_LOAD_MODULE_HEADER: // 05 - name - image.fread( &data, length); + image.fread(&data, length); if (LOG) logerror("/CMD load module header '%s'\n", data); break; case CMD_TYPE_COPYRIGHT_BLOCK: // 1F - copyright info - image.fread( &data, length); + image.fread(&data, length); if (LOG) logerror("/CMD copyright block '%s'\n", data); break; default: - image.fread( &data, length); + image.fread(&data, length); logerror("/CMD unsupported block type %u!\n", type); image.message("Unsupported or invalid block type"); return image_error::INVALIDIMAGE; diff --git a/src/mame/trs/trs80m3_m.cpp b/src/mame/trs/trs80m3_m.cpp index 3d9c1e91d32..831bdecfc57 100644 --- a/src/mame/trs/trs80m3_m.cpp +++ b/src/mame/trs/trs80m3_m.cpp @@ -675,12 +675,12 @@ QUICKLOAD_LOAD_MEMBER(trs80m3_state::quickload_cb) while (!image.image_feof()) { - image.fread( &type, 1); - image.fread( &length, 1); + image.fread(&type, 1); + image.fread(&length, 1); switch (type) { - case CMD_TYPE_OBJECT_CODE: // 01 - block of data + case CMD_TYPE_OBJECT_CODE: // 01 - block of data { length -= 2; u16 block_length = length ? length : 256; @@ -693,11 +693,11 @@ QUICKLOAD_LOAD_MEMBER(trs80m3_state::quickload_cb) image.message("Attempting to write outside of RAM"); return image_error::INVALIDIMAGE; } - image.fread( ptr, block_length); + image.fread(ptr, block_length); } break; - case CMD_TYPE_TRANSFER_ADDRESS: // 02 - go address + case CMD_TYPE_TRANSFER_ADDRESS: // 02 - go address { image.fread( &addr, 2); u16 address = (addr[1] << 8) | addr[0]; @@ -717,7 +717,7 @@ QUICKLOAD_LOAD_MEMBER(trs80m3_state::quickload_cb) break; default: - image.fread( &data, length); + image.fread(&data, length); logerror("/CMD unsupported block type %u!\n", type); image.message("Unsupported or invalid block type"); return image_error::INVALIDIMAGE; diff --git a/src/mame/tvgames/elan_eu3a05.cpp b/src/mame/tvgames/elan_eu3a05.cpp index a7374f53567..4528714757b 100644 --- a/src/mame/tvgames/elan_eu3a05.cpp +++ b/src/mame/tvgames/elan_eu3a05.cpp @@ -362,9 +362,9 @@ void elan_eu3a05_buzztime_state::machine_start() DEVICE_IMAGE_LOAD_MEMBER(elan_eu3a05_buzztime_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); - if (size != 0x200000) + if (size != 0x20'0000) { osd_printf_error("%s: Unsupported cartridge size\n", image.basename()); return image_error::INVALIDLENGTH; diff --git a/src/mame/tvgames/generalplus_gpl16250_mobigo.cpp b/src/mame/tvgames/generalplus_gpl16250_mobigo.cpp index 7496dc62f5b..a76d7853e42 100644 --- a/src/mame/tvgames/generalplus_gpl16250_mobigo.cpp +++ b/src/mame/tvgames/generalplus_gpl16250_mobigo.cpp @@ -72,7 +72,7 @@ INPUT_PORTS_END DEVICE_IMAGE_LOAD_MEMBER(mobigo2_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); return std::error_condition(); @@ -80,7 +80,7 @@ DEVICE_IMAGE_LOAD_MEMBER(mobigo2_state::cart_load) DEVICE_IMAGE_LOAD_MEMBER(mobigo_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); return std::error_condition(); diff --git a/src/mame/tvgames/generalplus_gpl16250_nand.cpp b/src/mame/tvgames/generalplus_gpl16250_nand.cpp index c55db6559e9..c71acef6097 100644 --- a/src/mame/tvgames/generalplus_gpl16250_nand.cpp +++ b/src/mame/tvgames/generalplus_gpl16250_nand.cpp @@ -103,7 +103,7 @@ void generalplus_gpac800_game_state::generalplus_gpac800(machine_config &config) DEVICE_IMAGE_LOAD_MEMBER(generalplus_gpac800_vbaby_game_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); diff --git a/src/mame/tvgames/generalplus_gpl16250_spi.cpp b/src/mame/tvgames/generalplus_gpl16250_spi.cpp index ea0e3d600bb..fd72259749b 100644 --- a/src/mame/tvgames/generalplus_gpl16250_spi.cpp +++ b/src/mame/tvgames/generalplus_gpl16250_spi.cpp @@ -108,7 +108,7 @@ void generalplus_gpspispi_game_state::generalplus_gpspispi(machine_config &confi DEVICE_IMAGE_LOAD_MEMBER(generalplus_gpspispi_bkrankp_game_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); diff --git a/src/mame/tvgames/generalplus_gpl32612.cpp b/src/mame/tvgames/generalplus_gpl32612.cpp index 07a95ea1fe0..06685121413 100644 --- a/src/mame/tvgames/generalplus_gpl32612.cpp +++ b/src/mame/tvgames/generalplus_gpl32612.cpp @@ -201,7 +201,7 @@ void generalplus_zippity_game_state::machine_start() DEVICE_IMAGE_LOAD_MEMBER(generalplus_zippity_game_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); diff --git a/src/mame/tvgames/hyperscan_card.h b/src/mame/tvgames/hyperscan_card.h index 068e8d1e9c1..32dd095efc3 100644 --- a/src/mame/tvgames/hyperscan_card.h +++ b/src/mame/tvgames/hyperscan_card.h @@ -22,7 +22,7 @@ protected: 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 void call_unload() override; virtual bool is_creatable() const noexcept override { return false; } @@ -30,7 +30,6 @@ protected: virtual const char *image_interface() const noexcept override { return "hyperscan_card"; } virtual const char *file_extensions() const noexcept override { return "bin"; } - // device_image_interface implementation virtual const software_list_loader &get_software_list_loader() const override; private: diff --git a/src/mame/tvgames/magiceyes_pollux_vr3520f.cpp b/src/mame/tvgames/magiceyes_pollux_vr3520f.cpp index a14dca0e3b3..2bfbd28708f 100644 --- a/src/mame/tvgames/magiceyes_pollux_vr3520f.cpp +++ b/src/mame/tvgames/magiceyes_pollux_vr3520f.cpp @@ -71,7 +71,7 @@ void magiceyes_vr3520f_game_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER(magiceyes_vr3520f_game_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); diff --git a/src/mame/tvgames/pubint_storyreader.cpp b/src/mame/tvgames/pubint_storyreader.cpp index 7e3831c06b2..41fea27e073 100644 --- a/src/mame/tvgames/pubint_storyreader.cpp +++ b/src/mame/tvgames/pubint_storyreader.cpp @@ -118,7 +118,7 @@ void pi_storyreader_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER(pi_storyreader_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); diff --git a/src/mame/tvgames/spg110.cpp b/src/mame/tvgames/spg110.cpp index dc53bf9cf14..9ca15e90d3f 100644 --- a/src/mame/tvgames/spg110.cpp +++ b/src/mame/tvgames/spg110.cpp @@ -563,7 +563,7 @@ void spg110_sstarkar_game_state::machine_start() DEVICE_IMAGE_LOAD_MEMBER(spg110_sstarkar_game_state::cart_load) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); m_cart->rom_alloc(size, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE); m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom"); diff --git a/src/mame/tvgames/spg2xx_ican.cpp b/src/mame/tvgames/spg2xx_ican.cpp index cbb68987c73..2fbcfe13061 100644 --- a/src/mame/tvgames/spg2xx_ican.cpp +++ b/src/mame/tvgames/spg2xx_ican.cpp @@ -429,9 +429,9 @@ void icanguit_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER(icanguit_state::cart_load_icanguit) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); - if (size < 0x800000) + if (size < 0x80'0000) { osd_printf_error("%s: Unsupported cartridge size\n", image.basename()); return image_error::INVALIDLENGTH; diff --git a/src/mame/tvgames/spg2xx_smarttv.cpp b/src/mame/tvgames/spg2xx_smarttv.cpp index b1a4f510743..02771d5354b 100644 --- a/src/mame/tvgames/spg2xx_smarttv.cpp +++ b/src/mame/tvgames/spg2xx_smarttv.cpp @@ -192,9 +192,9 @@ void smarttv_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER(smarttv_state::cart_load_smarttv) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); - if (size > 0x800000) + if (size > 0x80'0000) { osd_printf_error("%s: Unsupported cartridge size\n", image.basename()); return image_error::INVALIDLENGTH; diff --git a/src/mame/tvgames/spg2xx_telestory.cpp b/src/mame/tvgames/spg2xx_telestory.cpp index 844673c31ec..341916ebaed 100644 --- a/src/mame/tvgames/spg2xx_telestory.cpp +++ b/src/mame/tvgames/spg2xx_telestory.cpp @@ -256,9 +256,9 @@ void telestory_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER(telestory_state::cart_load_telestory) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); - if (size > 0x800000) + if (size > 0x80'0000) { osd_printf_error("%s: Unsupported cartridge size\n", image.basename()); return image_error::INVALIDLENGTH; diff --git a/src/mame/tvgames/spg2xx_tvgogo.cpp b/src/mame/tvgames/spg2xx_tvgogo.cpp index 132e72d7941..0e187bd3159 100644 --- a/src/mame/tvgames/spg2xx_tvgogo.cpp +++ b/src/mame/tvgames/spg2xx_tvgogo.cpp @@ -209,9 +209,9 @@ void tvgogo_state::machine_reset() DEVICE_IMAGE_LOAD_MEMBER(tvgogo_state::cart_load_tvgogo) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); - if (size > 0x800000) + if (size > 0x80'0000) { osd_printf_error("%s: Unsupported cartridge size\n", image.basename()); return image_error::INVALIDLENGTH; diff --git a/src/mame/tvgames/spg2xx_vii.cpp b/src/mame/tvgames/spg2xx_vii.cpp index 3713c18e7c0..015caeda01d 100644 --- a/src/mame/tvgames/spg2xx_vii.cpp +++ b/src/mame/tvgames/spg2xx_vii.cpp @@ -136,9 +136,9 @@ TIMER_CALLBACK_MEMBER(vii_state::poll_controls) DEVICE_IMAGE_LOAD_MEMBER(vii_state::cart_load_vii) { - uint32_t size = m_cart->common_get_size("rom"); + uint32_t const size = m_cart->common_get_size("rom"); - if (size < 0x800000) + if (size < 0x80'0000) { osd_printf_error("%s: Unsupported cartridge size\n", image.basename()); return image_error::INVALIDLENGTH; diff --git a/src/mame/ussr/lviv.h b/src/mame/ussr/lviv.h index cb3cad90b68..742b621c2a6 100644 --- a/src/mame/ussr/lviv.h +++ b/src/mame/ussr/lviv.h @@ -69,7 +69,7 @@ private: void update_palette(uint8_t pal); void update_memory(); - void setup_snapshot(uint8_t * data); + void setup_snapshot(uint8_t *data); void dump_registers(); std::error_condition verify_snapshot(const uint8_t * data, uint32_t size); -- cgit v1.2.3