1 // license:BSD-3-Clause
2 // copyright-holders:Ernesto Corvi
3 /*************************************************************************
4 
5     Vendetta
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_VENDETTA_H
9 #define MAME_INCLUDES_VENDETTA_H
10 
11 #pragma once
12 
13 #include "cpu/m6809/konami.h" // for the callback and the firq irq definition
14 #include "machine/bankdev.h"
15 #include "machine/k053252.h"
16 #include "video/k052109.h"
17 #include "video/k053246_k053247_k055673.h"
18 #include "video/k053251.h"
19 #include "video/k054000.h"
20 #include "video/konami_helper.h"
21 #include "emupal.h"
22 
23 class vendetta_state : public driver_device
24 {
25 public:
vendetta_state(const machine_config & mconfig,device_type type,const char * tag)26 	vendetta_state(const machine_config &mconfig, device_type type, const char *tag) :
27 		driver_device(mconfig, type, tag),
28 		m_maincpu(*this, "maincpu"),
29 		m_audiocpu(*this, "audiocpu"),
30 		m_k052109(*this, "k052109"),
31 		m_k053246(*this, "k053246"),
32 		m_k053251(*this, "k053251"),
33 		m_k053252(*this, "k053252"),
34 		m_k054000(*this, "k054000"),
35 		m_palette(*this, "palette"),
36 		m_videobank0(*this, "videobank0"),
37 		m_videobank1(*this, "videobank1")
38 	{ }
39 
40 	void esckids(machine_config &config);
41 	void vendetta(machine_config &config);
42 
43 private:
44 	enum
45 	{
46 		TIMER_Z80_NMI
47 	};
48 
49 	// video-related
50 	int        m_layer_colorbase[3];
51 	int        m_sprite_colorbase;
52 	int        m_layerpri[3];
53 
54 	// misc
55 	int        m_irq_enabled;
56 
57 	// devices
58 	required_device<konami_cpu_device> m_maincpu;
59 	required_device<cpu_device> m_audiocpu;
60 	required_device<k052109_device> m_k052109;
61 	required_device<k053247_device> m_k053246;
62 	required_device<k053251_device> m_k053251;
63 	optional_device<k053252_device> m_k053252;
64 	optional_device<k054000_device> m_k054000;
65 	required_device<palette_device> m_palette;
66 
67 	required_device<address_map_bank_device> m_videobank0;
68 	required_device<address_map_bank_device> m_videobank1;
69 
70 	void eeprom_w(uint8_t data);
71 	uint8_t K052109_r(offs_t offset);
72 	void K052109_w(offs_t offset, uint8_t data);
73 	void _5fe0_w(uint8_t data);
74 	void z80_arm_nmi_w(uint8_t data);
75 	void z80_irq_w(uint8_t data);
76 	uint8_t z80_irq_r();
77 
78 	virtual void machine_start() override;
79 	virtual void machine_reset() override;
80 
81 	uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
82 
83 	INTERRUPT_GEN_MEMBER(irq);
84 
85 	K052109_CB_MEMBER(vendetta_tile_callback);
86 	K052109_CB_MEMBER(esckids_tile_callback);
87 	void banking_callback(uint8_t data);
88 	K053246_CB_MEMBER(sprite_callback);
89 
90 	void esckids_map(address_map &map);
91 	void main_map(address_map &map);
92 	void sound_map(address_map &map);
93 	void videobank0_map(address_map &map);
94 	void videobank1_map(address_map &map);
95 
96 	virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
97 };
98 
99 #endif // MAME_INCLUDES_VENDETTA_H
100