1 // license:BSD-3-Clause
2 // copyright-holders:Phil Stroffolino, David Haywood
3 #ifndef MAME_INCLUDES_TUNHUNT_H
4 #define MAME_INCLUDES_TUNHUNT_H
5 
6 #pragma once
7 
8 #include "emupal.h"
9 #include "screen.h"
10 #include "tilemap.h"
11 
12 class tunhunt_state : public driver_device
13 {
14 public:
tunhunt_state(const machine_config & mconfig,device_type type,const char * tag)15 	tunhunt_state(const machine_config &mconfig, device_type type, const char *tag) :
16 		driver_device(mconfig, type, tag),
17 		m_maincpu(*this, "maincpu"),
18 		m_gfxdecode(*this, "gfxdecode"),
19 		m_screen(*this, "screen"),
20 		m_palette(*this, "palette"),
21 		m_workram(*this, "workram"),
22 		m_videoram(*this, "videoram"),
23 		m_spriteram(*this, "spriteram"),
24 		m_generic_paletteram_8(*this, "paletteram"),
25 		m_led(*this, "led0")
26 	{ }
27 
28 	void tunhunt(machine_config &config);
29 
30 private:
31 	void control_w(uint8_t data);
32 	uint8_t button_r(offs_t offset);
33 	void videoram_w(offs_t offset, uint8_t data);
34 	uint8_t dsw2_0r();
35 	uint8_t dsw2_1r();
36 	uint8_t dsw2_2r();
37 	uint8_t dsw2_3r();
38 	uint8_t dsw2_4r();
39 
40 	TILE_GET_INFO_MEMBER(get_fg_tile_info);
41 
machine_start()42 	virtual void machine_start() override { m_led.resolve(); }
43 	virtual void video_start() override;
44 	void tunhunt_palette(palette_device &palette) const;
45 
46 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
47 	void set_pens();
48 	void draw_motion_object(bitmap_ind16 &bitmap, const rectangle &cliprect);
49 	void draw_box(bitmap_ind16 &bitmap, const rectangle &cliprect);
50 	void draw_shell(bitmap_ind16 &bitmap, const rectangle &cliprect, int picture_code,
51 	int hposition,int vstart,int vstop,int vstretch,int hstretch);
52 	void main_map(address_map &map);
53 
54 	required_device<cpu_device> m_maincpu;
55 	required_device<gfxdecode_device> m_gfxdecode;
56 	required_device<screen_device> m_screen;
57 	required_device<palette_device> m_palette;
58 
59 	required_shared_ptr<uint8_t> m_workram;
60 	required_shared_ptr<uint8_t> m_videoram;
61 	required_shared_ptr<uint8_t> m_spriteram;
62 	required_shared_ptr<uint8_t> m_generic_paletteram_8;
63 	output_finder<> m_led;
64 
65 	uint8_t m_control;
66 	tilemap_t *m_fg_tilemap;
67 	bitmap_ind16 m_tmpbitmap;
68 };
69 
70 #endif // MAME_INCLUDES_TUNHUNT_H
71