1 // license:BSD-3-Clause
2 // copyright-holders:Bryan McPhail, David Graves
3 #ifndef MAME_INCLUDES_GUNBUSTR_H
4 #define MAME_INCLUDES_GUNBUSTR_H
5 
6 #pragma once
7 
8 #include "machine/eepromser.h"
9 #include "video/tc0480scp.h"
10 #include "emupal.h"
11 
12 struct gb_tempsprite
13 {
14 	int gfx;
15 	int code,color;
16 	int flipx,flipy;
17 	int x,y;
18 	int zoomx,zoomy;
19 	int primask;
20 };
21 
22 class gunbustr_state : public driver_device
23 {
24 public:
gunbustr_state(const machine_config & mconfig,device_type type,const char * tag)25 	gunbustr_state(const machine_config &mconfig, device_type type, const char *tag) :
26 		driver_device(mconfig, type, tag),
27 		m_maincpu(*this,"maincpu"),
28 		m_tc0480scp(*this, "tc0480scp"),
29 		m_ram(*this,"ram"),
30 		m_spriteram(*this,"spriteram"),
31 		m_eeprom(*this, "eeprom"),
32 		m_gfxdecode(*this, "gfxdecode"),
33 		m_palette(*this, "palette"),
34 		m_spritemap(*this, "spritemap"),
35 		m_io_light_x(*this, "LIGHT%u_X", 0U),
36 		m_io_light_y(*this, "LIGHT%u_Y", 0U)
37 	{
38 		m_coin_lockout = true;
39 	}
40 
41 	void gunbustr(machine_config &config);
42 
43 	void init_gunbustrj();
44 	void init_gunbustr();
45 
46 private:
47 	enum
48 	{
49 		TIMER_GUNBUSTR_INTERRUPT5
50 	};
51 
52 	required_device<cpu_device> m_maincpu;
53 	required_device<tc0480scp_device> m_tc0480scp;
54 	required_shared_ptr<u32> m_ram;
55 	required_shared_ptr<u32> m_spriteram;
56 	required_device<eeprom_serial_93cxx_device> m_eeprom;
57 	required_device<gfxdecode_device> m_gfxdecode;
58 	required_device<palette_device> m_palette;
59 	required_region_ptr<u16> m_spritemap;
60 
61 	required_ioport_array<2> m_io_light_x;
62 	required_ioport_array<2> m_io_light_y;
63 
64 	bool m_coin_lockout;
65 	std::unique_ptr<gb_tempsprite[]> m_spritelist;
66 	emu_timer *m_interrupt5_timer;
67 
68 	void motor_control_w(u32 data);
69 	u32 gun_r();
70 	void gun_w(u32 data);
71 	u32 main_cycle_r();
72 	void coin_word_w(u8 data);
73 	virtual void video_start() override;
74 	u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
75 	INTERRUPT_GEN_MEMBER(gunbustr_interrupt);
76 	void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap,const rectangle &cliprect,const u32 *primasks,int x_offs,int y_offs);
77 
78 	void gunbustr_map(address_map &map);
79 
80 	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
81 };
82 
83 #endif // MAME_INCLUDES_GUNBUSTR_H
84