1 // license:BSD-3-Clause
2 // copyright-holders:Zsolt Vasvari
3 /*************************************************************************
4 
5     D-Day
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_DDAY_H
9 #define MAME_INCLUDES_DDAY_H
10 
11 #pragma once
12 
13 #include "emupal.h"
14 #include "screen.h"
15 #include "sound/ay8910.h"
16 #include "tilemap.h"
17 
18 
19 class dday_state : public driver_device
20 {
21 public:
dday_state(const machine_config & mconfig,device_type type,const char * tag)22 	dday_state(const machine_config &mconfig, device_type type, const char *tag) :
23 		driver_device(mconfig, type, tag),
24 		m_textvideoram(*this, "textvideoram"),
25 		m_fgvideoram(*this, "fgvideoram"),
26 		m_bgvideoram(*this, "bgvideoram"),
27 		m_colorram(*this, "colorram"),
28 		m_maincpu(*this, "maincpu"),
29 		m_gfxdecode(*this, "gfxdecode"),
30 		m_screen(*this, "screen"),
31 		m_palette(*this, "palette"),
32 		m_ay1(*this, "ay1")
33 	{ }
34 
35 	void dday(machine_config &config);
36 
37 protected:
38 	virtual void machine_start() override;
39 	virtual void machine_reset() override;
40 	virtual void video_start() override;
41 
42 private:
43 	/* memory pointers */
44 	required_shared_ptr<uint8_t> m_textvideoram;
45 	required_shared_ptr<uint8_t> m_fgvideoram;
46 	required_shared_ptr<uint8_t> m_bgvideoram;
47 	required_shared_ptr<uint8_t> m_colorram;
48 
49 	/* video-related */
50 	tilemap_t        *m_fg_tilemap;
51 	tilemap_t        *m_bg_tilemap;
52 	tilemap_t        *m_text_tilemap;
53 	tilemap_t        *m_sl_tilemap;
54 	bitmap_ind16 m_main_bitmap;
55 	int            m_control;
56 	int            m_sl_image;
57 	int            m_sl_enable;
58 	int            m_timer_value;
59 	emu_timer *m_countdown_timer;
60 
61 	/* devices */
62 	required_device<cpu_device> m_maincpu;
63 	required_device<gfxdecode_device> m_gfxdecode;
64 	required_device<screen_device> m_screen;
65 	required_device<palette_device> m_palette;
66 	required_device<ay8912_device> m_ay1;
67 
68 	uint8_t dday_countdown_timer_r();
69 	void dday_bgvideoram_w(offs_t offset, uint8_t data);
70 	void dday_fgvideoram_w(offs_t offset, uint8_t data);
71 	void dday_textvideoram_w(offs_t offset, uint8_t data);
72 	void dday_colorram_w(offs_t offset, uint8_t data);
73 	uint8_t dday_colorram_r(offs_t offset);
74 	void dday_sl_control_w(uint8_t data);
75 	void dday_control_w(uint8_t data);
76 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
77 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
78 	TILE_GET_INFO_MEMBER(get_text_tile_info);
79 	TILE_GET_INFO_MEMBER(get_sl_tile_info);
80 	void dday_palette(palette_device &palette) const;
81 	uint32_t screen_update_dday(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
82 	TIMER_CALLBACK_MEMBER(countdown_timer_callback);
83 	void start_countdown_timer();
84 	void dday_map(address_map &map);
85 };
86 
87 #endif // MAME_INCLUDES_DDAY_H
88