1 // license:BSD-3-Clause
2 // copyright-holders:Lee Taylor, Chris Moore
3 /*************************************************************************
4 
5     Cheeky Mouse
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_CHEEKYMS_H
9 #define MAME_INCLUDES_CHEEKYMS_H
10 
11 #pragma once
12 
13 #include "audio/cheekyms.h"
14 #include "sound/dac.h"
15 #include "emupal.h"
16 #include "screen.h"
17 #include "tilemap.h"
18 
19 class cheekyms_state : public driver_device
20 {
21 public:
cheekyms_state(const machine_config & mconfig,device_type type,const char * tag)22 	cheekyms_state(const machine_config &mconfig, device_type type, const char *tag)
23 		: driver_device(mconfig, type, tag)
24 		, m_maincpu(*this, "maincpu")
25 		, m_sound_board(*this, "soundboard")
26 		, m_gfxdecode(*this, "gfxdecode")
27 		, m_screen(*this, "screen")
28 		, m_palette(*this, "palette")
29 		, m_videoram(*this, "videoram")
30 		, m_spriteram(*this, "spriteram")
31 		, m_port_80(*this, "port_80")
32 	{
33 	}
34 
35 	DECLARE_INPUT_CHANGED_MEMBER(coin_inserted);
36 
37 	void cheekyms(machine_config &config);
38 
39 protected:
40 	virtual void machine_start() override;
41 	virtual void video_start() override;
42 
43 private:
44 	void port_40_w(uint8_t data);
45 	void port_80_w(uint8_t data);
46 
47 	INTERRUPT_GEN_MEMBER(vblank_irq);
48 
49 	TILE_GET_INFO_MEMBER(get_tile_info);
50 
51 	void cheekyms_palette(palette_device &palette) const;
52 
53 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
54 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, gfx_element *gfx, int flip);
55 
56 	void io_map(address_map &map);
57 	void main_map(address_map &map);
58 
59 	// devices
60 	required_device<cpu_device>             m_maincpu;
61 	required_device<cheekyms_audio_device>  m_sound_board;
62 	required_device<gfxdecode_device>       m_gfxdecode;
63 	required_device<screen_device>          m_screen;
64 	required_device<palette_device>         m_palette;
65 
66 	// memory pointers
67 	required_shared_ptr<uint8_t>    m_videoram;
68 	required_shared_ptr<uint8_t>    m_spriteram;
69 	required_shared_ptr<uint8_t>    m_port_80;
70 
71 	// video-related
72 	tilemap_t        *m_cm_tilemap;
73 	std::unique_ptr<bitmap_ind16>       m_bitmap_buffer;
74 
75 	uint8_t          m_irq_mask;
76 };
77 
78 #endif // MAME_INCLUDES_CHEEKYMS_H
79