summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/bw2/ramcard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/bw2/ramcard.cpp')
-rw-r--r--src/devices/bus/bw2/ramcard.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/src/devices/bus/bw2/ramcard.cpp b/src/devices/bus/bw2/ramcard.cpp
index 48de6cffdec..33d1fc147d9 100644
--- a/src/devices/bus/bw2/ramcard.cpp
+++ b/src/devices/bus/bw2/ramcard.cpp
@@ -51,7 +51,7 @@ bw2_ramcard_device::bw2_ramcard_device(const machine_config &mconfig, const char
: device_t(mconfig, BW2_RAMCARD, tag, owner, clock),
device_bw2_expansion_slot_interface(mconfig, *this),
m_rom(*this, "ramcard"),
- m_ram(*this, "ram"),
+ m_ram(*this, "ram", 512*1024, ENDIANNESS_LITTLE),
m_en(0),
m_bank(0)
{
@@ -64,9 +64,6 @@ bw2_ramcard_device::bw2_ramcard_device(const machine_config &mconfig, const char
void bw2_ramcard_device::device_start()
{
- // allocate memory
- m_ram.allocate(512 * 1024);
-
// state saving
save_item(NAME(m_en));
save_item(NAME(m_bank));
@@ -90,15 +87,17 @@ void bw2_ramcard_device::device_reset()
uint8_t bw2_ramcard_device::bw2_cd_r(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6)
{
- if (!ram2)
- {
- data = m_rom->base()[offset & 0x3fff];
- }
- else if (m_en && !ram5)
+ if (offset < 0x8000)
{
- data = m_ram[(m_bank << 15) | offset];
+ if (!ram2)
+ {
+ data = m_rom->base()[offset & 0x3fff];
+ }
+ else if (m_en && !ram5)
+ {
+ data = m_ram[(m_bank << 15) | offset];
+ }
}
-
return data;
}
@@ -109,9 +108,12 @@ uint8_t bw2_ramcard_device::bw2_cd_r(offs_t offset, uint8_t data, int ram2, int
void bw2_ramcard_device::bw2_cd_w(offs_t offset, uint8_t data, int ram2, int ram3, int ram4, int ram5, int ram6)
{
- if (m_en && !ram5)
+ if (offset < 0x8000)
{
- m_ram[(m_bank << 15) | offset] = data;
+ if (m_en && !ram5)
+ {
+ m_ram[(m_bank << 15) | offset] = data;
+ }
}
}