1 // license:BSD-3-Clause
2 // copyright-holders:Takahiro Nogi
3 /*************************************************************************
4 
5     Mr. Jong
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_MRJONG_H
9 #define MAME_INCLUDES_MRJONG_H
10 
11 #pragma once
12 
13 #include "emupal.h"
14 #include "tilemap.h"
15 
16 class mrjong_state : public driver_device
17 {
18 public:
mrjong_state(const machine_config & mconfig,device_type type,const char * tag)19 	mrjong_state(const machine_config &mconfig, device_type type, const char *tag) :
20 		driver_device(mconfig, type, tag),
21 		m_videoram(*this, "videoram"),
22 		m_colorram(*this, "colorram"),
23 		m_maincpu(*this, "maincpu"),
24 		m_gfxdecode(*this, "gfxdecode"),
25 		m_palette(*this, "palette")
26 	{ }
27 
28 	void mrjong(machine_config &config);
29 
30 private:
31 	uint8_t io_0x03_r();
32 	void mrjong_videoram_w(offs_t offset, uint8_t data);
33 	void mrjong_colorram_w(offs_t offset, uint8_t data);
34 	void mrjong_flipscreen_w(uint8_t data);
35 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
36 	virtual void video_start() override;
37 	void mrjong_palette(palette_device &palette) const;
38 	uint32_t screen_update_mrjong(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
39 	void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
40 
41 	void mrjong_io_map(address_map &map);
42 	void mrjong_map(address_map &map);
43 
44 	/* memory pointers */
45 	required_shared_ptr<uint8_t> m_videoram;
46 	required_shared_ptr<uint8_t> m_colorram;
47 
48 	/* video-related */
49 	tilemap_t *m_bg_tilemap = nullptr;
50 
51 	required_device<cpu_device> m_maincpu;
52 	required_device<gfxdecode_device> m_gfxdecode;
53 	required_device<palette_device> m_palette;
54 };
55 
56 #endif // MAME_INCLUDES_MRJONG_H
57