1 // license:BSD-3-Clause
2 // copyright-holders:Bryan McPhail, David Graves
3 #ifndef MAME_INCLUDES_GROUNDFX_H
4 #define MAME_INCLUDES_GROUNDFX_H
5 
6 #pragma once
7 
8 #include "video/tc0100scn.h"
9 #include "video/tc0480scp.h"
10 #include "emupal.h"
11 
12 struct gfx_tempsprite
13 {
14 	u8 gfx;
15 	u32 code,color;
16 	bool flipx,flipy;
17 	int x,y;
18 	int zoomx,zoomy;
19 	int pri;
20 };
21 
22 class groundfx_state : public driver_device
23 {
24 public:
groundfx_state(const machine_config & mconfig,device_type type,const char * tag)25 	groundfx_state(const machine_config &mconfig, device_type type, const char *tag) :
26 		driver_device(mconfig, type, tag),
27 		m_ram(*this, "ram"),
28 		m_spriteram(*this, "spriteram"),
29 		m_maincpu(*this, "maincpu"),
30 		m_tc0620scc(*this, "tc0620scc"),
31 		m_tc0480scp(*this, "tc0480scp"),
32 		m_gfxdecode(*this, "gfxdecode"),
33 		m_palette(*this, "palette"),
34 		m_spritemap(*this, "spritemap")
35 	{ }
36 
37 	void groundfx(machine_config &config);
38 	void init_groundfx();
39 
40 protected:
41 	virtual void video_start() override;
42 
43 private:
44 	required_shared_ptr<u32> m_ram;
45 	required_shared_ptr<u32> m_spriteram;
46 
47 	required_device<cpu_device> m_maincpu;
48 	required_device<tc0620scc_device> m_tc0620scc;
49 	required_device<tc0480scp_device> m_tc0480scp;
50 	required_device<gfxdecode_device> m_gfxdecode;
51 	required_device<palette_device> m_palette;
52 	required_region_ptr<u16> m_spritemap;
53 
54 	u16 m_frame_counter;
55 	u16 m_port_sel;
56 	std::unique_ptr<gfx_tempsprite[]> m_spritelist;
57 	u16 m_rotate_ctrl[8];
58 	rectangle m_hack_cliprect;
59 
60 	void rotate_control_w(offs_t offset, u16 data);
61 	void motor_control_w(u32 data);
62 	u32 irq_speedup_r();
63 	DECLARE_READ_LINE_MEMBER(frame_counter_r);
64 	void coin_word_w(u8 data);
65 	u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
66 	INTERRUPT_GEN_MEMBER(interrupt);
67 	void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,int do_hack,int x_offs,int y_offs);
68 
69 	void groundfx_map(address_map &map);
70 };
71 
72 #endif // MAME_INCLUDES_GROUNDFX_H
73