summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/tumbleb.h
blob: f01bdd544719c9b00f6f53f34eea948e29dfb7fb (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
// license:BSD-3-Clause
// copyright-holders:David Haywood,Bryan McPhail
#ifndef MAME_INCLUDES_TUMBLEB_H
#define MAME_INCLUDES_TUMBLEB_H

#pragma once

#include "machine/gen_latch.h"
#include "sound/okim6295.h"
#include "video/decospr.h"
#include "emupal.h"
#include "screen.h"
#include "tilemap.h"

class tumbleb_state : public driver_device
{
public:
	tumbleb_state(const machine_config &mconfig, device_type type, const char *tag) :
		driver_device(mconfig, type, tag),
		m_mainram(*this, "mainram"),
		m_spriteram(*this, "spriteram"),
		m_pf1_data(*this, "pf1_data"),
		m_pf2_data(*this, "pf2_data"),
		m_control(*this, "control"),
		m_maincpu(*this, "maincpu"),
		m_audiocpu(*this, "audiocpu"),
		m_oki(*this, "oki"),
		m_gfxdecode(*this, "gfxdecode"),
		m_palette(*this, "palette"),
		m_sprgen(*this, "spritegen"),
		m_screen(*this, "screen"),
		m_soundlatch(*this, "soundlatch")
	{ }

	void tumblepb(machine_config &config);
	void tumblepba(machine_config &config);
	void bcstory(machine_config &config);
	void pangpang(machine_config &config);
	void semibase(machine_config &config);
	void tumbleb2(machine_config &config);
	void cookbib(machine_config &config);
	void metlsavr(machine_config &config);
	void fncywld(machine_config &config);
	void magipur(machine_config &config);
	void suprtrio(machine_config &config);
	void htchctch(machine_config &config);
	void sdfight(machine_config &config);
	void chokchok(machine_config &config);
	void cookbib_mcu(machine_config &config);
	void jumpkids(machine_config &config);

	void init_dquizgo();
	void init_jumpkids();
	void init_htchctch();
	void init_wlstar();
	void init_suprtrio();
	void init_tumblepb();
	void init_tumblepba();
	void init_bcstory();
	void init_wondl96();
	void init_tumbleb2();
	void init_chokchok();
	void init_fncywld();
	void init_magipur();
	void init_carket();

protected:
	/* memory pointers */
	optional_shared_ptr<uint16_t> m_mainram;
	required_shared_ptr<uint16_t> m_spriteram;
	required_shared_ptr<uint16_t> m_pf1_data;
	required_shared_ptr<uint16_t> m_pf2_data;
	optional_shared_ptr<uint16_t> m_control;

	/* misc */
	int         m_music_command;
	int         m_music_bank;
	int         m_music_is_playing;

	/* video-related */
	tilemap_t   *m_pf1_tilemap;
	tilemap_t   *m_pf1_alt_tilemap;
	tilemap_t   *m_pf2_tilemap;
	tilemap_t   *m_pf2_alt_tilemap;
	uint16_t      m_control_0[8];
	uint16_t      m_tilebank;

	/* devices */
	required_device<cpu_device> m_maincpu;
	optional_device<cpu_device> m_audiocpu;
	required_device<okim6295_device> m_oki;
	required_device<gfxdecode_device> m_gfxdecode;
	required_device<palette_device> m_palette;
	optional_device<decospr_device> m_sprgen;
	required_device<screen_device> m_screen;
	optional_device<generic_latch_8_device> m_soundlatch;

	uint8_t m_semicom_prot_offset;
	uint16_t m_protbase;
	DECLARE_WRITE16_MEMBER(tumblepb_oki_w);
	DECLARE_READ16_MEMBER(tumblepb_prot_r);
	DECLARE_READ16_MEMBER(tumblepopb_controls_r);
	DECLARE_READ16_MEMBER(semibase_unknown_r);
	DECLARE_WRITE16_MEMBER(jumpkids_sound_w);
	DECLARE_WRITE16_MEMBER(semicom_soundcmd_w);
	DECLARE_WRITE8_MEMBER(oki_sound_bank_w);
	DECLARE_WRITE8_MEMBER(jumpkids_oki_bank_w);
	DECLARE_WRITE8_MEMBER(prot_p0_w);
	DECLARE_WRITE8_MEMBER(prot_p1_w);
	DECLARE_WRITE8_MEMBER(prot_p2_w);
	DECLARE_READ16_MEMBER(bcstory_1a0_read);
	DECLARE_WRITE16_MEMBER(bcstory_tilebank_w);
	DECLARE_WRITE16_MEMBER(chokchok_tilebank_w);
	DECLARE_WRITE16_MEMBER(wlstar_tilebank_w);
	DECLARE_WRITE16_MEMBER(suprtrio_tilebank_w);
	DECLARE_WRITE16_MEMBER(tumblepb_pf1_data_w);
	DECLARE_WRITE16_MEMBER(tumblepb_pf2_data_w);
	DECLARE_WRITE16_MEMBER(fncywld_pf1_data_w);
	DECLARE_WRITE16_MEMBER(fncywld_pf2_data_w);
	DECLARE_WRITE16_MEMBER(tumblepb_control_0_w);
	DECLARE_WRITE16_MEMBER(pangpang_pf1_data_w);
	DECLARE_WRITE16_MEMBER(pangpang_pf2_data_w);
	DECLARE_WRITE16_MEMBER(tumbleb2_soundmcu_w);

	TILEMAP_MAPPER_MEMBER(tumblep_scan);
	TILE_GET_INFO_MEMBER(get_bg1_tile_info);
	TILE_GET_INFO_MEMBER(get_bg2_tile_info);
	TILE_GET_INFO_MEMBER(get_fg_tile_info);
	TILE_GET_INFO_MEMBER(get_fncywld_bg1_tile_info);
	TILE_GET_INFO_MEMBER(get_fncywld_bg2_tile_info);
	TILE_GET_INFO_MEMBER(get_fncywld_fg_tile_info);
	TILE_GET_INFO_MEMBER(pangpang_get_bg1_tile_info);
	TILE_GET_INFO_MEMBER(pangpang_get_bg2_tile_info);
	TILE_GET_INFO_MEMBER(pangpang_get_fg_tile_info);
	DECLARE_MACHINE_START(tumbleb);
	DECLARE_MACHINE_RESET(tumbleb);
	DECLARE_VIDEO_START(tumblepb);
	DECLARE_VIDEO_START(fncywld);
	DECLARE_MACHINE_RESET(htchctch);
	DECLARE_VIDEO_START(suprtrio);
	DECLARE_VIDEO_START(pangpang);
	DECLARE_VIDEO_START(sdfight);
	uint32_t screen_update_tumblepb(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_jumpkids(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_fncywld(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_semicom(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_suprtrio(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_pangpang(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_semicom_altoffsets(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_bcstory(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_semibase(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_sdfight(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	INTERRUPT_GEN_MEMBER(tumbleb2_interrupt);
	void tumbleb_tilemap_redraw();
	inline void get_bg_tile_info( tile_data &tileinfo, int tile_index, int gfx_bank, uint16_t *gfx_base);
	inline void get_fncywld_bg_tile_info( tile_data &tileinfo, int tile_index, int gfx_bank, uint16_t *gfx_base);
	inline void pangpang_get_bg_tile_info( tile_data &tileinfo, int tile_index, int gfx_bank, uint16_t *gfx_base );
	inline void pangpang_get_bg2x_tile_info( tile_data &tileinfo, int tile_index, int gfx_bank, uint16_t *gfx_base );
	void tumbleb_draw_common(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int pf1x_offs, int pf1y_offs, int pf2x_offs, int pf2y_offs);
	void tumbleb2_set_music_bank( int bank );
	void tumbleb2_play_sound( okim6295_device *oki, int data );
	void tumbleb2_playmusic(okim6295_device *oki);
	void process_tumbleb2_music_command( okim6295_device *oki, int data );
	void tumblepb_gfx_rearrange(int rgn);
	void suprtrio_decrypt_code();
	void suprtrio_decrypt_gfx();

	void unico_base_map(address_map &map);
	void fncywld_main_map(address_map &map);
	void magipur_main_map(address_map &map);
	void htchctch_main_map(address_map &map);
	void jumpkids_main_map(address_map &map);
	void jumpkids_sound_map(address_map &map);
	void pangpang_main_map(address_map &map);
	void semicom_sound_map(address_map &map);
	void suprtrio_main_map(address_map &map);
	void suprtrio_sound_map(address_map &map);
	void tumblepopb_main_map(address_map &map);
	void tumblepopba_main_map(address_map &map);
};

class tumbleb_pic_state : public tumbleb_state
{
public:
	tumbleb_pic_state(const machine_config &mconfig, device_type type, const char *tag) :
		tumbleb_state(mconfig, type, tag),
		m_okibank(*this, "okibank")
	{ }

	void funkyjetb(machine_config &config);

protected:
	virtual void driver_start() override;

private:
	void oki_bank_w(uint8_t data);
	uint8_t pic_data_r();
	void pic_data_w(uint8_t data);
	void pic_ctrl_w(uint8_t data);

	void funkyjetb_map(address_map &map);
	void funkyjetb_oki_map(address_map &map);

	required_memory_bank m_okibank;

	uint8_t m_pic_data;
};

#endif // MAME_INCLUDES_TUMBLEB_H