summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/machine/k033906.h
blob: 3184b210a90853811de8948630c20c4a1ec6fbb9 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
// license:BSD-3-Clause
// copyright-holders:Fabio Priuli
/***************************************************************************

    Konami 033906

***************************************************************************/

#ifndef MAME_MACHINE_K033906_H
#define MAME_MACHINE_K033906_H

#pragma once

#include "video/voodoo.h"

class k033906_device :  public device_t
{
public:
	// construction/destruction
	template <typename T>
	k033906_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock, T &&voodoo_tag)
		: k033906_device(mconfig, tag, owner, clock)
	{
		m_voodoo.set_tag(std::forward<T>(voodoo_tag));
	}

	k033906_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);

	u32 read(offs_t offset);
	void write(offs_t offset, u32 data);
	DECLARE_WRITE_LINE_MEMBER(set_reg);

protected:
	// device-level overrides
	virtual void device_start() override;
	virtual void device_reset() override { }
	virtual void device_post_load() override { }
	virtual void device_clock_changed() override { }

private:
	uint32_t reg_r(int reg);
	void reg_w(int reg, uint32_t data);

	/* i/o lines */

	int          m_reg_set; // 1 = access reg / 0 = access ram

	required_device<voodoo_device> m_voodoo;

	std::unique_ptr<u32[]> m_reg;
	std::unique_ptr<u32[]> m_ram;
};

DECLARE_DEVICE_TYPE(K033906, k033906_device)

#endif // MAME_MACHINE_K033906_H