1 // license:BSD-3-Clause
2 // copyright-holders:David Graves
3 /*************************************************************************
4 
5     Operation Thunderbolt
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_OTHUNDER_H
9 #define MAME_INCLUDES_OTHUNDER_H
10 
11 #pragma once
12 
13 #include "audio/taitosnd.h"
14 #include "machine/eepromser.h"
15 #include "machine/taitoio.h"
16 #include "sound/flt_vol.h"
17 #include "video/tc0100scn.h"
18 #include "video/tc0110pcr.h"
19 #include "emupal.h"
20 
21 
22 class othunder_state : public driver_device
23 {
24 public:
othunder_state(const machine_config & mconfig,device_type type,const char * tag)25 	othunder_state(const machine_config &mconfig, device_type type, const char *tag) :
26 		driver_device(mconfig, type, tag),
27 		m_spriteram(*this,"spriteram"),
28 		m_sprmap_rom(*this,"sprmap_rom"),
29 		m_z80bank(*this,"z80bank"),
30 		m_maincpu(*this, "maincpu"),
31 		m_audiocpu(*this, "audiocpu"),
32 		m_eeprom(*this, "eeprom"),
33 		m_tc0220ioc(*this, "tc0220ioc"),
34 		m_tc0100scn(*this, "tc0100scn"),
35 		m_tc0110pcr(*this, "tc0110pcr"),
36 		m_tc0140syt(*this, "tc0140syt"),
37 		m_2610_0l(*this, "2610.0l"),
38 		m_2610_0r(*this, "2610.0r"),
39 		m_2610_1l(*this, "2610.1l"),
40 		m_2610_1r(*this, "2610.1r"),
41 		m_2610_2l(*this, "2610.2l"),
42 		m_2610_2r(*this, "2610.2r"),
43 		m_gfxdecode(*this, "gfxdecode")
44 	{ }
45 
46 	void othunder(machine_config &config);
47 
48 protected:
49 	virtual void machine_start() override;
50 	virtual void video_start() override;
51 
52 private:
53 	void draw_sprites(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, const u32 *primasks, int y_offs);
54 
55 	void irq_ack_w(offs_t offset, u16 data);
56 	void eeprom_w(u8 data);
57 	void coins_w(u8 data);
58 	DECLARE_WRITE_LINE_MEMBER(adc_eoc_w);
59 	void sound_bankswitch_w(u8 data);
60 	void tc0310fam_w(offs_t offset, u8 data);
61 	u32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
62 	DECLARE_WRITE_LINE_MEMBER(vblank_w);
63 
64 	void othunder_map(address_map &map);
65 	void z80_sound_map(address_map &map);
66 
67 	/* memory pointers */
68 	required_shared_ptr<u16> m_spriteram;
69 	required_region_ptr<u16> m_sprmap_rom;
70 	required_memory_bank m_z80bank;
71 
72 	/* video-related */
73 	struct tempsprite
74 	{
75 		u32 code,color;
76 		bool flipx,flipy;
77 		int x,y;
78 		int zoomx,zoomy;
79 		u32 primask;
80 	};
81 
82 	std::unique_ptr<tempsprite[]> m_spritelist;
83 
84 	/* misc */
85 	int        m_pan[4];
86 
87 	/* devices */
88 	required_device<cpu_device> m_maincpu;
89 	required_device<cpu_device> m_audiocpu;
90 	optional_device<eeprom_serial_93cxx_device> m_eeprom;
91 	required_device<tc0220ioc_device> m_tc0220ioc;
92 	required_device<tc0100scn_device> m_tc0100scn;
93 	required_device<tc0110pcr_device> m_tc0110pcr;
94 	required_device<tc0140syt_device> m_tc0140syt;
95 	required_device<filter_volume_device> m_2610_0l;
96 	required_device<filter_volume_device> m_2610_0r;
97 	required_device<filter_volume_device> m_2610_1l;
98 	required_device<filter_volume_device> m_2610_1r;
99 	required_device<filter_volume_device> m_2610_2l;
100 	required_device<filter_volume_device> m_2610_2r;
101 	required_device<gfxdecode_device> m_gfxdecode;
102 };
103 
104 #endif // MAME_INCLUDES_OTHUNDER_H
105