1 // license:BSD-3-Clause
2 // copyright-holders:Uki
3 /*************************************************************************
4 
5     Dr. Micro
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_DRMICRO_H
9 #define MAME_INCLUDES_DRMICRO_H
10 
11 #pragma once
12 
13 #include "sound/msm5205.h"
14 #include "emupal.h"
15 #include "tilemap.h"
16 
17 class drmicro_state : public driver_device
18 {
19 public:
drmicro_state(const machine_config & mconfig,device_type type,const char * tag)20 	drmicro_state(const machine_config &mconfig, device_type type, const char *tag) :
21 		driver_device(mconfig, type, tag),
22 		m_msm(*this, "msm"),
23 		m_maincpu(*this, "maincpu"),
24 		m_gfxdecode(*this, "gfxdecode"),
25 		m_palette(*this, "palette")
26 	{ }
27 
28 	void drmicro(machine_config &config);
29 
30 private:
31 	/* memory pointers */
32 	std::unique_ptr<uint8_t[]>       m_videoram;
33 
34 	/* video-related */
35 	tilemap_t        *m_bg1;
36 	tilemap_t        *m_bg2;
37 	int            m_flipscreen;
38 
39 	/* misc */
40 	int            m_nmi_enable;
41 	int            m_pcm_adr;
42 
43 	/* devices */
44 	required_device<msm5205_device> m_msm;
45 	void nmi_enable_w(uint8_t data);
46 	void pcm_set_w(uint8_t data);
47 	void drmicro_videoram_w(offs_t offset, uint8_t data);
48 	TILE_GET_INFO_MEMBER(get_bg1_tile_info);
49 	TILE_GET_INFO_MEMBER(get_bg2_tile_info);
50 	virtual void machine_start() override;
51 	virtual void machine_reset() override;
52 	virtual void video_start() override;
53 	void drmicro_palette(palette_device &palette) const;
54 	uint32_t screen_update_drmicro(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
55 	INTERRUPT_GEN_MEMBER(drmicro_interrupt);
56 	DECLARE_WRITE_LINE_MEMBER(pcm_w);
57 	required_device<cpu_device> m_maincpu;
58 	required_device<gfxdecode_device> m_gfxdecode;
59 	required_device<palette_device> m_palette;
60 	void drmicro_map(address_map &map);
61 	void io_map(address_map &map);
62 };
63 
64 #endif // MAME_INCLUDES_DRMICRO_H
65