summaryrefslogtreecommitdiffstatshomepage
path: root/src/mame/includes/goldstar.h
blob: ef92e7e262a7d35bd3926ba7b4b612cf671e12fd (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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
// license:BSD-3-Clause
// copyright-holders:David Haywood, Roberto Fresca, Vas Crabb

#include "machine/ds2401.h"
#include "machine/ticket.h"


class goldstar_state : public driver_device
{
public:
	goldstar_state(const machine_config &mconfig, device_type type, const char *tag) :
		driver_device(mconfig, type, tag),
		m_fg_vidram(*this, "fg_vidram"),
		m_fg_atrram(*this, "fg_atrram"),
		m_bg_vidram(*this, "bg_vidram"),
		m_bg_atrram(*this, "bg_atrram"),
		m_reel1_ram(*this, "reel1_ram"),
		m_reel2_ram(*this, "reel2_ram"),
		m_reel3_ram(*this, "reel3_ram"),
		m_reel1_scroll(*this, "reel1_scroll"),
		m_reel2_scroll(*this, "reel2_scroll"),
		m_reel3_scroll(*this, "reel3_scroll"),
		m_maincpu(*this, "maincpu"),
		m_gfxdecode(*this, "gfxdecode"),
		m_palette(*this, "palette"),
		m_lamp(*this, "lamp%u", 0U)
	{ }

	DECLARE_WRITE8_MEMBER(protection_w);
	DECLARE_READ8_MEMBER(protection_r);
	DECLARE_WRITE8_MEMBER(p1_lamps_w);
	DECLARE_WRITE8_MEMBER(p2_lamps_w);
	DECLARE_WRITE8_MEMBER(ncb3_port81_w);
	DECLARE_WRITE8_MEMBER(cm_coincount_w);
	DECLARE_WRITE8_MEMBER(goldstar_fg_vidram_w);
	DECLARE_WRITE8_MEMBER(goldstar_fg_atrram_w);
	DECLARE_WRITE8_MEMBER(goldstar_reel1_ram_w);
	DECLARE_WRITE8_MEMBER(goldstar_reel2_ram_w);
	DECLARE_WRITE8_MEMBER(goldstar_reel3_ram_w);
	DECLARE_WRITE8_MEMBER(goldstar_fa00_w);
	DECLARE_WRITE8_MEMBER(ay8910_outputa_w);
	DECLARE_WRITE8_MEMBER(ay8910_outputb_w);
	void init_goldstar();
	void init_cmast91();
	void init_wcherry();
	void init_super9();
	DECLARE_VIDEO_START(goldstar);
	DECLARE_PALETTE_INIT(cm);
	DECLARE_VIDEO_START(cherrym);
	DECLARE_PALETTE_INIT(cmast91);
	DECLARE_PALETTE_INIT(lucky8);
	uint32_t screen_update_goldstar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_cmast91(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

	void ladylinr(machine_config &config);
	void wcherry(machine_config &config);
	void pkrmast(machine_config &config);
	void moonlght(machine_config &config);
	void kkotnoli(machine_config &config);
	void cmast91(machine_config &config);
	void super9(machine_config &config);
	void goldfrui(machine_config &config);
	void goldstar(machine_config &config);
	void goldstbl(machine_config &config);
	void bonusch_portmap(address_map &map);
	void cm_map(address_map &map);
	void cmast91_portmap(address_map &map);
	void flaming7_map(address_map &map);
	void goldstar_map(address_map &map);
	void goldstar_readport(address_map &map);
	void kkotnoli_map(address_map &map);
	void ladylinr_map(address_map &map);
	void lucky8_map(address_map &map);
	void mbstar_map(address_map &map);
	void megaline_portmap(address_map &map);
	void ncb3_readwriteport(address_map &map);
	void nfm_map(address_map &map);
	void pkrmast_portmap(address_map &map);
	void ramdac_map(address_map &map);
	void wcat3_map(address_map &map);
	void wcherry_map(address_map &map);
	void wcherry_readwriteport(address_map &map);

protected:
	virtual void machine_start() override { m_lamp.resolve(); }
	TILE_GET_INFO_MEMBER(get_goldstar_fg_tile_info);
	TILE_GET_INFO_MEMBER(get_cherrym_fg_tile_info);
	TILE_GET_INFO_MEMBER(get_goldstar_reel1_tile_info);
	TILE_GET_INFO_MEMBER(get_goldstar_reel2_tile_info);
	TILE_GET_INFO_MEMBER(get_goldstar_reel3_tile_info);

	int m_dataoffset;

	required_shared_ptr<uint8_t> m_fg_vidram;
	required_shared_ptr<uint8_t> m_fg_atrram;

	optional_shared_ptr<uint8_t> m_bg_vidram;
	optional_shared_ptr<uint8_t> m_bg_atrram;

	optional_shared_ptr<uint8_t> m_reel1_ram;
	optional_shared_ptr<uint8_t> m_reel2_ram;
	optional_shared_ptr<uint8_t> m_reel3_ram;

	optional_shared_ptr<uint8_t> m_reel1_scroll;
	optional_shared_ptr<uint8_t> m_reel2_scroll;
	optional_shared_ptr<uint8_t> m_reel3_scroll;

	tilemap_t *m_reel1_tilemap;
	tilemap_t *m_reel2_tilemap;
	tilemap_t *m_reel3_tilemap;

	int m_bgcolor;
	tilemap_t *m_fg_tilemap;
	tilemap_t *m_bg_tilemap;
	uint8_t m_cmaster_girl_num;
	uint8_t m_cmaster_girl_pal;
	uint8_t m_cm_enable_reg;
	uint8_t m_cm_girl_scroll;

	required_device<cpu_device> m_maincpu;
	required_device<gfxdecode_device> m_gfxdecode;
	required_device<palette_device> m_palette;
	output_finder<16> m_lamp;
};


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

	DECLARE_WRITE8_MEMBER(outport0_w);
	DECLARE_WRITE8_MEMBER(girl_scroll_w);
	DECLARE_WRITE8_MEMBER(background_col_w);

	void init_cm();
	void init_cmv4();
	void init_tonypok();
	void init_schery97();
	void init_schery97a();
	void init_skill98();
	void init_po33();
	void init_match133();
	void init_nfb96_dk();
	void init_nfb96_c2();
	void init_nfb96_d();
	void init_nfb96_c1();
	void init_nfb96sea();
	void init_fb2010();
	void init_rp35();
	void init_rp36();
	void init_rp36c3();
	void init_rp96sub();
	void init_tcl();
	void init_super7();

	uint32_t screen_update_amcoe1a(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

	void cm(machine_config &config);
	void cmasterc(machine_config &config);
	void amcoe1a(machine_config &config);
	void nfm(machine_config &config);
	void amcoe2(machine_config &config);
	void amcoe1(machine_config &config);
	void amcoe1_portmap(address_map &map);
	void amcoe2_portmap(address_map &map);
	void cm_portmap(address_map &map);
protected:
	// installed by various driver init handlers to get stuff to work
	READ8_MEMBER(fixedval09_r) { return 0x09; }
	READ8_MEMBER(fixedval38_r) { return 0x38; }
	READ8_MEMBER(fixedval48_r) { return 0x48; }
	READ8_MEMBER(fixedval58_r) { return 0x58; }
	READ8_MEMBER(fixedval68_r) { return 0x68; }
	READ8_MEMBER(fixedval74_r) { return 0x74; }
	READ8_MEMBER(fixedval80_r) { return 0x80; }
	READ8_MEMBER(fixedval82_r) { return 0x82; }
	READ8_MEMBER(fixedval84_r) { return 0x84; }
	READ8_MEMBER(fixedval90_r) { return 0x90; }
	READ8_MEMBER(fixedval96_r) { return 0x96; }
	READ8_MEMBER(fixedvala8_r) { return 0xa8; }
	READ8_MEMBER(fixedvalaa_r) { return 0xaa; }
	READ8_MEMBER(fixedvalb2_r) { return 0xb2; }
	READ8_MEMBER(fixedvalb4_r) { return 0xb4; }
	READ8_MEMBER(fixedvalbe_r) { return 0xbe; }
	READ8_MEMBER(fixedvalc7_r) { return 0xc7; }
	READ8_MEMBER(fixedvalea_r) { return 0xea; }
	READ8_MEMBER(fixedvale4_r) { return 0xe4; }
};


class wingco_state : public goldstar_state
{
public:
	wingco_state(const machine_config &mconfig, device_type type, const char *tag) :
		goldstar_state(mconfig, type, tag),
		m_fl7w4_id(*this, "fl7w4_id")
	{
	}

	DECLARE_WRITE8_MEMBER(magodds_outb850_w);
	DECLARE_WRITE8_MEMBER(magodds_outb860_w);
	DECLARE_WRITE8_MEMBER(fl7w4_outc802_w);
	DECLARE_WRITE8_MEMBER(system_outputa_w);
	DECLARE_WRITE8_MEMBER(system_outputb_w);
	DECLARE_WRITE8_MEMBER(system_outputc_w);

	void init_lucky8a();
	void init_magoddsc();
	void init_flaming7();
	void init_flam7_tw();

	DECLARE_VIDEO_START(bingowng);
	DECLARE_VIDEO_START(magical);
	DECLARE_PALETTE_INIT(magodds);
	uint32_t screen_update_bingowng(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_magical(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
	uint32_t screen_update_mbstar(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

	DECLARE_WRITE_LINE_MEMBER(masked_irq);

	void bingowng(machine_config &config);
	void flaming7(machine_config &config);
	void lucky8(machine_config &config);
	void wcat3(machine_config &config);
	void magodds(machine_config &config);
	void flam7_w4(machine_config &config);
	void bingownga(machine_config &config);
	void mbstar(machine_config &config);
	void flam7_tw(machine_config &config);
	void magodds_map(address_map &map);
protected:
	TILE_GET_INFO_MEMBER(get_magical_fg_tile_info);

private:
	optional_device<ds2401_device> m_fl7w4_id;

	uint8_t m_nmi_enable;
	uint8_t m_vidreg;

	int m_tile_bank;
};


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

	void init_cb3();
	void init_cb3e();
	void init_cherrys();
	void init_chrygld();
	void init_chry10();

	void cherrys(machine_config &config);
	void chrygld(machine_config &config);
	void cb3c(machine_config &config);
	void cb3e(machine_config &config);
	void ncb3(machine_config &config);
	void cm97(machine_config &config);
	void ncb3_map(address_map &map);
protected:
	void do_blockswaps(uint8_t* ROM);
	void dump_to_file(uint8_t* ROM);

	uint8_t cb3_decrypt(uint8_t cipherText, uint16_t address);
	uint8_t chry10_decrypt(uint8_t cipherText);
};


class sanghopm_state : public goldstar_state
{
public:
	sanghopm_state(const machine_config &mconfig, device_type type, const char *tag) :
		goldstar_state(mconfig, type, tag),
		m_reel1_attrram(*this, "reel1_attrram"),
		m_reel2_attrram(*this, "reel2_attrram"),
		m_reel3_attrram(*this, "reel3_attrram")
	{
	}

	DECLARE_WRITE8_MEMBER(enable_w);
	DECLARE_WRITE8_MEMBER(coincount_w);

	DECLARE_WRITE8_MEMBER(fg_vidram_w);
	DECLARE_WRITE8_MEMBER(fg_atrram_w);
	DECLARE_WRITE8_MEMBER(bg_vidram_w);
	DECLARE_WRITE8_MEMBER(bg_atrram_w);
	DECLARE_WRITE8_MEMBER(reel1_attrram_w);
	DECLARE_WRITE8_MEMBER(reel2_attrram_w);
	DECLARE_WRITE8_MEMBER(reel3_attrram_w);

	DECLARE_VIDEO_START(sangho);
	uint32_t screen_update_sangho(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

	void star100(machine_config &config);
	void star100_map(address_map &map);
	void star100_readport(address_map &map);
protected:
	TILE_GET_INFO_MEMBER(get_fg_tile_info);
	TILE_GET_INFO_MEMBER(get_bg_tile_info);
	TILE_GET_INFO_MEMBER(get_reel1_tile_info);
	TILE_GET_INFO_MEMBER(get_reel2_tile_info);
	TILE_GET_INFO_MEMBER(get_reel3_tile_info);

private:
	required_shared_ptr<uint8_t> m_reel1_attrram;
	required_shared_ptr<uint8_t> m_reel2_attrram;
	required_shared_ptr<uint8_t> m_reel3_attrram;

	uint8_t m_enable_reg;
};


class unkch_state : public goldstar_state
{
public:
	unkch_state(const machine_config &mconfig, device_type type, const char *tag) :
		goldstar_state(mconfig, type, tag),
		m_reel1_attrram(*this, "reel1_attrram"),
		m_reel2_attrram(*this, "reel2_attrram"),
		m_reel3_attrram(*this, "reel3_attrram"),
		m_ticket_dispenser(*this, "tickets")
	{
	}

	DECLARE_WRITE8_MEMBER(coincount_w);
	DECLARE_WRITE8_MEMBER(unkcm_0x02_w);
	DECLARE_WRITE8_MEMBER(unkcm_0x03_w);

	DECLARE_WRITE8_MEMBER(reel1_attrram_w);
	DECLARE_WRITE8_MEMBER(reel2_attrram_w);
	DECLARE_WRITE8_MEMBER(reel3_attrram_w);

	void init_unkch1();
	void init_unkch3();
	void init_unkch4();

	DECLARE_VIDEO_START(unkch);
	uint32_t screen_update_unkch(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);

	DECLARE_WRITE_LINE_MEMBER(vblank_irq);

	void megaline(machine_config &config);
	void unkch(machine_config &config);
	void bonusch(machine_config &config);
	void bonusch_map(address_map &map);
	void megaline_map(address_map &map);
	void unkch_map(address_map &map);
	void unkch_portmap(address_map &map);
protected:
	TILE_GET_INFO_MEMBER(get_reel1_tile_info);
	TILE_GET_INFO_MEMBER(get_reel2_tile_info);
	TILE_GET_INFO_MEMBER(get_reel3_tile_info);

private:
	required_shared_ptr<uint8_t> m_reel1_attrram;
	required_shared_ptr<uint8_t> m_reel2_attrram;
	required_shared_ptr<uint8_t> m_reel3_attrram;

	uint8_t m_vblank_irq_enable;
	uint8_t m_vidreg;

	optional_device<ticket_dispenser_device> m_ticket_dispenser;
};