1 // license:BSD-3-Clause
2 // copyright-holders:Nicola Salmoria
3 #ifndef MAME_INCLUDES_DOGFGT_H
4 #define MAME_INCLUDES_DOGFGT_H
5 
6 #pragma once
7 
8 #include "sound/ay8910.h"
9 #include "emupal.h"
10 #include "screen.h"
11 #include "tilemap.h"
12 
13 #define PIXMAP_COLOR_BASE  (16 + 32)
14 #define BITMAPRAM_SIZE      0x6000
15 
16 
17 class dogfgt_state : public driver_device
18 {
19 public:
dogfgt_state(const machine_config & mconfig,device_type type,const char * tag)20 	dogfgt_state(const machine_config &mconfig, device_type type, const char *tag) :
21 		driver_device(mconfig, type, tag),
22 		m_bgvideoram(*this, "bgvideoram"),
23 		m_spriteram(*this, "spriteram"),
24 		m_sharedram(*this, "sharedram"),
25 		m_subcpu(*this, "sub") ,
26 		m_maincpu(*this, "maincpu"),
27 		m_gfxdecode(*this, "gfxdecode"),
28 		m_screen(*this, "screen"),
29 		m_palette(*this, "palette"),
30 		m_ay(*this, "ay%u", 0U)
31 	{ }
32 
33 	void dogfgt(machine_config &config);
34 
35 protected:
36 	virtual void machine_start() override;
37 	virtual void machine_reset() override;
38 	virtual void video_start() override;
39 
40 private:
41 	/* memory pointers */
42 	required_shared_ptr<uint8_t> m_bgvideoram;
43 	required_shared_ptr<uint8_t> m_spriteram;
44 	required_shared_ptr<uint8_t> m_sharedram;
45 
46 	/* devices */
47 	required_device<cpu_device> m_subcpu;
48 	required_device<cpu_device> m_maincpu;
49 	required_device<gfxdecode_device> m_gfxdecode;
50 	required_device<screen_device> m_screen;
51 	required_device<palette_device> m_palette;
52 	required_device_array<ay8910_device, 2> m_ay;
53 
54 	/* video-related */
55 	bitmap_ind16 m_pixbitmap;
56 	tilemap_t   *m_bg_tilemap;
57 	std::unique_ptr<uint8_t[]>     m_bitmapram;
58 	int       m_bm_plane;
59 	int       m_pixcolor;
60 	int       m_scroll[4];
61 	int       m_lastflip;
62 	int       m_lastpixcolor;
63 
64 	/* sound-related */
65 	int       m_soundlatch;
66 	int       m_last_snd_ctrl;
67 
68 	void subirqtrigger_w(uint8_t data);
69 	void sub_irqack_w(uint8_t data);
70 	void soundlatch_w(uint8_t data);
71 	void soundcontrol_w(uint8_t data);
72 	void plane_select_w(uint8_t data);
73 	uint8_t bitmapram_r(offs_t offset);
74 	void internal_bitmapram_w(offs_t offset, uint8_t data);
75 	void bitmapram_w(offs_t offset, uint8_t data);
76 	void bgvideoram_w(offs_t offset, uint8_t data);
77 	void scroll_w(offs_t offset, uint8_t data);
78 	void _1800_w(uint8_t data);
79 
80 
81 	TILE_GET_INFO_MEMBER(get_tile_info);
82 	void dogfgt_palette(palette_device &palette) const;
83 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
84 	void draw_sprites(bitmap_ind16 &bitmap,const rectangle &cliprect);
85 
86 	void main_map(address_map &map);
87 	void sub_map(address_map &map);
88 };
89 
90 #endif // MAME_INCLUDES_DOGFGT_H
91