mirror of
https://github.com/holub/mame
synced 2025-04-23 17:00:53 +03:00
devices/bus/neogeo/cmc.cpp, rom.cpp : Implement NVRAM
Both jockeygp, vliner has battery-backed RAM, Correct this
This commit is contained in:
parent
9b5eaf70b6
commit
89e90a6616
@ -251,19 +251,23 @@ void neogeo_cmc_kof2000n_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
|
||||
DEFINE_DEVICE_TYPE(NEOGEO_CMC_JOCKEYGP_CART, neogeo_cmc_jockeygp_cart_device, "neocart_jockeygp", "Neo Geo Jockey GP CMC50 Cart")
|
||||
|
||||
neogeo_cmc_jockeygp_cart_device::neogeo_cmc_jockeygp_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
neogeo_cmc_cart_device(mconfig, NEOGEO_CMC_JOCKEYGP_CART, tag, owner, clock)
|
||||
neogeo_cmc_cart_device(mconfig, NEOGEO_CMC_JOCKEYGP_CART, tag, owner, clock),
|
||||
m_nvram(*this, "nvram")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void neogeo_cmc_jockeygp_cart_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_ram));
|
||||
m_ram = make_unique_clear<uint16_t[]>(0x2000/2);
|
||||
m_nvram->set_base(m_ram.get(), 0x2000);
|
||||
save_pointer(NAME(m_ram), 0x2000/2);
|
||||
}
|
||||
|
||||
void neogeo_cmc_jockeygp_cart_device::device_reset()
|
||||
void neogeo_cmc_jockeygp_cart_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
memset(m_ram, 0, 0x2000);
|
||||
neogeo_cmc_cart_device::device_add_mconfig(config);
|
||||
NVRAM(config, m_nvram);
|
||||
}
|
||||
|
||||
void neogeo_cmc_jockeygp_cart_device::decrypt_all(DECRYPT_ALL_PARAMS)
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "slot.h"
|
||||
#include "rom.h"
|
||||
#include "prot_cmc.h"
|
||||
#include "machine/nvram.h"
|
||||
|
||||
// ======================> neogeo_cmc_cart_device
|
||||
|
||||
@ -218,10 +219,13 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
private:
|
||||
uint16_t m_ram[0x1000];
|
||||
std::unique_ptr<uint16_t[]> m_ram;
|
||||
|
||||
required_device<nvram_device> m_nvram;
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(NEOGEO_CMC_JOCKEYGP_CART, neogeo_cmc_jockeygp_cart_device)
|
||||
|
@ -73,17 +73,19 @@ WRITE16_MEMBER(neogeo_rom_device::banksel_w)
|
||||
DEFINE_DEVICE_TYPE(NEOGEO_VLINER_CART, neogeo_vliner_cart_device, "neocart_vliner", "Neo Geo V-Liner Cart")
|
||||
|
||||
neogeo_vliner_cart_device::neogeo_vliner_cart_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) :
|
||||
neogeo_rom_device(mconfig, NEOGEO_VLINER_CART, tag, owner, clock)
|
||||
neogeo_rom_device(mconfig, NEOGEO_VLINER_CART, tag, owner, clock),
|
||||
m_nvram(*this, "nvram")
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void neogeo_vliner_cart_device::device_start()
|
||||
{
|
||||
save_item(NAME(m_cart_ram));
|
||||
m_cart_ram = make_unique_clear<uint16_t[]>(0x2000/2);
|
||||
m_nvram->set_base(m_cart_ram.get(), 0x2000);
|
||||
save_pointer(NAME(m_cart_ram), 0x2000/2);
|
||||
}
|
||||
|
||||
void neogeo_vliner_cart_device::device_reset()
|
||||
void neogeo_vliner_cart_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
memset(m_cart_ram, 0, 0x2000);
|
||||
NVRAM(config, m_nvram);
|
||||
}
|
||||
|
@ -6,6 +6,7 @@
|
||||
#pragma once
|
||||
|
||||
#include "slot.h"
|
||||
#include "machine/nvram.h"
|
||||
|
||||
// ======================> neogeo_rom_device
|
||||
|
||||
@ -50,10 +51,13 @@ public:
|
||||
|
||||
protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
private:
|
||||
uint16_t m_cart_ram[0x1000];
|
||||
std::unique_ptr<uint16_t[]> m_cart_ram;
|
||||
|
||||
required_device<nvram_device> m_nvram;
|
||||
};
|
||||
|
||||
DECLARE_DEVICE_TYPE(NEOGEO_VLINER_CART, neogeo_vliner_cart_device)
|
||||
|
Loading…
Reference in New Issue
Block a user