neogeo/neogeo.cpp, neogeo/ng_memcard.cpp: Hooked up more control lines.

Hooked up the memory card write enable/disable and register select
lines, and corrected the address range where memory card access is
enabled.

Card addressing still isn't quite right - the card bank register isn't
hooked up.  Neo Geo CD consoles also haven't been updated.

Also, more of the same mechanical cleanup of copy/pasted comments,
const, and variable scope.
This commit is contained in:
Vas Crabb 2023-04-05 03:33:46 +10:00
parent c2f45efe52
commit affd3d25b4
67 changed files with 272 additions and 233 deletions

View File

@ -100,7 +100,7 @@ public:
a78_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~a78_cart_slot_device();
// image-level overrides
// device_image_interface implementation
virtual std::error_condition call_load() override;
virtual void call_unload() override;
@ -109,7 +109,7 @@ public:
virtual const char *file_extensions() const noexcept override { return "a78"; }
virtual u32 unhashed_header_length() const noexcept override { return 128; }
// 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() { return m_type; }
@ -126,15 +126,15 @@ public:
void write_40xx(offs_t offset, uint8_t data);
private:
// device-level overrides
// device_t implementation
virtual void device_start() override;
device_a78_cart_interface* m_cart;
int m_type;
std::error_condition verify_header(const char *header);
int validate_header(int head, bool log) const;
void internal_header_logging(uint8_t *header, uint32_t len);
device_a78_cart_interface *m_cart;
int m_type;
};

View File

