1 // license:BSD-3-Clause
2 // copyright-holders:David Haywood
3 /***************************************************************************
4 
5     Battle Cross
6 
7 ***************************************************************************/
8 
9 #include "emupal.h"
10 #include "tilemap.h"
11 
12 class battlex_state : public driver_device
13 {
14 public:
battlex_state(const machine_config & mconfig,device_type type,const char * tag)15 	battlex_state(const machine_config &mconfig, device_type type, const char *tag)
16 		: driver_device(mconfig, type, tag),
17 		m_videoram(*this, "videoram"),
18 		m_spriteram(*this, "spriteram"),
19 		m_maincpu(*this, "maincpu"),
20 		m_gfxdecode(*this, "gfxdecode"),
21 		m_palette(*this, "palette") { }
22 
23 	uint8_t m_in0_b4;
24 
25 	/* memory pointers */
26 	required_shared_ptr<uint8_t> m_videoram;
27 	required_shared_ptr<uint8_t> m_spriteram;
28 
29 	/* video-related */
30 	tilemap_t *m_bg_tilemap;
31 	uint8_t m_scroll_lsb;
32 	uint8_t m_scroll_msb;
33 	uint8_t m_starfield_enabled;
34 	void battlex_palette_w(offs_t offset, uint8_t data);
35 	void battlex_scroll_x_lsb_w(uint8_t data);
36 	void battlex_scroll_x_msb_w(uint8_t data);
37 	void battlex_scroll_starfield_w(uint8_t data);
38 	void battlex_videoram_w(offs_t offset, uint8_t data);
39 	void battlex_flipscreen_w(uint8_t data);
40 	DECLARE_CUSTOM_INPUT_MEMBER(battlex_in0_b4_r);
41 	void init_battlex();
42 	TILE_GET_INFO_MEMBER(get_bg_tile_info);
43 	virtual void machine_start() override;
44 	virtual void machine_reset() override;
45 	virtual void video_start() override;
46 	uint32_t screen_update_battlex(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
47 	INTERRUPT_GEN_MEMBER(battlex_interrupt);
48 	void draw_sprites( bitmap_ind16 &bitmap, const rectangle &cliprect );
49 	required_device<cpu_device> m_maincpu;
50 	required_device<gfxdecode_device> m_gfxdecode;
51 	required_device<palette_device> m_palette;
52 
53 	DECLARE_VIDEO_START(dodgeman);
54 	TILE_GET_INFO_MEMBER(get_dodgeman_bg_tile_info);
55 	void dodgeman(machine_config &config);
56 	void battlex(machine_config &config);
57 	void battlex_map(address_map &map);
58 	void dodgeman_io_map(address_map &map);
59 	void io_map(address_map &map);
60 };
61