1 // license:BSD-3-Clause
2 // copyright-holders:Bryan McPhail
3 /*************************************************************************
4 
5     Data East 'Rohga' era hardware
6 
7 *************************************************************************/
8 
9 #include "sound/okim6295.h"
10 #include "cpu/h6280/h6280.h"
11 #include "video/deco16ic.h"
12 #include "video/decocomn.h"
13 #include "video/bufsprite.h"
14 #include "video/decospr.h"
15 #include "machine/deco146.h"
16 #include "machine/deco104.h"
17 #include "emupal.h"
18 
19 class rohga_state : public driver_device
20 {
21 public:
rohga_state(const machine_config & mconfig,device_type type,const char * tag)22 	rohga_state(const machine_config &mconfig, device_type type, const char *tag)
23 		: driver_device(mconfig, type, tag),
24 		m_maincpu(*this, "maincpu"),
25 		m_audiocpu(*this, "audiocpu"),
26 		m_ioprot(*this, "ioprot"),
27 		m_decocomn(*this, "deco_common"),
28 		m_deco_tilegen(*this, "tilegen%u", 1),
29 		m_oki(*this, "oki%u", 1),
30 		m_spriteram(*this, "spriteram%u", 1),
31 		m_pf_rowscroll(*this, "pf%u_rowscroll", 1),
32 		m_sprgen(*this, "spritegen%u", 1),
33 		m_palette(*this, "palette")
34 	{ }
35 
36 	void wizdfire(machine_config &config);
37 	void nitrobal(machine_config &config);
38 	void hangzo(machine_config &config);
39 	void schmeisr(machine_config &config);
40 	void rohga(machine_config &config);
41 
42 	void init_wizdfire();
43 	void init_nitrobal();
44 	void init_schmeisr();
45 	void init_hangzo();
46 	void init_rohga();
47 
48 private:
49 	/* devices */
50 	required_device<cpu_device> m_maincpu;
51 	required_device<h6280_device> m_audiocpu;
52 	required_device<deco_146_base_device> m_ioprot;
53 	required_device<decocomn_device> m_decocomn;
54 	required_device_array<deco16ic_device, 2> m_deco_tilegen;
55 	required_device_array<okim6295_device, 2> m_oki;
56 	optional_device_array<buffered_spriteram16_device, 2> m_spriteram;
57 
58 	/* memory pointers */
59 	optional_shared_ptr_array<u16, 4> m_pf_rowscroll;
60 
61 	optional_device_array<decospr_device, 2> m_sprgen;
62 
63 	required_device<palette_device> m_palette;
64 
65 	u16 irq_ack_r();
66 	void irq_ack_w(u16 data);
67 	void rohga_buffer_spriteram16_w(u16 data);
68 	void sound_bankswitch_w(u8 data);
69 
70 	DECLARE_VIDEO_START(wizdfire);
71 	u32 screen_update_rohga(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
72 	u32 screen_update_wizdfire(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
73 	u32 screen_update_nitrobal(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
74 	void mixwizdfirelayer(bitmap_rgb32 &bitmap, const rectangle &cliprect, u16 pri, u16 primask);
75 	void mixnitroballlayer(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
76 	DECO16IC_BANK_CB_MEMBER(bank_callback);
77 	DECOSPR_PRIORITY_CB_MEMBER(rohga_pri_callback);
78 	DECOSPR_COLOUR_CB_MEMBER(rohga_col_callback);
79 	DECOSPR_COLOUR_CB_MEMBER(schmeisr_col_callback);
80 
81 	u16 ioprot_r(offs_t offset);
82 	void ioprot_w(offs_t offset, u16 data, u16 mem_mask = ~0);
83 	void hangzo_map(address_map &map);
84 	void hotb_base_map(address_map &map);
85 	void nitrobal_map(address_map &map);
86 	void rohga_map(address_map &map);
87 	void sound_map(address_map &map);
88 	void schmeisr_map(address_map &map);
89 	void wizdfire_map(address_map &map);
90 };
91