1 // license:BSD-3-Clause
2 // copyright-holders:Allard van der Bas
3 #ifndef MAME_INCLUDES_POOYAN_H
4 #define MAME_INCLUDES_POOYAN_H
5 
6 #pragma once
7 
8 #include "emupal.h"
9 #include "tilemap.h"
10 
11 class pooyan_state : public driver_device
12 {
13 public:
pooyan_state(const machine_config & mconfig,device_type type,const char * tag)14 	pooyan_state(const machine_config &mconfig, device_type type, const char *tag) :
15 		driver_device(mconfig, type, tag),
16 		m_maincpu(*this, "maincpu"),
17 		m_gfxdecode(*this, "gfxdecode"),
18 		m_palette(*this, "palette"),
19 		m_colorram(*this, "colorram"),
20 		m_videoram(*this, "videoram"),
21 		m_spriteram(*this, "spriteram"),
22 		m_spriteram2(*this, "spriteram2")
23 	{ }
24 
25 	void pooyan(machine_config &config);
26 
27 private:
28 	/* devices */
29 	required_device<cpu_device> m_maincpu;
30 	required_device<gfxdecode_device> m_gfxdecode;
31 	required_device<palette_device> m_palette;
32 
33 	/* memory pointers */
34 	required_shared_ptr<uint8_t> m_colorram;
35 	required_shared_ptr<uint8_t> m_videoram;
36 	required_shared_ptr<uint8_t> m_spriteram;
37 	required_shared_ptr<uint8_t> m_spriteram2;
38 
39 	/* video-related */
40 	tilemap_t  *m_bg_tilemap;
41 
42 	/* misc */
43 	uint8_t    m_irq_enable;
44 
45 	DECLARE_WRITE_LINE_MEMBER(irq_enable_w);
46 	DECLARE_WRITE_LINE_MEMBER(coin_counter_1_w);
47 	DECLARE_WRITE_LINE_MEMBER(coin_counter_2_w);
48 	void videoram_w(offs_t offset, uint8_t data);
49 	void colorram_w(offs_t offset, uint8_t data);
50 	DECLARE_WRITE_LINE_MEMBER(flipscreen_w);
51 
52 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
53 
54 	virtual void machine_start() override;
55 	virtual void video_start() override;
56 	void pooyan_palette(palette_device &palette) const;
57 
58 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
59 	void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
60 
61 	DECLARE_WRITE_LINE_MEMBER(vblank_irq);
62 	void main_map(address_map &map);
63 };
64 
65 #endif // MAME_INCLUDES_POOYAN_H
66