1 // license:BSD-3-Clause
2 // copyright-holders:Nicola Salmoria
3 /*************************************************************************
4 
5 Crazy Ballooon
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_CRBALOON_H
9 #define MAME_INCLUDES_CRBALOON_H
10 
11 #pragma once
12 
13 #include "sound/discrete.h"
14 #include "sound/sn76477.h"
15 #include "emupal.h"
16 #include "tilemap.h"
17 
18 #define CRBALOON_MASTER_XTAL    (XTAL(9'987'000))
19 
20 
21 class crbaloon_state : public driver_device
22 {
23 public:
crbaloon_state(const machine_config & mconfig,device_type type,const char * tag)24 	crbaloon_state(const machine_config &mconfig, device_type type, const char *tag) :
25 		driver_device(mconfig, type, tag),
26 		m_videoram(*this, "videoram"),
27 		m_colorram(*this, "colorram"),
28 		m_spriteram(*this, "spriteram"),
29 		m_pc3092_data(*this, "pc3092_data"),
30 		m_maincpu(*this, "maincpu"),
31 		m_sn(*this, "snsnd"),
32 		m_discrete(*this, "discrete"),
33 		m_gfxdecode(*this, "gfxdecode")
34 	{ }
35 
36 	required_shared_ptr<uint8_t> m_videoram;
37 	required_shared_ptr<uint8_t> m_colorram;
38 	required_shared_ptr<uint8_t> m_spriteram;
39 	required_shared_ptr<uint8_t> m_pc3092_data;
40 	required_device<cpu_device> m_maincpu;
41 	required_device<sn76477_device> m_sn;
42 	required_device<discrete_device> m_discrete;
43 	required_device<gfxdecode_device> m_gfxdecode;
44 
45 	uint16_t m_collision_address;
46 	uint8_t m_collision_address_clear;
47 	tilemap_t *m_bg_tilemap;
48 	uint8_t m_irq_mask;
49 	void pc3092_w(offs_t offset, uint8_t data);
50 	uint8_t pc3259_r(offs_t offset);
51 	void port_sound_w(uint8_t data);
52 	void crbaloon_videoram_w(offs_t offset, uint8_t data);
53 	void crbaloon_colorram_w(offs_t offset, uint8_t data);
54 	DECLARE_CUSTOM_INPUT_MEMBER(pc3092_r);
55 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
56 	virtual void machine_reset() override;
57 	virtual void video_start() override;
58 	void crbaloon_palette(palette_device &palette) const;
59 	uint32_t screen_update_crbaloon(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
60 	INTERRUPT_GEN_MEMBER(vblank_irq);
61 	void crbaloon_audio_set_music_freq(uint8_t data);
62 	void crbaloon_audio_set_music_enable(uint8_t data);
63 	void crbaloon_audio_set_laugh_enable(uint8_t data);
64 	uint16_t crbaloon_get_collision_address();
65 	void crbaloon_set_clear_collision_address(int _crbaloon_collision_address_clear);
66 	void draw_sprite_and_check_collision(bitmap_ind16 &bitmap);
67 	void pc3092_reset(void);
68 	void pc3092_update();
69 	void pc3259_update(void);
70 	void crbaloon_audio_set_explosion_enable(int enabled);
71 	void crbaloon_audio_set_breath_enable(int enabled);
72 	void crbaloon_audio_set_appear_enable(int enabled);
73 	void crbaloon(machine_config &config);
74 	void crbaloon_audio(machine_config &config);
75 	void main_io_map(address_map &map);
76 	void main_map(address_map &map);
77 };
78 
79 #endif // MAME_INCLUDES_CRBALOON_H
80