summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/taito_f3.h
blob: 7b206b66df40d4c7e2ff62938de8dac9ed145a90 (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
293
294
295
296
297
298
299
300
301
302
#include "sound/okim6295.h"

/* This it the best way to allow game specific kludges until the system is fully understood */
enum {
	/* Early F3 class games, these are not cartridge games and system features may be different */
	RINGRAGE=0, /* D21 */
	ARABIANM,   /* D29 */
	RIDINGF,    /* D34 */
	GSEEKER,    /* D40 */
	TRSTAR,     /* D53 */
	GUNLOCK,    /* D66 */
	TWINQIX,
	UNDRFIRE,   /* D67 - Heavily modified F3 hardware (different memory map) */
	SCFINALS,
	LIGHTBR,    /* D69 */

	/* D77 - F3 motherboard proms, all following games are 'F3 package system' */
	/* D78 I CUP */
	KAISERKN,   /* D84 */
	DARIUSG,    /* D87 */
	BUBSYMPH,   /* D90 */
	SPCINVDX,   /* D93 */
	HTHERO95,   /* D94 */
	QTHEATER,   /* D95 */
	EACTION2,   /* E02 */
	SPCINV95,   /* E06 */
	QUIZHUHU,   /* E08 */
	PBOBBLE2,   /* E10 */
	GEKIRIDO,   /* E11 */
	KTIGER2,    /* E15 */
	BUBBLEM,    /* E21 */
	CLEOPATR,   /* E28 */
	PBOBBLE3,   /* E29 */
	ARKRETRN,   /* E36 */
	KIRAMEKI,   /* E44 */
	PUCHICAR,   /* E46 */
	PBOBBLE4,   /* E49 */
	POPNPOP,    /* E51 */
	LANDMAKR,   /* E61 */
	RECALH,     /* prototype */
	COMMANDW,   /* prototype */
	TMDRILL
};

class taito_f3_state : public driver_device
{
public:
	enum
	{
		TIMER_F3_INTERRUPT3
	};

	taito_f3_state(const machine_config &mconfig, device_type type, const char *tag)
		: driver_device(mconfig, type, tag),
		m_f3_ram(*this,"f3_ram") ,
		m_maincpu(*this, "maincpu"),
		m_audiocpu(*this, "audiocpu"),
		m_oki(*this, "oki"),
		m_gfxdecode(*this, "gfxdecode"),
		m_screen(*this, "screen"),
		m_palette(*this, "palette") { }

	UINT16 *m_videoram;
	UINT16 *m_spriteram;
	optional_shared_ptr<UINT32> m_f3_ram;
	UINT16 *m_f3_vram;
	UINT16 *m_f3_line_ram;
	UINT16 *m_f3_pf_data;
	UINT16 *m_f3_pivot_ram;

	UINT32 m_coin_word[2];
	int m_f3_game;
	tilemap_t *m_pf1_tilemap;
	tilemap_t *m_pf2_tilemap;
	tilemap_t *m_pf3_tilemap;
	tilemap_t *m_pf4_tilemap;
	tilemap_t *m_pf5_tilemap;
	tilemap_t *m_pf6_tilemap;
	tilemap_t *m_pf7_tilemap;
	tilemap_t *m_pf8_tilemap;
	tilemap_t *m_pixel_layer;
	tilemap_t *m_vram_layer;
	UINT16 *m_spriteram16_buffered;
	UINT16 m_f3_control_0[8];
	UINT16 m_f3_control_1[8];
	int m_flipscreen;
	UINT8 m_sprite_extra_planes;
	UINT8 m_sprite_pen_mask;
	UINT16 *m_f3_pf_data_1;
	UINT16 *m_f3_pf_data_2;
	UINT16 *m_f3_pf_data_3;
	UINT16 *m_f3_pf_data_4;
	UINT16 *m_f3_pf_data_5;
	UINT16 *m_f3_pf_data_6;
	UINT16 *m_f3_pf_data_7;
	UINT16 *m_f3_pf_data_8;
	int m_f3_skip_this_frame;
	int m_sprite_lag;
	UINT8 m_sprite_pri_usage;
	bitmap_ind8 m_pri_alp_bitmap;
	int m_f3_alpha_level_2as;
	int m_f3_alpha_level_2ad;
	int m_f3_alpha_level_3as;
	int m_f3_alpha_level_3ad;
	int m_f3_alpha_level_2bs;
	int m_f3_alpha_level_2bd;
	int m_f3_alpha_level_3bs;
	int m_f3_alpha_level_3bd;
	int m_alpha_level_last;
	int m_width_mask;
	int m_twidth_mask;
	int m_twidth_mask_bit;
	UINT8 *m_tile_opaque_sp;
	UINT8 *m_tile_opaque_pf[8];
	UINT8 m_add_sat[256][256];
	int m_alpha_s_1_1;
	int m_alpha_s_1_2;
	int m_alpha_s_1_4;
	int m_alpha_s_1_5;
	int m_alpha_s_1_6;
	int m_alpha_s_1_8;
	int m_alpha_s_1_9;
	int m_alpha_s_1_a;
	int m_alpha_s_2a_0;
	int m_alpha_s_2a_4;
	int m_alpha_s_2a_8;
	int m_alpha_s_2b_0;
	int m_alpha_s_2b_4;
	int m_alpha_s_2b_8;
	int m_alpha_s_3a_0;
	int m_alpha_s_3a_1;
	int m_alpha_s_3a_2;
	int m_alpha_s_3b_0;
	int m_alpha_s_3b_1;
	int m_alpha_s_3b_2;
	UINT32 m_dval;
	UINT8 m_pval;
	UINT8 m_tval;
	UINT8 m_pdest_2a;
	UINT8 m_pdest_2b;
	int m_tr_2a;
	int m_tr_2b;
	UINT8 m_pdest_3a;
	UINT8 m_pdest_3b;
	int m_tr_3a;
	int m_tr_3b;
	UINT16 *m_src0;
	UINT16 *m_src_s0;
	UINT16 *m_src_e0;
	UINT16 m_clip_al0;
	UINT16 m_clip_ar0;
	UINT16 m_clip_bl0;
	UINT16 m_clip_br0;
	UINT8 *m_tsrc0;
	UINT8 *m_tsrc_s0;
	UINT32 m_x_count0;
	UINT32 m_x_zoom0;
	UINT16 *m_src1;
	UINT16 *m_src_s1;
	UINT16 *m_src_e1;
	UINT16 m_clip_al1;
	UINT16 m_clip_ar1;
	UINT16 m_clip_bl1;
	UINT16 m_clip_br1;
	UINT8 *m_tsrc1;
	UINT8 *m_tsrc_s1;
	UINT32 m_x_count1;
	UINT32 m_x_zoom1;
	UINT16 *m_src2;
	UINT16 *m_src_s2;
	UINT16 *m_src_e2;
	UINT16 m_clip_al2;
	UINT16 m_clip_ar2;
	UINT16 m_clip_bl2;
	UINT16 m_clip_br2;
	UINT8 *m_tsrc2;
	UINT8 *m_tsrc_s2;
	UINT32 m_x_count2;
	UINT32 m_x_zoom2;
	UINT16 *m_src3;
	UINT16 *m_src_s3;
	UINT16 *m_src_e3;
	UINT16 m_clip_al3;
	UINT16 m_clip_ar3;
	UINT16 m_clip_bl3;
	UINT16 m_clip_br3;
	UINT8 *m_tsrc3;
	UINT8 *m_tsrc_s3;
	UINT32 m_x_count3;
	UINT32 m_x_zoom3;
	UINT16 *m_src4;
	UINT16 *m_src_s4;
	UINT16 *m_src_e4;
	UINT16 m_clip_al4;
	UINT16 m_clip_ar4;
	UINT16 m_clip_bl4;
	UINT16 m_clip_br4;
	UINT8 *m_tsrc4;
	UINT8 *m_tsrc_s4;
	UINT32 m_x_count4;
	UINT32 m_x_zoom4;
	struct tempsprite *m_spritelist;
	const struct tempsprite *m_sprite_end;
	struct f3_playfield_line_inf *m_pf_line_inf;
	struct f3_spritealpha_line_inf *m_sa_line_inf;
	const struct F3config *m_f3_game_config;
	int (*m_dpix_n[8][16])(taito_f3_state *state, UINT32 s_pix);
	int (**m_dpix_lp[5])(taito_f3_state *state, UINT32 s_pix);
	int (**m_dpix_sp[9])(taito_f3_state *state, UINT32 s_pix);

	DECLARE_READ32_MEMBER(f3_control_r);
	DECLARE_WRITE32_MEMBER(f3_control_w);
	DECLARE_WRITE32_MEMBER(f3_sound_reset_0_w);
	DECLARE_WRITE32_MEMBER(f3_sound_reset_1_w);
	DECLARE_WRITE32_MEMBER(f3_sound_bankswitch_w);
	DECLARE_WRITE16_MEMBER(f3_unk_w);
	DECLARE_READ32_MEMBER(bubsympb_oki_r);
	DECLARE_WRITE32_MEMBER(bubsympb_oki_w);
	DECLARE_READ16_MEMBER(f3_pf_data_r);
	DECLARE_WRITE16_MEMBER(f3_pf_data_w);
	DECLARE_WRITE16_MEMBER(f3_control_0_w);
	DECLARE_WRITE16_MEMBER(f3_control_1_w);
	DECLARE_READ16_MEMBER(f3_spriteram_r);
	DECLARE_WRITE16_MEMBER(f3_spriteram_w);
	DECLARE_READ16_MEMBER(f3_videoram_r);
	DECLARE_WRITE16_MEMBER(f3_videoram_w);
	DECLARE_READ16_MEMBER(f3_vram_r);
	DECLARE_WRITE16_MEMBER(f3_vram_w);
	DECLARE_READ16_MEMBER(f3_pivot_r);
	DECLARE_WRITE16_MEMBER(f3_pivot_w);
	DECLARE_READ16_MEMBER(f3_lineram_r);
	DECLARE_WRITE16_MEMBER(f3_lineram_w);
	DECLARE_WRITE32_MEMBER(f3_palette_24bit_w);
	DECLARE_CUSTOM_INPUT_MEMBER(f3_analog_r);
	DECLARE_CUSTOM_INPUT_MEMBER(f3_coin_r);
	DECLARE_DRIVER_INIT(commandw);
	DECLARE_DRIVER_INIT(pbobble2);
	DECLARE_DRIVER_INIT(puchicar);
	DECLARE_DRIVER_INIT(intcup94);
	DECLARE_DRIVER_INIT(landmakr);
	DECLARE_DRIVER_INIT(twinqix);
	DECLARE_DRIVER_INIT(elvactr);
	DECLARE_DRIVER_INIT(arabianm);
	DECLARE_DRIVER_INIT(bubsympb);
	DECLARE_DRIVER_INIT(ktiger2);
	DECLARE_DRIVER_INIT(lightbr);
	DECLARE_DRIVER_INIT(gekirido);
	DECLARE_DRIVER_INIT(arkretrn);
	DECLARE_DRIVER_INIT(kirameki);
	DECLARE_DRIVER_INIT(qtheater);
	DECLARE_DRIVER_INIT(popnpop);
	DECLARE_DRIVER_INIT(spcinvdj);
	DECLARE_DRIVER_INIT(pbobbl2p);
	DECLARE_DRIVER_INIT(landmkrp);
	DECLARE_DRIVER_INIT(bubblem);
	DECLARE_DRIVER_INIT(ridingf);
	DECLARE_DRIVER_INIT(gseeker);
	DECLARE_DRIVER_INIT(bubsymph);
	DECLARE_DRIVER_INIT(hthero95);
	DECLARE_DRIVER_INIT(gunlock);
	DECLARE_DRIVER_INIT(pbobble4);
	DECLARE_DRIVER_INIT(dariusg);
	DECLARE_DRIVER_INIT(recalh);
	DECLARE_DRIVER_INIT(kaiserkn);
	DECLARE_DRIVER_INIT(spcinv95);
	DECLARE_DRIVER_INIT(trstaroj);
	DECLARE_DRIVER_INIT(ringrage);
	DECLARE_DRIVER_INIT(cupfinal);
	DECLARE_DRIVER_INIT(quizhuhu);
	DECLARE_DRIVER_INIT(pbobble3);
	DECLARE_DRIVER_INIT(cleopatr);
	DECLARE_DRIVER_INIT(scfinals);
	DECLARE_DRIVER_INIT(pbobbl2x);
	TILE_GET_INFO_MEMBER(get_tile_info1);
	TILE_GET_INFO_MEMBER(get_tile_info2);
	TILE_GET_INFO_MEMBER(get_tile_info3);
	TILE_GET_INFO_MEMBER(get_tile_info4);
	TILE_GET_INFO_MEMBER(get_tile_info5);
	TILE_GET_INFO_MEMBER(get_tile_info6);
	TILE_GET_INFO_MEMBER(get_tile_info7);
	TILE_GET_INFO_MEMBER(get_tile_info8);
	TILE_GET_INFO_MEMBER(get_tile_info_vram);
	TILE_GET_INFO_MEMBER(get_tile_info_pixel);
	DECLARE_MACHINE_START(f3);
	DECLARE_MACHINE_RESET(f3);
	DECLARE_VIDEO_START(f3);
	UINT32 screen_update_f3(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
	void screen_eof_f3(screen_device &screen, bool state);
	INTERRUPT_GEN_MEMBER(f3_interrupt2);
	required_device<cpu_device> m_maincpu;
	optional_device<cpu_device> m_audiocpu;
	optional_device<okim6295_device> m_oki;
	required_device<gfxdecode_device> m_gfxdecode;
	required_device<screen_device> m_screen;
	required_device<palette_device> m_palette;

protected:
	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);

private:
	inline void get_tile_info(tile_data &tileinfo, int tile_index, UINT16 *gfx_base);
};