summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/msx_slot/ram.cpp
blob: 835a5551b92998acda48e4a1175dd2dc1cbd0b76 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// license:BSD-3-Clause
// copyright-holders:Wilbert Pol

#include "emu.h"
#include "ram.h"

DEFINE_DEVICE_TYPE(MSX_SLOT_RAM, msx_slot_ram_device, "msx_slot_ram", "MSX Internal RAM")

msx_slot_ram_device::msx_slot_ram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
	: device_t(mconfig, MSX_SLOT_RAM, tag, owner, clock)
	, msx_internal_slot_interface(mconfig, *this)
{
}

void msx_slot_ram_device::device_start()
{
	m_ram.resize(m_size);
	save_item(NAME(m_ram));
}

uint8_t msx_slot_ram_device::read(offs_t offset)
{
	if ( offset >= m_start_address && offset < m_end_address )
	{
		return m_ram[ offset - m_start_address ];
	}
	return 0xFF;
}

void msx_slot_ram_device::write(offs_t offset, uint8_t data)
{
	if ( offset >= m_start_address && offset < m_end_address )
	{
		m_ram[offset - m_start_address] = data;
	}
}