summaryrefslogtreecommitdiffstats
path: root/src/mame/includes/taito_l.h
blob: f592b09f0712b3a7160745f7cd4aca1594e8ad3b (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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
// license:BSD-3-Clause
// copyright-holders:Olivier Galibert
#ifndef MAME_INCLUDES_TAITO_L_H
#define MAME_INCLUDES_TAITO_L_H

#pragma once

#include "machine/74157.h"
#include "machine/bankdev.h"
#include "machine/tc009xlvc.h"
#include "machine/timer.h"
#include "machine/upd4701.h"
#include "sound/msm5205.h"
#include "sound/ymopn.h"
#include "emupal.h"
#include "tilemap.h"


class taitol_state : public driver_device
{
public:
	taitol_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag)
		, m_main_cpu(*this, "maincpu")
		, m_upd4701(*this, "upd4701")
		, m_main_prg(*this, "maincpu")
	{
	}

	DECLARE_MACHINE_START(taito_l);
	DECLARE_MACHINE_RESET(taito_l);
	IRQ_CALLBACK_MEMBER(irq_callback);

	void coin_control_w(u8 data);

protected:
	/* misc */
	int m_last_irq_level;
	void irq_enable_w(u8 data);

	void mcu_control_w(u8 data);
	u8 mcu_control_r();
	DECLARE_WRITE_LINE_MEMBER(screen_vblank_taitol);
	TIMER_DEVICE_CALLBACK_MEMBER(vbl_interrupt);

	void l_system_video(machine_config &config);

	void common_banks_map(address_map &map);

	virtual void state_register();
	virtual void taito_machine_reset();

	required_device<tc0090lvc_device> m_main_cpu;
	optional_device<upd4701_device>   m_upd4701;
	required_memory_region            m_main_prg;
};


class taitol_2cpu_state : public taitol_state
{
public:
	taitol_2cpu_state(const machine_config &mconfig, device_type type, const char *tag)
		: taitol_state(mconfig, type, tag)
		, m_audio_cpu(*this, "audiocpu")
		, m_audio_prg(*this, "audiocpu")
		, m_audio_bnk(*this, "audiobank")
	{
	}

	void sound_bankswitch_w(u8 data);

	void kurikint(machine_config &config);
	void evilston(machine_config &config);
	void raimais(machine_config &config);

protected:
	virtual void state_register() override;
	virtual void taito_machine_reset() override;

	void evilston_2_map(address_map &map);
	void evilston_map(address_map &map);
	void kurikint_2_map(address_map &map);
	void kurikint_map(address_map &map);
	void raimais_2_map(address_map &map);
	void raimais_3_map(address_map &map);
	void raimais_map(address_map &map);

	required_device<cpu_device> m_audio_cpu;
	required_memory_region      m_audio_prg;
	optional_memory_bank        m_audio_bnk;
};


class fhawk_state : public taitol_2cpu_state
{
public:
	fhawk_state(const machine_config &mconfig, device_type type, const char *tag)
		: taitol_2cpu_state(mconfig, type, tag)
		, m_slave_prg(*this, "slave")
		, m_slave_bnk(*this, "slavebank")
		, m_slave_rombank(0)
	{
	}

	void slave_rombank_w(u8 data);
	u8 slave_rombank_r();
	void portA_w(u8 data);

	void fhawk(machine_config &config);

protected:
	virtual void state_register() override;
	virtual void taito_machine_reset() override;

	void fhawk_2_map(address_map &map);
	void fhawk_3_map(address_map &map);
	void fhawk_map(address_map &map);

	required_memory_region      m_slave_prg;
	required_memory_bank        m_slave_bnk;

	u8  m_slave_rombank;
};


class champwr_state : public fhawk_state
{
public:
	champwr_state(const machine_config &mconfig, device_type type, const char *tag)
		: fhawk_state(mconfig, type, tag)
		, m_msm(*this, "msm")
		, m_adpcm_rgn(*this, "adpcm")
		, m_adpcm_pos(0)
		, m_adpcm_data(-1)
	{
	}

	DECLARE_WRITE_LINE_MEMBER(msm5205_vck);

	void msm5205_lo_w(u8 data);
	void msm5205_hi_w(u8 data);
	void msm5205_start_w(u8 data);
	void msm5205_stop_w(u8 data);
	void msm5205_volume_w(u8 data);

	void champwr(machine_config &config);

protected:
	virtual void state_register() override;
	virtual void taito_machine_reset() override;

	void champwr_2_map(address_map &map);
	void champwr_3_map(address_map &map);
	void champwr_map(address_map &map);

	required_device<msm5205_device> m_msm;
	required_region_ptr<u8>         m_adpcm_rgn;

	int m_adpcm_pos;
	int m_adpcm_data;
};


class taitol_1cpu_state : public taitol_state
{
public:
	taitol_1cpu_state(const machine_config &mconfig, device_type type, const char *tag)
		: taitol_state(mconfig, type, tag)
		, m_ymsnd(*this, "ymsnd")
		, m_mux(*this, {"dswmux", "inmux"})
	{
	}

	u8 extport_select_and_ym2203_r(offs_t offset);

	void init_plottinga();

	DECLARE_MACHINE_RESET(plotting);
	DECLARE_MACHINE_RESET(puzznic);
	DECLARE_MACHINE_RESET(palamed);
	DECLARE_MACHINE_RESET(cachat);

	void base(machine_config &config);
	void add_muxes(machine_config &config);
	void palamed(machine_config &config);
	void plotting(machine_config &config);
	void puzznici(machine_config &config);
	void cachat(machine_config &config);
	void puzznic(machine_config &config);

protected:
	virtual void state_register() override;
	virtual void taito_machine_reset() override;

	void palamed_map(address_map &map);
	void plotting_map(address_map &map);
	void puzznic_map(address_map &map);
	void puzznici_map(address_map &map);

	required_device<ym2203_device>  m_ymsnd;
	optional_device_array<ls157_x2_device, 2> m_mux;
};


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

	void horshoes(machine_config &config);

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

private:
	void horshoes_tile_cb(u32 &code);

	void bankg_w(u8 data);
	int m_horshoes_gfxbank = 0;

	void horshoes_map(address_map &map);
};

#endif // MAME_INCLUDES_TAITO_L_H