1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood, Mike Coates
3 #ifndef MAME_INCLUDES_SNOWBROS_H
4 #define MAME_INCLUDES_SNOWBROS_H
5 
6 #pragma once
7 
8 #include "machine/gen_latch.h"
9 #include "machine/timer.h"
10 #include "sound/okim6295.h"
11 #include "video/kan_pand.h" // for the original pandora
12 #include "emupal.h"
13 #include "screen.h"
14 
15 class snowbros_state : public driver_device
16 {
17 public:
snowbros_state(const machine_config & mconfig,device_type type,const char * tag)18 	snowbros_state(const machine_config &mconfig, device_type type, const char *tag)
19 		: driver_device(mconfig, type, tag),
20 		m_maincpu(*this,"maincpu"),
21 		m_soundcpu(*this, "soundcpu"),
22 		m_oki(*this, "oki"),
23 		m_gfxdecode(*this, "gfxdecode"),
24 		m_palette(*this, "palette"),
25 		m_screen(*this, "screen"),
26 		m_soundlatch(*this, "soundlatch"),
27 		m_pandora(*this, "pandora"),
28 		m_hyperpac_ram(*this, "hyperpac_ram"),
29 		m_bootleg_spriteram16(*this, "spriteram16b")
30 	{ }
31 
32 	void _4in1(machine_config &config);
33 	void semiprot(machine_config &config);
34 	void semicom_mcu(machine_config &config);
35 	void yutnori(machine_config &config);
36 	void snowbros(machine_config &config);
37 	void semicom(machine_config &config);
38 	void twinadv(machine_config &config);
39 	void wintbob(machine_config &config);
40 	void honeydol(machine_config &config);
41 	void snowbro3(machine_config &config);
42 	void finalttr(machine_config &config);
43 
44 	void init_pzlbreak();
45 	void init_snowbro3();
46 	void init_cookbib3();
47 	void init_4in1boot();
48 	void init_3in1semi();
49 	void init_cookbib2();
50 	void init_toto();
51 	void init_hyperpac();
52 	void init_yutnori();
53 
54 private:
55 	required_device<cpu_device> m_maincpu;
56 	optional_device<cpu_device> m_soundcpu;
57 	optional_device<okim6295_device> m_oki;
58 	required_device<gfxdecode_device> m_gfxdecode;
59 	required_device<palette_device> m_palette;
60 	required_device<screen_device> m_screen;
61 	optional_device<generic_latch_8_device> m_soundlatch; // not snowbro3
62 
63 	optional_device<kaneko_pandora_device> m_pandora;
64 	optional_shared_ptr<uint16_t> m_hyperpac_ram;
65 	optional_shared_ptr<uint16_t> m_bootleg_spriteram16;
66 
67 	int m_sb3_music_is_playing;
68 	int m_sb3_music;
69 	uint8_t m_semicom_prot_offset;
70 	uint16_t m_yutnori_prot_val;
71 
72 	void snowbros_flipscreen_w(uint8_t data);
73 	void bootleg_flipscreen_w(uint8_t data);
74 	void snowbros_irq4_ack_w(uint16_t data);
75 	void snowbros_irq3_ack_w(uint16_t data);
76 	void snowbros_irq2_ack_w(uint16_t data);
77 	void prot_p0_w(uint8_t data);
78 	void prot_p1_w(uint8_t data);
79 	void prot_p2_w(uint8_t data);
80 	uint16_t sb3_sound_r();
81 	uint16_t _4in1_02_read();
82 	uint16_t _3in1_read();
83 	uint16_t cookbib3_read();
84 	void twinadv_oki_bank_w(uint8_t data);
85 	void sb3_sound_w(uint16_t data);
86 	uint16_t toto_read(offs_t offset, uint16_t mem_mask = ~0);
87 	void yutnori_prot_w(uint16_t data);
88 	uint16_t yutnori_prot_r();
89 
90 	DECLARE_MACHINE_RESET(semiprot);
91 	DECLARE_MACHINE_RESET(finalttr);
92 
93 	uint32_t screen_update_snowbros(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
94 	uint32_t screen_update_honeydol(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
95 	uint32_t screen_update_twinadv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
96 	uint32_t screen_update_snowbro3(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
97 	uint32_t screen_update_wintbob(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
98 	DECLARE_WRITE_LINE_MEMBER(screen_vblank_snowbros);
99 
100 	TIMER_DEVICE_CALLBACK_MEMBER(snowbros_irq);
101 	TIMER_DEVICE_CALLBACK_MEMBER(snowbros3_irq);
102 
103 	void sb3_play_music(int data);
104 	void sb3_play_sound(int data);
105 
106 	void finalttr_map(address_map &map);
107 	void honeydol_map(address_map &map);
108 	void honeydol_sound_io_map(address_map &map);
109 	void honeydol_sound_map(address_map &map);
110 	void hyperpac_map(address_map &map);
111 	void hyperpac_sound_map(address_map &map);
112 	void snowbros3_map(address_map &map);
113 	void snowbros_map(address_map &map);
114 	void sound_io_map(address_map &map);
115 	void sound_map(address_map &map);
116 	void twinadv_map(address_map &map);
117 	void twinadv_sound_io_map(address_map &map);
118 	void wintbob_map(address_map &map);
119 	void yutnori_map(address_map &map);
120 };
121 
122 #endif // MAME_INCLUDES_SNOWBROS_H
123