summaryrefslogtreecommitdiffstatshomepage
path: root/src/mess/machine/msx_systemflags.c
blob: 25cd3b3705dfc36bd5af1f651725f2fb03714097 (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
37
38
39
40
// license:???
// copyright-holders:???
#include "emu.h"
#include "msx_systemflags.h"


const device_type MSX_SYSTEMFLAGS = &device_creator<msx_systemflags_device>;


msx_systemflags_device::msx_systemflags_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
	: device_t(mconfig, MSX_SYSTEMFLAGS, "MSX System Flags", tag, owner, clock, "msx_systemflags", __FILE__)
	, m_initial_value(0xff)
	, m_system_flags(0xff)
{
}


void msx_systemflags_device::device_start()
{
	m_system_flags = m_initial_value;

	save_item(NAME(m_system_flags));

	// Install IO read/write handlers
	address_space &space = machine().device<cpu_device>("maincpu")->space(AS_IO);
	space.install_write_handler(0xf4, 0xf4, write8_delegate(FUNC(msx_systemflags_device::write), this));
	space.install_read_handler(0xf4, 0xf4, read8_delegate(FUNC(msx_systemflags_device::read), this));
}


READ8_MEMBER(msx_systemflags_device::read)
{
	return m_system_flags;
}


WRITE8_MEMBER(msx_systemflags_device::write)
{
	m_system_flags = data;
}