1 // license:BSD-3-Clause
2 // copyright-holders:Manuel Abadia
3 /*************************************************************************
4 
5     Crime Fighters
6 
7 *************************************************************************/
8 #ifndef MAME_INCLUDES_CRIMFGHT_H
9 #define MAME_INCLUDES_CRIMFGHT_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/gen_latch.h"
16 #include "sound/k007232.h"
17 #include "video/k052109.h"
18 #include "video/k051960.h"
19 #include "emupal.h"
20 
21 class crimfght_state : public driver_device
22 {
23 public:
crimfght_state(const machine_config & mconfig,device_type type,const char * tag)24 	crimfght_state(const machine_config &mconfig, device_type type, const char *tag) :
25 		driver_device(mconfig, type, tag),
26 		m_maincpu(*this, "maincpu"),
27 		m_audiocpu(*this, "audiocpu"),
28 		m_bank0000(*this, "bank0000"),
29 		m_k007232(*this, "k007232"),
30 		m_k052109(*this, "k052109"),
31 		m_k051960(*this, "k051960"),
32 		m_palette(*this, "palette"),
33 		m_soundlatch(*this, "soundlatch"),
34 		m_rombank(*this, "rombank")
35 	{ }
36 
37 	/* devices */
38 	required_device<konami_cpu_device> m_maincpu;
39 	required_device<cpu_device> m_audiocpu;
40 	required_device<address_map_bank_device> m_bank0000;
41 	required_device<k007232_device> m_k007232;
42 	required_device<k052109_device> m_k052109;
43 	required_device<k051960_device> m_k051960;
44 	required_device<palette_device> m_palette;
45 	required_device<generic_latch_8_device> m_soundlatch;
46 	required_memory_bank m_rombank;
47 
48 	void crimfght_coin_w(uint8_t data);
49 	void sound_w(uint8_t data);
50 	uint8_t k052109_051960_r(offs_t offset);
51 	void k052109_051960_w(offs_t offset, uint8_t data);
52 	IRQ_CALLBACK_MEMBER(audiocpu_irq_ack);
53 	void ym2151_ct_w(uint8_t data);
54 	virtual void machine_start() override;
55 	uint32_t screen_update_crimfght(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
56 	void volume_callback(uint8_t data);
57 	K052109_CB_MEMBER(tile_callback);
58 	K051960_CB_MEMBER(sprite_callback);
59 	void banking_callback(uint8_t data);
60 	DECLARE_CUSTOM_INPUT_MEMBER(system_r);
61 
62 	void crimfght(machine_config &config);
63 	void bank0000_map(address_map &map);
64 	void crimfght_map(address_map &map);
65 	void crimfght_sound_map(address_map &map);
66 private:
67 	int m_woco;
68 	int m_rmrd;
69 	int m_init;
70 };
71 
72 #endif // MAME_INCLUDES_CRIMFGHT_H
73