summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/system16.h
blob: 23747d6d08e425ae4ddb0d4aac5f19f59d4c6330 (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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
// license:BSD-3-Clause
// copyright-holders:Nicola Salmoria, Phil Stroffolino, Mirko Buffoni

#include "video/sega16sp.h"
#include "machine/74157.h"
#include "machine/gen_latch.h"
#include "machine/segaic16.h"
#include "sound/msm5205.h"
#include "sound/upd7759.h"

class segas1x_bootleg_state : public sega_16bit_common_base
{
public:
	segas1x_bootleg_state(const machine_config &mconfig, device_type type, const char *tag)
		: sega_16bit_common_base(mconfig, type, tag)
		, m_textram(*this, "textram")
		, m_bg0_tileram(*this, "bg0_tileram")
		, m_bg1_tileram(*this, "bg1_tileram")
		, m_tileram(*this, "tileram")
		, m_goldnaxeb2_bgpage(*this, "gab2_bgpage")
		, m_goldnaxeb2_fgpage(*this, "gab2_fgpage")
		, m_sprites_region(*this, "sprites")
		, m_soundcpu_region(*this, "soundcpu")
		, m_soundbank(*this, "soundbank")
		, m_okibank(*this, "okibank")
		, m_sprites(*this, "sprites")
		, m_maincpu(*this, "maincpu")
		, m_soundcpu(*this, "soundcpu")
		, m_msm(*this, "5205")
		, m_upd7759(*this, "7759")
		, m_gfxdecode(*this, "gfxdecode")
		, m_soundlatch(*this, "soundlatch")
		, m_adpcm_select(*this, "adpcm_select")
		, m_decrypted_opcodes(*this, "decrypted_opcodes")
	{ }

	required_shared_ptr<uint16_t> m_textram;
	optional_shared_ptr<uint16_t> m_bg0_tileram;
	optional_shared_ptr<uint16_t> m_bg1_tileram;
	optional_shared_ptr<uint16_t> m_tileram;
	optional_shared_ptr<uint16_t> m_goldnaxeb2_bgpage;
	optional_shared_ptr<uint16_t> m_goldnaxeb2_fgpage;

	optional_memory_region m_sprites_region;
	optional_memory_region m_soundcpu_region;
	optional_memory_bank m_soundbank;
	optional_memory_bank m_okibank;

	optional_device<sega_16bit_sprite_device> m_sprites;

	uint16_t m_coinctrl;

	/* game specific */
	int m_passht4b_io1_val;
	int m_passht4b_io2_val;
	int m_passht4b_io3_val;

	int m_beautyb_unkx;

	int m_shinobl_kludge;

	int m_eswat_tilebank0;


	/* video-related */
	tilemap_t *m_background[2];
	tilemap_t *m_foreground[2];
	tilemap_t *m_text_layer;
	tilemap_t *m_bg_tilemaps[2];
	tilemap_t *m_text_tilemap;
	double m_weights[2][3][6];

	int m_spritebank_type;
	int m_back_yscroll;
	int m_fore_yscroll;
	int m_text_yscroll;

	int m_bg1_trans; // alien syn + sys18

	int m_tile_bank[2];
	int m_bg_page[2][4];
	int m_fg_page[2][4];

	uint16_t m_datsu_page[4];

	int m_old_bg_page[2][4];
	int m_old_fg_page[2][4];
	int m_old_tile_bank[2];

	int m_bg_scrollx;
	int m_bg_scrolly;
	int m_fg_scrollx;
	int m_fg_scrolly;
	uint16_t m_tilemapselect;

	int m_textlayer_lo_min;
	int m_textlayer_lo_max;
	int m_textlayer_hi_min;
	int m_textlayer_hi_max;

	int m_tilebank_switch;


	/* sound-related */
	int m_sample_buffer;
	int m_sample_select;

	uint8_t *m_soundbank_ptr;     /* Pointer to currently selected portion of ROM */

	/* sys18 */
	uint8_t *m_sound_bank;
	uint16_t *m_splittab_bg_x;
	uint16_t *m_splittab_bg_y;
	uint16_t *m_splittab_fg_x;
	uint16_t *m_splittab_fg_y;
	int     m_sound_info[4*2];
	int     m_refreshenable;
	int     m_system18;

	uint8_t *m_decrypted_region;  // goldnaxeb1 & bayrouteb1

	/* devices */
	required_device<cpu_device> m_maincpu;
	optional_device<cpu_device> m_soundcpu;
	optional_device<msm5205_device> m_msm;
	optional_device<upd7759_device> m_upd7759;
	required_device<gfxdecode_device> m_gfxdecode;
	optional_device<generic_latch_8_device> m_soundlatch;
	optional_device<ls157_device> m_adpcm_select;
	optional_shared_ptr<uint16_t> m_decrypted_opcodes;

	DECLARE_WRITE16_MEMBER(sound_command_nmi_w);
	DECLARE_WRITE16_MEMBER(sound_command_irq_w);
	DECLARE_READ8_MEMBER(sound_command_irq_r);
	DECLARE_WRITE8_MEMBER(soundbank_msm_w);
	DECLARE_WRITE16_MEMBER(sys16_coinctrl_w);
	DECLARE_READ16_MEMBER(passht4b_service_r);
	DECLARE_READ16_MEMBER(passht4b_io1_r);
	DECLARE_READ16_MEMBER(passht4b_io2_r);
	DECLARE_READ16_MEMBER(passht4b_io3_r);
	DECLARE_WRITE16_MEMBER(sys16_tilebank_w);
	DECLARE_WRITE16_MEMBER(ddcrewbl_spritebank_w);
	DECLARE_WRITE8_MEMBER(tturfbl_msm5205_data_w);
	DECLARE_READ8_MEMBER(tturfbl_soundbank_r);
	DECLARE_WRITE8_MEMBER(tturfbl_soundbank_w);
	DECLARE_WRITE16_MEMBER(s16bl_bgpage_w);
	DECLARE_WRITE16_MEMBER(s16bl_fgpage_w);
	DECLARE_WRITE16_MEMBER(s16bl_fgscrollx_bank_w);
	DECLARE_WRITE16_MEMBER(s16bl_fgscrollx_w);
	DECLARE_WRITE16_MEMBER(s16bl_fgscrolly_w);
	DECLARE_WRITE16_MEMBER(s16bl_bgscrollx_w);
	DECLARE_WRITE16_MEMBER(s16bl_bgscrolly_w);
	template<int Page> DECLARE_WRITE16_MEMBER(datsu_page_w);
	DECLARE_WRITE16_MEMBER(goldnaxeb2_fgscrollx_w);
	DECLARE_WRITE16_MEMBER(goldnaxeb2_bgscrollx_w);
	DECLARE_WRITE16_MEMBER(goldnaxeb2_fgscrolly_w);
	DECLARE_WRITE16_MEMBER(goldnaxeb2_bgscrolly_w);
	DECLARE_WRITE16_MEMBER(goldnaxeb2_fgpage_w);
	DECLARE_WRITE16_MEMBER(goldnaxeb2_bgpage_w);
	DECLARE_WRITE16_MEMBER(eswat_tilebank0_w);
	DECLARE_WRITE16_MEMBER(altbeastbl_gfx_w);
	DECLARE_READ16_MEMBER(beautyb_unkx_r);
	DECLARE_WRITE16_MEMBER(sys18_refreshenable_w);
	DECLARE_WRITE16_MEMBER(sys18_tilebank_w);
	DECLARE_READ8_MEMBER(system18_bank_r);
	DECLARE_WRITE8_MEMBER(sys18_soundbank_w);
	DECLARE_WRITE8_MEMBER(shdancbl_msm5205_data_w);
	DECLARE_READ8_MEMBER(shdancbl_soundbank_r);
	DECLARE_WRITE8_MEMBER(shdancbl_bankctrl_w);
	DECLARE_WRITE8_MEMBER(sys18bl_okibank_w);
	DECLARE_WRITE16_MEMBER(sys16_tileram_w);
	DECLARE_WRITE16_MEMBER(sys16_textram_w);
	DECLARE_WRITE16_MEMBER(s16a_bootleg_bgscrolly_w);
	DECLARE_WRITE16_MEMBER(s16a_bootleg_bgscrollx_w);
	DECLARE_WRITE16_MEMBER(s16a_bootleg_fgscrolly_w);
	DECLARE_WRITE16_MEMBER(s16a_bootleg_fgscrollx_w);
	DECLARE_WRITE16_MEMBER(s16a_bootleg_tilemapselect_w);
	DECLARE_WRITE8_MEMBER(upd7759_bank_w);
	void init_passsht();
	void init_wb3bbl();
	void init_fpointbl();
	void init_eswatbl();
	void init_astormbl();
	void init_sys18bl_oki();
	void init_astormb2();
	void init_shdancbl();
	void init_dduxbl();
	void init_altbeastbl();
	void init_goldnaxeb2();
	void init_bayrouteb1();
	void init_beautyb();
	void init_bayrouteb2();
	void init_shinobl();
	void init_tturfbl();
	void init_goldnaxeb1();
	void init_ddcrewbl();
	void init_common();
	DECLARE_MACHINE_RESET(ddcrewbl);
	TILEMAP_MAPPER_MEMBER(sys16_bg_map);
	TILEMAP_MAPPER_MEMBER(sys16_text_map);
	TILE_GET_INFO_MEMBER(get_bg_tile_info);
	TILE_GET_INFO_MEMBER(get_fg_tile_info);
	TILE_GET_INFO_MEMBER(get_bg2_tile_info);
	TILE_GET_INFO_MEMBER(get_fg2_tile_info);
	TILE_GET_INFO_MEMBER(get_text_tile_info);
	TILE_GET_INFO_MEMBER(get_s16a_bootleg_tile_infotxt);
	TILE_GET_INFO_MEMBER(get_s16a_bootleg_tile_info0);
	TILE_GET_INFO_MEMBER(get_s16a_bootleg_tile_info1);
	DECLARE_VIDEO_START(system16);
	DECLARE_VIDEO_START(system18old);
	DECLARE_VIDEO_START(s16a_bootleg_shinobi);
	DECLARE_VIDEO_START(s16a_bootleg_passsht);
	DECLARE_VIDEO_START(s16a_bootleg_wb3bl);
	DECLARE_VIDEO_START(s16a_bootleg);
	uint32_t screen_update_system16(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_system18old(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_s16a_bootleg(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_s16a_bootleg_passht4b(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	void setup_system16_bootleg_spritebanking(  );
	void update_page(  );
	void set_tile_bank( int data );
	void set_fg_page( int data );
	void set_bg_page( int data );
	void datsu_set_pages(  );
	DECLARE_WRITE_LINE_MEMBER(tturfbl_msm5205_callback);
	DECLARE_WRITE_LINE_MEMBER(datsu_msm5205_callback);
	DECLARE_WRITE_LINE_MEMBER(shdancbl_msm5205_callback);
	DECLARE_WRITE_LINE_MEMBER(sound_cause_nmi);
	void z80_ym2151(machine_config &config);
	void z80_ym2151_upd7759(machine_config &config);
	void datsu_ym2151_msm5205(machine_config &config);
	void datsu_2x_ym2203_msm5205(machine_config &config);
	void system16_base(machine_config &config);
	void goldnaxeb_base(machine_config &config);
	void passshtb(machine_config &config);
	void goldnaxeb2(machine_config &config);
	void beautyb(machine_config &config);
	void goldnaxeb1(machine_config &config);
	void mwalkbl(machine_config &config);
	void eswatbl2(machine_config &config);
	void ddcrewbl(machine_config &config);
	void shdancbla(machine_config &config);
	void astormbl(machine_config &config);
	void astormb2(machine_config &config);
	void passsht4b(machine_config &config);
	void wb3bb(machine_config &config);
	void shdancbl(machine_config &config);
	void shinobi_datsu(machine_config &config);
	void bayrouteb1(machine_config &config);
	void tetrisbl(machine_config &config);
	void eswatbl(machine_config &config);
	void dduxbl(machine_config &config);
	void bayrouteb2(machine_config &config);
	void tturfbl(machine_config &config);
	void altbeastbl(machine_config &config);
	void system18(machine_config &config);
	void astormbl_map(address_map &map);
	void bayrouteb1_map(address_map &map);
	void bayrouteb2_map(address_map &map);
	void beautyb_map(address_map &map);
	void ddcrewbl_map(address_map &map);
	void dduxbl_map(address_map &map);
	void decrypted_opcodes_map(address_map &map);
	void eswatbl2_map(address_map &map);
	void eswatbl_map(address_map &map);
	void goldnaxeb1_map(address_map &map);
	void goldnaxeb2_map(address_map &map);
	void mwalkbl_map(address_map &map);
	void passht4b_map(address_map &map);
	void passshtb_map(address_map &map);
	void pcm_map(address_map &map);
	void shdancbl_map(address_map &map);
	void shdancbl_sound_io_map(address_map &map);
	void shdancbl_sound_map(address_map &map);
	void shdancbla_map(address_map &map);
	void shdancbla_sound_map(address_map &map);
	void shinobi_datsu_sound_map(address_map &map);
	void shinobib_map(address_map &map);
	void sound_18_io_map(address_map &map);
	void sound_18_map(address_map &map);
	void sound_7759_io_map(address_map &map);
	void sound_7759_map(address_map &map);
	void sound_io_map(address_map &map);
	void sound_map(address_map &map);
	void sys18bl_oki_map(address_map &map);
	void sys18bl_sound_map(address_map &map);
	void tetrisbl_map(address_map &map);
	void tturfbl_map(address_map &map);
	void tturfbl_sound_io_map(address_map &map);
	void tturfbl_sound_map(address_map &map);
	void wb3bbl_map(address_map &map);
};