1 // license:BSD-3-Clause
2 // copyright-holders:Bryan McPhail
3 /*************************************************************************
4 
5     Vapor Trail
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_VAPORTRA_H
9 #define MAME_INCLUDES_VAPORTRA_H
10 
11 #pragma once
12 
13 #include "cpu/h6280/h6280.h"
14 #include "machine/gen_latch.h"
15 #include "video/bufsprite.h"
16 #include "video/deco16ic.h"
17 #include "video/decmxc06.h"
18 #include "emupal.h"
19 
20 class vaportra_state : public driver_device
21 {
22 public:
vaportra_state(const machine_config & mconfig,device_type type,const char * tag)23 	vaportra_state(const machine_config &mconfig, device_type type, const char *tag)
24 		: driver_device(mconfig, type, tag)
25 		, m_maincpu(*this, "maincpu")
26 		, m_audiocpu(*this, "audiocpu")
27 		, m_deco_tilegen(*this, "tilegen%u", 1U)
28 		, m_spritegen(*this, "spritegen")
29 		, m_spriteram(*this, "spriteram")
30 		, m_gfxdecode(*this, "gfxdecode")
31 		, m_palette(*this, "colors")
32 		, m_soundlatch(*this, "soundlatch")
33 		, m_paletteram(*this, "palette")
34 		, m_paletteram_ext(*this, "palette_ext")
35 	{ }
36 
37 	void vaportra(machine_config &config);
38 
39 	void init_vaportra();
40 
41 private:
42 	/* devices */
43 	required_device<cpu_device> m_maincpu;
44 	required_device<h6280_device> m_audiocpu;
45 	required_device_array<deco16ic_device, 2> m_deco_tilegen;
46 	required_device<deco_mxc06_device> m_spritegen;
47 	required_device<buffered_spriteram16_device> m_spriteram;
48 	required_device<gfxdecode_device> m_gfxdecode;
49 	required_device<palette_device> m_palette;
50 	required_device<generic_latch_8_device> m_soundlatch;
51 
52 	required_shared_ptr<uint16_t> m_paletteram;
53 	required_shared_ptr<uint16_t> m_paletteram_ext;
54 
55 	/* misc */
56 	uint16_t    m_priority[2];
57 
58 	uint8_t irq6_ack_r();
59 	void irq6_ack_w(uint8_t data);
60 	void priority_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
61 	void palette_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
62 	void palette_ext_w(offs_t offset, uint16_t data, uint16_t mem_mask = ~0);
63 
64 	virtual void machine_start() override;
65 	virtual void machine_reset() override;
66 
67 	void vaportra_colpri_cb(u32 &colour, u32 &pri_mask);
68 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
69 	void update_palette( int offset );
70 
71 	DECO16IC_BANK_CB_MEMBER(bank_callback);
72 
73 	void main_map(address_map &map);
74 	void sound_map(address_map &map);
75 };
76 
77 #endif // MAME_INCLUDES_VAPORTRA_H
78