1 // license:BSD-3-Clause
2 // copyright-holders:Bryan McPhail
3 /*************************************************************************
4 
5     Bogey Manor
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_BOGEYMAN_H
9 #define MAME_INCLUDES_BOGEYMAN_H
10 
11 #pragma once
12 
13 #include "sound/ay8910.h"
14 #include "emupal.h"
15 #include "tilemap.h"
16 
17 class bogeyman_state : public driver_device
18 {
19 public:
bogeyman_state(const machine_config & mconfig,device_type type,const char * tag)20 	bogeyman_state(const machine_config &mconfig, device_type type, const char *tag) :
21 		driver_device(mconfig, type, tag),
22 		m_maincpu(*this, "maincpu"),
23 		m_gfxdecode(*this, "gfxdecode"),
24 		m_palette(*this, "palette"),
25 		m_ay1(*this, "ay1"),
26 		m_ay2(*this, "ay2"),
27 		m_videoram(*this, "videoram"),
28 		m_videoram2(*this, "videoram2"),
29 		m_colorram(*this, "colorram"),
30 		m_colorram2(*this, "colorram2"),
31 		m_spriteram(*this, "spriteram")
32 	{ }
33 
34 	void bogeyman(machine_config &config);
35 
36 protected:
37 	virtual void machine_start() override;
38 	virtual void machine_reset() override;
39 	virtual void video_start() override;
40 
41 private:
42 	/* devices */
43 	required_device<cpu_device> m_maincpu;
44 	required_device<gfxdecode_device> m_gfxdecode;
45 	required_device<palette_device> m_palette;
46 	required_device<ay8910_device> m_ay1;
47 	required_device<ay8910_device> m_ay2;
48 
49 	/* memory pointers */
50 	required_shared_ptr<uint8_t> m_videoram;
51 	required_shared_ptr<uint8_t> m_videoram2;
52 	required_shared_ptr<uint8_t> m_colorram;
53 	required_shared_ptr<uint8_t> m_colorram2;
54 	required_shared_ptr<uint8_t> m_spriteram;
55 
56 	/* video-related */
57 	tilemap_t    *m_bg_tilemap;
58 	tilemap_t    *m_fg_tilemap;
59 
60 	/* misc */
61 	int        m_psg_latch;
62 	int        m_last_write;
63 	int        m_colbank;
64 
65 	void ay8910_latch_w(uint8_t data);
66 	void ay8910_control_w(uint8_t data);
67 	void videoram_w(offs_t offset, uint8_t data);
68 	void colorram_w(offs_t offset, uint8_t data);
69 	void videoram2_w(offs_t offset, uint8_t data);
70 	void colorram2_w(offs_t offset, uint8_t data);
71 	void colbank_w(uint8_t data);
72 
73 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
74 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
75 
76 	void bogeyman_palette(palette_device &palette) const;
77 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
78 	void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect);
79 	void bogeyman_map(address_map &map);
80 };
81 
82 #endif // MAME_INCLUDES_BOGEYMAN_H
83