summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/generalplus_gpl16250.h
blob: dbbc1076c48684c1c231afe351307ea24b82bb59 (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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// license:BSD-3-Clause
// copyright-holders:David Haywood
#ifndef MAME_INCLUDES_SUNPLUS_GCM394_H
#define MAME_INCLUDES_SUNPLUS_GCM394_H

#pragma once

#include "machine/generalplus_gpl16250soc.h"
#include "machine/generalplus_gpl16250.h"
#include "bus/generic/slot.h"
#include "bus/generic/carts.h"

#include "screen.h"
#include "speaker.h"



class gcm394_game_state : public driver_device
{
public:
	gcm394_game_state(const machine_config& mconfig, device_type type, const char* tag) :
		driver_device(mconfig, type, tag),
		m_maincpu(*this, "maincpu"),
		m_screen(*this, "screen"),
		m_io(*this, "IN%u", 0U),
		m_romregion(*this, "maincpu"),
		m_memory(*this, "memory")
	{
	}

	void base(machine_config &config);

	void cs_map_base(address_map &map);

	virtual DECLARE_READ16_MEMBER(cs0_r);
	virtual DECLARE_WRITE16_MEMBER(cs0_w);
	virtual DECLARE_READ16_MEMBER(cs1_r);
	virtual DECLARE_WRITE16_MEMBER(cs1_w);
	virtual DECLARE_READ16_MEMBER(cs2_r);
	virtual DECLARE_WRITE16_MEMBER(cs2_w);
	virtual DECLARE_READ16_MEMBER(cs3_r);
	virtual DECLARE_WRITE16_MEMBER(cs3_w);
	virtual DECLARE_READ16_MEMBER(cs4_r);
	virtual DECLARE_WRITE16_MEMBER(cs4_w);

	void cs_callback(uint16_t cs0, uint16_t cs1, uint16_t cs2, uint16_t cs3, uint16_t cs4);

protected:
	virtual void machine_start() override;
	virtual void machine_reset() override;


	required_device<sunplus_gcm394_base_device> m_maincpu;
	required_device<screen_device> m_screen;


	required_ioport_array<3> m_io;


	optional_region_ptr<uint16_t> m_romregion;
	required_device<full_memory_device> m_memory;

	virtual uint16_t porta_r();
	virtual uint16_t portb_r();
	virtual uint16_t portc_r();
	virtual void porta_w(uint16_t data);

	virtual uint16_t read_external_space(offs_t offset);
	virtual void write_external_space(offs_t offset, uint16_t data);

private:
};




class tkmag220_game_state : public gcm394_game_state
{
public:
	tkmag220_game_state(const machine_config& mconfig, device_type type, const char* tag) :
		gcm394_game_state(mconfig, type, tag)
	{
	}

	void tkmag220(machine_config &config);

protected:

	virtual void machine_reset() override;

	/*
	virtual DECLARE_READ16_MEMBER(porta_r) override
	{
	    return machine().rand();
	}

	virtual DECLARE_READ16_MEMBER(portb_r) override
	{
	    return machine().rand();
	}

	virtual DECLARE_WRITE16_MEMBER(porta_w) override
	{
	}
	*/

private:
	int m_upperbase;

	virtual DECLARE_READ16_MEMBER(cs0_r) override;

};


#endif