@ -139,7 +139,7 @@ void acorn_8k_device::device_reset()
std::error_condition acorn_8k_device::load_rom(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");
// socket accepts 2K and 4K ROM only
if (size != 0x0800 && size != 0x1000)

View File

@ -32,7 +32,7 @@ public:
acorn_8k_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
virtual void device_reset() override;

View File

@ -81,11 +81,9 @@ std::error_condition adam_expansion_slot_device::call_load()
{
if (m_card)
{
size_t size;
if (!loaded_through_softlist())
{
size = length();
size_t const size = length();
fread(m_card->m_rom, size);
}

View File

@ -60,7 +60,7 @@ protected:
virtual const char *image_interface() const noexcept override { return "adam_rom"; }
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;
devcb_write_line m_write_irq;

View File

@ -148,7 +148,7 @@ std::error_condition apf_cart_slot_device::call_load()
{
if (m_cart)
{
uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size > 0x3800)
{
@ -186,8 +186,6 @@ std::error_condition apf_cart_slot_device::call_load()
}
//printf("Type: %s\n", apf_get_slot(m_type));
return std::error_condition();
}
return std::error_condition();

View File

@ -72,7 +72,7 @@ public:
apf_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
virtual ~apf_cart_slot_device();
// image-level overrides
// device_image_interface implementation
virtual std::error_condition call_load() override;
virtual void call_unload() override {}
@ -80,7 +80,7 @@ public:
virtual const char *image_interface() const noexcept override { return "apfm1000_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; }
@ -94,11 +94,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_apf_cart_interface* m_cart;
device_apf_cart_interface *m_cart;
};

View File

@ -87,7 +87,7 @@ std::error_condition aquarius_cartridge_slot_device::call_load()
{
if (m_cart)
{
uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size % 0x1000)
{

View File

@ -137,7 +137,7 @@ std::error_condition arcadia_cart_slot_device::call_load()
{
if (m_cart)
{
uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint32_t const len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
m_cart->rom_alloc(len);
@ -193,8 +193,6 @@ std::error_condition arcadia_cart_slot_device::call_load()
}
//printf("Type: %s\n", arcadia_get_slot(m_type));
return std::error_condition();
}
return std::error_condition();

View File

@ -61,7 +61,7 @@ public:
arcadia_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~arcadia_cart_slot_device();
// image-level overrides
// device_image_interface implementation
virtual std::error_condition call_load() override;
virtual void call_unload() override {}
@ -69,7 +69,7 @@ public:
virtual const char *image_interface() const noexcept override { return "arcadia_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; }
@ -79,11 +79,11 @@ public:
uint8_t extra_rom(offs_t offset);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
int m_type;
device_arcadia_cart_interface* m_cart;
device_arcadia_cart_interface *m_cart;
};
DECLARE_DEVICE_TYPE(EA2001_CART_SLOT, arcadia_cart_slot_device)

View File

@ -138,7 +138,7 @@ std::error_condition astrocade_cart_slot_device::call_load()
{
if (m_cart)
{
uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
m_cart->rom_alloc(size);
if (!loaded_through_softlist())
@ -163,8 +163,6 @@ std::error_condition astrocade_cart_slot_device::call_load()
}
//printf("Type: %s\n", astrocade_get_slot(m_type));
return std::error_condition();
}
return std::error_condition();

View File

@ -309,13 +309,13 @@ INPUT_CHANGED_MEMBER(bbc_datacentre_device::import_nvrest)
template<int Drive>
QUICKLOAD_LOAD_MEMBER(bbc_datacentre_device::quickload_cb)
{
/* simulate *IMPORT from USB to RAMFS */
// simulate *IMPORT from USB to RAMFS
if (image.is_filetype("ssd") || image.is_filetype("img") || image.is_filetype("dsd"))
{
uint32_t ram_addr = (Drive * 0x40000) | 0x1000;
uint32_t const ram_addr = (Drive * 0x40000) | 0x1000;
offs_t offset = 0;
/* import tracks */
// import tracks
for (int i = 0; i < 80; i++)
{
image.fread(m_ram.get() + ram_addr + offset, 0xa00);

View File

@ -33,7 +33,7 @@ public:
template<int Drive> DECLARE_QUICKLOAD_LOAD_MEMBER(quickload_cb);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
// optional information overrides

View File

@ -118,7 +118,7 @@ std::error_condition bbc_romslot_device::call_load()
{
if (m_cart)
{
uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size % 0x2000)
{

View File

@ -29,7 +29,7 @@ class bbc_romslot_device : public device_t,
public device_single_card_slot_interface<device_bbc_rom_interface>
{
public:
// image-level overrides
// device_image_interface implementation
virtual std::error_condition call_load() override;
virtual void call_unload() override;
@ -37,7 +37,7 @@ public:
virtual const char *image_interface() const noexcept override { return "bbc_rom"; }
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
@ -55,7 +55,7 @@ protected:
// construction/destruction
bbc_romslot_device(const machine_config &mconfig, device_type type, char const *tag, device_t *owner, uint32_t clock);
// device-level overrides
// device_t implementation
virtual void device_start() override;
uint32_t m_slot_size;

View File

@ -95,18 +95,18 @@ public:
void set_passthrough();
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
virtual void device_reset() override;
// image-level overrides
// device_image_interface implementation
virtual std::error_condition call_load() override;
virtual bool is_reset_on_load() const noexcept override { return true; }
virtual const char *image_interface() const noexcept override { return "c64_cart,vic10_cart"; }
virtual const char *file_extensions() const noexcept override { return "80,a0,e0,crt"; }
// slot interface overrides
// device_slot_interface implementation
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
devcb_read8 m_read_dma_cd;

View File

@ -85,13 +85,11 @@ void cbm2_expansion_slot_device::device_start()
std::error_condition cbm2_expansion_slot_device::call_load()
{
size_t size;
if (m_card)
{
if (!loaded_through_softlist())
{
size = length();
size_t const size = length();
if (is_filetype("20"))
{

View File

@ -177,7 +177,7 @@ TIMER_DEVICE_CALLBACK_MEMBER( cgenie_fdc_device::timer_callback )
DEVICE_IMAGE_LOAD_MEMBER( cgenie_fdc_device::socket_load )
{
uint32_t size = m_socket->common_get_size("rom");
uint32_t const size = m_socket->common_get_size("rom");
if (size > 0x1000)
{

View File

@ -150,7 +150,7 @@ std::error_condition channelf_cart_slot_device::call_load()
{
if (m_cart)
{
uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint32_t const len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
m_cart->rom_alloc(len);
if (!loaded_through_softlist())
@ -180,8 +180,6 @@ std::error_condition channelf_cart_slot_device::call_load()
}
//printf("Type: %s\n", chanf_get_slot(m_type));
return std::error_condition();
}
return std::error_condition();

View File

@ -77,7 +77,7 @@ public:
virtual const char *image_interface() const noexcept override { return "coco_cart"; }
virtual const char *file_extensions() const noexcept override { return "ccc,rom"; }
// 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 to $C000-$FFEF

View File

@ -80,7 +80,7 @@ std::error_condition colecovision_cartridge_slot_device::call_load()
{
if (m_card)
{
size_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
size_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
m_card->rom_alloc(size);
if (!loaded_through_softlist())

View File

@ -103,18 +103,17 @@ void cpc_rom_image_device::device_start()
-------------------------------------------------*/
std::error_condition cpc_rom_image_device::call_load()
{
device_image_interface* image = this;
uint64_t size = image->length();
uint64_t const size = length();
m_base = std::make_unique<uint8_t[]>(16384);
if(size <= 16384)
{
image->fread(m_base,size);
fread(m_base, size);
}
else
{
image->fseek(size-16384,SEEK_SET);
image->fread(m_base,16384);
fseek(size - 16384, SEEK_SET);
fread(m_base, 16384);
}
return std::error_condition();

View File

@ -36,7 +36,7 @@ public:
uint8_t* base() { return m_base.get(); }
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
private:

View File

@ -141,7 +141,7 @@ std::error_condition crvision_cart_slot_device::call_load()
{
if (m_cart)
{
uint32_t size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint32_t const size = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (size > 0x4800)
{
@ -192,9 +192,7 @@ std::error_condition crvision_cart_slot_device::call_load()
m_type = crvision_get_pcb_id(pcb_name);
}
printf("Type: %s\n", crvision_get_slot(m_type));
return std::error_condition();
logerror("Type: %s\n", crvision_get_slot(m_type));
}
return std::error_condition();

View File

@ -70,7 +70,7 @@ public:
crvision_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~crvision_cart_slot_device();
// image-level overrides
// device_image_interface implementation
virtual std::error_condition call_load() override;
virtual void call_unload() override { }
@ -78,7 +78,7 @@ public:
virtual const char *image_interface() const noexcept override { return "crvision_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; }
@ -88,11 +88,11 @@ public:
uint8_t read_rom80(offs_t offset);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
int m_type;
device_crvision_cart_interface* m_cart;
device_crvision_cart_interface *m_cart;
};
// device type definition

View File

@ -131,12 +131,11 @@ std::error_condition ekara_cart_slot_device::call_load()
{
if (m_cart)
{
uint8_t *ROM;
uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint32_t const len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
m_cart->rom_alloc(len);
ROM = m_cart->get_rom_base();
uint8_t *const ROM = m_cart->get_rom_base();
if (!loaded_through_softlist())
fread(ROM, len);
@ -155,8 +154,6 @@ std::error_condition ekara_cart_slot_device::call_load()
if (pcb_name)
m_type = ekara_get_pcb_id(pcb_name);
}
return std::error_condition();
}
return std::error_condition();

View File

@ -156,7 +156,7 @@ void electron_ap5_device::write(offs_t offset, uint8_t data, int infc, int infd,
std::error_condition electron_ap5_device::load_rom(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");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
@ -169,8 +169,9 @@ std::error_condition electron_ap5_device::load_rom(device_image_interface &image
slot->common_load_rom(slot->get_rom_base(), size, "rom");
// mirror 8K ROMs
uint8_t *crt = slot->get_rom_base();
if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000);
uint8_t *const crt = slot->get_rom_base();
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
return std::error_condition();
}

View File

@ -31,13 +31,13 @@ public:
electron_ap5_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
// electron_cart_interface overrides
// electron_cart_interface implementation
virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;

View File

@ -142,7 +142,7 @@ void electron_romp144_device::write(offs_t offset, uint8_t data, int infc, int i
std::error_condition electron_romp144_device::load_rom(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");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
@ -155,8 +155,9 @@ std::error_condition electron_romp144_device::load_rom(device_image_interface &i
slot->common_load_rom(slot->get_rom_base(), size, "rom");
// mirror 8K ROMs
uint8_t *crt = slot->get_rom_base();
if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000);
uint8_t *const crt = slot->get_rom_base();
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
return std::error_condition();
}

View File

@ -26,13 +26,13 @@ public:
electron_romp144_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
// optional information overrides
virtual void device_add_mconfig(machine_config &config) override;
// electron_cart_interface overrides
// electron_cart_interface implementation
virtual uint8_t read(offs_t offset, int infc, int infd, int romqa, int oe, int oe2) override;
virtual void write(offs_t offset, uint8_t data, int infc, int infd, int romqa, int oe, int oe2) override;

View File

@ -128,7 +128,7 @@ std::error_condition electron_cartslot_device::call_load()
{
if (!loaded_through_softlist())
{
uint32_t size = length();
uint32_t const size = length();
if (size % 0x2000)
{
@ -150,7 +150,7 @@ std::error_condition electron_cartslot_device::call_load()
uint32_t ramsize = get_software_region_length("ram");
uint32_t nvramsize = get_software_region_length("nvram");
if ((upsize % 0x2000 && upsize != 0) || (losize % 0x2000 && losize != 0) || (romsize % 0x2000 && romsize != 0))
if ((upsize % 0x2000) || (losize % 0x2000) || (romsize % 0x2000))
{
osd_printf_error("%s: Unsupported cartridge size\n", basename());
return image_error::INVALIDLENGTH;

View File

@ -136,7 +136,7 @@ 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 void call_unload() override;
@ -145,7 +145,7 @@ public:
virtual const char *image_interface() const noexcept override { return "electron_cart"; }
virtual const char *file_extensions() const noexcept override { return "rom,bin"; }
// slot interface overrides
// device_image_interface implementation
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
// reading and writing
@ -160,7 +160,7 @@ public:
protected:
electron_cartslot_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;
device_electron_cart_interface *m_cart;

View File

@ -492,7 +492,7 @@ void electron_ap6_device::expbus_w(offs_t offset, uint8_t data)
std::error_condition electron_ap6_device::load_rom(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");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
@ -505,8 +505,9 @@ std::error_condition electron_ap6_device::load_rom(device_image_interface &image
slot->common_load_rom(slot->get_rom_base(), size, "rom");
// mirror 8K ROMs
uint8_t *crt = slot->get_rom_base();
if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000);
uint8_t *const crt = slot->get_rom_base();
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
return std::error_condition();
}

View File

@ -34,7 +34,7 @@ public:
protected:
electron_plus1_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;
// optional information overrides
@ -76,7 +76,7 @@ public:
electron_ap6_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
// optional information overrides

View File

@ -226,7 +226,7 @@ void electron_plus2_device::expbus_w(offs_t offset, uint8_t data)
std::error_condition electron_plus2_device::load_rom(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");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
@ -239,8 +239,9 @@ std::error_condition electron_plus2_device::load_rom(device_image_interface &ima
slot->common_load_rom(slot->get_rom_base(), size, "rom");
// mirror 8K ROMs
uint8_t *crt = slot->get_rom_base();
if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000);
uint8_t *const crt = slot->get_rom_base();
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
return std::error_condition();
}

View File

@ -31,7 +31,7 @@ public:
electron_plus2_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
// optional information overrides

View File

@ -180,7 +180,7 @@ void electron_rombox_device::expbus_w(offs_t offset, uint8_t data)
std::error_condition electron_rombox_device::load_rom(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");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
@ -193,8 +193,9 @@ std::error_condition electron_rombox_device::load_rom(device_image_interface &im
slot->common_load_rom(slot->get_rom_base(), size, "rom");
// mirror 8K ROMs
uint8_t *crt = slot->get_rom_base();
if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000);
uint8_t *const crt = slot->get_rom_base();
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
return std::error_condition();
}

View File

@ -27,7 +27,7 @@ public:
electron_rombox_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
virtual void device_reset() override;

View File

@ -323,7 +323,7 @@ void electron_romboxp_device::expbus_w(offs_t offset, uint8_t data)
std::error_condition electron_romboxp_device::load_rom(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");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
@ -336,8 +336,9 @@ std::error_condition electron_romboxp_device::load_rom(device_image_interface &i
slot->common_load_rom(slot->get_rom_base(), size, "rom");
// mirror 8K ROMs
uint8_t *crt = slot->get_rom_base();
if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000);
uint8_t *const crt = slot->get_rom_base();
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
return std::error_condition();
}

View File

@ -32,7 +32,7 @@ public:
electron_romboxp_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
virtual void device_reset() override;

View File

@ -169,7 +169,7 @@ void electron_sidewndr_device::expbus_w(offs_t offset, uint8_t data)
std::error_condition electron_sidewndr_device::load_rom(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");
// socket accepts 8K and 16K ROM only
if (size != 0x2000 && size != 0x4000)
@ -182,8 +182,9 @@ std::error_condition electron_sidewndr_device::load_rom(device_image_interface &
slot->common_load_rom(slot->get_rom_base(), size, "rom");
// mirror 8K ROMs
uint8_t *crt = slot->get_rom_base();
if (size <= 0x2000) memcpy(crt + 0x2000, crt, 0x2000);
uint8_t *const crt = slot->get_rom_base();
if (size <= 0x2000)
memcpy(crt + 0x2000, crt, 0x2000);
return std::error_condition();
}

View File

@ -27,7 +27,7 @@ public:
electron_sidewndr_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
// optional information overrides

View File

@ -129,10 +129,9 @@ std::error_condition gamate_cart_slot_device::call_load()
{
if (m_cart)
{
uint8_t *ROM;
uint32_t len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
uint32_t const len = !loaded_through_softlist() ? length() : get_software_region_length("rom");
if (len > 0x80000)
if (len > 0x8'0000)
{
osd_printf_error("%s: Unsupported cartridge size\n", basename());
return image_error::INVALIDLENGTH;
@ -140,7 +139,7 @@ std::error_condition gamate_cart_slot_device::call_load()
m_cart->rom_alloc(len);
ROM = m_cart->get_rom_base();
uint8_t *const ROM = m_cart->get_rom_base();
if (!loaded_through_softlist())
fread(ROM, len);
@ -159,8 +158,6 @@ std::error_condition gamate_cart_slot_device::call_load()
if (pcb_name)
m_type = gamate_get_pcb_id(pcb_name);
}
return std::error_condition();
}
return std::error_condition();

View File

@ -64,7 +64,7 @@ public:
gamate_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock = 0);
virtual ~gamate_cart_slot_device();
// image-level overrides
// device_image_interface implementation
virtual std::error_condition call_load() override;
virtual void call_unload() override { }
@ -72,7 +72,7 @@ public:
virtual const char *image_interface() const noexcept override { return "gamate_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:
void write_cart(offs_t offset, uint8_t data);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
int m_type;
device_gamate_cart_interface* m_cart;
device_gamate_cart_interface *m_cart;
};
// device type definition

View File

@ -108,14 +108,14 @@ public:
auto out_irq4_callback() { return m_out_irq4_cb.bind(); }
auto out_drq_callback() { return m_out_drq_cb.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 "iq151_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;
// reading and writing
@ -126,7 +126,7 @@ public:
virtual void video_update(bitmap_ind16 &bitmap, const rectangle &cliprect);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
devcb_write_line m_out_irq0_cb;

View File

@ -79,7 +79,7 @@ public:
vsmile_cart_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
virtual ~vsmile_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 "vsmile_cart"; }
virtual const char *file_extensions() const noexcept override { return "u1,u3,bin"; }
// slot interface overrides
// device_slot_interface implementation
virtual std::string get_default_card_software(get_default_card_software_hook &hook) const override;
void save_nvram() { if (m_cart && m_cart->get_nvram_size()) m_cart->save_nvram(); }
@ -107,11 +107,11 @@ public:
void set_cs2(bool cs2);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
int m_type;
device_vsmile_cart_interface* m_cart;
device_vsmile_cart_interface *m_cart;
};
// device type definition

View File

@ -34,7 +34,7 @@ public:
template <typename Object> void set_device_unload(Object &&cb) { m_device_image_unload = std::forward<Object>(cb); }
void set_interface(const char *interface) { m_interface = interface; }
// image-level overrides
// device_image_interface implementation
virtual std::error_condition call_load() override;
virtual std::error_condition call_create(int create_format, util::option_resolution *create_args) override;
virtual void call_unload() override;
@ -48,7 +48,7 @@ public:
hard_disk_file *get_hard_disk_file() { return m_hard_disk_handle; }
protected:
// device-level overrides
// device_t implementation
virtual void device_config_complete() override;
virtual void device_start() override;
virtual void device_stop() override;

View File

@ -1059,18 +1059,15 @@ CUSTOM_INPUT_MEMBER(neogeo_base_state::get_memcard_status)
}
uint16_t neogeo_base_state::memcard_r(offs_t offset)
uint16_t neogeo_base_state::memcard_r(offs_t offset, uint16_t mem_mask)
{
m_maincpu->eat_cycles(2); // insert waitstate
uint16_t ret;
if (m_memcard->present())
ret = m_memcard->read(offset) | 0xff00;
// memory card enabled by /UDS
if (ACCESSING_BITS_8_15 && m_memcard->present())
return m_memcard->read(offset);
else
ret = 0xffff;
return ret;
return 0xffff;
}
@ -1078,11 +1075,9 @@ void neogeo_base_state::memcard_w(offs_t offset, uint16_t data, uint16_t mem_mas
{
m_maincpu->eat_cycles(2); // insert waitstate
if (ACCESSING_BITS_0_7)
{
if (m_memcard->present())
m_memcard->write(offset, data);
}
// memory card enabled by /UDS
if (ACCESSING_BITS_8_15 && m_memcard->present())
m_memcard->write(offset, data);
}
/*************************************
@ -1584,9 +1579,9 @@ void ngarcade_base_state::machine_start()
if (m_memcard)
{
main_program_space.unmap_readwrite(0x800000, 0x800fff);
main_program_space.install_read_handler(0x800000, 0x800fff, read16sm_delegate(*this, FUNC(ngarcade_base_state::memcard_r)));
main_program_space.install_write_handler(0x800000, 0x800fff, write16s_delegate(*this, FUNC(ngarcade_base_state::memcard_w)));
main_program_space.unmap_readwrite(0x800000, 0xbfffff);
main_program_space.install_read_handler(0x800000, 0xbfffff, read16s_delegate(*this, FUNC(ngarcade_base_state::memcard_r)));
main_program_space.install_write_handler(0x800000, 0xbfffff, write16s_delegate(*this, FUNC(ngarcade_base_state::memcard_w)));
}
// enable rtc and serial mode
@ -1711,7 +1706,7 @@ void neogeo_base_state::base_main_map(address_map &map)
map(0x360000, 0x37ffff).r(FUNC(neogeo_base_state::unmapped_r));
map(0x380000, 0x3800ff).mirror(0x01ff00).w(FUNC(neogeo_base_state::io_control_w)).umask16(0x00ff);
map(0x3a0000, 0x3a001f).mirror(0x01ffe0).r(FUNC(neogeo_base_state::unmapped_r));
map(0x3a0000, 0x3a001f).mirror(0x01ffe0).w("systemlatch", FUNC(hc259_device::write_a3)).umask16(0x00ff); // BITW1 (system control registers)
map(0x3a0000, 0x3a001f).mirror(0x01ffe0).w(m_systemlatch, FUNC(hc259_device::write_a3)).umask16(0x00ff); // BITW1 (system control registers)
map(0x3c0000, 0x3c0007).mirror(0x01fff8).r(FUNC(neogeo_base_state::video_register_r));
map(0x3c0000, 0x3c000f).mirror(0x01fff0).w(FUNC(neogeo_base_state::video_register_w));
map(0x3e0000, 0x3fffff).r(FUNC(neogeo_base_state::unmapped_r));
@ -1761,7 +1756,7 @@ void aes_state::aes_main_map(address_map &map)
map(0x000000, 0x00007f).r(FUNC(aes_state::banked_vectors_r));
map(0x100000, 0x10ffff).mirror(0x0f0000).ram();
// some games have protection devices in the 0x200000 region, it appears to map to cart space, not surprising, the ROM is read here too
map(0x800000, 0x800fff).rw(FUNC(aes_state::memcard_r), FUNC(aes_state::memcard_w));
map(0x800000, 0xbfffff).rw(FUNC(aes_state::memcard_r), FUNC(aes_state::memcard_w));
map(0xc00000, 0xc1ffff).mirror(0x0e0000).rom().region("mainbios", 0);
map(0xd00000, 0xffffff).r(FUNC(aes_state::unmapped_r));
}
@ -1931,7 +1926,7 @@ void neogeo_base_state::neogeo_base(machine_config &config)
m_systemlatch->q_out_cb<1>().set(FUNC(neogeo_base_state::set_use_cart_vectors));
m_systemlatch->q_out_cb<2>().set_nop(); // memory card 1: write enable/disable
m_systemlatch->q_out_cb<3>().set_nop(); // memory card 2: write disable/enable
m_systemlatch->q_out_cb<4>().set_nop(); // memory card: register select enable/set to normal (what does it mean?)
m_systemlatch->q_out_cb<4>().set_nop(); // memory card: register select enable/set to normal
m_systemlatch->q_out_cb<7>().set(FUNC(neogeo_base_state::set_palette_bank));
/* video hardware */
@ -1973,6 +1968,16 @@ void neogeo_base_state::neogeo_stereo(machine_config &config)
}
void neogeo_base_state::neogeo_memcard(machine_config &config)
{
NG_MEMCARD(config, m_memcard, 0);
m_systemlatch->q_out_cb<2>().set(m_memcard, FUNC(ng_memcard_device::lock1_w));
m_systemlatch->q_out_cb<3>().set(m_memcard, FUNC(ng_memcard_device::unlock2_w));
m_systemlatch->q_out_cb<4>().set(m_memcard, FUNC(ng_memcard_device::regsel_w));
}
void ngarcade_base_state::neogeo_arcade(machine_config &config)
{
neogeo_base(config);
@ -2010,8 +2015,7 @@ void mvs_led_state::mv1(machine_config &config)
{
neogeo_arcade(config);
neogeo_stereo(config);
NG_MEMCARD(config, m_memcard, 0);
neogeo_memcard(config);
NEOGEO_CTRL_EDGE_CONNECTOR(config, m_edge, neogeo_arc_edge, "joy", false);
@ -2054,8 +2058,7 @@ void mvs_led_el_state::mv2f(machine_config &config)
{
neogeo_arcade(config);
neogeo_stereo(config);
NG_MEMCARD(config, m_memcard, 0);
neogeo_memcard(config);
NEOGEO_CTRL_EDGE_CONNECTOR(config, m_edge, neogeo_arc_edge, "joy", false);
@ -2071,8 +2074,7 @@ void mvs_led_el_state::mv4f(machine_config &config)
{
neogeo_arcade(config);
neogeo_stereo(config);
NG_MEMCARD(config, m_memcard, 0);
neogeo_memcard(config);
NEOGEO_CTRL_EDGE_CONNECTOR(config, m_edge, neogeo_arc_edge, "joy", false);
@ -2088,8 +2090,7 @@ void mvs_led_el_state::mv6f(machine_config &config)
{
neogeo_arcade(config);
neogeo_stereo(config);
NG_MEMCARD(config, m_memcard, 0);
neogeo_memcard(config);
NEOGEO_CTRL_EDGE_CONNECTOR(config, m_edge, neogeo_arc_edge, "joy", false);
@ -2105,8 +2106,7 @@ void mvs_led_state::mv1_fixed(machine_config &config)
{
neogeo_arcade(config);
neogeo_stereo(config);
NG_MEMCARD(config, m_memcard, 0);
neogeo_memcard(config);
NEOGEO_CTRL_EDGE_CONNECTOR(config, m_edge, neogeo_arc_edge, "joy", true);
@ -2147,11 +2147,10 @@ void aes_state::aes_ntsc(machine_config &config)
{
neogeo_base(config);
neogeo_stereo(config);
neogeo_memcard(config);
m_maincpu->set_addrmap(AS_PROGRAM, &aes_state::aes_main_map);
NG_MEMCARD(config, m_memcard, 0);
NEOGEO_CART_SLOT(config, m_slots[0], neogeo_cart, nullptr);
NEOGEO_CONTROL_PORT(config, m_ctrl1, neogeo_controls, "joy", false);

View File

@ -11,6 +11,12 @@
#pragma once
#include "ng_memcard.h"
#include "neogeo_spr.h"
#include "bus/neogeo/slot.h"
#include "bus/neogeo/carts.h"
#include "bus/neogeo_ctrl/ctrl.h"
#include "cpu/m68000/m68000.h"
#include "cpu/z80/z80.h"
#include "sound/ymopn.h"
@ -18,12 +24,6 @@
#include "machine/gen_latch.h"
#include "machine/input_merger.h"
#include "machine/upd1990a.h"
#include "ng_memcard.h"
#include "neogeo_spr.h"
#include "bus/neogeo/slot.h"
#include "bus/neogeo/carts.h"
#include "bus/neogeo_ctrl/ctrl.h"
#include "emupal.h"
#include "screen.h"
@ -72,7 +72,7 @@ protected:
, m_audionmi(*this, "audionmi")
{ }
uint16_t memcard_r(offs_t offset);
uint16_t memcard_r(offs_t offset, uint16_t data);
void memcard_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
uint8_t audio_cpu_bank_select_r(offs_t offset);
void audio_cpu_enable_nmi_w(offs_t offset, uint8_t data);
@ -106,6 +106,7 @@ protected:
void neogeo_base(machine_config &config);
void neogeo_stereo(machine_config &config);
void neogeo_memcard(machine_config &config);
void base_main_map(address_map &map);
void audio_io_map(address_map &map);

View File

@ -2,7 +2,22 @@
// copyright-holders:Miodrag Milanovic
/*********************************************************************
NEOGEO Memory card functions.
Neo Geo Memory card functions.
JEIDA V3 SRAM cards. The BIOS supports 8-bit and 16-bit cards,
in 2KiB, 4KiB, 6KiB, 8KiB, 10KiB, 14KiB and 16KiB capacities.
8-bit cards are connected to the least significant byte of the
bus, but the memory card is enabled by the /UDS signal. This
means only word accesses or accesses to the most significant
byte will access the card.
SNK sold 2K*8 cards cards as NEO-IC8. Two variants are known,
both using Sharp SRAMs and soldered CR2016 lithium coin cells:
* C10075-X2-2 PCB with LH5116NA-10 SRAM
* EZ866 PCB wtih LH5116HN-10 SRAM
SNK cards had no attribute EEPROMs.
*********************************************************************/
@ -22,6 +37,9 @@ DEFINE_DEVICE_TYPE(NG_MEMCARD, ng_memcard_device, "ng_memcard", "NeoGeo Memory C
ng_memcard_device::ng_memcard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, NG_MEMCARD, tag, owner, clock)
, device_memcard_image_interface(mconfig, *this)
, m_lock1(1)
, m_unlock2(1)
, m_regsel(1)
{
}
@ -33,6 +51,9 @@ ng_memcard_device::ng_memcard_device(const machine_config &mconfig, const char *
void ng_memcard_device::device_start()
{
save_item(NAME(m_memcard_data));
save_item(NAME(m_lock1));
save_item(NAME(m_unlock2));
save_item(NAME(m_regsel));
}
/*-------------------------------------------------
@ -71,12 +92,32 @@ std::error_condition ng_memcard_device::call_create(int format_type, util::optio
}
uint8_t ng_memcard_device::read(offs_t offset)
uint16_t ng_memcard_device::read(offs_t offset)
{
return m_memcard_data[offset];
if (m_regsel)
return 0xff00 | m_memcard_data[offset & 0x07ff];
else
return 0xffff;
}
void ng_memcard_device::write(offs_t offset, uint8_t data)
void ng_memcard_device::write(offs_t offset, uint16_t data)
{
m_memcard_data[offset] = data;
if (m_regsel && !m_lock1 && m_unlock2)
m_memcard_data[offset & 0x07ff] = uint8_t(data & 0x00ff);
}
WRITE_LINE_MEMBER(ng_memcard_device::lock1_w)
{
m_lock1 = state;
}
WRITE_LINE_MEMBER(ng_memcard_device::unlock2_w)
{
m_unlock2 = state;
}
WRITE_LINE_MEMBER(ng_memcard_device::regsel_w)
{
m_regsel = state;
}

View File

@ -2,7 +2,7 @@
// copyright-holders:Miodrag Milanovic
/*********************************************************************
NEOGEO Memory card functions.
Neo Geo Memory card functions
*********************************************************************/
#ifndef MAME_NEOGEO_NG_MEMCARD_H
@ -13,8 +13,6 @@
#include "imagedev/memcard.h"
// ======================> ng_memcard_device
class ng_memcard_device : public device_t, public device_memcard_image_interface
{
public:
@ -30,8 +28,13 @@ public:
virtual std::error_condition call_create(int format_type, util::option_resolution *format_options) override;
// bus interface
uint8_t read(offs_t offset);
void write(offs_t offset, uint8_t data);
uint16_t read(offs_t offset);
void write(offs_t offset, uint16_t data);
// control lines
DECLARE_WRITE_LINE_MEMBER(lock1_w);
DECLARE_WRITE_LINE_MEMBER(unlock2_w);
DECLARE_WRITE_LINE_MEMBER(regsel_w);
bool present() { return is_loaded(); }
@ -41,6 +44,9 @@ protected:
private:
uint8_t m_memcard_data[0x800];
uint8_t m_lock1;
uint8_t m_unlock2;
uint8_t m_regsel;
};

View File

@ -13,7 +13,7 @@
std::error_condition z80bin_load_file(snapshot_image_device &image, address_space &space, uint16_t &exec_addr, uint16_t &start_addr, uint16_t &end_addr)
{
uint16_t args[3]{};
uint16_t i = 0U, j = 0U, size = 0U;
uint16_t i, size = 0U;
uint8_t data = 0U;
char pgmname[256]{};
@ -21,6 +21,7 @@ std::error_condition z80bin_load_file(snapshot_image_device &image, address_spac
char ch = '\0';
uint32_t bytes = 0;
i = 0;
while ((bytes = image.fread(&ch, 1)) != 0 && ch != 0x1A)
{
if (ch != '\0')
@ -32,7 +33,7 @@ std::error_condition z80bin_load_file(snapshot_image_device &image, address_spac
return image_error::INVALIDIMAGE;
}
pgmname[i] = ch; /* build program name */
pgmname[i] = ch; // build program name
i++;
}
}
@ -44,7 +45,7 @@ std::error_condition z80bin_load_file(snapshot_image_device &image, address_spac
return image_error::UNSPECIFIED;
}
pgmname[i] = '\0'; /* terminate string with a null */
pgmname[i] = '\0'; // terminate string with a NUL
if (image.fread(args, sizeof(args)) != sizeof(args))
{
@ -59,12 +60,12 @@ std::error_condition z80bin_load_file(snapshot_image_device &image, address_spac
size = (end_addr - start_addr + 1) & 0xffff;
/* display a message about the loaded quickload */
// display a message about the loaded quickload
image.message(" %s\nsize=%04X : start=%04X : end=%04X : exec=%04X",pgmname,size,start_addr,end_addr,exec_addr);
for (i = 0; i < size; i++)
{
j = (start_addr + i) & 0xffff;
uint16_t const j = (start_addr + i) & 0xffff;
if (image.fread(&data, 1) != 1)
{
osd_printf_error("%s: Unexpected EOF while writing byte to %04X\n", image.basename(), j);

View File

@ -97,7 +97,7 @@ public:
// construction/destruction
x68k_hdc_image_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
// image-level overrides
// device_image_interface implementation
virtual const char *file_extensions() const noexcept override { return "hdf"; }
virtual const char *image_type_name() const noexcept override { return "sasihd"; }
virtual const char *image_brief_type_name() const noexcept override { return "sasi"; }
@ -107,7 +107,7 @@ public:
u16 hdc_r(offs_t offset);
protected:
// device-level overrides
// device_t implementation
virtual void device_start() override;
private:

View File

@ -191,7 +191,7 @@ private:
DEVICE_IMAGE_LOAD_MEMBER(cc40_state::cart_load)
{
u32 size = m_cart->common_get_size("rom");
u32 const size = m_cart->common_get_size("rom");
// max size is 4*32KB
if (size > 0x20000)

View File

@ -309,7 +309,7 @@ void snspellc_state::power_off()
DEVICE_IMAGE_LOAD_MEMBER(snspellc_state::cart_load)
{
u32 size = m_cart->common_get_size("rom");
u32 const size = m_cart->common_get_size("rom");
if (size > 0x4000)
{

View File

@ -144,7 +144,7 @@ private:
DEVICE_IMAGE_LOAD_MEMBER(ti74_state::cart_load)
{
u32 size = m_cart->common_get_size("rom");
u32 const size = m_cart->common_get_size("rom");
// max size is 32KB
if (size > 0x8000)

View File

@ -2823,7 +2823,7 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state::load_file)
return image_error::INVALIDIMAGE;
}
uint32_t version = r32(8);
uint32_t const version = r32(8);
logerror("File version %x.%02x\n", version >> 8, version & 0xff);
uint32_t data_start = version >= 0x150 ? r32(0x34) + 0x34 : 0x40;
@ -2835,52 +2835,58 @@ QUICKLOAD_LOAD_MEMBER(vgmplay_state::load_file)
else if (volbyte > 0xc1)
volbyte -= 0x100;
float volume = version >= 0x160 && data_start >= 0x7d ? powf(2.0f, float(volbyte) / float(0x20)) : 1.0f;
float const volume = version >= 0x160 && data_start >= 0x7d ? powf(2.0f, float(volbyte) / float(0x20)) : 1.0f;
uint32_t extra_header_start = version >= 0x170 && data_start >= 0xc0 && r32(0xbc) ? r32(0xbc) + 0xbc : 0;
uint32_t header_size = extra_header_start ? extra_header_start : data_start;
uint32_t const extra_header_start = version >= 0x170 && data_start >= 0xc0 && r32(0xbc) ? r32(0xbc) + 0xbc : 0;
uint32_t const header_size = extra_header_start ? extra_header_start : data_start;
uint32_t extra_header_size = extra_header_start ? r32(extra_header_start) : 0;
uint32_t chip_clock_start = extra_header_size >= 4 && r32(extra_header_start + 4) ? r32(extra_header_start + 4) + extra_header_start + 4: 0;
uint32_t chip_volume_start = extra_header_size >= 8 && r32(extra_header_start + 8) ? r32(extra_header_start + 8) + extra_header_start + 8 : 0;
uint32_t const extra_header_size = extra_header_start ? r32(extra_header_start) : 0;
uint32_t const chip_clock_start = extra_header_size >= 4 && r32(extra_header_start + 4) ? r32(extra_header_start + 4) + extra_header_start + 4: 0;
uint32_t const chip_volume_start = extra_header_size >= 8 && r32(extra_header_start + 8) ? r32(extra_header_start + 8) + extra_header_start + 8 : 0;
if (chip_volume_start != 0)
osd_printf_warning("Warning: file has unsupported chip volumes\n");
const auto&& setup_device([&](device_t &device, int chip_num, vgm_chip chip_type, uint32_t offset, uint32_t min_version = 0)
{
uint32_t c = 0;
float chip_volume = volume;
bool has_2chip = false;
const auto setup_device(
[this, version, volume, header_size, chip_clock_start, chip_volume_start] (
device_t &device,
int chip_num,
vgm_chip chip_type,
uint32_t offset,
uint32_t min_version = 0)
{
uint32_t c = 0;
float chip_volume = volume;
bool has_2chip = false;
if (min_version <= version && offset + 4 <= header_size && (chip_num == 0 || (r32(offset) & 0x40000000) != 0))
{
c = r32(offset);
has_2chip = (c & 0x40000000) != 0;
if (chip_clock_start && chip_num != 0)
for (auto i(0); i < r8(chip_clock_start); i++)
if (min_version <= version && offset + 4 <= header_size && (chip_num == 0 || (r32(offset) & 0x40000000) != 0))
{
if (r8(chip_clock_start + 1 + (i * 5)) == chip_type)
{
c = r32(chip_clock_start + 2 + (i * 5));
break;
}
c = r32(offset);
has_2chip = (c & 0x40000000) != 0;
if (chip_clock_start && chip_num != 0)
for (auto i(0); i < r8(chip_clock_start); i++)
{
if (r8(chip_clock_start + 1 + (i * 5)) == chip_type)
{
c = r32(chip_clock_start + 2 + (i * 5));
break;
}
}
}
}
if (has_2chip)
{
chip_volume /= 2.0f;
}
device.set_unscaled_clock(c & ~0xc0000000);
if (device.unscaled_clock() != 0)
dynamic_cast<device_sound_interface *>(&device)->set_output_gain(ALL_OUTPUTS, chip_volume);
else
dynamic_cast<device_sound_interface *>(&device)->set_output_gain(ALL_OUTPUTS, 0);
if (has_2chip)
{
chip_volume /= 2.0f;
}
device.set_unscaled_clock(c & ~0xc0000000);
if (device.unscaled_clock() != 0)
dynamic_cast<device_sound_interface *>(&device)->set_output_gain(ALL_OUTPUTS, chip_volume);
else
dynamic_cast<device_sound_interface *>(&device)->set_output_gain(ALL_OUTPUTS, 0);
return (c & 0x80000000) != 0;
});
return (c & 0x80000000) != 0;
});
// Parse clocks
if (setup_device(*m_sn76489[0], 0, CT_SN76489, 0x0c) ||

View File

@ -196,7 +196,7 @@ void clickstart_state::machine_reset()
DEVICE_IMAGE_LOAD_MEMBER(clickstart_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");

View File

@ -672,7 +672,7 @@ void geniusiq_state::machine_reset()
DEVICE_IMAGE_LOAD_MEMBER(geniusiq_state::cart_load)
{
uint32_t size = m_cart->common_get_size("rom");
uint32_t const size = m_cart->common_get_size("rom");
// we always a 0x100000 region, for easier mapping in the memory map
m_cart->rom_alloc(0x100000, GENERIC_ROM16_WIDTH, ENDIANNESS_LITTLE);

View File

@ -119,7 +119,7 @@ void vtech_innotv_innotabmax_state::machine_reset()
DEVICE_IMAGE_LOAD_MEMBER(vtech_innotv_innotabmax_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");

View File

@ -169,7 +169,7 @@ INPUT_PORTS_END
DEVICE_IMAGE_LOAD_MEMBER(iqunlim_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_BIG);
m_cart->common_load_rom(m_cart->get_rom_base(), size, "rom");

View File

@ -901,7 +901,7 @@ GFXDECODE_END
DEVICE_IMAGE_LOAD_MEMBER( pc2000_state::cart_load )
{
uint32_t size = m_cart->common_get_size("rom");
uint32_t const size = m_cart->common_get_size("rom");
// we always allocate a 0x40000 region, even if most carts span only 0x20000,
// because the bankswitch code accesses up to 16 x 16K banks...

View File

@ -87,7 +87,7 @@ void vtech_storio_state::machine_reset()
DEVICE_IMAGE_LOAD_MEMBER(vtech_storio_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");

View File

@ -173,11 +173,11 @@ SNAPSHOT_LOAD_MEMBER(vtech1_base_state::snapshot_cb)
pgmname[16] = '\0';
// get start and end addresses
uint16_t start = pick_integer_le(header, 22, 2);
uint16_t end = start + image.length() - sizeof(header);
uint16_t size = end - start;
uint16_t const start = pick_integer_le(header, 22, 2);
uint16_t const end = start + image.length() - sizeof(header);
uint16_t const size = end - start;
// write it to ram
// write it to RAM
auto buf = std::make_unique<uint8_t []>(size);
if (image.fread(buf.get(), size) != size)
{

View File

@ -30,14 +30,13 @@ void vtech2_state::init_laser()
init_waitstates();
uint8_t *gfx = memregion("gfx2")->base();
int i;
m_laser_track_x2[0] = m_laser_track_x2[1] = 80;
m_laser_fdc_bits = 8;
m_laser_drive = -1;
m_cart_size = 0;
for (i = 0; i < 256; i++)
for (int i = 0; i < 256; i++)
gfx[i] = i;
m_laser_latch = -1;

View File

@ -70,7 +70,7 @@ void vtech_innotab_state::machine_start()
DEVICE_IMAGE_LOAD_MEMBER(vtech_innotab_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");

View File

@ -378,11 +378,11 @@ static const z80_daisy_config xerox820_daisy_chain[] =
QUICKLOAD_LOAD_MEMBER(xerox820_state::quickload_cb)
{
address_space& prog_space = m_maincpu->space(AS_PROGRAM);
if (image.length() >= 0xfd00)
return image_error::INVALIDLENGTH;
address_space &prog_space = m_maincpu->space(AS_PROGRAM);
m_view.select(0);
/* Avoid loading a program if CP/M-80 is not in memory */