1 // license:BSD-3-Clause
2 // copyright-holders:Zsolt Vasvari
3 /***************************************************************************
4 
5   Seibu Stinger/Wiz hardware
6 
7 ***************************************************************************/
8 #ifndef MAME_INCLUDES_WIZ_H
9 #define MAME_INCLUDES_WIZ_H
10 
11 #pragma once
12 
13 #include "sound/discrete.h"
14 #include "emupal.h"
15 
16 class wiz_state : public driver_device
17 {
18 public:
wiz_state(const machine_config & mconfig,device_type type,const char * tag)19 	wiz_state(const machine_config &mconfig, device_type type, const char *tag) :
20 		driver_device(mconfig, type, tag),
21 		m_maincpu(*this, "maincpu"),
22 		m_audiocpu(*this, "audiocpu"),
23 		m_discrete(*this, "discrete"),
24 		m_gfxdecode(*this, "gfxdecode"),
25 		m_palette(*this, "palette"),
26 		m_videoram(*this, "videoram"),
27 		m_videoram2(*this, "videoram2"),
28 		m_colorram(*this, "colorram"),
29 		m_colorram2(*this, "colorram2"),
30 		m_attrram(*this, "attrram"),
31 		m_attrram2(*this, "attrram2"),
32 		m_spriteram(*this, "spriteram"),
33 		m_spriteram2(*this, "spriteram2"),
34 		m_decrypted_opcodes(*this, "decrypted_opcodes")
35 	{ }
36 
37 	void wiz(machine_config &config);
38 	void kungfut(machine_config &config);
39 	void scion(machine_config &config);
40 	void stinger(machine_config &config);
41 
42 	void init_stinger();
43 
44 private:
45 	required_device<cpu_device> m_maincpu;
46 	required_device<cpu_device> m_audiocpu;
47 	optional_device<discrete_device> m_discrete;
48 	required_device<gfxdecode_device> m_gfxdecode;
49 	required_device<palette_device> m_palette;
50 
51 	required_shared_ptr<uint8_t> m_videoram;
52 	required_shared_ptr<uint8_t> m_videoram2;
53 	required_shared_ptr<uint8_t> m_colorram;
54 	required_shared_ptr<uint8_t> m_colorram2;
55 	required_shared_ptr<uint8_t> m_attrram;
56 	required_shared_ptr<uint8_t> m_attrram2;
57 	required_shared_ptr<uint8_t> m_spriteram;
58 	required_shared_ptr<uint8_t> m_spriteram2;
59 	optional_shared_ptr<uint8_t> m_decrypted_opcodes;
60 
61 	int32_t m_flipx;
62 	int32_t m_flipy;
63 	int32_t m_bgcolor;
64 	uint8_t m_charbank[2];
65 	uint8_t m_palbank[2];
66 	uint8_t m_main_nmi_mask;
67 	uint8_t m_sound_nmi_mask;
68 	uint8_t m_sprite_bank;
69 
70 	int m_dsc0;
71 	int m_dsc1;
72 
73 	uint8_t wiz_protection_r();
74 	void wiz_coin_counter_w(offs_t offset, uint8_t data);
75 	void wiz_main_nmi_mask_w(uint8_t data);
76 	void wiz_sound_nmi_mask_w(uint8_t data);
77 	void wiz_palette_bank_w(offs_t offset, uint8_t data);
78 	void wiz_sprite_bank_w(uint8_t data);
79 	void wiz_bgcolor_w(uint8_t data);
80 	void wiz_char_bank_w(offs_t offset, uint8_t data);
81 	void wiz_flipx_w(uint8_t data);
82 	void wiz_flipy_w(uint8_t data);
83 	void stinger_explosion_w(uint8_t data);
84 	void stinger_shot_w(uint8_t data);
85 
86 	virtual void machine_reset() override;
87 	virtual void machine_start() override;
88 	void wiz_palette(palette_device &palette) const;
89 	uint32_t screen_update_wiz(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
90 	uint32_t screen_update_stinger(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
91 	uint32_t screen_update_kungfut(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
92 	INTERRUPT_GEN_MEMBER(wiz_vblank_interrupt);
93 	INTERRUPT_GEN_MEMBER(wiz_sound_interrupt);
94 	void draw_tiles(bitmap_ind16 &bitmap, const rectangle &cliprect, int layer, int charbank, int colortype);
95 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, int set, int charbank);
96 
97 	void decrypted_opcodes_map(address_map &map);
98 	void kungfut_main_map(address_map &map);
99 	void kungfut_sound_map(address_map &map);
100 	void stinger_main_map(address_map &map);
101 	void stinger_sound_map(address_map &map);
102 	void wiz_main_map(address_map &map);
103 };
104 
105 #endif // MAME_INCLUDES_WIZ_H
106